def onEntityAdded(self, entity, context=None): if context == 'new': self.setFocus() pnode = entity.parent if pnode: self.tree.setNodeExpanded(pnode, True) self.tree.setFocus() # self.tree.editNode (entity) self.tree.selectNode(entity) signals.emit('scene.update') self.markSceneDirty()
def execCommand(self): text = self.luaConsoleInput.text() self.history.append(text) if len(self.history) > 10: self.history.pop(1) self.historyCursor = len(self.history) self.luaConsoleInput.clear() self.appendText(self.module.stdoutCapture.read()) self.appendText(">>") self.appendText(text) self.appendText("\n") signals.emit('console.exec', text.encode('utf-8'))
def toggleSolo(self, layer): solo = layer.isEditorSolo(layer) if solo: self.tree.hasSoloLayer = False for l in _CANDY.game.layers.values(): if l.name == 'CANDY_EDITOR_LAYER': continue if l != layer: l.editorSolo = False layer.setEditorSolo(layer, False) else: self.tree.hasSoloLayer = True for l in _CANDY.game.layers.values(): if l.name == 'CANDY_EDITOR_LAYER': continue if l != layer: l.editorSolo = 'hidden' layer.setEditorSolo(layer, True) self.tree.refreshAllContent() signals.emit('scene.update')
def on_moved(self, event): super(FileWatcherEventHandler, self).on_moved(event) signals.emit('file.moved', event.src_path, event.dest_path)
def on_deleted(self, event): super(FileWatcherEventHandler, self).on_deleted(event) signals.emit('file.removed', event.src_path)
def on_created(self, event): super(FileWatcherEventHandler, self).on_created(event) signals.emit('file.added', event.src_path)
def toggleLock(self, layer): layer.locked = not layer.locked self.tree.refreshNodeContent(layer) signals.emit('scene.update')
def toggleEditVisible(self, layer): layer.setEditorVisible(layer, not layer.isEditorVisible(layer)) self.tree.refreshNodeContent(layer) signals.emit('scene.update')
def toggleHidden(self, layer): layer.setVisible(layer, not layer.isVisible(layer)) self.tree.refreshNodeContent(layer) signals.emit('scene.update')
def onComponentRemoved(self, com, entity): signals.emit('scene.update') self.markSceneDirty()
def onEntityRemoved(self, entity): signals.emit('scene.update') self.markSceneDirty()
def renameEntity(self, target, name): #TODO:command pattern target.setName(target, name) signals.emit('entity.modified', target)