diff --git a/SpriteBuilder/ccBuilder/AppDelegate.m b/SpriteBuilder/ccBuilder/AppDelegate.m index 2a1a46d5e..f99882cb5 100644 --- a/SpriteBuilder/ccBuilder/AppDelegate.m +++ b/SpriteBuilder/ccBuilder/AppDelegate.m @@ -4200,7 +4200,7 @@ - (BOOL) validateMenuItem:(NSMenuItem *)menuItem else if (menuItem.action == @selector(menuSelectBehind:)) { if (!hasOpenedDocument) return NO; - return (self.selectedNode != NULL); + return (self.selectedNode != NULL && [[CocosScene cocosScene] currentNodeAtSelectionPtIdx] != NULL); } else if (menuItem.action == @selector(selectNextTab:)) { diff --git a/SpriteBuilder/ccBuilder/CocosScene.h b/SpriteBuilder/ccBuilder/CocosScene.h index b09a112e4..73549f93b 100644 --- a/SpriteBuilder/ccBuilder/CocosScene.h +++ b/SpriteBuilder/ccBuilder/CocosScene.h @@ -123,7 +123,7 @@ enum { // Selection NSMutableArray* nodesAtSelectionPt; - int currentNodeAtSelectionPtIdx; + CCNodeColor* borderBottom; CCNodeColor* borderTop; @@ -146,6 +146,8 @@ enum { CGPoint effectSpriteDraggingLocation; } +@property (nonatomic,readonly) int currentNodeAtSelectionPtIdx; + @property (nonatomic) CCNode* rootNode; @property (nonatomic,readonly) BOOL isMouseTransforming; @@ -198,7 +200,7 @@ enum { - (void)mouseExited:(NSEvent *)event; - (void)cursorUpdate:(NSEvent *)event; -//Draggin +//Dragging - (NSDragOperation)draggingEntered:(id )sender pos:(CGPoint)pos; - (NSDragOperation)draggingUpdated:(id )sender pos:(CGPoint)pos; - (void)draggingExited:(id )sender pos:(CGPoint)pos; diff --git a/SpriteBuilder/ccBuilder/CocosScene.m b/SpriteBuilder/ccBuilder/CocosScene.m index 9a6939d57..21ab934d4 100644 --- a/SpriteBuilder/ccBuilder/CocosScene.m +++ b/SpriteBuilder/ccBuilder/CocosScene.m @@ -76,6 +76,7 @@ @implementation CocosScene @synthesize physicsLayer; @synthesize lightIconsLayer; @synthesize stageLight; +@synthesize currentNodeAtSelectionPtIdx; +(id) sceneWithAppDelegate:(AppDelegate*)app { @@ -521,8 +522,9 @@ - (void) updateSelection for (CCNode* node in nodes) { // Refresh informations for "Select Behind" called from outlineHierarchy + /* - [nodesAtSelectionPt removeAllObjects]; + //[nodesAtSelectionPt removeAllObjects]; CGPoint worldPos = [node convertToWorldSpace:node.position]; [self nodesUnderPt:worldPos rootNode:rootNode nodes:nodesAtSelectionPt]; [[jointsLayer.children.firstObject children] forEach:^(CCNode * jointNode, int idx) { @@ -1288,7 +1290,6 @@ - (void) mouseDown:(NSEvent *)event // shortcut for Select Behind: Alt + LeftClick if ([event modifierFlags] & NSAlternateKeyMask) { - NSLog(@"selectBehind"); [self selectBehind]; }