def applyChanges(self): stage = self._executeAllToStage() layerString = stage.GetRootLayer().ExportToString() self.layer.ImportFromString(layerString) GraphState.executeCallbacks('layerChangesApplied', layer=self.layer.realPath)
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)
def mouseReleaseEvent(self, event): super(Pipe, self).mouseReleaseEvent(event) if self.isFloat: scene = self.scene() with GraphState.stopLiveUpdate(): self._unFloatSelf(event) scene.liveUpdateRequired()
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()
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 = []
def _loadSceneFromXml(self, xmlString): self.view._floatWidget.switchButton.setFormat('ung') with GraphState.stopLiveUpdate(): self.pasteNodesFromXml(xmlString, selected=False)
def isEditable(realPath): if GraphState.hasFunction('isFileEditable') and realPath is not None: editAble = GraphState.executeFunction('isFileEditable', realPath) return editAble return True
def liveUpdateRequired(self): if GraphState.isLiveUpdate(): self.applyChanges()
def deleteSelection(self): with GraphState.stopLiveUpdate(): self._deleteSelection() self.liveUpdateRequired()
def mousePressEvent(self, event): if event.button() == QtCore.Qt.LeftButton: with GraphState.stopLiveUpdate(): self._floatSelf(event) else: super(Pipe, self).mousePressEvent(event)
def mouseReleaseEvent(self, event): if event.button() == QtCore.Qt.LeftButton and self.findingPort: with GraphState.stopLiveUpdate(): self._connectToFoundPort(event) self.scene().liveUpdateRequired()
def resetScene(self): with GraphState.stopLiveUpdate(): self._resetScene()