def onStart(self, selection): data = _MOCK.loadAsset( selection.getPath() ) if data: asset, luaAssetNode = data self.editor.setTarget( asset ) else: self.editor.setTarget( None )
def rebuildChildNodes(self, node): _MOCK.releaseAsset(node.getPath()) t = _MOCK.loadAsset(node.getPath()) if not t: return False (proj, luaAssetNode) = t if not proj: return False strings = proj.getStrings(proj) eventRootNode = node.affirmChildNode( 'event', 'fs_folder', manager='asset_manager.fmod_studio') snapshotRootNode = node.affirmChildNode( 'snapshot', 'fs_folder', manager='asset_manager.fmod_studio') bankRootNode = node.affirmChildNode( 'bank', 'fs_folder', manager='asset_manager.fmod_studio') busRootNode = node.affirmChildNode('bus', 'fs_folder', manager='asset_manager.fmod_studio') eventRootNode.groupType = 'package' snapshotRootNode.groupType = 'package' bankRootNode.groupType = 'package' busRootNode.groupType = 'package' def _affirmChildNode(rootNode, itemType, path): parts = path.split('/') itemName = parts[-1] currentNode = rootNode for p in parts[:-1]: if p: currentNode = currentNode.affirmChildNode( p, 'fs_folder', manager='asset_manager.fmod_studio') currentNode.groupType = 'package' node = currentNode.affirmChildNode( itemName, itemType, manager='asset_manager.fmod_studio') return node for path, guid in list(strings.items()): resType, itemPath = path.split(':/') itemNode = None if resType == 'event': itemNode = _affirmChildNode(eventRootNode, 'fs_event', itemPath) elif resType == 'snapshot': itemNode = _affirmChildNode(snapshotRootNode, 'fs_event', itemPath) elif resType == 'bus': #TODO pass elif resType == 'bank': #TODO pass if itemNode: itemNode.setProperty('guid', guid) itemNode.setProperty('path', path) return True
def setTarget(self, targetNode): self.targetNode = targetNode data = _MOCK.loadAsset(targetNode.getPath()) if data: asset, luaAssetNode = data self.targetAsset = asset self.propertyEditor.setTarget(asset) else: self.targetAsset = None self.propertyEditor.setTarget(None)
def setTarget( self, node ): self.targetNode = node data = _MOCK.loadAsset( node.getPath() ) if data: ( script, luaAssetNode ) = data self.targetScript = script self.window.rebuild() else: self.targetScript = None self.window.rebuild()
def setTarget(self, targetNode): self.targetNode = targetNode data = _MOCK.loadAsset( targetNode.getPath() ) if data: asset, luaAssetNode = data self.targetAsset = asset self.propertyEditor.setTarget( asset ) else: self.targetAsset = None self.propertyEditor.setTarget( None )