diff options
Diffstat (limited to 'tools/editor')
56 files changed, 357 insertions, 315 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index e693753c33..68bd051ee9 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -2309,7 +2309,7 @@ void AnimationKeyEditor::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { zoomicon->set_texture( get_icon("Zoom","EditorIcons") ); //menu_track->set_icon(get_icon("AddTrack","EditorIcons")); @@ -2465,12 +2465,12 @@ void AnimationKeyEditor::set_animation(const Ref<Animation>& p_anim) { void AnimationKeyEditor::set_root(Node *p_root) { if (root) - root->disconnect("exit_scene",this,"_root_removed"); + root->disconnect("exit_tree",this,"_root_removed"); root=p_root; if (root) - root->connect("exit_scene",this,"_root_removed",make_binds(),CONNECT_ONESHOT); + root->connect("exit_tree",this,"_root_removed",make_binds(),CONNECT_ONESHOT); } diff --git a/tools/editor/call_dialog.cpp b/tools/editor/call_dialog.cpp index 4548d7291c..2e4fb96a58 100644 --- a/tools/editor/call_dialog.cpp +++ b/tools/editor/call_dialog.cpp @@ -76,7 +76,7 @@ void CallDialog::_notification(int p_what) { _update_method_list(); } - if (p_what==NOTIFICATION_EXIT_SCENE) { + if (p_what==NOTIFICATION_EXIT_TREE) { call->disconnect("pressed", this,"_call"); cancel->disconnect("pressed", this,"_cancel"); @@ -285,7 +285,7 @@ CallDialog::CallDialog() { property_editor->set_anchor_and_margin( MARGIN_TOP, ANCHOR_BEGIN, 50 ); property_editor->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.55 ); property_editor->set_anchor_and_margin( MARGIN_BOTTOM, ANCHOR_END, 90 ); - property_editor->get_tree()->set_hide_root( true ); + property_editor->get_scene_tree()->set_hide_root( true ); property_editor->hide_top_label(); add_child(property_editor); diff --git a/tools/editor/console.cpp b/tools/editor/console.cpp index 746f61ad67..6b37895bc4 100644 --- a/tools/editor/console.cpp +++ b/tools/editor/console.cpp @@ -129,7 +129,7 @@ void Console::_window_input_event(InputEvent p_event) { if (p_event.key.scancode==KEY_ESCAPE && !window_has_modal_stack() && is_visible()) { hide(); - get_scene()->call_group(0,"windows","_cancel_input_ID",p_event.ID); + get_tree()->call_group(0,"windows","_cancel_input_ID",p_event.ID); } @@ -153,7 +153,7 @@ void Console::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { _resized(); show(); diff --git a/tools/editor/create_dialog.cpp b/tools/editor/create_dialog.cpp index 43c18341be..f816e46bcf 100644 --- a/tools/editor/create_dialog.cpp +++ b/tools/editor/create_dialog.cpp @@ -225,7 +225,7 @@ void CreateDialog::_confirmed() { void CreateDialog::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { connect("confirmed",this,"_confirmed"); _update_search(); diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index bb4262e4b0..aeca76bb29 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -462,7 +462,7 @@ void EditorSelection::add_node(Node *p_node) { } selection[p_node]=meta; - p_node->connect("exit_scene",this,"_node_removed",varray(p_node),CONNECT_ONESHOT); + p_node->connect("exit_tree",this,"_node_removed",varray(p_node),CONNECT_ONESHOT); //emit_signal("selection_changed"); } @@ -478,7 +478,7 @@ void EditorSelection::remove_node(Node *p_node) { if (meta) memdelete(meta); selection.erase(p_node); - p_node->disconnect("exit_scene",this,"_node_removed"); + p_node->disconnect("exit_tree",this,"_node_removed"); //emit_signal("selection_changed"); } bool EditorSelection::is_selected(Node * p_node) const { diff --git a/tools/editor/editor_dir_dialog.cpp b/tools/editor/editor_dir_dialog.cpp index 790c3c8cd5..eee4125e93 100644 --- a/tools/editor/editor_dir_dialog.cpp +++ b/tools/editor/editor_dir_dialog.cpp @@ -69,7 +69,7 @@ void EditorDirDialog::reload() { void EditorDirDialog::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { reload(); tree->connect("item_collapsed",this,"_item_collapsed",varray(),CONNECT_DEFERRED); } diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp index 76755666eb..e0b743a929 100644 --- a/tools/editor/editor_file_system.cpp +++ b/tools/editor/editor_file_system.cpp @@ -681,12 +681,12 @@ void EditorFileSystem::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { _load_type_cache(); scan(); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { if (use_threads && thread) { //abort thread if in progress abort_scan=true; diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 42260e70ba..8408436a6c 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -270,7 +270,7 @@ void EditorHelpSearch::_confirmed() { void EditorHelpSearch::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { connect("confirmed",this,"_confirmed"); _update_search(); diff --git a/tools/editor/editor_log.cpp b/tools/editor/editor_log.cpp index 23ba88ef81..f7f5f596d7 100644 --- a/tools/editor/editor_log.cpp +++ b/tools/editor/editor_log.cpp @@ -76,7 +76,7 @@ void EditorLog::_error_handler(void *p_self, const char*p_func, const char*p_fil void EditorLog::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { log->add_color_override("default_color",get_color("font_color","Tree")); tb->set_normal_texture( get_icon("Collapse","EditorIcons")); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index b23f6c2765..5e9cdf78a2 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -140,7 +140,7 @@ void EditorNode::_unhandled_input(const InputEvent& p_event) { void EditorNode::_notification(int p_what) { - if (p_what==NOTIFICATION_EXIT_SCENE) { + if (p_what==NOTIFICATION_EXIT_TREE) { editor_data.save_editor_external_data(); log->deinit(); // do not get messages anymore @@ -213,13 +213,13 @@ void EditorNode::_notification(int p_what) { } } - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { //MessageQueue::get_singleton()->push_call(this,"_get_scene_metadata"); - get_scene()->set_editor_hint(true); - get_scene()->get_root()->set_as_audio_listener(false); - get_scene()->get_root()->set_as_audio_listener_2d(false); - get_scene()->set_auto_accept_quit(false); + get_tree()->set_editor_hint(true); + get_tree()->get_root()->set_as_audio_listener(false); + get_tree()->get_root()->set_as_audio_listener_2d(false); + get_tree()->set_auto_accept_quit(false); //VisualServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport(),false); //import_monitor->scan_changes(); @@ -242,7 +242,7 @@ void EditorNode::_notification(int p_what) { if (ok!=OK) OS::get_singleton()->set_exit_code(255); defer_translatable=""; - get_scene()->quit(); + get_tree()->quit(); } /* @@ -1232,7 +1232,7 @@ void EditorNode::_edit_current() { Node * current_node = current_obj->cast_to<Node>(); ERR_FAIL_COND(!current_node); - ERR_FAIL_COND(!current_node->is_inside_scene()); + ERR_FAIL_COND(!current_node->is_inside_tree()); @@ -1902,7 +1902,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } _menu_option_confirm(RUN_STOP,true); - get_scene()->quit(); + get_tree()->quit(); } break; case FILE_EXTERNAL_OPEN_SCENE: { @@ -2122,7 +2122,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { break; } - get_scene()->quit(); + get_tree()->quit(); String exec = OS::get_singleton()->get_executable_path(); List<String> args; @@ -2380,8 +2380,8 @@ void EditorNode::set_edited_scene(Node *p_scene) { if (edited_scene && edited_scene->cast_to<Popup>()) edited_scene->cast_to<Popup>()->show(); //show popups scene_tree_dock->set_edited_scene(edited_scene); - if (get_scene()) - get_scene()->set_edited_scene_root(edited_scene); + if (get_tree()) + get_tree()->set_edited_scene_root(edited_scene); if (edited_scene) { if (p_scene->get_parent()!=scene_root) @@ -2425,7 +2425,7 @@ void EditorNode::_fetch_translatable_strings(const Object *p_object,Set<StringNa Error EditorNode::save_translatable_strings(const String& p_to_file) { - if (!is_inside_scene()) { + if (!is_inside_tree()) { defer_translatable=p_to_file; return OK; } @@ -2619,7 +2619,7 @@ Error EditorNode::save_optimized_copy(const String& p_scene,const String& p_pres Error EditorNode::load_scene(const String& p_scene) { - if (!is_inside_scene()) { + if (!is_inside_tree()) { defer_load_scene = p_scene; return OK; } diff --git a/tools/editor/editor_run_native.cpp b/tools/editor/editor_run_native.cpp index be1a124fc2..17117be188 100644 --- a/tools/editor/editor_run_native.cpp +++ b/tools/editor/editor_run_native.cpp @@ -33,7 +33,7 @@ void EditorRunNative::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { List<StringName> ep; EditorImportExport::get_singleton()->get_export_platforms(&ep); diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index bc88896ebb..8852293fe4 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -464,10 +464,10 @@ void EditorSettings::notify_changes() { _THREAD_SAFE_METHOD_ - SceneMainLoop *sml=NULL; + SceneTree *sml=NULL; if (OS::get_singleton()->get_main_loop()) - sml = OS::get_singleton()->get_main_loop()->cast_to<SceneMainLoop>(); + sml = OS::get_singleton()->get_main_loop()->cast_to<SceneTree>(); if (!sml) { print_line("not SML"); diff --git a/tools/editor/groups_editor.cpp b/tools/editor/groups_editor.cpp index f0a2a6a758..52db562d8a 100644 --- a/tools/editor/groups_editor.cpp +++ b/tools/editor/groups_editor.cpp @@ -36,7 +36,7 @@ void GroupsEditor::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { connect("confirmed", this,"_close"); } } diff --git a/tools/editor/import_settings.cpp b/tools/editor/import_settings.cpp index 74e4aa97d7..63b8d65b69 100644 --- a/tools/editor/import_settings.cpp +++ b/tools/editor/import_settings.cpp @@ -224,7 +224,7 @@ void ImportSettingsDialog::update_tree() { void ImportSettingsDialog::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"update_tree"); } diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp index 6a6ee8c614..064758f6cd 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -529,7 +529,7 @@ public: void _notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { prop_edit->edit(options); _update_text(); } diff --git a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp index 6ebdb6cc41..7d6f400ccc 100644 --- a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp @@ -245,7 +245,7 @@ public: void _notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { option_editor->edit(options); } diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.cpp b/tools/editor/io_plugins/editor_sample_import_plugin.cpp index cd02156eef..377af8f179 100644 --- a/tools/editor/io_plugins/editor_sample_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_sample_import_plugin.cpp @@ -290,7 +290,7 @@ public: void _notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { option_editor->edit(options); } diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index d7f0bd470c..f305564622 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -348,7 +348,7 @@ void EditorImportAnimationOptions::_bind_methods() { void EditorImportAnimationOptions::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { flags->connect("item_edited",this,"_changed"); clips_tree->connect("item_edited",this,"_item_edited"); @@ -807,7 +807,7 @@ void EditorSceneImportDialog::popup_import(const String &p_from) { void EditorSceneImportDialog::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { List<String> extensions; @@ -2366,6 +2366,28 @@ void EditorSceneImportPlugin::_create_clips(Node *scene, const Array& p_clips,bo anim->remove_animation("default"); //remove default (no longer needed) } +void EditorSceneImportPlugin::_filter_anim_tracks(Ref<Animation> anim,Set<String> &keep) { + + Ref<Animation> a = anim; + ERR_FAIL_COND(!a.is_valid()); + + print_line("From Anim "+anim->get_name()+":"); + + for(int j=0;j<a->get_track_count();j++) { + + String path = a->track_get_path(j); + + if (!keep.has(path)) { + + print_line("Remove: "+path); + a->remove_track(j); + j--; + } + + } +} + + void EditorSceneImportPlugin::_filter_tracks(Node *scene, const String& p_text) { if (!scene->has_node(String("AnimationPlayer"))) @@ -2383,11 +2405,15 @@ void EditorSceneImportPlugin::_filter_tracks(Node *scene, const String& p_text) List<StringName> anim_names; anim->get_animation_list(&anim_names); - Set<String> keep; for(List<StringName>::Element *E=anim_names.front();E;E=E->next()) { String name = E->get(); bool valid_for_this=false; + bool valid=false; + + Set<String> keep; + Set<String> keep_local; + for(int i=0;i<strings.size();i++) { @@ -2395,12 +2421,15 @@ void EditorSceneImportPlugin::_filter_tracks(Node *scene, const String& p_text) if (strings[i].begins_with("@")) { valid_for_this=false; - keep.clear(); + for(Set<String>::Element *F=keep_local.front();F;F=F->next()) { + keep.insert(F->get()); + } + keep_local.clear(); Vector<String> filters=strings[i].substr(1,strings[i].length()).split(","); for(int j=0;j<filters.size();j++) { - String fname = filters[i].strip_edges(); + String fname = filters[j].strip_edges(); if (fname=="") continue; int fc = fname[0]; @@ -2418,6 +2447,10 @@ void EditorSceneImportPlugin::_filter_tracks(Node *scene, const String& p_text) continue; valid_for_this=plus; } + + if (valid_for_this) + valid=true; + } else if (valid_for_this) { Ref<Animation> a = anim->get_animation(name); @@ -2446,21 +2479,28 @@ void EditorSceneImportPlugin::_filter_tracks(Node *scene, const String& p_text) continue; if (plus) - keep.insert(path); + keep_local.insert(path); else if (!keep.has(path)) { - a->remove_track(j); - j--; + keep_local.erase(path); } - } } } + if (valid) { + for(Set<String>::Element *F=keep_local.front();F;F=F->next()) { + keep.insert(F->get()); + } + + _filter_anim_tracks(anim->get_animation(name),keep); + } + } + } Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, const Ref<ResourceImportMetadata>& p_from) { diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.h b/tools/editor/io_plugins/editor_scene_import_plugin.h index 8aafde93df..c56be57aed 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.h +++ b/tools/editor/io_plugins/editor_scene_import_plugin.h @@ -109,6 +109,7 @@ class EditorSceneImportPlugin : public EditorImportPlugin { void _find_resources(const Variant& p_var,Map<Ref<ImageTexture>,TextureRole >& image_map,int p_flags); Node* _fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>,Ref<Shape> > &collision_map,uint32_t p_flags,Map<Ref<ImageTexture>,TextureRole >& image_map); void _create_clips(Node *scene, const Array& p_clips, bool p_bake_all); + void _filter_anim_tracks(Ref<Animation> anim,Set<String> &keep); void _filter_tracks(Node *scene, const String& p_text); void _merge_existing_node(Node *p_node,Node *p_imported_scene,Set<Ref<Resource> >& checked_resources,Set<Node*> &checked_nodes); diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index 86f7787a9c..b855b15b39 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -151,7 +151,7 @@ void EditorImportTextureOptions::_bind_methods() { void EditorImportTextureOptions::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { flags->connect("item_edited",this,"_changed"); format->connect("item_selected",this,"_changedp"); @@ -429,7 +429,7 @@ void EditorTextureImportDialog::popup_import(const String& p_from) { void EditorTextureImportDialog::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { List<String> extensions; diff --git a/tools/editor/io_plugins/editor_translation_import_plugin.cpp b/tools/editor/io_plugins/editor_translation_import_plugin.cpp index 89a7584f77..9540869789 100644 --- a/tools/editor/io_plugins/editor_translation_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -273,7 +273,7 @@ public: void _notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { } diff --git a/tools/editor/output_strings.cpp b/tools/editor/output_strings.cpp index 122db3adf9..ec85505484 100644 --- a/tools/editor/output_strings.cpp +++ b/tools/editor/output_strings.cpp @@ -129,7 +129,7 @@ void OutputStrings::_notification(int p_what) { } break; - case NOTIFICATION_ENTER_SCENE: + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_RESIZED: { diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 0d709b9a72..8bb37f1d71 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -87,7 +87,7 @@ void AnimationPlayerEditor::_notification(int p_what) { updating = false; } - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { editor->connect("hide_animation_player_editors",this,"_hide_anim_editors"); add_anim->set_icon( get_icon("New","EditorIcons") ); @@ -119,7 +119,7 @@ void AnimationPlayerEditor::_notification(int p_what) { if (p_what==NOTIFICATION_READY) { - get_scene()->connect("node_removed",this,"_node_removed"); + get_tree()->connect("node_removed",this,"_node_removed"); } if (p_what==NOTIFICATION_DRAW) { diff --git a/tools/editor/plugins/animation_tree_editor_plugin.cpp b/tools/editor/plugins/animation_tree_editor_plugin.cpp index aeef593093..af15e17f50 100644 --- a/tools/editor/plugins/animation_tree_editor_plugin.cpp +++ b/tools/editor/plugins/animation_tree_editor_plugin.cpp @@ -221,8 +221,8 @@ void AnimationTreeEditor::_edit_dialog_animation_changed() { void AnimationTreeEditor::_edit_dialog_edit_animation() { - if (get_scene()->is_editor_hint()) { - get_scene()->get_root()->get_child(0)->call("_resource_selected", property_editor->get_variant().operator RefPtr()); + if (get_tree()->is_editor_hint()) { + get_tree()->get_root()->get_child(0)->call("_resource_selected", property_editor->get_variant().operator RefPtr()); }; }; @@ -936,7 +936,7 @@ void AnimationTreeEditor::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { play_button->set_icon( get_icon("Play","EditorIcons") ); add_menu->set_icon( get_icon("Add","EditorIcons") ); diff --git a/tools/editor/plugins/baked_light_editor_plugin.cpp b/tools/editor/plugins/baked_light_editor_plugin.cpp index 2f8393f102..0f02899dc2 100644 --- a/tools/editor/plugins/baked_light_editor_plugin.cpp +++ b/tools/editor/plugins/baked_light_editor_plugin.cpp @@ -34,7 +34,7 @@ void BakedLightEditor::_node_removed(Node *p_node) { void BakedLightEditor::_notification(int p_option) { - if (p_option==NOTIFICATION_ENTER_SCENE) { + if (p_option==NOTIFICATION_ENTER_TREE) { button_bake->set_icon(get_icon("Bake","EditorIcons")); button_reset->set_icon(get_icon("Reload","EditorIcons")); diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index e2944af422..599160eb46 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -1055,7 +1055,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { editor_selection->clear(); editor_selection->add_node(c); //reselect - if (get_scene()->is_editor_hint()) { + if (get_tree()->is_editor_hint()) { editor->call("edit_node",c); } @@ -1791,7 +1791,7 @@ void CanvasItemEditor::_notification(int p_what) { } } - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { select_sb->set_texture( get_icon("EditorRect2D","EditorIcons") ); for(int i=0;i<4;i++) { @@ -1814,7 +1814,7 @@ void CanvasItemEditor::_notification(int p_what) { if (p_what==NOTIFICATION_READY) { - get_scene()->connect("node_removed",this,"_node_removed"); + get_tree()->connect("node_removed",this,"_node_removed"); } if (p_what==NOTIFICATION_DRAW) { diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp index 96c7e4540c..6bae0d2fd0 100644 --- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp @@ -13,7 +13,7 @@ void CollisionPolygon2DEditor::_notification(int p_what) { button_create->set_icon( get_icon("Edit","EditorIcons")); button_edit->set_icon( get_icon("MovePoint","EditorIcons")); button_edit->set_pressed(true); - get_scene()->connect("node_removed",this,"_node_removed"); + get_tree()->connect("node_removed",this,"_node_removed"); } break; case NOTIFICATION_FIXED_PROCESS: { diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp index 16b9622312..35f22aa6f8 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_editor_plugin.cpp @@ -40,7 +40,7 @@ void CollisionPolygonEditor::_notification(int p_what) { button_create->set_icon( get_icon("Edit","EditorIcons")); button_edit->set_icon( get_icon("MovePoint","EditorIcons")); button_edit->set_pressed(true); - get_scene()->connect("node_removed",this,"_node_removed"); + get_tree()->connect("node_removed",this,"_node_removed"); } break; diff --git a/tools/editor/plugins/item_list_editor_plugin.cpp b/tools/editor/plugins/item_list_editor_plugin.cpp index a059470cec..eb7ab69987 100644 --- a/tools/editor/plugins/item_list_editor_plugin.cpp +++ b/tools/editor/plugins/item_list_editor_plugin.cpp @@ -157,7 +157,7 @@ void ItemListEditor::_add_pressed() { void ItemListEditor::_notification(int p_notification) { - if (p_notification==NOTIFICATION_ENTER_SCENE) { + if (p_notification==NOTIFICATION_ENTER_TREE) { add_button->set_icon(get_icon("Add","EditorIcons")); del_button->set_icon(get_icon("Del","EditorIcons")); diff --git a/tools/editor/plugins/mesh_editor_plugin.cpp b/tools/editor/plugins/mesh_editor_plugin.cpp index 10e4c0b681..a3884f9be4 100644 --- a/tools/editor/plugins/mesh_editor_plugin.cpp +++ b/tools/editor/plugins/mesh_editor_plugin.cpp @@ -47,7 +47,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { CollisionShape *cshape = memnew( CollisionShape ); cshape->set_shape(shape); body->add_child(cshape); - Node *owner = node==get_scene()->get_edited_scene_root() ? node : node->get_owner(); + Node *owner = node==get_tree()->get_edited_scene_root() ? node : node->get_owner(); UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); ur->create_action("Create Static Trimesh"); @@ -68,7 +68,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { CollisionShape *cshape = memnew( CollisionShape ); cshape->set_shape(shape); body->add_child(cshape); - Node *owner = node==get_scene()->get_edited_scene_root() ? node : node->get_owner(); + Node *owner = node==get_tree()->get_edited_scene_root() ? node : node->get_owner(); UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); ur->create_action("Create Static Trimesh"); @@ -83,7 +83,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { case MENU_OPTION_CREATE_TRIMESH_COLLISION_SHAPE: { - if (node==get_scene()->get_edited_scene_root()) { + if (node==get_tree()->get_edited_scene_root()) { err_dialog->set_text("This doesn't work on scene root!"); err_dialog->popup_centered(Size2(100,50)); return; @@ -109,7 +109,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { case MENU_OPTION_CREATE_CONVEX_COLLISION_SHAPE: { - if (node==get_scene()->get_edited_scene_root()) { + if (node==get_tree()->get_edited_scene_root()) { err_dialog->set_text("This doesn't work on scene root!"); err_dialog->popup_centered(Size2(100,50)); return; @@ -146,7 +146,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { NavigationMeshInstance *nmi = memnew( NavigationMeshInstance ); nmi->set_navigation_mesh(nmesh); - Node *owner = node==get_scene()->get_edited_scene_root() ? node : node->get_owner(); + Node *owner = node==get_tree()->get_edited_scene_root() ? node : node->get_owner(); UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); ur->create_action("Create Navigation Mesh"); @@ -186,7 +186,7 @@ void MeshInstanceEditor::_create_outline_mesh() { MeshInstance *mi = memnew( MeshInstance ); mi->set_mesh(mesho); Node *owner=node->get_owner(); - if (get_scene()->get_edited_scene_root()==node) { + if (get_tree()->get_edited_scene_root()==node) { owner=node; } diff --git a/tools/editor/plugins/particles_2d_editor_plugin.cpp b/tools/editor/plugins/particles_2d_editor_plugin.cpp index b23847231b..a7adfcd172 100644 --- a/tools/editor/plugins/particles_2d_editor_plugin.cpp +++ b/tools/editor/plugins/particles_2d_editor_plugin.cpp @@ -26,173 +26,173 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "particles_2d_editor_plugin.h"
-#include "canvas_item_editor_plugin.h"
-#include "io/image_loader.h"
-
-
-void Particles2DEditorPlugin::edit(Object *p_object) {
-
- if (p_object) {
- particles=p_object->cast_to<Particles2D>();
- } else {
- particles=NULL;
- }
-}
-
-bool Particles2DEditorPlugin::handles(Object *p_object) const {
-
- return p_object->is_type("Particles2D");
-}
-
-void Particles2DEditorPlugin::make_visible(bool p_visible) {
-
- if (p_visible) {
-
- sep->show();
- menu->show();
- } else {
-
- menu->hide();
- sep->hide();
- }
-
-}
-
-void Particles2DEditorPlugin::_file_selected(const String& p_file) {
-
- print_line("file: "+p_file);
-
- int epc=epoints->get_val();
-
- Image img;
- Error err = ImageLoader::load_image(p_file,&img);
- ERR_EXPLAIN("Error loading image: "+p_file);
- ERR_FAIL_COND(err!=OK);
-
- img.convert(Image::FORMAT_GRAYSCALE_ALPHA);
- ERR_FAIL_COND(img.get_format()!=Image::FORMAT_GRAYSCALE_ALPHA);
- Size2i s = Size2(img.get_width(),img.get_height());
- ERR_FAIL_COND(s.width==0 || s.height==0);
-
- DVector<uint8_t> data = img.get_data();
- DVector<uint8_t>::Read r = data.read();
-
- Vector<Point2i> valid_positions;
- valid_positions.resize(s.width*s.height);
- int vpc=0;
-
-
- for(int i=0;i<s.width*s.height;i++) {
-
- uint8_t a = r[i*2+1];
- if (a>128) {
- valid_positions[vpc++]=Point2i(i%s.width,i/s.width);
- }
- }
-
- valid_positions.resize(vpc);
-
- ERR_EXPLAIN("No pixels with transparency > 128 in image..");
- ERR_FAIL_COND(valid_positions.size()==0);
-
- DVector<Point2> epoints;
- epoints.resize(epc);
- DVector<Point2>::Write w = epoints.write();
-
- Size2 extents = Size2(img.get_width()*0.5,img.get_height()*0.5);
-
- for(int i=0;i<epc;i++) {
-
- Point2 p = valid_positions[Math::rand()%vpc];
- p-=s/2;
- w[i]=p/extents;
- }
-
- w = DVector<Point2>::Write();
-
- undo_redo->create_action("Set Emission Mask");
- undo_redo->add_do_method(particles,"set_emission_points",epoints);
- undo_redo->add_do_method(particles,"set_emission_half_extents",extents);
- undo_redo->add_undo_method(particles,"set_emission_points",particles->get_emission_points());
- undo_redo->add_undo_method(particles,"set_emission_half_extents",particles->get_emission_half_extents());
- undo_redo->commit_action();
-
-}
-
-void Particles2DEditorPlugin::_menu_callback(int p_idx) {
-
- switch(p_idx) {
- case MENU_LOAD_EMISSION_MASK: {
-
-
- file->popup_centered_ratio();
-
- } break;
- case MENU_CLEAR_EMISSION_MASK: {
-
- undo_redo->create_action("Clear Emission Mask");
- undo_redo->add_do_method(particles,"set_emission_points",DVector<Vector2>());
- undo_redo->add_undo_method(particles,"set_emission_points",particles->get_emission_points());
- undo_redo->commit_action();
- } break;
- }
-
-}
-
-
-void Particles2DEditorPlugin::_notification(int p_what) {
-
- if (p_what==NOTIFICATION_ENTER_SCENE) {
-
- menu->get_popup()->connect("item_pressed",this,"_menu_callback");
- file->connect("file_selected",this,"_file_selected");
- }
-}
-
-void Particles2DEditorPlugin::_bind_methods() {
-
- ObjectTypeDB::bind_method(_MD("_menu_callback"),&Particles2DEditorPlugin::_menu_callback);
- ObjectTypeDB::bind_method(_MD("_file_selected"),&Particles2DEditorPlugin::_file_selected);
-}
-
-
-
-Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) {
-
- particles=NULL;
- editor=p_node;
- undo_redo=editor->get_undo_redo();
- sep = memnew( VSeparator );
- CanvasItemEditor::get_singleton()->add_control_to_menu_panel(sep);
- sep->hide();
-
- menu = memnew( MenuButton );
- menu->get_popup()->add_item("Load Emission Mask",MENU_LOAD_EMISSION_MASK);
- menu->get_popup()->add_item("Clear Emission Mask",MENU_CLEAR_EMISSION_MASK);
- menu->set_text("Particles");
-
- file = memnew(FileDialog);
- add_child(file);
- List<String> ext;
- ImageLoader::get_recognized_extensions(&ext);
- for(List<String>::Element *E=ext.front();E;E=E->next()) {
- file->add_filter("*."+E->get()+"; "+E->get().to_upper());
- }
- file->set_mode(FileDialog::MODE_OPEN_FILE);
- CanvasItemEditor::get_singleton()->add_control_to_menu_panel(menu);
- epoints = memnew( SpinBox );
- epoints->set_min(1);
- epoints->set_max(8192);
- epoints->set_step(1);
- epoints->set_val(512);
- file->get_vbox()->add_margin_child("Generated Point Count:",epoints);
- menu->hide();
-
-}
-
-
-Particles2DEditorPlugin::~Particles2DEditorPlugin()
-{
-}
-
+#include "particles_2d_editor_plugin.h" +#include "canvas_item_editor_plugin.h" +#include "io/image_loader.h" + + +void Particles2DEditorPlugin::edit(Object *p_object) { + + if (p_object) { + particles=p_object->cast_to<Particles2D>(); + } else { + particles=NULL; + } +} + +bool Particles2DEditorPlugin::handles(Object *p_object) const { + + return p_object->is_type("Particles2D"); +} + +void Particles2DEditorPlugin::make_visible(bool p_visible) { + + if (p_visible) { + + sep->show(); + menu->show(); + } else { + + menu->hide(); + sep->hide(); + } + +} + +void Particles2DEditorPlugin::_file_selected(const String& p_file) { + + print_line("file: "+p_file); + + int epc=epoints->get_val(); + + Image img; + Error err = ImageLoader::load_image(p_file,&img); + ERR_EXPLAIN("Error loading image: "+p_file); + ERR_FAIL_COND(err!=OK); + + img.convert(Image::FORMAT_GRAYSCALE_ALPHA); + ERR_FAIL_COND(img.get_format()!=Image::FORMAT_GRAYSCALE_ALPHA); + Size2i s = Size2(img.get_width(),img.get_height()); + ERR_FAIL_COND(s.width==0 || s.height==0); + + DVector<uint8_t> data = img.get_data(); + DVector<uint8_t>::Read r = data.read(); + + Vector<Point2i> valid_positions; + valid_positions.resize(s.width*s.height); + int vpc=0; + + + for(int i=0;i<s.width*s.height;i++) { + + uint8_t a = r[i*2+1]; + if (a>128) { + valid_positions[vpc++]=Point2i(i%s.width,i/s.width); + } + } + + valid_positions.resize(vpc); + + ERR_EXPLAIN("No pixels with transparency > 128 in image.."); + ERR_FAIL_COND(valid_positions.size()==0); + + DVector<Point2> epoints; + epoints.resize(epc); + DVector<Point2>::Write w = epoints.write(); + + Size2 extents = Size2(img.get_width()*0.5,img.get_height()*0.5); + + for(int i=0;i<epc;i++) { + + Point2 p = valid_positions[Math::rand()%vpc]; + p-=s/2; + w[i]=p/extents; + } + + w = DVector<Point2>::Write(); + + undo_redo->create_action("Set Emission Mask"); + undo_redo->add_do_method(particles,"set_emission_points",epoints); + undo_redo->add_do_method(particles,"set_emission_half_extents",extents); + undo_redo->add_undo_method(particles,"set_emission_points",particles->get_emission_points()); + undo_redo->add_undo_method(particles,"set_emission_half_extents",particles->get_emission_half_extents()); + undo_redo->commit_action(); + +} + +void Particles2DEditorPlugin::_menu_callback(int p_idx) { + + switch(p_idx) { + case MENU_LOAD_EMISSION_MASK: { + + + file->popup_centered_ratio(); + + } break; + case MENU_CLEAR_EMISSION_MASK: { + + undo_redo->create_action("Clear Emission Mask"); + undo_redo->add_do_method(particles,"set_emission_points",DVector<Vector2>()); + undo_redo->add_undo_method(particles,"set_emission_points",particles->get_emission_points()); + undo_redo->commit_action(); + } break; + } + +} + + +void Particles2DEditorPlugin::_notification(int p_what) { + + if (p_what==NOTIFICATION_ENTER_TREE) { + + menu->get_popup()->connect("item_pressed",this,"_menu_callback"); + file->connect("file_selected",this,"_file_selected"); + } +} + +void Particles2DEditorPlugin::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("_menu_callback"),&Particles2DEditorPlugin::_menu_callback); + ObjectTypeDB::bind_method(_MD("_file_selected"),&Particles2DEditorPlugin::_file_selected); +} + + + +Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) { + + particles=NULL; + editor=p_node; + undo_redo=editor->get_undo_redo(); + sep = memnew( VSeparator ); + CanvasItemEditor::get_singleton()->add_control_to_menu_panel(sep); + sep->hide(); + + menu = memnew( MenuButton ); + menu->get_popup()->add_item("Load Emission Mask",MENU_LOAD_EMISSION_MASK); + menu->get_popup()->add_item("Clear Emission Mask",MENU_CLEAR_EMISSION_MASK); + menu->set_text("Particles"); + + file = memnew(FileDialog); + add_child(file); + List<String> ext; + ImageLoader::get_recognized_extensions(&ext); + for(List<String>::Element *E=ext.front();E;E=E->next()) { + file->add_filter("*."+E->get()+"; "+E->get().to_upper()); + } + file->set_mode(FileDialog::MODE_OPEN_FILE); + CanvasItemEditor::get_singleton()->add_control_to_menu_panel(menu); + epoints = memnew( SpinBox ); + epoints->set_min(1); + epoints->set_max(8192); + epoints->set_step(1); + epoints->set_val(512); + file->get_vbox()->add_margin_child("Generated Point Count:",epoints); + menu->hide(); + +} + + +Particles2DEditorPlugin::~Particles2DEditorPlugin() +{ +} + diff --git a/tools/editor/plugins/particles_editor_plugin.cpp b/tools/editor/plugins/particles_editor_plugin.cpp index 418ad11704..ebb45bc316 100644 --- a/tools/editor/plugins/particles_editor_plugin.cpp +++ b/tools/editor/plugins/particles_editor_plugin.cpp @@ -110,7 +110,7 @@ void ParticlesEditor::_populate() { void ParticlesEditor::_notification(int p_notification) { - if (p_notification==NOTIFICATION_ENTER_SCENE) { + if (p_notification==NOTIFICATION_ENTER_TREE) { } } diff --git a/tools/editor/plugins/path_editor_plugin.cpp b/tools/editor/plugins/path_editor_plugin.cpp index 7b0ff971d2..3f540a3bf4 100644 --- a/tools/editor/plugins/path_editor_plugin.cpp +++ b/tools/editor/plugins/path_editor_plugin.cpp @@ -500,7 +500,7 @@ void PathEditorPlugin::_close_curve() { void PathEditorPlugin::_notification(int p_what) {
- if (p_what==NOTIFICATION_ENTER_SCENE) {
+ if (p_what==NOTIFICATION_ENTER_TREE) {
curve_create->connect("pressed",this,"_mode_changed",make_binds(0));
curve_edit->connect("pressed",this,"_mode_changed",make_binds(1));
diff --git a/tools/editor/plugins/resource_preloader_editor_plugin.cpp b/tools/editor/plugins/resource_preloader_editor_plugin.cpp index b0841933ec..d9726cac21 100644 --- a/tools/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/tools/editor/plugins/resource_preloader_editor_plugin.cpp @@ -45,7 +45,7 @@ void ResourcePreloaderEditor::_notification(int p_what) { } - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { load->set_icon( get_icon("Folder","EditorIcons") ); _delete->set_icon( get_icon("Del","EditorIcons") ); } diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp index e3fad58a89..83adeee789 100644 --- a/tools/editor/plugins/sample_editor_plugin.cpp +++ b/tools/editor/plugins/sample_editor_plugin.cpp @@ -46,7 +46,7 @@ void SampleEditor::_notification(int p_what) { } - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { play->set_icon( get_icon("Play","EditorIcons") ); stop->set_icon( get_icon("Stop","EditorIcons") ); } diff --git a/tools/editor/plugins/sample_library_editor_plugin.cpp b/tools/editor/plugins/sample_library_editor_plugin.cpp index 84143dcd4b..41c84f6e2c 100644 --- a/tools/editor/plugins/sample_library_editor_plugin.cpp +++ b/tools/editor/plugins/sample_library_editor_plugin.cpp @@ -47,7 +47,7 @@ void SampleLibraryEditor::_notification(int p_what) { } - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { play->set_icon( get_icon("Play","EditorIcons") ); stop->set_icon( get_icon("Stop","EditorIcons") ); load->set_icon( get_icon("Folder","EditorIcons") ); @@ -129,7 +129,7 @@ void SampleLibraryEditor::_button_pressed(Object *p_item,int p_column, int p_id) player->play(name,true); } else if (p_column==1) { - get_scene()->get_root()->get_child(0)->call("_resource_selected",sample_library->get_sample(name)); + get_tree()->get_root()->get_child(0)->call("_resource_selected",sample_library->get_sample(name)); } @@ -186,7 +186,7 @@ void SampleLibraryEditor::_item_edited() { Ref<Sample> samp = sample_library->get_sample(tree->get_selected()->get_metadata(0)); - get_scene()->get_root()->get_child(0)->call("_resource_selected",samp); + get_tree()->get_root()->get_child(0)->call("_resource_selected",samp); } diff --git a/tools/editor/plugins/sample_player_editor_plugin.cpp b/tools/editor/plugins/sample_player_editor_plugin.cpp index f3d6fe65da..405107889c 100644 --- a/tools/editor/plugins/sample_player_editor_plugin.cpp +++ b/tools/editor/plugins/sample_player_editor_plugin.cpp @@ -32,7 +32,7 @@ void SamplePlayerEditor::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { play->set_icon( get_icon("Play","EditorIcons") ); stop->set_icon( get_icon("Stop","EditorIcons") ); } diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 24e09111e2..2cb907f1c3 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -115,7 +115,7 @@ void ScriptEditorQuickOpen::_confirmed() { void ScriptEditorQuickOpen::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { connect("confirmed",this,"_confirmed"); } @@ -822,7 +822,7 @@ void ScriptEditor::_tab_changed(int p_which) { void ScriptEditor::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { editor->connect("play_pressed",this,"_editor_play"); editor->connect("pause_pressed",this,"_editor_pause"); @@ -837,7 +837,7 @@ void ScriptEditor::_notification(int p_what) { _update_window_menu(); } - if (p_what==NOTIFICATION_EXIT_SCENE) { + if (p_what==NOTIFICATION_EXIT_TREE) { editor->disconnect("play_pressed",this,"_editor_play"); editor->disconnect("pause_pressed",this,"_editor_pause"); @@ -895,7 +895,7 @@ Dictionary ScriptEditor::get_state() const { } else { - const Node *owner = _find_node_with_script(get_scene()->get_root(),script.get_ref_ptr()); + const Node *owner = _find_node_with_script(get_tree()->get_root(),script.get_ref_ptr()); if (owner) paths.push_back(owner->get_path()); @@ -931,7 +931,7 @@ void ScriptEditor::set_state(const Dictionary& p_state) { if (source.get_type()==Variant::NODE_PATH) { - Node *owner=get_scene()->get_root()->get_node(source); + Node *owner=get_tree()->get_root()->get_node(source); if (!owner) continue; diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index 17c4291378..d9bf4b6fa5 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -258,7 +258,7 @@ void ShaderEditor::_tab_changed(int p_which) { void ShaderEditor::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { close->set_normal_texture( get_icon("Close","EditorIcons")); close->set_hover_texture( get_icon("CloseHover","EditorIcons")); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index e91e7a94fe..a1f1ccf5e3 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -249,7 +249,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2& p_pos, bool p_append,b Vector3 ray=_get_ray(p_pos); Vector3 pos=_get_ray_pos(p_pos); - Vector<RID> instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_scene()->get_root()->get_world()->get_scenario() ); + Vector<RID> instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() ); Set<Ref<SpatialEditorGizmo> > found_gizmos; //uint32_t closest=0; @@ -449,7 +449,7 @@ void SpatialEditorViewport::_select_region() { frustum.push_back( far ); - Vector<RID> instances=VisualServer::get_singleton()->instances_cull_convex(frustum,get_scene()->get_root()->get_world()->get_scenario()); + Vector<RID> instances=VisualServer::get_singleton()->instances_cull_convex(frustum,get_tree()->get_root()->get_world()->get_scenario()); for (int i=0;i<instances.size();i++) { @@ -724,7 +724,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { if (b.mod.control) { - Vector<RID> instances=VisualServer::get_singleton()->instances_cull_ray(ray_origin,ray_dir,get_scene()->get_root()->get_world()->get_scenario() ); + Vector<RID> instances=VisualServer::get_singleton()->instances_cull_ray(ray_origin,ray_dir,get_tree()->get_root()->get_world()->get_scenario() ); Plane p(ray_origin,_get_camera_normal()); @@ -1711,7 +1711,7 @@ void SpatialEditorViewport::_notification(int p_what) { } - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { surface->connect("draw",this,"_draw"); surface->connect("input_event",this,"_sinput"); @@ -1976,7 +1976,7 @@ void SpatialEditorViewport::_init_gizmo_instance(int p_idx) { for(int i=0;i<3;i++) { move_gizmo_instance[i]=VS::get_singleton()->instance_create(); VS::get_singleton()->instance_set_base(move_gizmo_instance[i],spatial_editor->get_move_gizmo(i)->get_rid()); - VS::get_singleton()->instance_set_scenario(move_gizmo_instance[i],get_scene()->get_root()->get_world()->get_scenario()); + VS::get_singleton()->instance_set_scenario(move_gizmo_instance[i],get_tree()->get_root()->get_world()->get_scenario()); VS::get_singleton()->instance_geometry_set_flag(move_gizmo_instance[i],VS::INSTANCE_FLAG_VISIBLE,false); //VS::get_singleton()->instance_geometry_set_flag(move_gizmo_instance[i],VS::INSTANCE_FLAG_DEPH_SCALE,true); VS::get_singleton()->instance_geometry_set_flag(move_gizmo_instance[i],VS::INSTANCE_FLAG_CAST_SHADOW,false); @@ -1984,7 +1984,7 @@ void SpatialEditorViewport::_init_gizmo_instance(int p_idx) { rotate_gizmo_instance[i]=VS::get_singleton()->instance_create(); VS::get_singleton()->instance_set_base(rotate_gizmo_instance[i],spatial_editor->get_rotate_gizmo(i)->get_rid()); - VS::get_singleton()->instance_set_scenario(rotate_gizmo_instance[i],get_scene()->get_root()->get_world()->get_scenario()); + VS::get_singleton()->instance_set_scenario(rotate_gizmo_instance[i],get_tree()->get_root()->get_world()->get_scenario()); VS::get_singleton()->instance_geometry_set_flag(rotate_gizmo_instance[i],VS::INSTANCE_FLAG_VISIBLE,false); //VS::get_singleton()->instance_geometry_set_flag(rotate_gizmo_instance[i],VS::INSTANCE_FLAG_DEPH_SCALE,true); VS::get_singleton()->instance_geometry_set_flag(rotate_gizmo_instance[i],VS::INSTANCE_FLAG_CAST_SHADOW,false); @@ -2001,7 +2001,7 @@ void SpatialEditorViewport::_toggle_camera_preview(bool p_activate) { if (!p_activate) { - previewing->disconnect("exit_scene",this,"_preview_exited_scene"); + previewing->disconnect("exit_tree",this,"_preview_exited_scene"); previewing=NULL; VS::get_singleton()->viewport_attach_camera( viewport->get_viewport(), camera->get_camera() ); //restore if (!preview) @@ -2012,7 +2012,7 @@ void SpatialEditorViewport::_toggle_camera_preview(bool p_activate) { } else { previewing=preview; - previewing->connect("exit_scene",this,"_preview_exited_scene"); + previewing->connect("exit_tree",this,"_preview_exited_scene"); VS::get_singleton()->viewport_attach_camera( viewport->get_viewport(), preview->get_camera() ); //replace view_menu->hide(); surface->update(); @@ -2313,7 +2313,7 @@ Object *SpatialEditor::_get_editor_data(Object *p_what) { // si->aabb = VisualServer::get_singleton()->instance_get_base_aabb(inst); - if (get_scene()->is_editor_hint()) + if (get_tree()->is_editor_hint()) editor->call("edit_node",sp); @@ -2454,7 +2454,7 @@ void SpatialEditor::set_state(const Dictionary& p_state) { VisualServer::get_singleton()->free(light_instance); light_instance=RID(); } else { - light_instance=VisualServer::get_singleton()->instance_create2(light,get_scene()->get_root()->get_world()->get_scenario()); + light_instance=VisualServer::get_singleton()->instance_create2(light,get_tree()->get_root()->get_world()->get_scenario()); VisualServer::get_singleton()->instance_set_transform(light_instance,light_transform); } @@ -2656,7 +2656,7 @@ void SpatialEditor::_menu_item_pressed(int p_option) { VisualServer::get_singleton()->free(light_instance); light_instance=RID(); } else { - light_instance=VisualServer::get_singleton()->instance_create2(light,get_scene()->get_root()->get_world()->get_scenario()); + light_instance=VisualServer::get_singleton()->instance_create2(light,get_tree()->get_root()->get_world()->get_scenario()); VisualServer::get_singleton()->instance_set_transform(light_instance,light_transform); _update_default_light_angle(); @@ -2828,7 +2828,7 @@ void SpatialEditor::_menu_item_pressed(int p_option) { case MENU_VIEW_DISPLAY_NORMAL: { - VisualServer::get_singleton()->scenario_set_debug( get_scene()->get_root()->get_world()->get_scenario(), VisualServer::SCENARIO_DEBUG_DISABLED ); + VisualServer::get_singleton()->scenario_set_debug( get_tree()->get_root()->get_world()->get_scenario(), VisualServer::SCENARIO_DEBUG_DISABLED ); view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_DISPLAY_NORMAL), true ); view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_DISPLAY_WIREFRAME), false ); @@ -2838,7 +2838,7 @@ void SpatialEditor::_menu_item_pressed(int p_option) { } break; case MENU_VIEW_DISPLAY_WIREFRAME: { - VisualServer::get_singleton()->scenario_set_debug( get_scene()->get_root()->get_world()->get_scenario(), VisualServer::SCENARIO_DEBUG_WIREFRAME ); + VisualServer::get_singleton()->scenario_set_debug( get_tree()->get_root()->get_world()->get_scenario(), VisualServer::SCENARIO_DEBUG_WIREFRAME ); view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_DISPLAY_NORMAL), false ); view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_DISPLAY_WIREFRAME), true ); view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_DISPLAY_OVERDRAW), false ); @@ -2847,7 +2847,7 @@ void SpatialEditor::_menu_item_pressed(int p_option) { } break; case MENU_VIEW_DISPLAY_OVERDRAW: { - VisualServer::get_singleton()->scenario_set_debug( get_scene()->get_root()->get_world()->get_scenario(), VisualServer::SCENARIO_DEBUG_OVERDRAW ); + VisualServer::get_singleton()->scenario_set_debug( get_tree()->get_root()->get_world()->get_scenario(), VisualServer::SCENARIO_DEBUG_OVERDRAW ); view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_DISPLAY_NORMAL), false ); view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_DISPLAY_WIREFRAME), false ); view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_DISPLAY_OVERDRAW), true ); @@ -2856,7 +2856,7 @@ void SpatialEditor::_menu_item_pressed(int p_option) { } break; case MENU_VIEW_DISPLAY_SHADELESS: { - VisualServer::get_singleton()->scenario_set_debug( get_scene()->get_root()->get_world()->get_scenario(), VisualServer::SCENARIO_DEBUG_SHADELESS ); + VisualServer::get_singleton()->scenario_set_debug( get_tree()->get_root()->get_world()->get_scenario(), VisualServer::SCENARIO_DEBUG_SHADELESS ); view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_DISPLAY_NORMAL), false ); view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_DISPLAY_WIREFRAME), false ); view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_DISPLAY_OVERDRAW), false ); @@ -2903,7 +2903,7 @@ void SpatialEditor::_init_indicators() { //make sure that the camera indicator is not selectable light=VisualServer::get_singleton()->light_create( VisualServer::LIGHT_DIRECTIONAL ); //VisualServer::get_singleton()->light_set_shadow( light, true ); - light_instance=VisualServer::get_singleton()->instance_create2(light,get_scene()->get_root()->get_world()->get_scenario()); + light_instance=VisualServer::get_singleton()->instance_create2(light,get_tree()->get_root()->get_world()->get_scenario()); @@ -2964,7 +2964,7 @@ void SpatialEditor::_init_indicators() { d[VisualServer::ARRAY_COLOR]=grid_colors[i]; VisualServer::get_singleton()->mesh_add_surface(grid[i],VisualServer::PRIMITIVE_LINES,d); VisualServer::get_singleton()->mesh_surface_set_material(grid[i],0,indicator_mat); - grid_instance[i] = VisualServer::get_singleton()->instance_create2(grid[i],get_scene()->get_root()->get_world()->get_scenario()); + grid_instance[i] = VisualServer::get_singleton()->instance_create2(grid[i],get_tree()->get_root()->get_world()->get_scenario()); grid_visible[i]=false; grid_enable[i]=false; @@ -2988,7 +2988,7 @@ void SpatialEditor::_init_indicators() { // origin = VisualServer::get_singleton()->poly_create(); // VisualServer::get_singleton()->poly_add_primitive(origin,origin_points,Vector<Vector3>(),origin_colors,Vector<Vector3>()); // VisualServer::get_singleton()->poly_set_material(origin,indicator_mat,true); - origin_instance = VisualServer::get_singleton()->instance_create2(origin,get_scene()->get_root()->get_world()->get_scenario()); + origin_instance = VisualServer::get_singleton()->instance_create2(origin,get_tree()->get_root()->get_world()->get_scenario()); VS::get_singleton()->instance_set_layer_mask(origin_instance,1<<SpatialEditorViewport::GIZMO_GRID_LAYER); VisualServer::get_singleton()->instance_geometry_set_flag(origin_instance,VS::INSTANCE_FLAG_CAST_SHADOW,false); @@ -3025,7 +3025,7 @@ void SpatialEditor::_init_indicators() { VisualServer::get_singleton()->mesh_add_surface(cursor_mesh,VS::PRIMITIVE_LINES,d); VisualServer::get_singleton()->mesh_surface_set_material(cursor_mesh,0,cmat,true); - cursor_instance = VisualServer::get_singleton()->instance_create2(cursor_mesh,get_scene()->get_root()->get_world()->get_scenario()); + cursor_instance = VisualServer::get_singleton()->instance_create2(cursor_mesh,get_tree()->get_root()->get_world()->get_scenario()); VS::get_singleton()->instance_set_layer_mask(cursor_instance,1<<SpatialEditorViewport::GIZMO_GRID_LAYER); VisualServer::get_singleton()->instance_geometry_set_flag(cursor_instance,VS::INSTANCE_FLAG_CAST_SHADOW,false); @@ -3306,19 +3306,19 @@ void SpatialEditor::_notification(int p_what) { _menu_item_pressed(MENU_VIEW_USE_1_VIEWPORT); - get_scene()->connect("node_removed",this,"_node_removed"); + get_tree()->connect("node_removed",this,"_node_removed"); VS::get_singleton()->scenario_set_fallback_environment(get_viewport()->find_world()->get_scenario(),viewport_environment->get_rid()); } - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { gizmos = memnew( SpatialEditorGizmos ); _init_indicators(); _update_default_light_angle(); } - if (p_what==NOTIFICATION_EXIT_SCENE) { + if (p_what==NOTIFICATION_EXIT_TREE) { _finish_indicators(); memdelete( gizmos ); diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.cpp b/tools/editor/plugins/sprite_frames_editor_plugin.cpp index a26fab0f9a..e04d9dfddb 100644 --- a/tools/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/tools/editor/plugins/sprite_frames_editor_plugin.cpp @@ -46,7 +46,7 @@ void SpriteFramesEditor::_notification(int p_what) { } - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { load->set_icon( get_icon("Folder","EditorIcons") ); _delete->set_icon( get_icon("Del","EditorIcons") ); } diff --git a/tools/editor/plugins/stream_editor_plugin.cpp b/tools/editor/plugins/stream_editor_plugin.cpp index 4588c694ee..6477cce47c 100644 --- a/tools/editor/plugins/stream_editor_plugin.cpp +++ b/tools/editor/plugins/stream_editor_plugin.cpp @@ -32,7 +32,7 @@ void StreamEditor::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { play->set_icon( get_icon("Play","EditorIcons") ); stop->set_icon( get_icon("Stop","EditorIcons") ); } diff --git a/tools/editor/progress_dialog.cpp b/tools/editor/progress_dialog.cpp index 42dd971bc3..ac54796c64 100644 --- a/tools/editor/progress_dialog.cpp +++ b/tools/editor/progress_dialog.cpp @@ -182,6 +182,7 @@ void ProgressDialog::add_task(const String& p_task,const String& p_label,int p_s t.progress->set_val(p_steps); vb2->add_child(t.progress); t.state=memnew( Label ); + t.state->set_clip_text(true); vb2->add_child(t.state); main->add_child(t.vb); diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp index a0031ff456..3a0f1e76b5 100644 --- a/tools/editor/project_export.cpp +++ b/tools/editor/project_export.cpp @@ -256,7 +256,7 @@ void ProjectExportDialog::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { CenterContainer *cc = memnew( CenterContainer ); @@ -320,7 +320,7 @@ void ProjectExportDialog::_notification(int p_what) { _update_group_tree(); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { } break; case MainLoop::NOTIFICATION_WM_FOCUS_IN: { @@ -482,7 +482,7 @@ Error ProjectExportDialog::export_platform(const String& p_platform, const Strin return ERR_CANT_CREATE; } else { if (p_quit_after) { - get_scene()->quit(); + get_tree()->quit(); } } diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index 0c32a4ba75..4eadd980f4 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -628,7 +628,7 @@ void ProjectManager::_open_project_confirm() { ERR_FAIL_COND(err); } - get_scene()->quit(); + get_tree()->quit(); } void ProjectManager::_open_project() { @@ -786,7 +786,7 @@ void ProjectManager::_erase_project() { void ProjectManager::_exit_dialog() { - get_scene()->quit(); + get_tree()->quit(); } void ProjectManager::_bind_methods() { @@ -1033,7 +1033,7 @@ void ProjectListFilter::_filter_option_selected(int p_idx) { void ProjectListFilter::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { clear_search_button->set_icon(get_icon("CloseHover","EditorIcons")); } break; } diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index 105f251461..304fb76d1c 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -57,7 +57,7 @@ static const char* _button_names[JOY_BUTTON_MAX]={ void ProjectSettings::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { translation_list->connect("button_pressed",this,"_translation_delete"); _update_actions(); @@ -504,7 +504,7 @@ void ProjectSettings::popup_project_settings() { void ProjectSettings::_item_selected() { - TreeItem *ti = globals_editor->get_tree()->get_selected(); + TreeItem *ti = globals_editor->get_scene_tree()->get_selected(); if (!ti) return; if (!ti->get_parent()) @@ -1212,7 +1212,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { globals_editor->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 5 ); globals_editor->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 5 ); globals_editor->set_capitalize_paths(false); - globals_editor->get_tree()->connect("cell_selected",this,"_item_selected"); + globals_editor->get_scene_tree()->connect("cell_selected",this,"_item_selected"); globals_editor->connect("property_toggled",this,"_item_checked"); globals_editor->connect("property_edited",this,"_settings_prop_edited"); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 645d967a4b..777694481b 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -1863,11 +1863,11 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p void PropertyEditor::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { - get_scene()->connect("node_removed",this,"_node_removed"); + get_tree()->connect("node_removed",this,"_node_removed"); } - if (p_what==NOTIFICATION_EXIT_SCENE) { + if (p_what==NOTIFICATION_EXIT_TREE) { edit(NULL); } @@ -2919,7 +2919,7 @@ void PropertyEditor::_bind_methods() { ADD_SIGNAL( MethodInfo("property_edited",PropertyInfo( Variant::STRING, "property"))); } -Tree *PropertyEditor::get_tree() { +Tree *PropertyEditor::get_scene_tree() { return tree; } diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h index f13deab1ae..08435ad75d 100644 --- a/tools/editor/property_editor.h +++ b/tools/editor/property_editor.h @@ -197,7 +197,7 @@ public: String get_selected_path() const; - Tree *get_tree(); + Tree *get_scene_tree(); Label* get_top_label(); void hide_top_label(); void update_tree(); diff --git a/tools/editor/quick_open.cpp b/tools/editor/quick_open.cpp index bae7528150..129c637ab0 100644 --- a/tools/editor/quick_open.cpp +++ b/tools/editor/quick_open.cpp @@ -111,7 +111,7 @@ void EditorQuickOpen::_confirmed() { void EditorQuickOpen::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { connect("confirmed",this,"_confirmed"); } diff --git a/tools/editor/reparent_dialog.cpp b/tools/editor/reparent_dialog.cpp index 2c85eb3a2a..5a5566c756 100644 --- a/tools/editor/reparent_dialog.cpp +++ b/tools/editor/reparent_dialog.cpp @@ -36,7 +36,7 @@ void ReparentDialog::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { connect("confirmed", this,"_reparent"); } diff --git a/tools/editor/resources_dock.cpp b/tools/editor/resources_dock.cpp index 495225b91e..4614c4945d 100644 --- a/tools/editor/resources_dock.cpp +++ b/tools/editor/resources_dock.cpp @@ -106,7 +106,7 @@ void ResourcesDock::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { button_new->set_icon(get_icon("New","EditorIcons")); button_open->set_icon(get_icon("Folder","EditorIcons")); diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index f693036bc2..3455582bbc 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -393,7 +393,7 @@ void SceneTreeDock::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { static const char* button_names[TOOL_BUTTON_MAX]={ "New", @@ -913,7 +913,7 @@ void SceneTreeDock::_delete_confirm() { //delete from animation for(List<Node*>::Element *E=remove_list.front();E;E=E->next()) { Node *n = E->get(); - if (!n->is_inside_scene() || !n->get_parent()) + if (!n->is_inside_tree() || !n->get_parent()) continue; fill_path_renames(n,NULL,&path_renames); @@ -924,7 +924,7 @@ void SceneTreeDock::_delete_confirm() { //delete for read for(List<Node*>::Element *E=remove_list.front();E;E=E->next()) { Node *n = E->get(); - if (!n->is_inside_scene() || !n->get_parent()) + if (!n->is_inside_tree() || !n->get_parent()) continue; List<Node*> owned; diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index 9b4ef6cef1..e9ec0199d0 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -36,11 +36,11 @@ Node *SceneTreeEditor::get_scene_node() { - ERR_FAIL_COND_V(!is_inside_scene(),NULL); - if (get_scene()->get_root()->get_child_count() && get_scene()->get_root()->get_child(0)->cast_to<EditorNode>()) - return get_scene()->get_root()->get_child(0)->cast_to<EditorNode>()->get_edited_scene(); + ERR_FAIL_COND_V(!is_inside_tree(),NULL); + if (get_tree()->get_root()->get_child_count() && get_tree()->get_root()->get_child(0)->cast_to<EditorNode>()) + return get_tree()->get_root()->get_child(0)->cast_to<EditorNode>()->get_edited_scene(); else - return get_scene()->get_root(); + return get_tree()->get_root(); return NULL; } @@ -367,7 +367,7 @@ void SceneTreeEditor::_node_removed(Node *p_node) { void SceneTreeEditor::_update_tree() { - if (!is_inside_scene()) { + if (!is_inside_tree()) { tree_dirty=false; return; } @@ -403,7 +403,7 @@ void SceneTreeEditor::_test_update_tree() { pending_test_update=false; - if (!is_inside_scene()) + if (!is_inside_tree()) return; if(tree_dirty) @@ -483,10 +483,10 @@ void SceneTreeEditor::_cell_multi_selected(Object *p_object,int p_cell,bool p_se void SceneTreeEditor::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { - get_scene()->connect("tree_changed",this,"_tree_changed"); - get_scene()->connect("node_removed",this,"_node_removed"); + get_tree()->connect("tree_changed",this,"_tree_changed"); + get_tree()->connect("node_removed",this,"_node_removed"); instance_menu->set_item_icon(2,get_icon("Load","EditorIcons")); tree->connect("item_collapsed",this,"_cell_collapsed"); @@ -494,10 +494,10 @@ void SceneTreeEditor::_notification(int p_what) { // get_scene()->connect("node_removed",this,"_node_removed",Vector<Variant>(),CONNECT_DEFERRED); _update_tree(); } - if (p_what==NOTIFICATION_EXIT_SCENE) { + if (p_what==NOTIFICATION_EXIT_TREE) { - get_scene()->disconnect("tree_changed",this,"_tree_changed"); - get_scene()->disconnect("node_removed",this,"_node_removed"); + get_tree()->disconnect("tree_changed",this,"_tree_changed"); + get_tree()->disconnect("node_removed",this,"_node_removed"); _update_tree(); } @@ -806,7 +806,7 @@ SceneTreeEditor::~SceneTreeEditor() { void SceneTreeDialog::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { connect("confirmed", this,"_select"); } diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp index 3f7c82d988..516cb5930d 100644 --- a/tools/editor/scenes_dock.cpp +++ b/tools/editor/scenes_dock.cpp @@ -115,7 +115,7 @@ void ScenesDock::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"_update_tree"); @@ -145,7 +145,7 @@ void ScenesDock::_notification(int p_what) { _update_tree(); //maybe it finished already } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { } break; case NOTIFICATION_PROCESS: { @@ -383,7 +383,7 @@ void ScenesDockFilter::_file_filter_selected(int p_idx) { void ScenesDockFilter::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { clear_search_button->set_icon(get_icon("CloseHover","EditorIcons")); } break; } diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index 00066e67e9..024377ad18 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -431,7 +431,7 @@ void ScriptEditorDebugger::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { step->set_icon( get_icon("DebugStep","EditorIcons")); next->set_icon( get_icon("DebugNext","EditorIcons")); @@ -771,7 +771,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor){ inspector = memnew( PropertyEditor ); inspector->set_h_size_flags(SIZE_EXPAND_FILL); inspector->hide_top_label(); - inspector->get_tree()->set_column_title(0,"Variable"); + inspector->get_scene_tree()->set_column_title(0,"Variable"); inspector->set_capitalize_paths(false); inspector->set_read_only(true); sc->add_child(inspector); diff --git a/tools/editor/settings_config_dialog.cpp b/tools/editor/settings_config_dialog.cpp index c82b075bc4..2310df4ffb 100644 --- a/tools/editor/settings_config_dialog.cpp +++ b/tools/editor/settings_config_dialog.cpp @@ -246,7 +246,7 @@ void EditorSettingsDialog::_update_plugins() { void EditorSettingsDialog::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { rescan_plugins->set_icon(get_icon("Reload","EditorIcons")); _update_plugins(); |