diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-11-05 21:20:42 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-11-05 21:20:42 -0300 |
commit | 0dbedd18fc62f700e92a4cf581e505d849bc47ad (patch) | |
tree | 8f2c85b4d9227e441fd35ab4873009faa656bcba /tools/editor/plugins | |
parent | d14baf6e41bcdbe4968e0513beccc09dfb160ecd (diff) |
SceneMainLoop -> SceneTree
-=-=-=-=-=-=-=-=-=-=-=-=-=-
*YOUR SOURCE MIGHT NOT WORK*
For mor information on fix:
https://github.com/okamstudio/godot/wiki/devel_scene_tree
Other stuff:
-Shower of bullets demo
-Fixes all around
Diffstat (limited to 'tools/editor/plugins')
20 files changed, 226 insertions, 226 deletions
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") ); } |