コード例 #1
0
 def saveRegistry(self):
     JSONHelper.trySaveJSON(
         self.portalRegistry,
         self.getProject().getGameConfigPath(_GII_PORTAL_DATA_NAME),
         'portal data')
     reg = _MOCK.getScenePortalRegistry()
     reg.markDirty(reg)
コード例 #2
0
 def locateConnectedPortal(self, portalId):
     registry = _MOCK.getScenePortalRegistry()
     targetId = registry.findConnectedPortal(registry, portalId)
     if targetId:
         self.locatePortal(targetId)
         return True
     return False
コード例 #3
0
 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
コード例 #4
0
 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
コード例 #5
0
    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()
コード例 #6
0
 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)
コード例 #7
0
 def getRootNode(self):
     return _MOCK.getScenePortalRegistry()
コード例 #8
0
 def removeGraph(self, graphNode):
     registry = _MOCK.getScenePortalRegistry()
     registry.removeGraph(registry, graphNode.getPath(graphNode))
     self.treeGraphs.removeNode(graphNode)
コード例 #9
0
 def addGraph(self, assetNode):
     registry = _MOCK.getScenePortalRegistry()
     graphNode = registry.addGraph(registry, assetNode.getPath())
     self.treeGraphs.addNode(graphNode)
コード例 #10
0
 def getPortalList(self):
     if self.showAllScenePortals:
         registry = _MOCK.getScenePortalRegistry()
         return [info for info in list(registry.portals.values())]
     else:
         return self.getCurrentScenePortals()