diff --git a/src/QuiltiX/quiltix.py b/src/QuiltiX/quiltix.py index a5ada6c..aeeb2f0 100644 --- a/src/QuiltiX/quiltix.py +++ b/src/QuiltiX/quiltix.py @@ -218,6 +218,7 @@ def on_mx_file_loaded(self, path): if self.act_apply_mat.isChecked(): self.stage_ctrl.apply_first_material_to_all_prims() self.stage_tree_widget.refresh_tree() + self.hide_node_defs() def on_node_graph_changed(self, nodegraph): if self.act_apply_mat.isChecked(): @@ -366,6 +367,12 @@ def init_menu_bar(self): self.act_ng_abstraction.setChecked(True) self.options_menu.addAction(self.act_ng_abstraction) + self.act_hide_defs = QAction("Hide nodegraph definitions", self) + self.act_hide_defs.setCheckable(True) + self.act_hide_defs.setChecked(True) + self.act_hide_defs.toggled.connect(self.hide_node_defs) + self.options_menu.addAction(self.act_hide_defs) + self.act_validate = QAction("Validate MaterialX document...", self) self.act_validate.triggered.connect(self.validate) self.options_menu.addAction(self.act_validate) @@ -727,6 +734,14 @@ def register_qx_nodes(self): self.qx_node_graph.register_node(qx_node.QxGroupNode) + def hide_node_defs(self, hide=None): + if hide is None: + hide = self.act_hide_defs.isChecked() + + for node in self.qx_node_graph.all_nodes(): + if node.get_property("nodedef"): + node.view.setVisible(not hide) + def validate(self, doc=None, popup=True): result = self.qx_node_graph.validate_mtlx_doc(doc) if result[0]: diff --git a/src/QuiltiX/qx_nodegraph.py b/src/QuiltiX/qx_nodegraph.py index caafa8f..2fdbf37 100644 --- a/src/QuiltiX/qx_nodegraph.py +++ b/src/QuiltiX/qx_nodegraph.py @@ -923,6 +923,7 @@ def create_nodegraph_from_mx_nodegraph( pos=pos, push_undo=push_undo ) + qx_node.create_property("nodedef", mx_node.getNodeDef()) if create_ports: for output in mx_node.getOutputs(): color = qx_node_module.QxNodeBase._random_color_from_string(str(output.getType()))