From 1352d344a18682d3ad74820ddfa137192657d83d Mon Sep 17 00:00:00 2001 From: HungryProton Date: Tue, 12 Oct 2021 22:53:28 +0200 Subject: [PATCH] fix: local item reference would get deleted after last patch, fix: bitmask UI now works with both godot 3.3 and 3.4 --- src/core/scatter_item.gd | 5 ++- .../ui/components/parameter_bitmask.gd | 10 ++++++ .../ui/components/parameter_bitmask.tscn | 32 ++++++------------- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/core/scatter_item.gd b/src/core/scatter_item.gd index 7690ec0..b644115 100644 --- a/src/core/scatter_item.gd +++ b/src/core/scatter_item.gd @@ -88,9 +88,11 @@ func update(): func get_mesh_instance_copy() -> MeshInstance: var root = null + var local_root = false if local_item_path: root = get_node_or_null(local_item_path) + local_root = true if item_path: var scene = load(item_path) @@ -99,7 +101,8 @@ func get_mesh_instance_copy() -> MeshInstance: if root: var mesh = _get_mesh_from_scene(root) - root.queue_free() + if not local_root: + root.queue_free() if mesh: _save_initial_data(mesh) return mesh diff --git a/src/tools/modifier_stack_inspector_plugin/ui/components/parameter_bitmask.gd b/src/tools/modifier_stack_inspector_plugin/ui/components/parameter_bitmask.gd index ab2d461..e593ef0 100644 --- a/src/tools/modifier_stack_inspector_plugin/ui/components/parameter_bitmask.gd +++ b/src/tools/modifier_stack_inspector_plugin/ui/components/parameter_bitmask.gd @@ -17,10 +17,20 @@ var _layer_count := 32 func _ready() -> void: _buttons = [] var grids = [_grid_1, _grid_2, _grid_3, _grid_4] + + # Disable the extra layers if we're on 3.3 + if not ProjectSettings.has_setting("layer_names/3d_physics/layer_21"): + _layer_count = 20 + for g in grids: for c in g.get_children(): if c is Button: + var layer_number = int(c.text) + if layer_number > _layer_count: + c.visible = false + continue _buttons.push_front(c) + c.focus_mode = Control.FOCUS_NONE c.connect("pressed", self, "_on_button_pressed") _popup = _menu_button.get_popup() diff --git a/src/tools/modifier_stack_inspector_plugin/ui/components/parameter_bitmask.tscn b/src/tools/modifier_stack_inspector_plugin/ui/components/parameter_bitmask.tscn index e0237b8..43e2a7d 100644 --- a/src/tools/modifier_stack_inspector_plugin/ui/components/parameter_bitmask.tscn +++ b/src/tools/modifier_stack_inspector_plugin/ui/components/parameter_bitmask.tscn @@ -15,30 +15,30 @@ __meta__ = { } [node name="Label" type="Label" parent="."] -margin_right = 1280.0 +margin_right = 1024.0 margin_bottom = 14.0 text = "Parameter name" [node name="MarginContainer" type="MarginContainer" parent="."] margin_top = 18.0 -margin_right = 1280.0 +margin_right = 1024.0 margin_bottom = 88.0 [node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"] -margin_right = 1280.0 +margin_right = 1024.0 margin_bottom = 70.0 alignment = 2 [node name="MenuButton" type="MenuButton" parent="MarginContainer/HBoxContainer"] -margin_left = 1052.0 -margin_right = 1080.0 +margin_left = 796.0 +margin_right = 824.0 margin_bottom = 70.0 icon = ExtResource( 3 ) -items = [ "Default", null, 1, false, false, 19, 0, null, "", false, "Characters", null, 1, false, false, 18, 0, null, "", false, "Layer 3", null, 1, false, false, 17, 0, null, "", false, "Layer 4", null, 1, false, false, 16, 0, null, "", false, "Props", null, 1, false, false, 15, 0, null, "", false, "", null, 0, false, false, 105, 0, null, "", true, "Layer 6", null, 1, false, false, 14, 0, null, "", false, "Layer 7", null, 1, false, false, 13, 0, null, "", false, "Layer 8", null, 1, false, false, 12, 0, null, "", false, "LevelGeometry", null, 1, false, false, 11, 0, null, "", false, "Layer 10", null, 1, false, false, 10, 0, null, "", false, "", null, 0, false, false, 110, 0, null, "", true, "Layer 11", null, 1, false, false, 9, 0, null, "", false, "Layer 12", null, 1, false, false, 8, 0, null, "", false, "InvisibleWalls (Player)", null, 1, false, false, 7, 0, null, "", false, "InvisibleWalls (AI)", null, 1, false, false, 6, 0, null, "", false, "Layer 15", null, 1, false, false, 5, 0, null, "", false, "", null, 0, false, false, 115, 0, null, "", true, "Layer 16", null, 1, false, false, 4, 0, null, "", false, "Layer 17", null, 1, false, false, 3, 0, null, "", false, "Layer 18", null, 1, false, false, 2, 0, null, "", false, "Layer 19", null, 1, false, false, 1, 0, null, "", false, "Layer 20", null, 1, false, false, 0, 0, null, "", false ] +items = [ "Layer 1", null, 1, false, false, 31, 0, null, "", false, "Layer 2", null, 1, false, false, 30, 0, null, "", false, "Layer 3", null, 1, false, false, 29, 0, null, "", false, "Layer 4", null, 1, false, false, 28, 0, null, "", false, "", null, 0, false, false, 104, 0, null, "", true, "Layer 5", null, 1, false, false, 27, 0, null, "", false, "Layer 6", null, 1, false, false, 26, 0, null, "", false, "Layer 7", null, 1, false, false, 25, 0, null, "", false, "Layer 8", null, 1, false, false, 24, 0, null, "", false, "", null, 0, false, false, 108, 0, null, "", true, "Layer 9", null, 1, false, false, 23, 0, null, "", false, "Layer 10", null, 1, false, false, 22, 0, null, "", false, "Layer 11", null, 1, false, false, 21, 0, null, "", false, "Layer 12", null, 1, false, false, 20, 0, null, "", false, "", null, 0, false, false, 112, 0, null, "", true, "Layer 13", null, 1, false, false, 19, 0, null, "", false, "Layer 14", null, 1, false, false, 18, 0, null, "", false, "Layer 15", null, 1, false, false, 17, 0, null, "", false, "Layer 16", null, 1, false, false, 16, 0, null, "", false, "", null, 0, false, false, 116, 0, null, "", true, "Layer 17", null, 1, false, false, 15, 0, null, "", false, "Layer 18", null, 1, false, false, 14, 0, null, "", false, "Layer 19", null, 1, false, false, 13, 0, null, "", false, "Layer 20", null, 1, false, false, 12, 0, null, "", false, "", null, 0, false, false, 120, 0, null, "", true, "Layer 21", null, 1, false, false, 11, 0, null, "", false, "Layer 22", null, 1, false, false, 10, 0, null, "", false, "Layer 23", null, 1, false, false, 9, 0, null, "", false, "Layer 24", null, 1, false, false, 8, 0, null, "", false, "", null, 0, false, false, 124, 0, null, "", true, "Layer 25", null, 1, false, false, 7, 0, null, "", false, "Layer 26", null, 1, false, false, 6, 0, null, "", false, "Layer 27", null, 1, false, false, 5, 0, null, "", false, "Layer 28", null, 1, false, false, 4, 0, null, "", false, "", null, 0, false, false, 128, 0, null, "", true, "Layer 29", null, 1, false, false, 3, 0, null, "", false, "Layer 30", null, 1, false, false, 2, 0, null, "", false, "Layer 31", null, 1, false, false, 1, 0, null, "", false, "Layer 32", null, 1, false, false, 0, 0, null, "", false ] [node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer"] -margin_left = 1084.0 -margin_right = 1248.0 +margin_left = 828.0 +margin_right = 992.0 margin_bottom = 70.0 [node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/HBoxContainer/VBoxContainer"] @@ -200,7 +200,6 @@ text = "20" margin_top = 15.0 margin_right = 18.0 margin_bottom = 29.0 -focus_mode = 2 text = "21" [node name="Button22" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer2/GridContainer3" instance=ExtResource( 2 )] @@ -208,7 +207,6 @@ margin_left = 19.0 margin_top = 15.0 margin_right = 37.0 margin_bottom = 29.0 -focus_mode = 2 text = "22" [node name="Button23" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer2/GridContainer3" instance=ExtResource( 2 )] @@ -216,7 +214,6 @@ margin_left = 38.0 margin_top = 15.0 margin_right = 56.0 margin_bottom = 29.0 -focus_mode = 2 text = "23" [node name="Button24" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer2/GridContainer3" instance=ExtResource( 2 )] @@ -224,7 +221,6 @@ margin_left = 57.0 margin_top = 15.0 margin_right = 75.0 margin_bottom = 29.0 -focus_mode = 2 text = "24" [node name="VSeparator2" type="VSeparator" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer2"] @@ -243,32 +239,27 @@ columns = 4 [node name="Button25" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer2/GridContainer4" instance=ExtResource( 2 )] margin_right = 18.0 -focus_mode = 2 text = "25" [node name="Button26" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer2/GridContainer4" instance=ExtResource( 2 )] margin_left = 19.0 margin_right = 37.0 -focus_mode = 2 text = "26" [node name="Button27" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer2/GridContainer4" instance=ExtResource( 2 )] margin_left = 38.0 margin_right = 56.0 -focus_mode = 2 text = "27" [node name="Button28" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer2/GridContainer4" instance=ExtResource( 2 )] margin_left = 57.0 margin_right = 75.0 -focus_mode = 2 text = "28" [node name="Button29" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer2/GridContainer4" instance=ExtResource( 2 )] margin_top = 15.0 margin_right = 18.0 margin_bottom = 29.0 -focus_mode = 2 text = "29" [node name="Button30" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer2/GridContainer4" instance=ExtResource( 2 )] @@ -276,7 +267,6 @@ margin_left = 19.0 margin_top = 15.0 margin_right = 37.0 margin_bottom = 29.0 -focus_mode = 2 text = "30" [node name="Button31" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer2/GridContainer4" instance=ExtResource( 2 )] @@ -284,7 +274,6 @@ margin_left = 38.0 margin_top = 15.0 margin_right = 56.0 margin_bottom = 29.0 -focus_mode = 2 text = "31" [node name="Button32" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer2/GridContainer4" instance=ExtResource( 2 )] @@ -292,12 +281,11 @@ margin_left = 57.0 margin_top = 15.0 margin_right = 75.0 margin_bottom = 29.0 -focus_mode = 2 text = "32" [node name="VBoxContainer2" type="VBoxContainer" parent="MarginContainer/HBoxContainer"] -margin_left = 1252.0 -margin_right = 1280.0 +margin_left = 996.0 +margin_right = 1024.0 margin_bottom = 70.0 alignment = 1