def _explodeClicked(): from coral.coralUi.nodeEditor.nodeEditor import NodeEditor from coral import coralApp sel = NodeEditor.selectedNodes() if sel: coralApp.executeCommand("ExplodeCollapsedNode", collapsedNode = sel[0].fullName())
def _createFromItemData(itemData): from nodeEditor import nodeEditor sceneItem = None className = itemData["data"]["className"] parentNode = nodeEditor.NodeEditor.focusedInstance().currentNode().fullName() if itemData["type"] == "attributeClassName": name = "input" if itemData["data"]["output"]: name = "output" newAttributeName = coralApp.executeCommand("CreateAttribute", className = className, name = name, parentNode = parentNode, input = itemData["data"]["input"], output = itemData["data"]["output"]) if newAttributeName: newAttribute = coralApp.findAttribute(newAttributeName) attributeUi = nodeEditor.NodeEditor.findAttributeUi(newAttribute.id()) if attributeUi.proxy(): sceneItem = attributeUi.proxy() elif itemData["type"] == "nodeClassName": newNodeName = coralApp.executeCommand("CreateNode", className = className, name = className, parentNode = parentNode) if newNodeName: newNode = coralApp.findNode(newNodeName) sceneItem = nodeEditor.NodeEditor.findNodeUi(newNode.id()) return sceneItem
def addOutput(self, name, attClass, specs): """ Adds a new output attribute to the node, and connects it to the inputs """ coralApp.executeCommand("CreateAttribute", className=attClass.__name__, name=name, parentNode=self.fullName(), output=True) attr = self.findAttribute(name) self._setAttributeAllowedSpecializations(attr, specs) for inAtt in self.inputAttributes(): self._setAttributeAffect(inAtt, attr)
def _collapseClicked(): from coral.coralUi.nodeEditor.nodeEditor import NodeEditor from coral import coralApp nodesName = [] for node in NodeEditor.selectedNodes(): nodesName.append(node.fullName()) if nodesName: coralApp.executeCommand("CollapseNodes", nodes = nodesName)
def _collapseClicked(): from coral.coralUi.nodeEditor.nodeEditor import NodeEditor from coral import coralApp nodesName = [] for node in NodeEditor.selectedNodes(): nodesName.append(node.fullName()) if nodesName: coralApp.executeCommand("CollapseNodes", nodes=nodesName)
def _createFromItemData(itemData): from nodeEditor import nodeEditor sceneItem = None className = itemData["data"]["className"] parentNode = nodeEditor.NodeEditor.focusedInstance().currentNode( ).fullName() if itemData["type"] == "attributeClassName": name = "input" if itemData["data"]["output"]: name = "output" newAttributeName = coralApp.executeCommand( "CreateAttribute", className=className, name=name, parentNode=parentNode, input=itemData["data"]["input"], output=itemData["data"]["output"]) if newAttributeName: newAttribute = coralApp.findAttribute(newAttributeName) attributeUi = nodeEditor.NodeEditor.findAttributeUi( newAttribute.id()) if attributeUi.proxy(): sceneItem = attributeUi.proxy() elif itemData["type"] == "nodeClassName": newNodeName = coralApp.executeCommand("CreateNode", className=className, name=className, parentNode=parentNode) if newNodeName: newNode = coralApp.findNode(newNodeName) sceneItem = nodeEditor.NodeEditor.findNodeUi(newNode.id()) return sceneItem