Size newly added resources in the world editor properly.

This commit is contained in:
Relintai 2022-08-05 21:31:07 +02:00
parent 69054c8fa5
commit 9145867ac4
2 changed files with 10 additions and 3 deletions

View File

@ -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

View File

@ -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