From 9145867ac4f14b08a93643c2939506bf00e7436f Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 5 Aug 2022 21:31:07 +0200 Subject: [PATCH] Size newly added resources in the world editor properly. --- game/addons/world_generator/ui/DataList.gd | 10 ++++++++++ game/addons/world_generator/ui/DataList.tscn | 3 --- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/game/addons/world_generator/ui/DataList.gd b/game/addons/world_generator/ui/DataList.gd index a658706e..fca6f1df 100644 --- a/game/addons/world_generator/ui/DataList.gd +++ b/game/addons/world_generator/ui/DataList.gd @@ -49,6 +49,8 @@ func add_item(item_name : String = "") -> void: e = Zone.new() elif cn == "SubZone": e = SubZone.new() + elif cn == "SubZoneProp": + e = SubZoneProp.new() elif ti.has_meta("file"): var cls = load(ti.get_meta("file")) @@ -61,6 +63,14 @@ func add_item(item_name : String = "") -> void: e.resource_name = item_name + var r : Rect2 = edited_resource.get_rect() + var rs : Vector2 = r.size + r.size.x /= 10.0 + r.size.y /= 10.0 + r.position = rs / Vector2(2, 2) + r.position -= r.size / Vector2(2, 2) + e.set_rect(r) + #edited_resource.add_content(e) #remove_content_entry diff --git a/game/addons/world_generator/ui/DataList.tscn b/game/addons/world_generator/ui/DataList.tscn index 20764086..f120e5bc 100644 --- a/game/addons/world_generator/ui/DataList.tscn +++ b/game/addons/world_generator/ui/DataList.tscn @@ -9,9 +9,6 @@ size_flags_horizontal = 3 size_flags_vertical = 3 hide_root = true script = ExtResource( 1 ) -__meta__ = { -"_edit_use_anchors_": false -} [node name="NameDialog" type="ConfirmationDialog" parent="."] margin_right = 329.0