Skip to content

Commit

Permalink
option to hide nodedefinitions from loaded files
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardFrangenberg committed Jun 16, 2024
1 parent 0336284 commit bcfa67c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/QuiltiX/quiltix.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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]:
Expand Down
1 change: 1 addition & 0 deletions src/QuiltiX/qx_nodegraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down

0 comments on commit bcfa67c

Please sign in to comment.