Example #1
0
	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
Example #2
0
 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)
Example #3
0
    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
Example #4
0
 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)
Example #5
0
	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)
Example #6
0
    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
Example #7
0
	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
Example #8
0
    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)
Example #9
0
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
Example #10
0
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
Example #11
0
 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('------------------')
Example #12
0
	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
Example #13
0
    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
Example #14
0
	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) )
Example #15
0
 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))
Example #16
0
	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
Example #17
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'
Example #18
0
 def onDClicked(self, item, col):
     device = item.node
     app.getModule('device_manager').setActiveDevice(device)
Example #19
0
 def run(self, *args):
     if len(args) >= 1:
         s = ' '.join(args)
         runtime = app.getModule('moai')
         print '> ' + s
         runtime.runString(s)
Example #20
0
 def onItemActivated(self, item, col):
     node = item.node
     app.getModule('scene_portal_manager').locateGraph(node)
Example #21
0
 def run(self, *args):
     preview = app.getModule('game_preview')
     preview.stopPreview()
Example #22
0
 def onItemSelectionChanged(self):
     selections = self.getSelection()
     app.getModule('global_object_manager').selectObject(selections)
Example #23
0
	def run( self, *args ):
		preview = app.getModule('game_preview')
		preview.stopPreview()
Example #24
0
	def onItemSelectionChanged(self):
		selections = self.getSelection()
		app.getModule('global_object_manager').selectObject( selections )
Example #25
0
def getSceneSelectionManager():
	return app.getModule('scene_editor').selectionManager
Example #26
0
	def onItemActivated( self, item, col ):
		node = item.node
		if isMockInstance( node, 'QuestSessionSchemeEntry' ):
			path = node.path
			app.getModule( 'asset_browser' ).locateAsset( path )
Example #27
0
	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 )
Example #28
0
	def onClicked(self, idx):
		if not idx.isValid(): return
		id=idx.row()
		app.getModule('script_view').debuggerHandler.getScopeInfo(id+1)
Example #29
0
	def onItemChanged( self, item, col ):
		layer = self.getNodeByItem( item )
		app.getModule('layer_manager').changeLayerName( layer, item.text(0) )
Example #30
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'
Example #31
0
 def run(self, *args):
     preview = app.getModule('game_preview')
     preview.runSceneExternal()
Example #32
0
def getSceneSelectionManager():
    return app.getModule('scene_editor').selectionManager
Example #33
0
	def onItemChanged( self, item, col ):
		obj = self.getNodeByItem( item )
		app.getModule('global_object_manager').renameObject( obj, item.text(0) )
Example #34
0
	def run( self, *args ):
		preview = app.getModule('game_preview')
		preview.runSceneExternal()
		
Example #35
0
 def onClicked(self, idx):
     if not idx.isValid(): return
     id = idx.row()
     app.getModule('script_view').debuggerHandler.getScopeInfo(id + 1)
Example #36
0
 def onItemChanged(self, item, col):
     obj = self.getNodeByItem(item)
     app.getModule('global_object_manager').renameObject(obj, item.text(0))
Example #37
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?')
Example #38
0
 def onItemSelectionChanged(self):
     for node in self.getSelection():
         app.getModule('scene_portal_manager').setCurrentGraph(node)
         break
Example #39
0
 def getRootNode(self):
     return app.getModule('scene_tool_manager').getRootCategory()
Example #40
0
 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)
Example #41
0
	def getRootNode( self ):
		return app.getModule( 'scene_tool_manager' ).getRootCategory()
Example #42
0
 def onItemChanged(self, item, col):
     layer = self.getNodeByItem(item)
     app.getModule('layer_manager').changeLayerName(layer, item.text(0))
Example #43
0
	def onDClicked( self, item, col ):
		device = item.node
		app.getModule('device_manager').setActiveDevice( device )