Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to hide nodedefinitions from loaded files #74

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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