diff --git a/addons/material_maker/engine/gen_graph.gd b/addons/material_maker/engine/gen_graph.gd index cd26cd0..e34675d 100644 --- a/addons/material_maker/engine/gen_graph.gd +++ b/addons/material_maker/engine/gen_graph.gd @@ -42,6 +42,10 @@ func get_type() -> String: func get_type_name() -> String: return label +func set_type_name(l) -> void: + if l !=label: + label = l + emit_hierarchy_changed() func toggle_editable() -> bool: editable = !editable diff --git a/material_maker/graph_edit.gd b/material_maker/graph_edit.gd index 91f04bd..c2ee1e9 100644 --- a/material_maker/graph_edit.gd +++ b/material_maker/graph_edit.gd @@ -352,7 +352,7 @@ func on_ButtonUp_pressed() -> void: call_deferred("update_view", generator.get_parent()) func _on_Label_text_changed(new_text) -> void: - generator.label = new_text + generator.set_type_name(new_text) # Create subgraph diff --git a/material_maker/preview/preview_3d.gd b/material_maker/preview/preview_3d.gd index 2fefb78..f765f60 100644 --- a/material_maker/preview/preview_3d.gd +++ b/material_maker/preview/preview_3d.gd @@ -54,7 +54,9 @@ func _on_Rotate_toggled(button_pressed) -> void: $MaterialPreview/Preview3d/ObjectRotate.stop(false) func get_materials() -> Array: - return [ current_object.get_surface_material(0) ] + if current_object != null: + return [ current_object.get_surface_material(0) ] + return [] func on_gui_input(event) -> void: if event is InputEventMouseButton: