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