Exemple #1
0
    def applyChanges(self):
        stage = self._executeAllToStage()

        layerString = stage.GetRootLayer().ExportToString()
        self.layer.ImportFromString(layerString)

        GraphState.executeCallbacks('layerChangesApplied',
                                    layer=self.layer.realPath)
Exemple #2
0
    def _loadSceneFromUng(self, ungFile):
        self.view._floatWidget.switchButton.setFormat('ung')

        with open(ungFile, 'r') as f:
            xmlString = f.read()
        with GraphState.stopLiveUpdate():
            self.pasteNodesFromXml(xmlString, selected=False)
Exemple #3
0
 def mouseReleaseEvent(self, event):
     super(Pipe, self).mouseReleaseEvent(event)
     if self.isFloat:
         scene = self.scene()
         with GraphState.stopLiveUpdate():
             self._unFloatSelf(event)
         scene.liveUpdateRequired()
Exemple #4
0
    def _loadSceneFromLayer(self):
        with GraphState.stopLiveUpdate():
            self.view._floatWidget.switchButton.setFormat('usd')

            primSpec = self.layer.GetPrimAtPath('/')

            rootNode = self.createNode('Root')
            self._addNodeToPrimPath(rootNode, '/')

            self._addLayerNodes(self.layer)
            self._getIntoPrim(primSpec, rootNode)

            # we need to connect shader nodes after all nodes are created
            self._connectShadeNodes()

            self.layoutNodes()
Exemple #5
0
    def _connectToFoundPipe(self):
        if len(self.findPipes) > 0:
            with GraphState.stopLiveUpdate():

                for pipe in self.findPipes:
                    source = pipe.source
                    target = pipe.target

                    pipe.breakConnection()

                    self.inputPort.connectTo(source)
                    self.outputPort.connectTo(target)

            self.scene().liveUpdateRequired()

            self.findPipes = []
Exemple #6
0
    def _loadSceneFromXml(self, xmlString):
        self.view._floatWidget.switchButton.setFormat('ung')

        with GraphState.stopLiveUpdate():
            self.pasteNodesFromXml(xmlString, selected=False)
Exemple #7
0
def isEditable(realPath):
    if GraphState.hasFunction('isFileEditable') and realPath is not None:
        editAble = GraphState.executeFunction('isFileEditable', realPath)
        return editAble
    return True
Exemple #8
0
 def liveUpdateRequired(self):
     if GraphState.isLiveUpdate():
         self.applyChanges()
Exemple #9
0
 def deleteSelection(self):
     with GraphState.stopLiveUpdate():
         self._deleteSelection()
     self.liveUpdateRequired()
Exemple #10
0
 def mousePressEvent(self, event):
     if event.button() == QtCore.Qt.LeftButton:
         with GraphState.stopLiveUpdate():
             self._floatSelf(event)
     else:
         super(Pipe, self).mousePressEvent(event)
Exemple #11
0
 def mouseReleaseEvent(self, event):
     if event.button() == QtCore.Qt.LeftButton and self.findingPort:
         with GraphState.stopLiveUpdate():
             self._connectToFoundPort(event)
         self.scene().liveUpdateRequired()
Exemple #12
0
 def resetScene(self):
     with GraphState.stopLiveUpdate():
         self._resetScene()