diff options
| author | Juan Linietsky | 2017-01-10 01:04:31 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2017-01-10 01:07:03 -0300 |
| commit | a503f8aadcb8cbc85bde589fb25ea06e599b367b (patch) | |
| tree | 070ebbf0dd6af2d43c5519f5e32045b3512f0e9e /tools/editor/plugins | |
| parent | 68c008ca8d87a1f72fcf17467ee43714954e9ce4 (diff) | |
| download | godot-a503f8aadcb8cbc85bde589fb25ea06e599b367b.tar.gz godot-a503f8aadcb8cbc85bde589fb25ea06e599b367b.tar.zst godot-a503f8aadcb8cbc85bde589fb25ea06e599b367b.zip | |
Groundbreaking!! Godot resources can now be flagged to be local to the scene being edited!
This means that each time this scene is instanced, the resource will be unique!
As such, thanks to this, the following features were implemented:
-ButtonGroup is no longer a control, it's now a resource local to the scene
-ViewportTexture can be created from the editor and set to any object, making ViewportSprite and other kind of nodes obsolete!
Diffstat (limited to 'tools/editor/plugins')
| -rw-r--r-- | tools/editor/plugins/canvas_item_editor_plugin.cpp | 17 | ||||
| -rw-r--r-- | tools/editor/plugins/canvas_item_editor_plugin.h | 3 | ||||
| -rw-r--r-- | tools/editor/plugins/theme_editor_plugin.cpp | 2 |
3 files changed, 15 insertions, 7 deletions
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 7fecd6048..683932688 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -3671,7 +3671,10 @@ void CanvasItemEditorViewport::_on_select_type(Object* selected) { } void CanvasItemEditorViewport::_on_change_type() { - CheckBox* check=btn_group->get_pressed_button()->cast_to<CheckBox>(); + if (!button_group->get_pressed_button()) + return; + + CheckBox* check=button_group->get_pressed_button()->cast_to<CheckBox>(); default_type=check->get_text(); _perform_drop_data(); selector->hide(); @@ -3798,7 +3801,7 @@ bool CanvasItemEditorViewport::_create_instance(Node* parent, String& path, cons return false; } - Node* instanced_scene=sdata->instance(true); + Node* instanced_scene=sdata->instance(PackedScene::GEN_EDIT_STATE_INSTANCE); if (!instanced_scene) { // error on instancing return false; } @@ -3899,7 +3902,7 @@ bool CanvasItemEditorViewport::can_drop_data(const Point2& p_point,const Variant String type=res->get_class(); if (type=="PackedScene") { Ref<PackedScene> sdata=ResourceLoader::load(files[i]); - Node* instanced_scene=sdata->instance(true); + Node* instanced_scene=sdata->instance(PackedScene::GEN_EDIT_STATE_INSTANCE); if (!instanced_scene) { continue; } @@ -3957,7 +3960,8 @@ void CanvasItemEditorViewport::drop_data(const Point2& p_point,const Variant& p_ if (is_alt) { List<BaseButton*> btn_list; - btn_group->get_button_list(&btn_list); + button_group->get_buttons(&btn_list); + for (int i=0;i<btn_list.size();i++) { CheckBox* check=btn_list[i]->cast_to<CheckBox>(); check->set_pressed(check->get_text()==default_type); @@ -4016,7 +4020,9 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte selector_label->set_custom_minimum_size(Size2(0,30)*EDSCALE); vbc->add_child(selector_label); - btn_group=memnew( ButtonGroup ); + button_group.instance(); + + btn_group=memnew( VBoxContainer ); btn_group->set_h_size_flags(0); btn_group->connect("button_selected", this, "_on_select_type"); @@ -4024,6 +4030,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte CheckBox* check=memnew(CheckBox); check->set_text(types[i]); btn_group->add_child(check); + check->set_button_group(button_group); } vbc->add_child(btn_group); diff --git a/tools/editor/plugins/canvas_item_editor_plugin.h b/tools/editor/plugins/canvas_item_editor_plugin.h index f74df9d6e..ee3655447 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.h +++ b/tools/editor/plugins/canvas_item_editor_plugin.h @@ -473,7 +473,8 @@ class CanvasItemEditorViewport : public VBoxContainer { Label* selector_label; Label* label; Label* label_desc; - ButtonGroup* btn_group; + VBoxContainer* btn_group; + Ref<ButtonGroup> button_group; void _on_mouse_exit(); void _on_select_type(Object* selected); diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp index ad0968178..a700ddce7 100644 --- a/tools/editor/plugins/theme_editor_plugin.cpp +++ b/tools/editor/plugins/theme_editor_plugin.cpp @@ -711,7 +711,7 @@ ThemeEditor::ThemeEditor() { first_vb->add_child(cbx ); - ButtonGroup *bg = memnew( ButtonGroup ); + VBoxContainer *bg = memnew( VBoxContainer ); bg->set_v_size_flags(SIZE_EXPAND_FILL); VBoxContainer *gbvb = memnew( VBoxContainer ); gbvb->set_v_size_flags(SIZE_EXPAND_FILL); |
