mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-11 13:51:11 +01:00
RectView basic setup.
This commit is contained in:
parent
c2e75ef147
commit
9c4c30b821
@ -6,6 +6,7 @@ var edited_world
|
|||||||
func refresh() -> void:
|
func refresh() -> void:
|
||||||
$TabContainer/World/HSplitContainer/ResourcePropertyList.edit_resource(edited_world)
|
$TabContainer/World/HSplitContainer/ResourcePropertyList.edit_resource(edited_world)
|
||||||
$TabContainer/World/VBoxContainer/DataList.set_edited_resource(edited_world)
|
$TabContainer/World/VBoxContainer/DataList.set_edited_resource(edited_world)
|
||||||
|
$TabContainer/World/HSplitContainer/RectEditor.set_edited_resource(edited_world)
|
||||||
|
|
||||||
func set_wgworld(wgw : WorldGenWorld) -> void:
|
func set_wgworld(wgw : WorldGenWorld) -> void:
|
||||||
edited_world = wgw
|
edited_world = wgw
|
||||||
|
@ -4,3 +4,6 @@ extends PanelContainer
|
|||||||
func _init():
|
func _init():
|
||||||
# Control/EditorZoomWidget
|
# Control/EditorZoomWidget
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
func set_edited_resource(res : WorldGenBaseResource):
|
||||||
|
$ScrollContainer/MarginContainer/RectView.set_edited_resource(res)
|
||||||
|
@ -15,14 +15,22 @@ __meta__ = {
|
|||||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||||
margin_left = 7.0
|
margin_left = 7.0
|
||||||
margin_top = 7.0
|
margin_top = 7.0
|
||||||
margin_right = 1017.0
|
margin_right = 7.0
|
||||||
margin_bottom = 593.0
|
margin_bottom = 7.0
|
||||||
|
|
||||||
[node name="RectView" type="Control" parent="ScrollContainer"]
|
[node name="MarginContainer" type="MarginContainer" parent="ScrollContainer"]
|
||||||
margin_right = 1010.0
|
margin_right = 400.0
|
||||||
margin_bottom = 586.0
|
margin_bottom = 400.0
|
||||||
size_flags_horizontal = 3
|
custom_constants/margin_right = 200
|
||||||
size_flags_vertical = 3
|
custom_constants/margin_top = 200
|
||||||
|
custom_constants/margin_left = 200
|
||||||
|
custom_constants/margin_bottom = 200
|
||||||
|
|
||||||
|
[node name="RectView" type="Control" parent="ScrollContainer/MarginContainer"]
|
||||||
|
margin_left = 200.0
|
||||||
|
margin_top = 200.0
|
||||||
|
margin_right = 200.0
|
||||||
|
margin_bottom = 200.0
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
|
|
||||||
[node name="Control" type="Control" parent="."]
|
[node name="Control" type="Control" parent="."]
|
||||||
@ -30,6 +38,7 @@ margin_left = 7.0
|
|||||||
margin_top = 7.0
|
margin_top = 7.0
|
||||||
margin_right = 1017.0
|
margin_right = 1017.0
|
||||||
margin_bottom = 593.0
|
margin_bottom = 593.0
|
||||||
|
mouse_filter = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
|
||||||
|
@ -3,16 +3,42 @@ extends Control
|
|||||||
|
|
||||||
#"res://addons/world_generator/ui/RectEditorNode.tscn"
|
#"res://addons/world_generator/ui/RectEditorNode.tscn"
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
var edited_resource : WorldGenBaseResource = null
|
||||||
# var a = 2
|
|
||||||
# var b = "text"
|
|
||||||
|
|
||||||
|
func _draw():
|
||||||
|
draw_rect(Rect2(Vector2(), get_size()), Color(0.2, 0.2, 0.2, 1))
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
func refresh() -> void:
|
||||||
func _ready():
|
clear()
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
if !edited_resource:
|
||||||
|
return
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
var rect : Rect2 = edited_resource.rect
|
||||||
#func _process(delta):
|
|
||||||
# pass
|
set_custom_minimum_size(rect.size)
|
||||||
|
|
||||||
|
var p : MarginContainer = get_parent() as MarginContainer
|
||||||
|
|
||||||
|
p.add_constant_override("margin_left", rect.size.x / 4.0)
|
||||||
|
p.add_constant_override("margin_right", rect.size.x / 4.0)
|
||||||
|
p.add_constant_override("margin_top", rect.size.y / 4.0)
|
||||||
|
p.add_constant_override("margin_bottom", rect.size.y / 4.0)
|
||||||
|
|
||||||
|
func clear() -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
func set_edited_resource(res : WorldGenBaseResource):
|
||||||
|
if edited_resource:
|
||||||
|
edited_resource.disconnect("changed", self, "on_edited_resource_changed")
|
||||||
|
|
||||||
|
edited_resource = res
|
||||||
|
|
||||||
|
refresh()
|
||||||
|
|
||||||
|
if edited_resource:
|
||||||
|
edited_resource.connect("changed", self, "on_edited_resource_changed")
|
||||||
|
|
||||||
|
func on_edited_resource_changed() -> void:
|
||||||
|
pass
|
||||||
|
#refresh()
|
||||||
|
Loading…
Reference in New Issue
Block a user