def saveRegistry(self): JSONHelper.trySaveJSON( self.portalRegistry, self.getProject().getGameConfigPath(_GII_PORTAL_DATA_NAME), 'portal data') reg = _MOCK.getScenePortalRegistry() reg.markDirty(reg)
def locateConnectedPortal(self, portalId): registry = _MOCK.getScenePortalRegistry() targetId = registry.findConnectedPortal(registry, portalId) if targetId: self.locatePortal(targetId) return True return False
def enumerateSelectableGraphs(self, typeId, context, option): result = [] registry = _MOCK.getScenePortalRegistry() for asset in self.getAssetLibrary().iterAssets(): if asset.getType() != 'scene_portal_graph': continue path = asset.getPath() if registry.hasGraph(registry, path): continue entry = (asset, path, 'portal_graph', 'portal_graph') result.append(entry) return result
def getCurrentScenePortals(self): registry = _MOCK.getScenePortalRegistry() editor = self.getModule('scenegraph_editor') sceneNode = editor.getActiveSceneNode() if not sceneNode: return [] result = [] for info in list(registry.portals.values()): if info.scene == sceneNode.getPath(): result.append(info) return result
def locatePortalGroup(self, groupName): registry = _MOCK.getScenePortalRegistry() scenePath = registry.getPortalGroupDefaultScene(registry, groupName) if not scenePath: alertMessage('No scene for portal group', 'No default scene found for group:' + groupName) return False node = self.getAssetLibrary().getAssetNode(scenePath) if not node: alertMessage('No scene found', 'Target scene not found:' + scenePath) return False node.edit()
def locatePortal(self, portalInfo, select=False): if self.updatingSelection: return if isinstance(portalInfo, str): #ID? registry = _MOCK.getScenePortalRegistry() portalInfo = registry.getPortalInfo(registry, portalInfo) if not portalInfo: return False scenePath = portalInfo.scene sceneNode = self.getAssetLibrary().getAssetNode(scenePath) if sceneNode: guid = portalInfo.data.guid editor = self.getModule('scenegraph_editor') if editor.getActiveSceneNode() == sceneNode: editor.locateEntityByGUID(guid) else: # if editor.getActiveSceneNode() and ( not requestConfirm( 'Changing Scene', 'opening another scene, proceed?' ) ): # return callLocating = signals.callOnce( 'scene.change', lambda: editor.locateEntityByGUID(guid)) if not editor.openScene(sceneNode): signals.dropCall(callLocating)
def getRootNode(self): return _MOCK.getScenePortalRegistry()
def removeGraph(self, graphNode): registry = _MOCK.getScenePortalRegistry() registry.removeGraph(registry, graphNode.getPath(graphNode)) self.treeGraphs.removeNode(graphNode)
def addGraph(self, assetNode): registry = _MOCK.getScenePortalRegistry() graphNode = registry.addGraph(registry, assetNode.getPath()) self.treeGraphs.addNode(graphNode)
def getPortalList(self): if self.showAllScenePortals: registry = _MOCK.getScenePortalRegistry() return [info for info in list(registry.portals.values())] else: return self.getCurrentScenePortals()