def importAsset(self, node, reload = False ): if node.isVirtual(): return node.assetType = 'msprite' node.setBundle() #atlas atlasFile = node.getCacheFile( 'atlas' ) node.setObjectFile( 'atlas', atlasFile ) #define defFile = node.getCacheFile( 'def' ) node.setObjectFile( 'def', defFile ) proj = MSpriteProject() #traverse path filePath = node.getFilePath() nodePath = node.getNodePath() proj.loadFolder( node.getAbsFilePath() ) #TODO: let texture library handle atlas absAtlas, absDef = node.getAbsObjectFile( 'atlas' ), node.getAbsObjectFile( 'def' ) proj.save( absAtlas, absDef ) atlasNode = node.affirmChildNode( node.getBaseName()+'_texture', 'texture', manager = 'asset_manager.texture' ) atlasNode.setMetaData( 'source', atlasFile ) app.getModule( 'texture_library' ).scheduleImport( atlasNode ) return True
def onNodeDClicked(self, item): node = item.node fullname = node.getFullLabel() if node.isGroup(): app.getModule('scene_portal_manager').locatePortalGroup(fullname) else: app.getModule('scene_portal_manager').locatePortal(fullname)
def importAsset(self, node, reload=False): if node.isVirtual(): return node.assetType = "msprite" node.setBundle() # atlas atlasFile = node.getCacheFile("atlas") node.setObjectFile("atlas", atlasFile) # define defFile = node.getCacheFile("def") node.setObjectFile("def", defFile) proj = MSpriteProject() # traverse path filePath = node.getFilePath() nodePath = node.getNodePath() for fileName in os.listdir(node.getAbsFilePath()): fullPath = filePath + "/" + fileName name, ext = os.path.splitext(fileName) if ext == ".psd": proj.loadPSD(fullPath) # TODO: let texture library handle atlas absAtlas, absDef = node.getAbsObjectFile("atlas"), node.getAbsObjectFile("def") proj.save(absAtlas, absDef) atlasNode = node.affirmChildNode(node.getBaseName() + "_texture", "texture", manager="asset_manager.texture") atlasNode.setMetaData("source", atlasFile) app.getModule("texture_library").scheduleImport(atlasNode) return True
def onDClicked(self, idx): if not idx.isValid(): return level = self.model().data(idx, Qt.UserRole) if level['file']: highLight = (idx.row() == 0) app.getModule('script_view').locateFile( level['file'], level['line'], highLight and 'normal' or False)
def onDClicked( self, idx ): if not idx.isValid(): return level = self.model().data(idx, Qt.UserRole) if level['file']: highLight = ( idx.row() == 0 ) app.getModule('script_view').locateFile( level['file'], level['line'], highLight and 'normal' or False)
def importAsset(self, node, reload=False): if node.isVirtual(): return node.assetType = 'msprite' node.setBundle() #atlas atlasFile = node.getCacheFile('atlas') node.setObjectFile('atlas', atlasFile) #define defFile = node.getCacheFile('def') node.setObjectFile('def', defFile) proj = MSpriteProject() #traverse path filePath = node.getFilePath() nodePath = node.getNodePath() proj.loadFolder(node.getAbsFilePath()) #TODO: let texture library handle atlas absAtlas, absDef = node.getAbsObjectFile( 'atlas'), node.getAbsObjectFile('def') proj.save(absAtlas, absDef) atlasNode = node.affirmChildNode(node.getBaseName() + '_texture', 'texture', manager='asset_manager.texture') atlasNode.setMetaData('source', atlasFile) app.getModule('texture_library').scheduleImport(atlasNode) return True
def importAsset(self, node, reload = False ): node.assetType = 'aurora_sprite' scriptPath = _getModulePath( 'AuroraSpriteImporter.lua' ) importer = app.getModule('moai').loadLuaDelegate( scriptPath ) #TODO: need convert PNG defFile = node.getCacheFile('def') result = importer.call( 'convertAuroraSprite', node.getAbsFilePath(), getProjectPath( defFile ) ) node.setObjectFile( 'def', defFile ) #add depedency #TODO: ADD texture dependency #add child nodes #_frames node.createChildNode( 'frames', 'quadlists', manager = self ) #anim clips # print(result, result.animations) # #TODO: # for key, ani in result.animations.items(): # node.createChildNode( ani.name, 'animclip', manager = self ) return True
def dropEvent(self, ev): p = self.dropIndicatorPosition() pos = False if p == QtWidgets.QAbstractItemView.OnItem: #reparent pos = 'on' elif p == QtWidgets.QAbstractItemView.AboveItem: pos = 'above' elif p == QtWidgets.QAbstractItemView.BelowItem: pos = 'below' else: pos = 'viewport' if pos == 'above' or pos == 'below': #TODO: reorder ev.setDropAction(Qt.IgnoreAction) return targetItem = self.itemAt(ev.pos()) if pos == 'on': targetObject = targetItem.node else: targetObject = 'root' if app.getModule('global_object_manager').reparentObject( self.getSelection(), targetObject): ev.acceptProposedAction() self.rebuild() else: ev.setDropAction(Qt.IgnoreAction)
def deployTargetSearchEnumerator(typeId, context, option): if not context in ['deploy_target_type']: return result = [] mgr = app.getModule('deploy_manager') for name in mgr.getDeployTargetTypes(): entry = (name, name, 'Deploy Target', None) result.append(entry) return result
def deployTargetSearchEnumerator( typeId, context, option ): if not context in [ 'deploy_target_type' ] : return result = [] mgr = app.getModule( 'deploy_manager' ) for name in mgr.getDeployTargetTypes(): entry = ( name, name, 'Deploy Target', None ) result.append( entry ) return result
def run(self, *args): if len(args) >= 1: # s = ' '.join( args ) src = decodeStr(args[0]) runtime = app.getModule('moai') print('>-----------------') print('> eval script ->') runtime.evalScript(src) print('------------------')
def importAsset(self, node, reload = False ): if node.isVirtual(): return node.assetType = 'msprite' node.groupType = None node.setBundle() #atlas atlasFile = node.getCacheFile( 'atlas' ) # node.setObjectFile( 'atlas', atlasFile ) #define defFile = node.getCacheFile( 'def' ) node.setObjectFile( 'def', defFile ) packedDefFile = node.getCacheFile( 'packed_def' ) node.setObjectFile( 'packed_def', packedDefFile ) proj = MSpriteProject() #traverse path filePath = node.getFilePath() nodePath = node.getNodePath() proj.loadFolder( node.getAbsFilePath() ) #TODO: let texture library handle atlas absAtlas = AssetLibrary.get().getAbsProjectPath( atlasFile ) absDef = AssetLibrary.get().getAbsProjectPath( defFile ) absPackDef = AssetLibrary.get().getAbsProjectPath( packedDefFile ) data = proj.save( absAtlas, absDef ) JSONHelper.saveMsgPack( data, absPackDef ) atlasNode = node.affirmChildNode( node.getBaseName() + '_texture', 'texture', manager = 'asset_manager.texture' ) atlasNode.setWorkspaceData( 'source', atlasFile ) app.getModule( 'texture_library' ).scheduleImport( atlasNode ) if node.getMetaData( 'build_sub_deck', False ): if data: for animIdx, animData in data[ 'anims' ].items(): print(( 'sub node', animData[ 'name' ] )) deprecated = animData.get( 'deprecated', False ) subNode = node.affirmChildNode( animData[ 'name' ], 'deck2d.msprite_seq', manager = self ) subNode.setInternalDeprecated( deprecated ) return True
def importAsset(self, node, reload=False): if node.isVirtual(): return node.setBundle() node.assetType = 'texture_pack' node.groupType = 'package' output = node.getCacheFile('export', is_dir=True) extractor = PSDLayerExtractor() result = extractor.extract(node.getAbsFilePath(), output) #import for item in result: name, absPath, filename = item texNode = node.affirmChildNode(name, 'texture', manager='asset_manager.texture') texNode.setWorkspaceData('source', absPath) app.getModule('texture_library').scheduleImport(texNode) return True
def onClicked(self, item, col): if col == 1: #editor view toggle app.getModule('layer_manager').toggleEditVisible( self.getNodeByItem(item) ) elif col == 2: #lock toggle app.getModule('layer_manager').toggleLock( self.getNodeByItem(item) ) elif col == 3: app.getModule('layer_manager').toggleSolo( self.getNodeByItem(item) )
def onClicked(self, item, col): if col == 1: #editor view toggle app.getModule('layer_manager').toggleEditVisible( self.getNodeByItem(item)) elif col == 2: #lock toggle app.getModule('layer_manager').toggleLock(self.getNodeByItem(item)) elif col == 3: app.getModule('layer_manager').toggleSolo(self.getNodeByItem(item))
def onItemSelectionChanged( self ): m = app.getModule( 'quest_session_manager' ) for node in self.getSelection(): if isMockInstance( node, 'QuestSession' ): session = node schemeEntry = None m.setCurrentSelection( session, schemeEntry ) elif isMockInstance( node, 'QuestSessionSchemeEntry' ): session = node.session schemeEntry = node m.setCurrentSelection( session, schemeEntry ) break
def onExpandVar(self, item): var = item.data if var and not var.get('expanded', False): app.getModule('script_view').debuggerHandler.dumpVar(var['index']) var['expanded'] = 'expanding'
def onDClicked(self, item, col): device = item.node app.getModule('device_manager').setActiveDevice(device)
def run(self, *args): if len(args) >= 1: s = ' '.join(args) runtime = app.getModule('moai') print '> ' + s runtime.runString(s)
def onItemActivated(self, item, col): node = item.node app.getModule('scene_portal_manager').locateGraph(node)
def run(self, *args): preview = app.getModule('game_preview') preview.stopPreview()
def onItemSelectionChanged(self): selections = self.getSelection() app.getModule('global_object_manager').selectObject(selections)
def run( self, *args ): preview = app.getModule('game_preview') preview.stopPreview()
def onItemSelectionChanged(self): selections = self.getSelection() app.getModule('global_object_manager').selectObject( selections )
def getSceneSelectionManager(): return app.getModule('scene_editor').selectionManager
def onItemActivated( self, item, col ): node = item.node if isMockInstance( node, 'QuestSessionSchemeEntry' ): path = node.path app.getModule( 'asset_browser' ).locateAsset( path )
def editAsset(self, node): editor = app.getModule('mock.stylesheet_editor') if not editor: return alertMessage( 'Editor not load', 'Style Editor not found!' ) editor.setFocus() editor.openAsset( node )
def onClicked(self, idx): if not idx.isValid(): return id=idx.row() app.getModule('script_view').debuggerHandler.getScopeInfo(id+1)
def onItemChanged( self, item, col ): layer = self.getNodeByItem( item ) app.getModule('layer_manager').changeLayerName( layer, item.text(0) )
def onExpandVar(self, item): var=item.data if var and not var.get('expanded',False): app.getModule('script_view').debuggerHandler.dumpVar(var['index']) var['expanded']='expanding'
def run(self, *args): preview = app.getModule('game_preview') preview.runSceneExternal()
def onItemChanged( self, item, col ): obj = self.getNodeByItem( item ) app.getModule('global_object_manager').renameObject( obj, item.text(0) )
def run( self, *args ): preview = app.getModule('game_preview') preview.runSceneExternal()
def onClicked(self, idx): if not idx.isValid(): return id = idx.row() app.getModule('script_view').debuggerHandler.getScopeInfo(id + 1)
def onItemChanged(self, item, col): obj = self.getNodeByItem(item) app.getModule('global_object_manager').renameObject(obj, item.text(0))
def onItemChanged( self, item, col ): node = self.getNodeByItem( item ) if isMockInstance( node, 'QuestSession' ): app.getModule( 'quest_session_manager' ).renameSession( node, item.text(0) ) else: print('WTF?')
def onItemSelectionChanged(self): for node in self.getSelection(): app.getModule('scene_portal_manager').setCurrentGraph(node) break
def getRootNode(self): return app.getModule('scene_tool_manager').getRootCategory()
def editAsset(self, node): editor = app.getModule('mock.stylesheet_editor') if not editor: return alertMessage('Editor not load', 'Style Editor not found!') editor.setFocus() editor.openAsset(node)
def getRootNode( self ): return app.getModule( 'scene_tool_manager' ).getRootCategory()
def onItemChanged(self, item, col): layer = self.getNodeByItem(item) app.getModule('layer_manager').changeLayerName(layer, item.text(0))
def onDClicked( self, item, col ): device = item.node app.getModule('device_manager').setActiveDevice( device )