diff options
168 files changed, 1534 insertions, 1310 deletions
diff --git a/bin/tests/test_gui.cpp b/bin/tests/test_gui.cpp index f814b0282b..17a6a4111c 100644 --- a/bin/tests/test_gui.cpp +++ b/bin/tests/test_gui.cpp @@ -58,7 +58,7 @@ namespace TestGUI { -class TestMainLoop : public SceneMainLoop { +class TestMainLoop : public SceneTree { Control *control; @@ -72,7 +72,7 @@ public: } virtual void init() { - SceneMainLoop::init(); + SceneTree::init(); #if 0 diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index 499ec0c08e..27c7c10aef 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -141,11 +141,11 @@ InputEvent::operator String() const { return ""; } -void InputEvent::set_as_action(const String& p_action) { +void InputEvent::set_as_action(const String& p_action, bool p_pressed) { type=ACTION; action.action=InputMap::get_singleton()->get_action_id(p_action); - action.pressed=false; + action.pressed=p_pressed; } bool InputEvent::is_pressed() const { diff --git a/core/os/input_event.h b/core/os/input_event.h index 2c10bffcd2..218ff327d1 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -288,7 +288,7 @@ struct InputEvent { bool is_pressed() const; bool is_action(const String& p_action) const; bool is_echo() const; - void set_as_action(const String& p_action); + void set_as_action(const String& p_action, bool p_pressed); bool operator==(const InputEvent &p_event) const; operator String() const; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index bd731abeaf..28953a535f 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -684,6 +684,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_PTR0R( InputEvent, is_pressed ); VCALL_PTR1R( InputEvent, is_action ); VCALL_PTR0R( InputEvent, is_echo ); + //VCALL_PTR2( InputEvent, set_as_action ); struct ConstructData { @@ -1488,6 +1489,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC0(INPUT_EVENT,BOOL,InputEvent,is_pressed,varray()); ADDFUNC1(INPUT_EVENT,BOOL,InputEvent,is_action,STRING,"action",varray()); ADDFUNC0(INPUT_EVENT,BOOL,InputEvent,is_echo,varray()); + //ADDFUNC2(INPUT_EVENT,NIL,InputEvent,set_as_action,STRING,"action",BOOL,"pressed",varray()); /* REGISTER CONSTRUCTORS */ diff --git a/demos/2d/shower_of_bullets/bullet.png b/demos/2d/shower_of_bullets/bullet.png Binary files differnew file mode 100644 index 0000000000..7466374129 --- /dev/null +++ b/demos/2d/shower_of_bullets/bullet.png diff --git a/demos/2d/shower_of_bullets/bullets.gd b/demos/2d/shower_of_bullets/bullets.gd new file mode 100644 index 0000000000..f76fcc38ba --- /dev/null +++ b/demos/2d/shower_of_bullets/bullets.gd @@ -0,0 +1,76 @@ + +extends Node2D + +# This demo is an example of controling a high number of 2D objects with logic and collision without using scene nodes. +# This technique is a lot more efficient than using instancing and nodes, but requires more programming and is less visual + +const BULLET_COUNT = 500 +const SPEED_MIN = 20 +const SPEED_MAX = 50 + +var bullets=[] +var shape + +class Bullet: + var pos = Vector2() + var speed = 1.0 + var body = RID() + + +func _draw(): + + var t = preload("res://bullet.png") + var tofs = -t.get_size()*0.5 + for b in bullets: + draw_texture(t,b.pos+tofs) + + +func _process(delta): + var width = get_viewport_rect().size.x*2.0 + var mat = Matrix32() + for b in bullets: + b.pos.x-=b.speed*delta + if (b.pos.x < -30): + b.pos.x+=width + mat.o=b.pos + + Physics2DServer.body_set_state(b.body,Physics2DServer.BODY_STATE_TRANSFORM,mat) + + update() + + +func _ready(): + + shape = Physics2DServer.shape_create(Physics2DServer.SHAPE_CIRCLE) + Physics2DServer.shape_set_data(shape,8) #radius + + for i in range(BULLET_COUNT): + var b = Bullet.new() + b.speed=rand_range(SPEED_MIN,SPEED_MAX) + b.body = Physics2DServer.body_create(Physics2DServer.BODY_MODE_KINEMATIC) + Physics2DServer.body_set_space(b.body,get_world_2d().get_space()) + Physics2DServer.body_add_shape(b.body,shape) + + b.pos = Vector2( get_viewport_rect().size * Vector2(randf()*2.0,randf()) ) #twice as long + b.pos.x += get_viewport_rect().size.x # start outside + var mat = Matrix32() + mat.o=b.pos + Physics2DServer.body_set_state(b.body,Physics2DServer.BODY_STATE_TRANSFORM,mat) + + bullets.append(b) + + + set_process(true) + + +func _exit_tree(): + for b in bullets: + Physics2DServer.free(b.body) + + Physics2DServer.free(shape) + # Initalization here + bullets.clear() + + pass + + diff --git a/demos/2d/shower_of_bullets/engine.cfg b/demos/2d/shower_of_bullets/engine.cfg new file mode 100644 index 0000000000..cad5751985 --- /dev/null +++ b/demos/2d/shower_of_bullets/engine.cfg @@ -0,0 +1,16 @@ +[application] + +name="Bullet Shower" +main_scene="res://shower.scn" +icon="res://icon.png" + +[display] + +width=1024 +height=600 +resizable=true +stretch_aspect="keep" + +[physics_2d] + +cell_size=64 diff --git a/demos/2d/shower_of_bullets/face_happy.png b/demos/2d/shower_of_bullets/face_happy.png Binary files differnew file mode 100644 index 0000000000..6ed643b62d --- /dev/null +++ b/demos/2d/shower_of_bullets/face_happy.png diff --git a/demos/2d/shower_of_bullets/face_sad.png b/demos/2d/shower_of_bullets/face_sad.png Binary files differnew file mode 100644 index 0000000000..d6318b20a3 --- /dev/null +++ b/demos/2d/shower_of_bullets/face_sad.png diff --git a/demos/2d/shower_of_bullets/icon.png b/demos/2d/shower_of_bullets/icon.png Binary files differnew file mode 100644 index 0000000000..432c74a5a3 --- /dev/null +++ b/demos/2d/shower_of_bullets/icon.png diff --git a/demos/2d/shower_of_bullets/shower.gd b/demos/2d/shower_of_bullets/shower.gd new file mode 100644 index 0000000000..bba8431764 --- /dev/null +++ b/demos/2d/shower_of_bullets/shower.gd @@ -0,0 +1,32 @@ + +extends Node2D + +# member variables here, example: +# var a=2 +# var b="textvar" + +var touching=0 + +func _input(ev): + + if (ev.type==InputEvent.MOUSE_MOTION): + get_node("player").set_pos(ev.pos-Vector2(0,16)) + + +func _on_player_body_enter_shape( body_id, body, body_shape, area_shape ): + + touching+=1 + if (touching==1): + get_node("player/sprite").set_frame(1) + + +func _on_player_body_exit_shape( body_id, body, body_shape, area_shape ): + + touching-=1 + if (touching==0): + get_node("player/sprite").set_frame(0) + + +func _ready(): + set_process_input(true) + pass diff --git a/demos/2d/shower_of_bullets/shower.scn b/demos/2d/shower_of_bullets/shower.scn Binary files differnew file mode 100644 index 0000000000..648888d099 --- /dev/null +++ b/demos/2d/shower_of_bullets/shower.scn diff --git a/demos/misc/autoload/global.gd b/demos/misc/autoload/global.gd index d9fa308a2f..a0415c6ee0 100644 --- a/demos/misc/autoload/global.gd +++ b/demos/misc/autoload/global.gd @@ -12,12 +12,12 @@ func goto_scene(scene): #instance the new scene current_scene = s.instance() #add it to the active scene, as child of root - get_scene().get_root().add_child(current_scene) + get_tree().get_root().add_child(current_scene) func _ready(): # get the current scene # it is always the last child of root, # after the autoloaded nodes - var root = get_scene().get_root() + var root = get_tree().get_root() current_scene = root.get_child( root.get_child_count() -1 ) diff --git a/demos/misc/pause/spinpause.gd b/demos/misc/pause/spinpause.gd index c21c13b4e1..1b8f8388f0 100644 --- a/demos/misc/pause/spinpause.gd +++ b/demos/misc/pause/spinpause.gd @@ -5,11 +5,11 @@ extends Spatial func _on_pause_pressed(): get_node("pause_popup").set_exclusive(true) get_node("pause_popup").popup() - get_scene().set_pause(true) + get_tree().set_pause(true) func _on_unpause_pressed(): get_node("pause_popup").hide() - get_scene().set_pause(false) + get_tree().set_pause(false) diff --git a/drivers/theoraplayer/video_stream_theoraplayer.cpp b/drivers/theoraplayer/video_stream_theoraplayer.cpp index 04210f0209..8cb393b79b 100644 --- a/drivers/theoraplayer/video_stream_theoraplayer.cpp +++ b/drivers/theoraplayer/video_stream_theoraplayer.cpp @@ -37,6 +37,9 @@ #include "include/theoraplayer/TheoraException.h" #include "core/ring_buffer.h" +#include "core/os/thread_safe.h" + +static TheoraVideoManager* mgr = NULL; class TPDataFA : public TheoraDataSource { @@ -107,6 +110,8 @@ public: class AudioStreamInput : public AudioStreamResampled { + _THREAD_SAFE_CLASS_; + int channels; int freq; @@ -114,16 +119,28 @@ class AudioStreamInput : public AudioStreamResampled { mutable RingBuffer<float> rb; int rb_power; int total_wrote; + bool playing; public: virtual void play() { + + _THREAD_SAFE_METHOD_ _setup(channels, freq, 256); stream_rid=AudioServer::get_singleton()->audio_stream_create(get_audio_stream()); AudioServer::get_singleton()->stream_set_active(stream_rid,true); AudioServer::get_singleton()->stream_set_volume_scale(stream_rid,1); + playing = true; + }; + virtual void stop() { + + _THREAD_SAFE_METHOD_ + + AudioServer::get_singleton()->stream_set_active(stream_rid,false); + //_clear_stream(); + playing=false; + _clear(); }; - virtual void stop() {}; virtual bool is_playing() const { return true; }; virtual void set_paused(bool p_paused) {}; @@ -141,12 +158,13 @@ public: virtual float get_pos() const { return 0; }; virtual void seek_pos(float p_time) {}; - virtual UpdateMode get_update_mode() const { return UPDATE_IDLE; }; + virtual UpdateMode get_update_mode() const { return UPDATE_THREAD; }; virtual bool _can_mix() const { return true; }; void input(float* p_data, int p_samples) { + _THREAD_SAFE_METHOD_; if (rb.space_left() < p_samples) { rb_power += 1; rb.resize(rb_power); @@ -156,6 +174,7 @@ public: void update() { + _THREAD_SAFE_METHOD_; int todo = get_todo(); int16_t* buffer = get_write_buffer(); int samples = rb.data_left(); @@ -181,12 +200,18 @@ public: AudioStreamInput(int p_channels, int p_freq) { + playing = false; channels = p_channels; freq = p_freq; total_wrote = 0; rb_power = 12; rb.resize(rb_power); }; + + ~AudioStreamInput() { + + stop(); + }; }; class TPAudioGodot : public TheoraAudioInterface, TheoraTimer { @@ -398,8 +423,10 @@ void VideoStreamTheoraplayer::set_file(const String& p_file) { audio_factory = memnew(TPAudioGodotFactory); }; - mgr = memnew(TheoraVideoManager); - mgr->setAudioInterfaceFactory(audio_factory); + if (mgr == NULL) { + mgr = memnew(TheoraVideoManager); + mgr->setAudioInterfaceFactory(audio_factory); + }; if (p_file.find(".mp4") != -1) { @@ -425,15 +452,18 @@ void VideoStreamTheoraplayer::set_file(const String& p_file) { VideoStreamTheoraplayer::~VideoStreamTheoraplayer() { - if (mgr) { - memdelete(mgr); + //if (mgr) { + // memdelete(mgr); + //}; + //mgr = NULL; + if (clip) { + delete clip; // created by video manager with new }; - mgr = NULL; }; VideoStreamTheoraplayer::VideoStreamTheoraplayer() { - mgr = NULL; + //mgr = NULL; clip = NULL; started = false; playing = false; diff --git a/drivers/theoraplayer/video_stream_theoraplayer.h b/drivers/theoraplayer/video_stream_theoraplayer.h index 67a2db710b..d88f495032 100644 --- a/drivers/theoraplayer/video_stream_theoraplayer.h +++ b/drivers/theoraplayer/video_stream_theoraplayer.h @@ -13,7 +13,6 @@ class VideoStreamTheoraplayer : public VideoStream { OBJ_TYPE(VideoStreamTheoraplayer,VideoStream); mutable DVector<uint8_t> data; - TheoraVideoManager* mgr; TheoraVideoClip* clip; bool started; bool playing; diff --git a/main/main.cpp b/main/main.cpp index fa7ce50c6d..ac2a20fb68 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -961,7 +961,7 @@ bool Main::start() { MainLoop *main_loop=NULL; if (editor) { - main_loop = memnew(SceneMainLoop); + main_loop = memnew(SceneTree); }; if (test!="") { @@ -979,7 +979,7 @@ bool Main::start() { ERR_EXPLAIN("Can't load script: "+script); ERR_FAIL_COND_V(script_res.is_null(),false); - if( script_res->can_instance() /*&& script_res->inherits_from("SceneMainLoopScripted")*/) { + if( script_res->can_instance() /*&& script_res->inherits_from("SceneTreeScripted")*/) { StringName instance_type=script_res->get_instance_base_type(); @@ -1005,7 +1005,7 @@ bool Main::start() { } if (!main_loop && main_loop_type=="") - main_loop_type="SceneMainLoop"; + main_loop_type="SceneTree"; if (!main_loop) { if (!ObjectTypeDB::type_exists(main_loop_type)) { @@ -1030,9 +1030,9 @@ bool Main::start() { } } - if (main_loop->is_type("SceneMainLoop")) { + if (main_loop->is_type("SceneTree")) { - SceneMainLoop *sml = main_loop->cast_to<SceneMainLoop>(); + SceneTree *sml = main_loop->cast_to<SceneTree>(); #ifdef TOOLS_ENABLED @@ -1060,19 +1060,19 @@ bool Main::start() { String stretch_aspect = GLOBAL_DEF("display/stretch_aspect","ignore"); Size2i stretch_size = Size2(GLOBAL_DEF("display/width",0),GLOBAL_DEF("display/height",0)); - SceneMainLoop::StretchMode sml_sm=SceneMainLoop::STRETCH_MODE_DISABLED; + SceneTree::StretchMode sml_sm=SceneTree::STRETCH_MODE_DISABLED; if (stretch_mode=="2d") - sml_sm=SceneMainLoop::STRETCH_MODE_2D; + sml_sm=SceneTree::STRETCH_MODE_2D; else if (stretch_mode=="viewport") - sml_sm=SceneMainLoop::STRETCH_MODE_VIEWPORT; + sml_sm=SceneTree::STRETCH_MODE_VIEWPORT; - SceneMainLoop::StretchAspect sml_aspect=SceneMainLoop::STRETCH_ASPECT_IGNORE; + SceneTree::StretchAspect sml_aspect=SceneTree::STRETCH_ASPECT_IGNORE; if (stretch_aspect=="keep") - sml_aspect=SceneMainLoop::STRETCH_ASPECT_KEEP; + sml_aspect=SceneTree::STRETCH_ASPECT_KEEP; else if (stretch_aspect=="keep_width") - sml_aspect=SceneMainLoop::STRETCH_ASPECT_KEEP_WIDTH; + sml_aspect=SceneTree::STRETCH_ASPECT_KEEP_WIDTH; else if (stretch_aspect=="keep_height") - sml_aspect=SceneMainLoop::STRETCH_ASPECT_KEEP_HEIGHT; + sml_aspect=SceneTree::STRETCH_ASPECT_KEEP_HEIGHT; sml->set_screen_stretch(sml_sm,sml_aspect,stretch_size); diff --git a/main/performance.cpp b/main/performance.cpp index 9999cc0ae0..5b76472ceb 100644 --- a/main/performance.cpp +++ b/main/performance.cpp @@ -133,7 +133,7 @@ float Performance::get_monitor(Monitor p_monitor) const { MainLoop *ml = OS::get_singleton()->get_main_loop(); if (!ml) return 0; - SceneMainLoop *sml = ml->cast_to<SceneMainLoop>(); + SceneTree *sml = ml->cast_to<SceneTree>(); if (!sml) return 0; return sml->get_node_count(); diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index dc6b0ff962..de2b5219a9 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -1158,7 +1158,7 @@ GDParser::Node* GDParser::_reduce_expression(Node *p_node,bool p_to_const) { cn->value=v; return cn; - } else if (op->arguments[0]->type==Node::TYPE_CONSTANT && op->arguments[1]->type==Node::TYPE_IDENTIFIER) { + } /*else if (op->arguments[0]->type==Node::TYPE_CONSTANT && op->arguments[1]->type==Node::TYPE_IDENTIFIER) { ConstantNode *ca = static_cast<ConstantNode*>(op->arguments[0]); IdentifierNode *ib = static_cast<IdentifierNode*>(op->arguments[1]); @@ -1173,10 +1173,31 @@ GDParser::Node* GDParser::_reduce_expression(Node *p_node,bool p_to_const) { ConstantNode *cn = alloc_node<ConstantNode>(); cn->value=v; return cn; + }*/ + return op; + + } else if (op->op==OperatorNode::OP_INDEX_NAMED) { + + if (op->arguments[0]->type==Node::TYPE_CONSTANT && op->arguments[1]->type==Node::TYPE_IDENTIFIER) { + + ConstantNode *ca = static_cast<ConstantNode*>(op->arguments[0]); + IdentifierNode *ib = static_cast<IdentifierNode*>(op->arguments[1]); + + bool valid; + Variant v = ca->value.get_named(ib->name,&valid); + if (!valid) { + _set_error("invalid index '"+String(ib->name)+"' in constant expression"); + return op; + } + + ConstantNode *cn = alloc_node<ConstantNode>(); + cn->value=v; + return cn; } return op; + } //validate assignment (don't assign to cosntant expression diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 7c10c474c3..7c344e1e90 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -677,7 +677,7 @@ void GridMap::_octant_clear_baked(const OctantKey &p_key) { g.bake_instance=RID(); g.baked=Ref<Mesh>(); - if (is_inside_scene()) + if (is_inside_tree()) _octant_enter_world(p_key); g.dirty=true; _queue_dirty_map(); diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 09e279305c..140718a91a 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -974,7 +974,7 @@ void GridMapEditor::update_grid() { void GridMapEditor::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { theme_pallete->connect("cell_selected", this,"_item_selected_cbk"); edit_mode->connect("item_selected", this,"_edit_mode_changed"); @@ -983,16 +983,16 @@ void GridMapEditor::_notification(int p_what) { for(int i=0;i<3;i++) { grid[i]=VS::get_singleton()->mesh_create(); - grid_instance[i]=VS::get_singleton()->instance_create2(grid[i],get_scene()->get_root()->get_world()->get_scenario()); + grid_instance[i]=VS::get_singleton()->instance_create2(grid[i],get_tree()->get_root()->get_world()->get_scenario()); } - selection_instance = VisualServer::get_singleton()->instance_create2(selection_mesh,get_scene()->get_root()->get_world()->get_scenario()); - duplicate_instance = VisualServer::get_singleton()->instance_create2(duplicate_mesh,get_scene()->get_root()->get_world()->get_scenario()); + selection_instance = VisualServer::get_singleton()->instance_create2(selection_mesh,get_tree()->get_root()->get_world()->get_scenario()); + duplicate_instance = VisualServer::get_singleton()->instance_create2(duplicate_mesh,get_tree()->get_root()->get_world()->get_scenario()); _update_selection_transform(); _update_duplicate_indicator(); - } else if (p_what==NOTIFICATION_EXIT_SCENE) { + } else if (p_what==NOTIFICATION_EXIT_TREE) { for(int i=0;i<3;i++) { @@ -1025,7 +1025,7 @@ void GridMapEditor::_notification(int p_what) { if (lock_view) { - EditorNode*editor = get_scene()->get_root()->get_child(0)->cast_to<EditorNode>(); + EditorNode*editor = get_tree()->get_root()->get_child(0)->cast_to<EditorNode>(); Plane p; p.normal[edit_axis]=1.0; @@ -1055,7 +1055,7 @@ void GridMapEditor::_update_cursor_instance() { Ref<Mesh> mesh = node->get_theme()->get_item_mesh(selected_pallete); if (!mesh.is_null() && mesh->get_rid().is_valid()) { - cursor_instance=VisualServer::get_singleton()->instance_create2(mesh->get_rid(),get_scene()->get_root()->get_world()->get_scenario()); + cursor_instance=VisualServer::get_singleton()->instance_create2(mesh->get_rid(),get_tree()->get_root()->get_world()->get_scenario()); VisualServer::get_singleton()->instance_set_transform(cursor_instance,cursor_transform); } } diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 7c2385e103..be53d2d46a 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -928,7 +928,7 @@ void OS_Windows::process_joysticks() { if ( (joysticks[i].last_buttons & (1<<j)) != (jinfo.dwButtons & (1<<j)) ) { - ievent.joy_button.button_index = _pc_joystick_get_native_button(j); + ievent.joy_button.button_index = j; //_pc_joystick_get_native_button(j); ievent.joy_button.pressed = jinfo.dwButtons & 1<<j; ievent.ID = ++last_id; input->parse_input_event(ievent); diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index ad228662e4..48fa74cc6d 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -94,7 +94,7 @@ real_t Area2D::get_priority() const{ } -void Area2D::_body_enter_scene(ObjectID p_id) { +void Area2D::_body_enter_tree(ObjectID p_id) { Object *obj = ObjectDB::get_instance(p_id); Node *node = obj ? obj->cast_to<Node>() : NULL; @@ -102,9 +102,9 @@ void Area2D::_body_enter_scene(ObjectID p_id) { Map<ObjectID,BodyState>::Element *E=body_map.find(p_id); ERR_FAIL_COND(!E); - ERR_FAIL_COND(E->get().in_scene); + ERR_FAIL_COND(E->get().in_tree); - E->get().in_scene=true; + E->get().in_tree=true; emit_signal(SceneStringNames::get_singleton()->body_enter,node); for(int i=0;i<E->get().shapes.size();i++) { @@ -113,15 +113,15 @@ void Area2D::_body_enter_scene(ObjectID p_id) { } -void Area2D::_body_exit_scene(ObjectID p_id) { +void Area2D::_body_exit_tree(ObjectID p_id) { Object *obj = ObjectDB::get_instance(p_id); Node *node = obj ? obj->cast_to<Node>() : NULL; ERR_FAIL_COND(!node); Map<ObjectID,BodyState>::Element *E=body_map.find(p_id); ERR_FAIL_COND(!E); - ERR_FAIL_COND(!E->get().in_scene); - E->get().in_scene=false; + ERR_FAIL_COND(!E->get().in_tree); + E->get().in_tree=false; emit_signal(SceneStringNames::get_singleton()->body_exit,node); for(int i=0;i<E->get().shapes.size();i++) { @@ -147,11 +147,11 @@ void Area2D::_body_inout(int p_status,const RID& p_body, int p_instance, int p_b E = body_map.insert(objid,BodyState()); E->get().rc=0; - E->get().in_scene=node && node->is_inside_scene(); + E->get().in_tree=node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_scene,make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene,make_binds(objid)); - if (E->get().in_scene) { + node->connect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree,make_binds(objid)); + node->connect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree,make_binds(objid)); + if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->body_enter,node); } } @@ -162,7 +162,7 @@ void Area2D::_body_inout(int p_status,const RID& p_body, int p_instance, int p_b E->get().shapes.insert(ShapePair(p_body_shape,p_area_shape)); - if (E->get().in_scene) { + if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->body_enter_shape,objid,node,p_body_shape,p_area_shape); } @@ -178,9 +178,9 @@ void Area2D::_body_inout(int p_status,const RID& p_body, int p_instance, int p_b if (E->get().rc==0) { if (node) { - node->disconnect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_scene); - node->disconnect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene); - if (E->get().in_scene) + node->disconnect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree); + node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree); + if (E->get().in_tree) emit_signal(SceneStringNames::get_singleton()->body_exit,obj); } @@ -188,7 +188,7 @@ void Area2D::_body_inout(int p_status,const RID& p_body, int p_instance, int p_b eraseit=true; } - if (node && E->get().in_scene) { + if (node && E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->body_exit_shape,objid,obj,p_body_shape,p_area_shape); } @@ -212,7 +212,7 @@ void Area2D::_clear_monitoring() { Object *obj = ObjectDB::get_instance(E->key()); Node *node = obj ? obj->cast_to<Node>() : NULL; ERR_CONTINUE(!node); - if (!E->get().in_scene) + if (!E->get().in_tree) continue; for(int i=0;i<E->get().shapes.size();i++) { @@ -222,8 +222,8 @@ void Area2D::_clear_monitoring() { emit_signal(SceneStringNames::get_singleton()->body_exit,obj); - node->disconnect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_scene); - node->disconnect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene); + node->disconnect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree); + node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree); } } @@ -232,7 +232,7 @@ void Area2D::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { _clear_monitoring(); } break; @@ -266,8 +266,8 @@ bool Area2D::is_monitoring_enabled() const { void Area2D::_bind_methods() { - ObjectTypeDB::bind_method(_MD("_body_enter_scene","id"),&Area2D::_body_enter_scene); - ObjectTypeDB::bind_method(_MD("_body_exit_scene","id"),&Area2D::_body_exit_scene); + ObjectTypeDB::bind_method(_MD("_body_enter_tree","id"),&Area2D::_body_enter_tree); + ObjectTypeDB::bind_method(_MD("_body_exit_tree","id"),&Area2D::_body_exit_tree); ObjectTypeDB::bind_method(_MD("set_space_override_mode","enable"),&Area2D::set_space_override_mode); ObjectTypeDB::bind_method(_MD("get_space_override_mode"),&Area2D::get_space_override_mode); diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h index b4c8edf138..85f2b91582 100644 --- a/scene/2d/area_2d.h +++ b/scene/2d/area_2d.h @@ -55,8 +55,8 @@ private: void _body_inout(int p_status,const RID& p_body, int p_instance, int p_body_shape,int p_area_shape); - void _body_enter_scene(ObjectID p_id); - void _body_exit_scene(ObjectID p_id); + void _body_enter_tree(ObjectID p_id); + void _body_exit_tree(ObjectID p_id); struct ShapePair { @@ -76,7 +76,7 @@ private: struct BodyState { int rc; - bool in_scene; + bool in_tree; VSet<ShapePair> shapes; }; diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index fe6c9637e0..b3897010bf 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -33,10 +33,10 @@ void Camera2D::_update_scroll() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; - if (get_scene()->is_editor_hint()) { + if (get_tree()->is_editor_hint()) { update(); //will just be drawn return; } @@ -48,7 +48,7 @@ void Camera2D::_update_scroll() { if (viewport) { viewport->set_canvas_transform( xform ); } - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,group_name,"_camera_moved",xform); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,group_name,"_camera_moved",xform); }; } @@ -67,7 +67,7 @@ Vector2 Camera2D::get_zoom() const { Matrix32 Camera2D::get_camera_transform() { - if (!get_scene()) + if (!get_tree()) return Matrix32(); Size2 screen_size = get_viewport_rect().size; @@ -213,7 +213,7 @@ void Camera2D::_notification(int p_what) { _update_scroll(); } break; - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { viewport = NULL; Node *n=this; @@ -239,7 +239,7 @@ void Camera2D::_notification(int p_what) { } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { if (is_current()) { if (viewport) { @@ -316,10 +316,10 @@ bool Camera2D::is_current() const { void Camera2D::make_current() { - if (!is_inside_scene()) { + if (!is_inside_tree()) { current=true; } else { - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,group_name,"_make_current",this); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,group_name,"_make_current",this); } } diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index d66f100b3f..f90da51eea 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -38,7 +38,7 @@ bool CanvasItem::is_visible() const { - if (!is_inside_scene()) + if (!is_inside_tree()) return false; const CanvasItem *p=this; @@ -92,7 +92,7 @@ void CanvasItem::show() { hidden=false; VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,true); - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (is_visible()) { @@ -106,11 +106,11 @@ void CanvasItem::hide() { if (hidden) return; - bool propagate=is_inside_scene() && is_visible(); + bool propagate=is_inside_tree() && is_visible(); hidden=true; VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,false); - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (propagate) _propagate_visibility_changed(false); @@ -147,7 +147,7 @@ void CanvasItem::_update_callback() { - if (!is_inside_scene()) { + if (!is_inside_tree()) { pending_update=false; return; } @@ -225,7 +225,7 @@ void CanvasItem::_sort_children() { pending_children_sort=false; - if (!is_inside_scene()) + if (!is_inside_tree()) return; for(int i=0;i<get_child_count();i++) { @@ -243,7 +243,7 @@ void CanvasItem::_sort_children() { void CanvasItem::_raise_self() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; VisualServer::get_singleton()->canvas_item_raise(canvas_item); @@ -283,7 +283,7 @@ void CanvasItem::_enter_canvas() { group = "root_canvas"+itos(canvas.get_id()); add_to_group(group); - get_scene()->call_group(SceneMainLoop::GROUP_CALL_UNIQUE,group,"_raise_self"); + get_tree()->call_group(SceneTree::GROUP_CALL_UNIQUE,group,"_raise_self"); } else { @@ -313,7 +313,7 @@ void CanvasItem::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { first_draw=true; pending_children_sort=false; @@ -324,14 +324,14 @@ void CanvasItem::_notification(int p_what) { } _enter_canvas(); if (!block_transform_notify && !xform_change.in_list()) { - get_scene()->xform_change_list.add(&xform_change); + get_tree()->xform_change_list.add(&xform_change); } } break; case NOTIFICATION_MOVED_IN_PARENT: { if (group!="") { - get_scene()->call_group(SceneMainLoop::GROUP_CALL_UNIQUE,group,"_raise_self"); + get_tree()->call_group(SceneTree::GROUP_CALL_UNIQUE,group,"_raise_self"); } else { CanvasItem *p = get_parent_item(); ERR_FAIL_COND(!p); @@ -340,9 +340,9 @@ void CanvasItem::_notification(int p_what) { } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { if (xform_change.in_list()) - get_scene()->xform_change_list.remove(&xform_change); + get_tree()->xform_change_list.remove(&xform_change); _exit_canvas(); if (C) { get_parent()->cast_to<CanvasItem>()->children_items.erase(C); @@ -379,7 +379,7 @@ bool CanvasItem::_is_visible_() const { void CanvasItem::update() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (pending_update) return; @@ -406,7 +406,7 @@ void CanvasItem::set_as_toplevel(bool p_toplevel) { if (toplevel==p_toplevel) return; - if (!is_inside_scene()) { + if (!is_inside_tree()) { toplevel=p_toplevel; return; } @@ -630,8 +630,8 @@ void CanvasItem::_notify_transform(CanvasItem *p_node) { if (!p_node->xform_change.in_list()) { if (!p_node->block_transform_notify) { - if (p_node->is_inside_scene()) - get_scene()->xform_change_list.add(&p_node->xform_change); + if (p_node->is_inside_tree()) + get_tree()->xform_change_list.add(&p_node->xform_change); } } @@ -648,13 +648,13 @@ void CanvasItem::_notify_transform(CanvasItem *p_node) { Rect2 CanvasItem::get_viewport_rect() const { - ERR_FAIL_COND_V(!is_inside_scene(),Rect2()); + ERR_FAIL_COND_V(!is_inside_tree(),Rect2()); return get_viewport()->get_visible_rect(); } RID CanvasItem::get_canvas() const { - ERR_FAIL_COND_V(!is_inside_scene(),RID()); + ERR_FAIL_COND_V(!is_inside_tree(),RID()); if (canvas_layer) return canvas_layer->get_world_2d()->get_canvas(); @@ -677,7 +677,7 @@ CanvasItem *CanvasItem::get_toplevel() const { Ref<World2D> CanvasItem::get_world_2d() const { - ERR_FAIL_COND_V(!is_inside_scene(),Ref<World2D>()); + ERR_FAIL_COND_V(!is_inside_tree(),Ref<World2D>()); CanvasItem *tl=get_toplevel(); @@ -693,7 +693,7 @@ Ref<World2D> CanvasItem::get_world_2d() const { RID CanvasItem::get_viewport_rid() const { - ERR_FAIL_COND_V(!is_inside_scene(),RID()); + ERR_FAIL_COND_V(!is_inside_tree(),RID()); return get_viewport()->get_viewport(); } @@ -824,7 +824,7 @@ void CanvasItem::_bind_methods() { Matrix32 CanvasItem::get_canvas_transform() const { - ERR_FAIL_COND_V(!is_inside_scene(),Matrix32()); + ERR_FAIL_COND_V(!is_inside_tree(),Matrix32()); if (canvas_layer) return canvas_layer->get_transform(); @@ -835,7 +835,7 @@ Matrix32 CanvasItem::get_canvas_transform() const { Matrix32 CanvasItem::get_viewport_transform() const { - ERR_FAIL_COND_V(!is_inside_scene(),Matrix32()); + ERR_FAIL_COND_V(!is_inside_tree(),Matrix32()); if (canvas_layer) { diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index 604eef0527..dbf8fd79e9 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -110,7 +110,7 @@ protected: - _FORCE_INLINE_ void _notify_transform() { if (!is_inside_scene()) return; _notify_transform(this); if (!block_transform_notify) notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED); } + _FORCE_INLINE_ void _notify_transform() { if (!is_inside_tree()) return; _notify_transform(this); if (!block_transform_notify) notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED); } void item_rect_changed(); @@ -120,7 +120,7 @@ public: enum { - NOTIFICATION_TRANSFORM_CHANGED=SceneMainLoop::NOTIFICATION_TRANSFORM_CHANGED, //unique + NOTIFICATION_TRANSFORM_CHANGED=SceneTree::NOTIFICATION_TRANSFORM_CHANGED, //unique NOTIFICATION_DRAW=30, NOTIFICATION_VISIBILITY_CHANGED=31, NOTIFICATION_ENTER_CANVAS=32, diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index 56359e6015..3b859d9366 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -45,7 +45,7 @@ void CollisionObject2D::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { if (area) Physics2DServer::get_singleton()->area_set_transform(rid,get_global_transform()); @@ -69,7 +69,7 @@ void CollisionObject2D::_notification(int p_what) { Physics2DServer::get_singleton()->body_set_state(rid,Physics2DServer::BODY_STATE_TRANSFORM,get_global_transform()); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { if (area) { Physics2DServer::get_singleton()->area_set_space(rid,RID()); diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index ef63286697..57495b5cb0 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -95,7 +95,7 @@ void CollisionPolygon2D::_notification(int p_what) { switch(p_what) { case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { - if (!is_inside_scene()) + if (!is_inside_tree()) break; _update_parent(); diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index 3f068f4ccc..9f35ade322 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -72,12 +72,12 @@ void CollisionShape2D::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { unparenting=false; } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { - if (!is_inside_scene()) + if (!is_inside_tree()) break; _update_parent(); diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp index 0e673ff791..e706ad658a 100644 --- a/scene/2d/joints_2d.cpp +++ b/scene/2d/joints_2d.cpp @@ -32,7 +32,7 @@ void Joint2D::_update_joint() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (joint.is_valid()) { @@ -86,7 +86,7 @@ void Joint2D::_notification(int p_what) { case NOTIFICATION_READY: { _update_joint(); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { if (joint.is_valid()) { Physics2DServer::get_singleton()->free(joint); @@ -145,7 +145,7 @@ void PinJoint2D::_notification(int p_what) { switch(p_what) { case NOTIFICATION_DRAW: { - if (is_inside_scene() && get_scene()->is_editor_hint()) { + if (is_inside_tree() && get_tree()->is_editor_hint()) { draw_line(Point2(-10,0),Point2(+10,0),Color(0.7,0.6,0.0,0.5),3); draw_line(Point2(0,-10),Point2(0,+10),Color(0.7,0.6,0.0,0.5),3); @@ -197,7 +197,7 @@ void GrooveJoint2D::_notification(int p_what) { switch(p_what) { case NOTIFICATION_DRAW: { - if (is_inside_scene() && get_scene()->is_editor_hint()) { + if (is_inside_tree() && get_tree()->is_editor_hint()) { draw_line(Point2(-10,0),Point2(+10,0),Color(0.7,0.6,0.0,0.5),3); draw_line(Point2(-10,length),Point2(+10,length),Color(0.7,0.6,0.0,0.5),3); @@ -291,7 +291,7 @@ void DampedSpringJoint2D::_notification(int p_what) { switch(p_what) { case NOTIFICATION_DRAW: { - if (is_inside_scene() && get_scene()->is_editor_hint()) { + if (is_inside_tree() && get_tree()->is_editor_hint()) { draw_line(Point2(-10,0),Point2(+10,0),Color(0.7,0.6,0.0,0.5),3); draw_line(Point2(-10,length),Point2(+10,length),Color(0.7,0.6,0.0,0.5),3); diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 4c00db2429..6dcee3458f 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -130,7 +130,7 @@ void Node2D::_update_transform() { VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(),_mat); - if (!is_inside_scene()) + if (!is_inside_tree()) return; @@ -272,7 +272,7 @@ void Node2D::set_transform(const Matrix32& p_transform) { VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(),_mat); - if (!is_inside_scene()) + if (!is_inside_tree()) return; _notify_transform(); diff --git a/scene/2d/parallax_background.cpp b/scene/2d/parallax_background.cpp index 55607bd4eb..df37285f9d 100644 --- a/scene/2d/parallax_background.cpp +++ b/scene/2d/parallax_background.cpp @@ -36,13 +36,13 @@ void ParallaxBackground::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { group_name = "__cameras_"+itos(get_viewport().get_id()); add_to_group(group_name); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { remove_from_group(group_name); } break; @@ -78,7 +78,7 @@ void ParallaxBackground::set_scroll_offset(const Point2& p_ofs) { void ParallaxBackground::_update_scroll() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; Vector2 ofs = base_offset+offset*base_scale; diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp index 2cda51dccb..a0913ab50c 100644 --- a/scene/2d/parallax_layer.cpp +++ b/scene/2d/parallax_layer.cpp @@ -74,7 +74,7 @@ void ParallaxLayer::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { orig_offset=get_pos(); orig_scale=get_scale(); @@ -85,9 +85,9 @@ void ParallaxLayer::_notification(int p_what) { void ParallaxLayer::set_base_offset_and_scale(const Point2& p_offset,float p_scale) { - if (!is_inside_scene()) + if (!is_inside_tree()) return; - if (get_scene()->is_editor_hint()) + if (get_tree()->is_editor_hint()) return; Point2 new_ofs = ((orig_offset+p_offset)*motion_scale)*p_scale; diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index 819b06e095..7f492e743c 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -34,14 +34,14 @@ void ParticleAttractor2D::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { _update_owner(); } break; case NOTIFICATION_DRAW: { - if (!get_scene()->is_editor_hint()) + if (!get_tree()->is_editor_hint()) return; Vector2 pv; @@ -58,7 +58,7 @@ void ParticleAttractor2D::_notification(int p_what) { } } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { if (owner) { _set_owner(NULL); } @@ -76,7 +76,7 @@ void ParticleAttractor2D::_owner_exited() { void ParticleAttractor2D::_update_owner() { - if (!is_inside_scene() || !has_node(path)) { + if (!is_inside_tree() || !has_node(path)) { _set_owner(NULL); return; } @@ -98,7 +98,7 @@ void ParticleAttractor2D::_set_owner(Particles2D* p_owner) { return; if (owner) { - owner->disconnect("exit_scene",this,"_owner_exited"); + owner->disconnect("exit_tree",this,"_owner_exited"); owner->attractors.erase(this); owner=NULL; } @@ -106,7 +106,7 @@ void ParticleAttractor2D::_set_owner(Particles2D* p_owner) { if (owner) { - owner->connect("exit_scene",this,"_owner_exited",varray(),CONNECT_ONESHOT); + owner->connect("exit_tree",this,"_owner_exited",varray(),CONNECT_ONESHOT); owner->attractors.insert(this); } } @@ -457,7 +457,7 @@ void Particles2D::_notification(int p_what) { _process_particles( get_process_delta_time() ); } break; - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { float ppt=preprocess; while(ppt>0) { diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index febec54124..5560274c98 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -31,7 +31,7 @@ void Path2D::_notification(int p_what) { - if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_scene() && get_scene()->is_editor_hint()) { + if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_tree() && get_tree()->is_editor_hint()) { //draw the curve!! for(int i=0;i<curve->get_point_count();i++) { @@ -52,7 +52,7 @@ void Path2D::_notification(int p_what) { void Path2D::_curve_changed() { - if (is_inside_scene() && get_scene()->is_editor_hint()) + if (is_inside_tree() && get_tree()->is_editor_hint()) update(); } @@ -135,7 +135,7 @@ void PathFollow2D::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { Node *parent=get_parent(); if (parent) { @@ -147,7 +147,7 @@ void PathFollow2D::_notification(int p_what) { } } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { path=NULL; diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 308aa8402f..f2f7a15e91 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -198,7 +198,7 @@ StaticBody2D::~StaticBody2D() { -void RigidBody2D::_body_enter_scene(ObjectID p_id) { +void RigidBody2D::_body_enter_tree(ObjectID p_id) { Object *obj = ObjectDB::get_instance(p_id); Node *node = obj ? obj->cast_to<Node>() : NULL; @@ -218,7 +218,7 @@ void RigidBody2D::_body_enter_scene(ObjectID p_id) { } -void RigidBody2D::_body_exit_scene(ObjectID p_id) { +void RigidBody2D::_body_exit_tree(ObjectID p_id) { Object *obj = ObjectDB::get_instance(p_id); Node *node = obj ? obj->cast_to<Node>() : NULL; @@ -251,10 +251,10 @@ void RigidBody2D::_body_inout(int p_status, ObjectID p_instance, int p_body_shap E = contact_monitor->body_map.insert(objid,BodyState()); // E->get().rc=0; - E->get().in_scene=node && node->is_inside_scene(); + E->get().in_scene=node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_scene,make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene,make_binds(objid)); + node->connect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree,make_binds(objid)); + node->connect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree,make_binds(objid)); if (E->get().in_scene) { emit_signal(SceneStringNames::get_singleton()->body_enter,node); } @@ -283,8 +283,8 @@ void RigidBody2D::_body_inout(int p_status, ObjectID p_instance, int p_body_shap if (E->get().shapes.empty()) { if (node) { - node->disconnect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_scene); - node->disconnect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene); + node->disconnect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree); + node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree); if (in_scene) emit_signal(SceneStringNames::get_singleton()->body_exit,obj); @@ -694,8 +694,8 @@ void RigidBody2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("is_able_to_sleep"),&RigidBody2D::is_able_to_sleep); ObjectTypeDB::bind_method(_MD("_direct_state_changed"),&RigidBody2D::_direct_state_changed); - ObjectTypeDB::bind_method(_MD("_body_enter_scene"),&RigidBody2D::_body_enter_scene); - ObjectTypeDB::bind_method(_MD("_body_exit_scene"),&RigidBody2D::_body_exit_scene); + ObjectTypeDB::bind_method(_MD("_body_enter_tree"),&RigidBody2D::_body_enter_tree); + ObjectTypeDB::bind_method(_MD("_body_exit_tree"),&RigidBody2D::_body_exit_tree); BIND_VMETHOD(MethodInfo("_integrate_forces",PropertyInfo(Variant::OBJECT,"state:Physics2DDirectBodyState"))); @@ -803,7 +803,7 @@ Vector2 KinematicBody2D::move(const Vector2& p_motion) { colliding=false; - ERR_FAIL_COND_V(!is_inside_scene(),Vector2()); + ERR_FAIL_COND_V(!is_inside_tree(),Vector2()); Physics2DDirectSpaceState *dss = Physics2DServer::get_singleton()->space_get_direct_state(get_world_2d()->get_space()); ERR_FAIL_COND_V(!dss,Vector2()); const int max_shapes=32; @@ -947,7 +947,7 @@ Vector2 KinematicBody2D::move_to(const Vector2& p_position) { bool KinematicBody2D::can_move_to(const Vector2& p_position, bool p_discrete) { - ERR_FAIL_COND_V(!is_inside_scene(),false); + ERR_FAIL_COND_V(!is_inside_tree(),false); Physics2DDirectSpaceState *dss = Physics2DServer::get_singleton()->space_get_direct_state(get_world_2d()->get_space()); ERR_FAIL_COND_V(!dss,false); @@ -987,7 +987,7 @@ bool KinematicBody2D::can_move_to(const Vector2& p_position, bool p_discrete) { bool KinematicBody2D::is_colliding() const { - ERR_FAIL_COND_V(!is_inside_scene(),false); + ERR_FAIL_COND_V(!is_inside_tree(),false); return colliding; } diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index e429ca1432..77e909f105 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -170,8 +170,8 @@ private: ContactMonitor *contact_monitor; - void _body_enter_scene(ObjectID p_id); - void _body_exit_scene(ObjectID p_id); + void _body_enter_tree(ObjectID p_id); + void _body_exit_tree(ObjectID p_id); void _body_inout(int p_status, ObjectID p_instance, int p_body_shape,int p_local_shape); diff --git a/scene/2d/position_2d.cpp b/scene/2d/position_2d.cpp index ca3be9aa8f..2db2be123b 100644 --- a/scene/2d/position_2d.cpp +++ b/scene/2d/position_2d.cpp @@ -45,14 +45,14 @@ void Position2D::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { update(); } break; case NOTIFICATION_DRAW: { - if (!is_inside_scene()) + if (!is_inside_tree()) break; - if (get_scene()->is_editor_hint()) + if (get_tree()->is_editor_hint()) _draw_cross(); } break; diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index 8479338521..e352ac64f5 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -33,7 +33,7 @@ void RayCast2D::set_cast_to(const Vector2& p_point) { cast_to=p_point; - if (is_inside_scene() && get_scene()->is_editor_hint()) + if (is_inside_tree() && get_tree()->is_editor_hint()) update(); } @@ -82,7 +82,7 @@ Vector2 RayCast2D::get_collision_normal() const{ void RayCast2D::set_enabled(bool p_enabled) { enabled=p_enabled; - if (is_inside_scene() && !get_scene()->is_editor_hint()) + if (is_inside_tree() && !get_tree()->is_editor_hint()) set_fixed_process(p_enabled); if (!p_enabled) collided=false; @@ -101,15 +101,15 @@ void RayCast2D::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { - if (enabled && !get_scene()->is_editor_hint()) + if (enabled && !get_tree()->is_editor_hint()) set_fixed_process(true); else set_fixed_process(false); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { if (enabled) set_fixed_process(false); @@ -118,7 +118,7 @@ void RayCast2D::_notification(int p_what) { #ifdef TOOLS_ENABLED case NOTIFICATION_DRAW: { - if (!get_scene()->is_editor_hint()) + if (!get_tree()->is_editor_hint()) break; Matrix32 xf; xf.rotate(cast_to.atan2()); diff --git a/scene/2d/remote_transform_2d.cpp b/scene/2d/remote_transform_2d.cpp index 80d038f6f8..b170986017 100644 --- a/scene/2d/remote_transform_2d.cpp +++ b/scene/2d/remote_transform_2d.cpp @@ -45,7 +45,7 @@ void RemoteTransform2D::_update_cache() { void RemoteTransform2D::_update_remote() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (!cache) @@ -59,7 +59,7 @@ void RemoteTransform2D::_update_remote() { if (!n) return; - if (!n->is_inside_scene()) + if (!n->is_inside_tree()) return; //todo make faster @@ -77,7 +77,7 @@ void RemoteTransform2D::_notification(int p_what) { } break; case NOTIFICATION_TRANSFORM_CHANGED: { - if (!is_inside_scene()) + if (!is_inside_tree()) break; if (cache) { @@ -95,7 +95,7 @@ void RemoteTransform2D::_notification(int p_what) { void RemoteTransform2D::set_remote_node(const NodePath& p_remote_node) { remote_node=p_remote_node; - if (is_inside_scene()) + if (is_inside_tree()) _update_cache(); } diff --git a/scene/2d/remote_transform_2d.h b/scene/2d/remote_transform_2d.h index 9561e72255..05a9b20f6e 100644 --- a/scene/2d/remote_transform_2d.h +++ b/scene/2d/remote_transform_2d.h @@ -38,7 +38,7 @@ class RemoteTransform2D : public Node2D { void _update_remote(); void _update_cache(); - void _node_exited_scene(); + //void _node_exited_scene(); protected: static void _bind_methods(); diff --git a/scene/2d/sample_player_2d.cpp b/scene/2d/sample_player_2d.cpp index bc1734ec06..99dfa67c27 100644 --- a/scene/2d/sample_player_2d.cpp +++ b/scene/2d/sample_player_2d.cpp @@ -89,7 +89,7 @@ void SamplePlayer2D::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { SpatialSound2DServer::get_singleton()->source_set_polyphony(get_source_rid(),polyphony); diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp index b606634819..2ac3c06031 100644 --- a/scene/2d/screen_button.cpp +++ b/scene/2d/screen_button.cpp @@ -69,9 +69,9 @@ void TouchScreenButton::_notification(int p_what) { case NOTIFICATION_DRAW: { - if (!is_inside_scene()) + if (!is_inside_tree()) return; - if (!get_scene()->is_editor_hint() && !OS::get_singleton()->has_touchscreen_ui_hint() && visibility==VISIBILITY_TOUCHSCREEN_ONLY) + if (!get_tree()->is_editor_hint() && !OS::get_singleton()->has_touchscreen_ui_hint() && visibility==VISIBILITY_TOUCHSCREEN_ONLY) return; if (finger_pressed!=-1) { @@ -87,13 +87,13 @@ void TouchScreenButton::_notification(int p_what) { } } break; - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { - if (!get_scene()->is_editor_hint() && !OS::get_singleton()->has_touchscreen_ui_hint() && visibility==VISIBILITY_TOUCHSCREEN_ONLY) + if (!get_tree()->is_editor_hint() && !OS::get_singleton()->has_touchscreen_ui_hint() && visibility==VISIBILITY_TOUCHSCREEN_ONLY) return; update(); - if (!get_scene()->is_editor_hint()) + if (!get_tree()->is_editor_hint()) set_process_input(true); if (action.operator String()!="" && InputMap::get_singleton()->has_action(action)) { @@ -129,7 +129,7 @@ String TouchScreenButton::get_action() const { void TouchScreenButton::_input(const InputEvent& p_event) { - if (!get_scene()) + if (!get_tree()) return; if (p_event.device != 0) @@ -149,7 +149,7 @@ void TouchScreenButton::_input(const InputEvent& p_event) { ie.ID=0; ie.action.action=action_id; ie.action.pressed=false; - get_scene()->input_event(ie); + get_tree()->input_event(ie); } finger_pressed=-1; @@ -193,7 +193,7 @@ void TouchScreenButton::_input(const InputEvent& p_event) { ie.ID=0; ie.action.action=action_id; ie.action.pressed=true; - get_scene()->input_event(ie); + get_tree()->input_event(ie); } update(); @@ -213,7 +213,7 @@ void TouchScreenButton::_input(const InputEvent& p_event) { ie.ID=0; ie.action.action=action_id; ie.action.pressed=false; - get_scene()->input_event(ie); + get_tree()->input_event(ie); } finger_pressed=-1; @@ -268,7 +268,7 @@ void TouchScreenButton::_input(const InputEvent& p_event) { ie.ID=0; ie.action.action=action_id; ie.action.pressed=true; - get_scene()->input_event(ie); + get_tree()->input_event(ie); } update(); @@ -289,7 +289,7 @@ void TouchScreenButton::_input(const InputEvent& p_event) { ie.ID=0; ie.action.action=action_id; ie.action.pressed=false; - get_scene()->input_event(ie); + get_tree()->input_event(ie); } finger_pressed=-1; update(); diff --git a/scene/2d/sound_player_2d.cpp b/scene/2d/sound_player_2d.cpp index 2fffef4e51..ef51295476 100644 --- a/scene/2d/sound_player_2d.cpp +++ b/scene/2d/sound_player_2d.cpp @@ -39,7 +39,7 @@ void SoundPlayer2D::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { //find the sound space source_rid = SpatialSound2DServer::get_singleton()->source_create(get_world_2d()->get_sound_space()); @@ -56,7 +56,7 @@ void SoundPlayer2D::_notification(int p_what) { SpatialSound2DServer::get_singleton()->source_set_transform(source_rid,get_global_transform()); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { if (source_rid.is_valid()) SpatialSound2DServer::get_singleton()->free(source_rid); diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index 8c3bbfdfc9..9f789a7a1f 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -365,7 +365,7 @@ void ViewportSprite::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { if (!viewport_path.is_empty()) { @@ -380,7 +380,7 @@ void ViewportSprite::_notification(int p_what) { item_rect_changed(); } } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { if (texture.is_valid()) { @@ -422,7 +422,7 @@ void ViewportSprite::set_viewport_path(const NodePath& p_viewport) { viewport_path=p_viewport; update(); - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (texture.is_valid()) { diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index eb04ca924f..9fcf34cee6 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -33,7 +33,7 @@ void TileMap::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { pending_update=true; _update_dirty_quadrants(); @@ -43,7 +43,7 @@ void TileMap::_notification(int p_what) { } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { _update_quadrant_space(RID()); @@ -68,7 +68,7 @@ void TileMap::_update_quadrant_space(const RID& p_space) { void TileMap::_update_quadrant_transform() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; Matrix32 global_transform = get_global_transform(); @@ -164,7 +164,7 @@ void TileMap::_update_dirty_quadrants() { if (!pending_update) return; - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (!tile_set.is_valid()) return; @@ -345,7 +345,7 @@ Map<TileMap::PosKey,TileMap::Quadrant>::Element *TileMap::_create_quadrant(const Physics2DServer::get_singleton()->body_set_param(q.static_body,Physics2DServer::BODY_PARAM_FRICTION,friction); Physics2DServer::get_singleton()->body_set_param(q.static_body,Physics2DServer::BODY_PARAM_BOUNCE,bounce); - if (is_inside_scene()) { + if (is_inside_tree()) { xform = get_global_transform() * xform; RID space = get_world_2d()->get_space(); Physics2DServer::get_singleton()->body_set_space(q.static_body,space); @@ -379,7 +379,7 @@ void TileMap::_make_quadrant_dirty(Map<PosKey,Quadrant>::Element *Q) { if (pending_update) return; pending_update=true; - if (!is_inside_scene()) + if (!is_inside_tree()) return; call_deferred("_update_dirty_quadrants"); } diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp index e5eb193f6f..22534eeb0e 100644 --- a/scene/2d/visibility_notifier_2d.cpp +++ b/scene/2d/visibility_notifier_2d.cpp @@ -64,7 +64,7 @@ void VisibilityNotifier2D::_exit_viewport(Viewport* p_viewport){ void VisibilityNotifier2D::set_rect(const Rect2& p_rect){ rect=p_rect; - if (is_inside_scene()) + if (is_inside_tree()) get_world_2d()->_update_notifier(this,get_global_transform().xform(rect)); _change_notify("rect"); @@ -85,7 +85,7 @@ void VisibilityNotifier2D::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { //get_world_2d()-> get_world_2d()->_register_notifier(this,get_global_transform().xform(rect)); @@ -97,12 +97,12 @@ void VisibilityNotifier2D::_notification(int p_what) { } break; case NOTIFICATION_DRAW: { - if (get_scene()->is_editor_hint()) { + if (get_tree()->is_editor_hint()) { draw_rect(rect,Color(1,0.5,1,0.2)); } } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { get_world_2d()->_remove_notifier(this); } break; @@ -190,7 +190,7 @@ void VisibilityEnabler2D::_find_nodes(Node* p_node) { if (add) { - p_node->connect(SceneStringNames::get_singleton()->exit_scene,this,"_node_removed",varray(p_node),CONNECT_ONESHOT); + p_node->connect(SceneStringNames::get_singleton()->exit_tree,this,"_node_removed",varray(p_node),CONNECT_ONESHOT); nodes[p_node]=meta; _change_node_state(p_node,false); } @@ -207,9 +207,9 @@ void VisibilityEnabler2D::_find_nodes(Node* p_node) { void VisibilityEnabler2D::_notification(int p_what){ - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { - if (get_scene()->is_editor_hint()) + if (get_tree()->is_editor_hint()) return; @@ -222,9 +222,9 @@ void VisibilityEnabler2D::_notification(int p_what){ } - if (p_what==NOTIFICATION_EXIT_SCENE) { + if (p_what==NOTIFICATION_EXIT_TREE) { - if (get_scene()->is_editor_hint()) + if (get_tree()->is_editor_hint()) return; @@ -235,7 +235,7 @@ void VisibilityEnabler2D::_notification(int p_what){ if (!visible) _change_node_state(E->key(),true); - E->key()->disconnect(SceneStringNames::get_singleton()->exit_scene,this,"_node_removed"); + E->key()->disconnect(SceneStringNames::get_singleton()->exit_tree,this,"_node_removed"); } nodes.clear(); diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index 7370c36eb7..407747fc0d 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -94,7 +94,7 @@ real_t Area::get_priority() const{ } -void Area::_body_enter_scene(ObjectID p_id) { +void Area::_body_enter_tree(ObjectID p_id) { Object *obj = ObjectDB::get_instance(p_id); Node *node = obj ? obj->cast_to<Node>() : NULL; @@ -102,9 +102,9 @@ void Area::_body_enter_scene(ObjectID p_id) { Map<ObjectID,BodyState>::Element *E=body_map.find(p_id); ERR_FAIL_COND(!E); - ERR_FAIL_COND(E->get().in_scene); + ERR_FAIL_COND(E->get().in_tree); - E->get().in_scene=true; + E->get().in_tree=true; emit_signal(SceneStringNames::get_singleton()->body_enter,node); for(int i=0;i<E->get().shapes.size();i++) { @@ -113,15 +113,15 @@ void Area::_body_enter_scene(ObjectID p_id) { } -void Area::_body_exit_scene(ObjectID p_id) { +void Area::_body_exit_tree(ObjectID p_id) { Object *obj = ObjectDB::get_instance(p_id); Node *node = obj ? obj->cast_to<Node>() : NULL; ERR_FAIL_COND(!node); Map<ObjectID,BodyState>::Element *E=body_map.find(p_id); ERR_FAIL_COND(!E); - ERR_FAIL_COND(!E->get().in_scene); - E->get().in_scene=false; + ERR_FAIL_COND(!E->get().in_tree); + E->get().in_tree=false; emit_signal(SceneStringNames::get_singleton()->body_exit,node); for(int i=0;i<E->get().shapes.size();i++) { @@ -147,11 +147,11 @@ void Area::_body_inout(int p_status,const RID& p_body, int p_instance, int p_bod E = body_map.insert(objid,BodyState()); E->get().rc=0; - E->get().in_scene=node && node->is_inside_scene(); + E->get().in_tree=node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_scene,make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene,make_binds(objid)); - if (E->get().in_scene) { + node->connect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree,make_binds(objid)); + node->connect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree,make_binds(objid)); + if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->body_enter,node); } } @@ -162,7 +162,7 @@ void Area::_body_inout(int p_status,const RID& p_body, int p_instance, int p_bod E->get().shapes.insert(ShapePair(p_body_shape,p_area_shape)); - if (E->get().in_scene) { + if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->body_enter_shape,objid,node,p_body_shape,p_area_shape); } @@ -178,9 +178,9 @@ void Area::_body_inout(int p_status,const RID& p_body, int p_instance, int p_bod if (E->get().rc==0) { if (node) { - node->disconnect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_scene); - node->disconnect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene); - if (E->get().in_scene) + node->disconnect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree); + node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree); + if (E->get().in_tree) emit_signal(SceneStringNames::get_singleton()->body_exit,obj); } @@ -188,7 +188,7 @@ void Area::_body_inout(int p_status,const RID& p_body, int p_instance, int p_bod eraseit=true; } - if (node && E->get().in_scene) { + if (node && E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->body_exit_shape,objid,obj,p_body_shape,p_area_shape); } @@ -211,7 +211,7 @@ void Area::_clear_monitoring() { Object *obj = ObjectDB::get_instance(E->key()); Node *node = obj ? obj->cast_to<Node>() : NULL; ERR_CONTINUE(!node); - if (!E->get().in_scene) + if (!E->get().in_tree) continue; for(int i=0;i<E->get().shapes.size();i++) { @@ -221,14 +221,14 @@ void Area::_clear_monitoring() { emit_signal(SceneStringNames::get_singleton()->body_exit,obj); - node->disconnect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_scene); - node->disconnect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene); + node->disconnect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree); + node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree); } } void Area::_notification(int p_what) { - if (p_what==NOTIFICATION_EXIT_SCENE) { + if (p_what==NOTIFICATION_EXIT_TREE) { _clear_monitoring(); } } @@ -258,8 +258,8 @@ bool Area::is_monitoring_enabled() const { void Area::_bind_methods() { - ObjectTypeDB::bind_method(_MD("_body_enter_scene","id"),&Area::_body_enter_scene); - ObjectTypeDB::bind_method(_MD("_body_exit_scene","id"),&Area::_body_exit_scene); + ObjectTypeDB::bind_method(_MD("_body_enter_tree","id"),&Area::_body_enter_tree); + ObjectTypeDB::bind_method(_MD("_body_exit_tree","id"),&Area::_body_exit_tree); ObjectTypeDB::bind_method(_MD("set_space_override_mode","enable"),&Area::set_space_override_mode); ObjectTypeDB::bind_method(_MD("get_space_override_mode"),&Area::get_space_override_mode); diff --git a/scene/3d/area.h b/scene/3d/area.h index 5558e2c719..96b8585338 100644 --- a/scene/3d/area.h +++ b/scene/3d/area.h @@ -56,8 +56,8 @@ private: void _body_inout(int p_status,const RID& p_body, int p_instance, int p_body_shape,int p_area_shape); - void _body_enter_scene(ObjectID p_id); - void _body_exit_scene(ObjectID p_id); + void _body_enter_tree(ObjectID p_id); + void _body_exit_tree(ObjectID p_id); struct ShapePair { @@ -77,7 +77,7 @@ private: struct BodyState { int rc; - bool in_scene; + bool in_tree; VSet<ShapePair> shapes; }; diff --git a/scene/3d/body_shape.cpp b/scene/3d/body_shape.cpp index 947acc6549..287515dce7 100644 --- a/scene/3d/body_shape.cpp +++ b/scene/3d/body_shape.cpp @@ -320,7 +320,7 @@ void CollisionShape::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { unparenting=false; //indicator_instance = VisualServer::get_singleton()->instance_create2(indicator,get_world()->get_scenario()); @@ -331,7 +331,7 @@ void CollisionShape::_notification(int p_what) { _update_body(); } } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { /* if (indicator_instance.is_valid()) { VisualServer::get_singleton()->free(indicator_instance); indicator_instance=RID(); diff --git a/scene/3d/bone_attachment.cpp b/scene/3d/bone_attachment.cpp index cbc4abb7a9..6bbb957d25 100644 --- a/scene/3d/bone_attachment.cpp +++ b/scene/3d/bone_attachment.cpp @@ -102,12 +102,12 @@ void BoneAttachment::_check_unbind() { void BoneAttachment::set_bone_name(const String& p_name) { - if (is_inside_scene()) + if (is_inside_tree()) _check_unbind(); bone_name=p_name; - if (is_inside_scene()) + if (is_inside_tree()) _check_bind(); } @@ -120,11 +120,11 @@ void BoneAttachment::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { _check_bind(); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { _check_unbind(); } break; diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index ab28c0c8d4..933f270475 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -121,7 +121,7 @@ bool Camera::_get(const StringName& p_name,Variant &r_ret) const { r_ret= int(keep_aspect); else if (p_name=="current") { - if (is_inside_scene() && get_scene()->is_editor_hint()) { + if (is_inside_tree() && get_tree()->is_editor_hint()) { r_ret=current; } else { r_ret=is_current(); @@ -182,7 +182,7 @@ void Camera::_update_camera() { // if (viewport_ptr && is_inside_scene() && is_current()) // viewport_ptr->_camera_transform_changed_notify(); - if (is_inside_scene() && is_current()) { + if (is_inside_tree() && is_current()) { if (viewport_ptr) { viewport_ptr->_camera_transform_changed_notify(); } @@ -309,7 +309,7 @@ void Camera::make_current() { current=true; - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (viewport_ptr) { @@ -324,7 +324,7 @@ void Camera::_camera_make_next_current(Node *p_exclude) { if (this==p_exclude) return; - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (get_viewport()->get_camera()!=NULL) return; @@ -336,14 +336,14 @@ void Camera::_camera_make_next_current(Node *p_exclude) { void Camera::clear_current() { current=false; - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (viewport_ptr) { if (viewport_ptr->get_camera()==this) { viewport_ptr->_set_camera(NULL); //a group is used beause this needs to be in order to be deterministic - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,camera_group,"_camera_make_next_current",this); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,camera_group,"_camera_make_next_current",this); } } @@ -352,7 +352,7 @@ void Camera::clear_current() { bool Camera::is_current() const { - if (is_inside_scene()) { + if (is_inside_tree()) { if (viewport_ptr) return viewport_ptr->get_camera()==this; } else @@ -462,9 +462,9 @@ Vector3 Camera::project_ray_normal(const Point2& p_pos) const { Vector3 Camera::project_local_ray_normal(const Point2& p_pos) const { - if (!is_inside_scene()) { + if (!is_inside_tree()) { ERR_EXPLAIN("Camera is not inside scene."); - ERR_FAIL_COND_V(!is_inside_scene(),Vector3()); + ERR_FAIL_COND_V(!is_inside_tree(),Vector3()); } @@ -496,9 +496,9 @@ Vector3 Camera::project_local_ray_normal(const Point2& p_pos) const { Vector3 Camera::project_ray_origin(const Point2& p_pos) const { - if (!is_inside_scene()) { + if (!is_inside_tree()) { ERR_EXPLAIN("Camera is not inside scene."); - ERR_FAIL_COND_V(!is_inside_scene(),Vector3()); + ERR_FAIL_COND_V(!is_inside_tree(),Vector3()); } #if 0 @@ -540,9 +540,9 @@ Vector3 Camera::project_ray_origin(const Point2& p_pos) const { Point2 Camera::unproject_position(const Vector3& p_pos) const { - if (!is_inside_scene()) { + if (!is_inside_tree()) { ERR_EXPLAIN("Camera is not inside scene."); - ERR_FAIL_COND_V(!is_inside_scene(),Vector2()); + ERR_FAIL_COND_V(!is_inside_tree(),Vector2()); } Size2 viewport_size = viewport_ptr->get_visible_rect().size; @@ -571,9 +571,9 @@ Point2 Camera::unproject_position(const Vector3& p_pos) const { Vector3 Camera::project_position(const Point2& p_point) const { - if (!is_inside_scene()) { + if (!is_inside_tree()) { ERR_EXPLAIN("Camera is not inside scene."); - ERR_FAIL_COND_V(!is_inside_scene(),Vector3()); + ERR_FAIL_COND_V(!is_inside_tree(),Vector3()); } Size2 viewport_size = viewport_ptr->get_visible_rect().size; diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp index 47d29cec1c..82158405ea 100644 --- a/scene/3d/collision_object.cpp +++ b/scene/3d/collision_object.cpp @@ -199,9 +199,9 @@ void CollisionObject::_mouse_exit() { } void CollisionObject::_update_pickable() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; - bool pickable = ray_pickable && is_inside_scene() && is_visible(); + bool pickable = ray_pickable && is_inside_tree() && is_visible(); if (area) PhysicsServer::get_singleton()->area_set_ray_pickable(rid,pickable); else diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp index 5a613f360a..4ab1a1a1ab 100644 --- a/scene/3d/collision_polygon.cpp +++ b/scene/3d/collision_polygon.cpp @@ -86,7 +86,7 @@ void CollisionPolygon::_notification(int p_what) { switch(p_what) { case NOTIFICATION_TRANSFORM_CHANGED: { - if (!is_inside_scene()) + if (!is_inside_tree()) break; _update_parent(); diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp index f795f935ae..2f35164f49 100644 --- a/scene/3d/interpolated_camera.cpp +++ b/scene/3d/interpolated_camera.cpp @@ -32,9 +32,9 @@ void InterpolatedCamera::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { - if (get_scene()->is_editor_hint() && enabled) + if (get_tree()->is_editor_hint() && enabled) set_fixed_process(false); } break; @@ -109,7 +109,7 @@ void InterpolatedCamera::set_interpolation_enabled(bool p_enable) { return; enabled=p_enable; if (p_enable) { - if (is_inside_scene() && get_scene()->is_editor_hint()) + if (is_inside_tree() && get_tree()->is_editor_hint()) return; set_process(true); } else diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index e51a9764f6..9d959cb0d6 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -432,7 +432,7 @@ void Light::approximate_opengl_attenuation(float p_constant, float p_linear, flo void Light::_update_visibility() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; @@ -440,10 +440,10 @@ bool editor_ok=true; #ifdef TOOLS_ENABLED if (editor_only) { - if (!get_scene()->is_editor_hint()) { + if (!get_tree()->is_editor_hint()) { editor_ok=false; } else { - editor_ok = (get_scene()->get_edited_scene_root() && (this==get_scene()->get_edited_scene_root() || get_owner()==get_scene()->get_edited_scene_root())); + editor_ok = (get_tree()->get_edited_scene_root() && (this==get_tree()->get_edited_scene_root() || get_owner()==get_tree()->get_edited_scene_root())); } } #endif @@ -456,7 +456,7 @@ bool editor_ok=true; void Light::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE || p_what==NOTIFICATION_VISIBILITY_CHANGED) { + if (p_what==NOTIFICATION_ENTER_TREE || p_what==NOTIFICATION_VISIBILITY_CHANGED) { _update_visibility(); } } diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp index 72d63fa006..d7266e5df7 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -126,7 +126,7 @@ void MeshInstance::_resolve_skeleton_path(){ void MeshInstance::set_skeleton_path(const NodePath &p_skeleton) { skeleton_path = p_skeleton; - if (!is_inside_scene()) + if (!is_inside_tree()) return; _resolve_skeleton_path(); } @@ -226,7 +226,7 @@ void MeshInstance::create_convex_collision() { void MeshInstance::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { _resolve_skeleton_path(); } } diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp index db416f24dd..8c52d4c35c 100644 --- a/scene/3d/navigation_mesh.cpp +++ b/scene/3d/navigation_mesh.cpp @@ -114,7 +114,7 @@ void NavigationMeshInstance::set_enabled(bool p_enabled) { return; enabled=p_enabled; - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (!enabled) { @@ -152,7 +152,7 @@ void NavigationMeshInstance::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { Spatial *c=this; while(c) { @@ -178,7 +178,7 @@ void NavigationMeshInstance::_notification(int p_what) { } } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { if (navigation) { diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp index bc5cb1c4a2..8be918fc22 100644 --- a/scene/3d/path.cpp +++ b/scene/3d/path.cpp @@ -26,363 +26,363 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "path.h"
-#include "scene/scene_string_names.h"
-
-void Path::_notification(int p_what) {
-#if 0
- if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_scene() && get_scene()->is_editor_hint()) {
- //draw the curve!!
-
- for(int i=0;i<curve->get_point_count();i++) {
-
- Vector2 prev_p=curve->get_point_pos(i);
-
- for(int j=1;j<=8;j++) {
-
- real_t frac = j/8.0;
- Vector2 p = curve->interpolate(i,frac);
- draw_line(prev_p,p,Color(0.5,0.6,1.0,0.7),2);
- prev_p=p;
- }
- }
- }
-#endif
-}
-
-void Path::_curve_changed() {
-
-
- if (is_inside_scene() && get_scene()->is_editor_hint())
- update_gizmo();
-}
-
-
-void Path::set_curve(const Ref<Curve3D>& p_curve) {
-
- if (curve.is_valid()) {
- curve->disconnect("changed",this,"_curve_changed");
- }
-
- curve=p_curve;
-
- if (curve.is_valid()) {
- curve->connect("changed",this,"_curve_changed");
- }
- _curve_changed();
-
-}
-
-Ref<Curve3D> Path::get_curve() const{
-
- return curve;
-}
-
-void Path::_bind_methods() {
-
- ObjectTypeDB::bind_method(_MD("set_curve","curve:Curve3D"),&Path::set_curve);
- ObjectTypeDB::bind_method(_MD("get_curve:Curve3D","curve"),&Path::get_curve);
- ObjectTypeDB::bind_method(_MD("_curve_changed"),&Path::_curve_changed);
-
- ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve3D"), _SCS("set_curve"),_SCS("get_curve"));
-}
-
-Path::Path() {
-
- set_curve(Ref<Curve3D>( memnew( Curve3D ))); //create one by default
-}
-
-
-//////////////
-
-
-void PathFollow::_update_transform() {
-
-
- if (!path)
- return;
-
- Ref<Curve3D> c =path->get_curve();
- if (!c.is_valid())
- return;
-
-
- float o = offset;
- if (loop)
- o=Math::fposmod(o,c->get_baked_length());
-
- Vector3 pos = c->interpolate_baked(o,cubic);
- Transform t=get_transform();
-
-
- if (rotation_mode!=ROTATION_NONE) {
-
- Vector3 n = (c->interpolate_baked(o+lookahead,cubic)-pos).normalized();
-
- if (rotation_mode==ROTATION_Y) {
-
- n.y=0;
- n.normalize();
- }
-
- if (n.length()<CMP_EPSILON) {//nothing, use previous
- n=-t.get_basis().get_axis(2).normalized();
- }
-
-
- Vector3 up = Vector3(0,1,0);
-
- if (rotation_mode==ROTATION_XYZ) {
-
- float tilt = c->interpolate_baked_tilt(o);
- if (tilt!=0) {
-
- Matrix3 rot(-n,tilt); //remember.. lookat will be znegative.. znegative!! we abide by opengl clan.
- up=rot.xform(up);
- }
- }
-
- t.set_look_at(pos,pos+n,up);
-
- } else {
-
- t.origin=pos;
- }
-
- t.origin+=t.basis.get_axis(0)*h_offset + t.basis.get_axis(1)*v_offset;
- set_transform(t);
-
-}
-
-void PathFollow::_notification(int p_what) {
-
-
- switch(p_what) {
-
- case NOTIFICATION_ENTER_SCENE: {
-
- Node *parent=get_parent();
- if (parent) {
-
- path=parent->cast_to<Path>();
- if (path) {
- _update_transform();
- }
- }
-
- } break;
- case NOTIFICATION_EXIT_SCENE: {
-
-
- path=NULL;
- } break;
- }
-
-}
-
-void PathFollow::set_cubic_interpolation(bool p_enable) {
-
- cubic=p_enable;
-}
-
-bool PathFollow::get_cubic_interpolation() const {
-
- return cubic;
-}
-
-
-bool PathFollow::_set(const StringName& p_name, const Variant& p_value) {
-
- if (p_name==SceneStringNames::get_singleton()->offset) {
- set_offset(p_value);
- } else if (p_name==SceneStringNames::get_singleton()->unit_offset) {
- set_unit_offset(p_value);
- } else if (p_name==SceneStringNames::get_singleton()->rotation_mode) {
- set_rotation_mode(RotationMode(p_value.operator int()));
- } else if (p_name==SceneStringNames::get_singleton()->v_offset) {
- set_v_offset(p_value);
- } else if (p_name==SceneStringNames::get_singleton()->h_offset) {
- set_h_offset(p_value);
- } else if (String(p_name)=="cubic_interp") {
- set_cubic_interpolation(p_value);
- } else if (String(p_name)=="loop") {
- set_loop(p_value);
- } else if (String(p_name)=="lookahead") {
- set_lookahead(p_value);
- } else
- return false;
-
- return true;
-}
-
-bool PathFollow::_get(const StringName& p_name,Variant &r_ret) const{
-
- if (p_name==SceneStringNames::get_singleton()->offset) {
- r_ret=get_offset();
- } else if (p_name==SceneStringNames::get_singleton()->unit_offset) {
- r_ret=get_unit_offset();
- } else if (p_name==SceneStringNames::get_singleton()->rotation_mode) {
- r_ret=get_rotation_mode();
- } else if (p_name==SceneStringNames::get_singleton()->v_offset) {
- r_ret=get_v_offset();
- } else if (p_name==SceneStringNames::get_singleton()->h_offset) {
- r_ret=get_h_offset();
- } else if (String(p_name)=="cubic_interp") {
- r_ret=cubic;
- } else if (String(p_name)=="loop") {
- r_ret=loop;
- } else if (String(p_name)=="lookahead") {
- r_ret=lookahead;
- } else
- return false;
-
- return true;
-
-}
-void PathFollow::_get_property_list( List<PropertyInfo> *p_list) const{
-
- float max=10000;
- if (path && path->get_curve().is_valid())
- max=path->get_curve()->get_baked_length();
- p_list->push_back( PropertyInfo( Variant::REAL, "offset", PROPERTY_HINT_RANGE,"0,"+rtos(max)+",0.01"));
- p_list->push_back( PropertyInfo( Variant::REAL, "unit_offset", PROPERTY_HINT_RANGE,"0,1,0.0001",PROPERTY_USAGE_EDITOR));
- p_list->push_back( PropertyInfo( Variant::REAL, "h_offset") );
- p_list->push_back( PropertyInfo( Variant::REAL, "v_offset") );
- p_list->push_back( PropertyInfo( Variant::INT, "rotation_mode", PROPERTY_HINT_ENUM,"None,Y,XY,XYZ"));
- p_list->push_back( PropertyInfo( Variant::BOOL, "cubic_interp"));
- p_list->push_back( PropertyInfo( Variant::BOOL, "loop"));
- p_list->push_back( PropertyInfo( Variant::REAL, "lookahead",PROPERTY_HINT_RANGE,"0.001,1024.0,0.001"));
-}
-
-
-void PathFollow::_bind_methods() {
-
- ObjectTypeDB::bind_method(_MD("set_offset","offset"),&PathFollow::set_offset);
- ObjectTypeDB::bind_method(_MD("get_offset"),&PathFollow::get_offset);
-
- ObjectTypeDB::bind_method(_MD("set_h_offset","h_offset"),&PathFollow::set_h_offset);
- ObjectTypeDB::bind_method(_MD("get_h_offset"),&PathFollow::get_h_offset);
-
- ObjectTypeDB::bind_method(_MD("set_v_offset","v_offset"),&PathFollow::set_v_offset);
- ObjectTypeDB::bind_method(_MD("get_v_offset"),&PathFollow::get_v_offset);
-
- ObjectTypeDB::bind_method(_MD("set_unit_offset","unit_offset"),&PathFollow::set_unit_offset);
- ObjectTypeDB::bind_method(_MD("get_unit_offset"),&PathFollow::get_unit_offset);
-
- ObjectTypeDB::bind_method(_MD("set_rotation_mode","rotation_mode"),&PathFollow::set_rotation_mode);
- ObjectTypeDB::bind_method(_MD("get_rotation_mode"),&PathFollow::get_rotation_mode);
-
- ObjectTypeDB::bind_method(_MD("set_cubic_interpolation","enable"),&PathFollow::set_cubic_interpolation);
- ObjectTypeDB::bind_method(_MD("get_cubic_interpolation"),&PathFollow::get_cubic_interpolation);
-
- ObjectTypeDB::bind_method(_MD("set_loop","loop"),&PathFollow::set_loop);
- ObjectTypeDB::bind_method(_MD("has_loop"),&PathFollow::has_loop);
-
- BIND_CONSTANT( ROTATION_NONE );
- BIND_CONSTANT( ROTATION_Y );
- BIND_CONSTANT( ROTATION_XY );
- BIND_CONSTANT( ROTATION_XYZ );
-
-}
-
-void PathFollow::set_offset(float p_offset) {
-
- offset=p_offset;
- if (path)
- _update_transform();
- _change_notify("offset");
- _change_notify("unit_offset");
-
-}
-
-void PathFollow::set_h_offset(float p_h_offset) {
-
- h_offset=p_h_offset;
- if (path)
- _update_transform();
-
-}
-
-float PathFollow::get_h_offset() const {
-
- return h_offset;
-}
-
-void PathFollow::set_v_offset(float p_v_offset) {
-
- v_offset=p_v_offset;
- if (path)
- _update_transform();
-
-}
-
-float PathFollow::get_v_offset() const {
-
- return v_offset;
-}
-
-
-float PathFollow::get_offset() const{
-
- return offset;
-}
-
-void PathFollow::set_unit_offset(float p_unit_offset) {
-
- if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length())
- set_offset(p_unit_offset*path->get_curve()->get_baked_length());
-
-}
-
-float PathFollow::get_unit_offset() const{
-
- if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length())
- return get_offset()/path->get_curve()->get_baked_length();
- else
- return 0;
-}
-
-void PathFollow::set_lookahead(float p_lookahead) {
-
- lookahead=p_lookahead;
-
-}
-
-float PathFollow::get_lookahead() const{
-
- return lookahead;
-}
-
-void PathFollow::set_rotation_mode(RotationMode p_rotation_mode) {
-
- rotation_mode=p_rotation_mode;
- _update_transform();
-}
-
-PathFollow::RotationMode PathFollow::get_rotation_mode() const {
-
- return rotation_mode;
-}
-
-void PathFollow::set_loop(bool p_loop) {
-
- loop=p_loop;
-}
-
-bool PathFollow::has_loop() const{
-
- return loop;
-}
-
-
-PathFollow::PathFollow() {
-
- offset=0;
- h_offset=0;
- v_offset=0;
- path=NULL;
- rotation_mode=ROTATION_XYZ;
- cubic=true;
- loop=true;
- lookahead=0.1;
-}
+#include "path.h" +#include "scene/scene_string_names.h" + +void Path::_notification(int p_what) { +#if 0 + if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_scene() && get_scene()->is_editor_hint()) { + //draw the curve!! + + for(int i=0;i<curve->get_point_count();i++) { + + Vector2 prev_p=curve->get_point_pos(i); + + for(int j=1;j<=8;j++) { + + real_t frac = j/8.0; + Vector2 p = curve->interpolate(i,frac); + draw_line(prev_p,p,Color(0.5,0.6,1.0,0.7),2); + prev_p=p; + } + } + } +#endif +} + +void Path::_curve_changed() { + + + if (is_inside_tree() && get_tree()->is_editor_hint()) + update_gizmo(); +} + + +void Path::set_curve(const Ref<Curve3D>& p_curve) { + + if (curve.is_valid()) { + curve->disconnect("changed",this,"_curve_changed"); + } + + curve=p_curve; + + if (curve.is_valid()) { + curve->connect("changed",this,"_curve_changed"); + } + _curve_changed(); + +} + +Ref<Curve3D> Path::get_curve() const{ + + return curve; +} + +void Path::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("set_curve","curve:Curve3D"),&Path::set_curve); + ObjectTypeDB::bind_method(_MD("get_curve:Curve3D","curve"),&Path::get_curve); + ObjectTypeDB::bind_method(_MD("_curve_changed"),&Path::_curve_changed); + + ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve3D"), _SCS("set_curve"),_SCS("get_curve")); +} + +Path::Path() { + + set_curve(Ref<Curve3D>( memnew( Curve3D ))); //create one by default +} + + +////////////// + + +void PathFollow::_update_transform() { + + + if (!path) + return; + + Ref<Curve3D> c =path->get_curve(); + if (!c.is_valid()) + return; + + + float o = offset; + if (loop) + o=Math::fposmod(o,c->get_baked_length()); + + Vector3 pos = c->interpolate_baked(o,cubic); + Transform t=get_transform(); + + + if (rotation_mode!=ROTATION_NONE) { + + Vector3 n = (c->interpolate_baked(o+lookahead,cubic)-pos).normalized(); + + if (rotation_mode==ROTATION_Y) { + + n.y=0; + n.normalize(); + } + + if (n.length()<CMP_EPSILON) {//nothing, use previous + n=-t.get_basis().get_axis(2).normalized(); + } + + + Vector3 up = Vector3(0,1,0); + + if (rotation_mode==ROTATION_XYZ) { + + float tilt = c->interpolate_baked_tilt(o); + if (tilt!=0) { + + Matrix3 rot(-n,tilt); //remember.. lookat will be znegative.. znegative!! we abide by opengl clan. + up=rot.xform(up); + } + } + + t.set_look_at(pos,pos+n,up); + + } else { + + t.origin=pos; + } + + t.origin+=t.basis.get_axis(0)*h_offset + t.basis.get_axis(1)*v_offset; + set_transform(t); + +} + +void PathFollow::_notification(int p_what) { + + + switch(p_what) { + + case NOTIFICATION_ENTER_TREE: { + + Node *parent=get_parent(); + if (parent) { + + path=parent->cast_to<Path>(); + if (path) { + _update_transform(); + } + } + + } break; + case NOTIFICATION_EXIT_TREE: { + + + path=NULL; + } break; + } + +} + +void PathFollow::set_cubic_interpolation(bool p_enable) { + + cubic=p_enable; +} + +bool PathFollow::get_cubic_interpolation() const { + + return cubic; +} + + +bool PathFollow::_set(const StringName& p_name, const Variant& p_value) { + + if (p_name==SceneStringNames::get_singleton()->offset) { + set_offset(p_value); + } else if (p_name==SceneStringNames::get_singleton()->unit_offset) { + set_unit_offset(p_value); + } else if (p_name==SceneStringNames::get_singleton()->rotation_mode) { + set_rotation_mode(RotationMode(p_value.operator int())); + } else if (p_name==SceneStringNames::get_singleton()->v_offset) { + set_v_offset(p_value); + } else if (p_name==SceneStringNames::get_singleton()->h_offset) { + set_h_offset(p_value); + } else if (String(p_name)=="cubic_interp") { + set_cubic_interpolation(p_value); + } else if (String(p_name)=="loop") { + set_loop(p_value); + } else if (String(p_name)=="lookahead") { + set_lookahead(p_value); + } else + return false; + + return true; +} + +bool PathFollow::_get(const StringName& p_name,Variant &r_ret) const{ + + if (p_name==SceneStringNames::get_singleton()->offset) { + r_ret=get_offset(); + } else if (p_name==SceneStringNames::get_singleton()->unit_offset) { + r_ret=get_unit_offset(); + } else if (p_name==SceneStringNames::get_singleton()->rotation_mode) { + r_ret=get_rotation_mode(); + } else if (p_name==SceneStringNames::get_singleton()->v_offset) { + r_ret=get_v_offset(); + } else if (p_name==SceneStringNames::get_singleton()->h_offset) { + r_ret=get_h_offset(); + } else if (String(p_name)=="cubic_interp") { + r_ret=cubic; + } else if (String(p_name)=="loop") { + r_ret=loop; + } else if (String(p_name)=="lookahead") { + r_ret=lookahead; + } else + return false; + + return true; + +} +void PathFollow::_get_property_list( List<PropertyInfo> *p_list) const{ + + float max=10000; + if (path && path->get_curve().is_valid()) + max=path->get_curve()->get_baked_length(); + p_list->push_back( PropertyInfo( Variant::REAL, "offset", PROPERTY_HINT_RANGE,"0,"+rtos(max)+",0.01")); + p_list->push_back( PropertyInfo( Variant::REAL, "unit_offset", PROPERTY_HINT_RANGE,"0,1,0.0001",PROPERTY_USAGE_EDITOR)); + p_list->push_back( PropertyInfo( Variant::REAL, "h_offset") ); + p_list->push_back( PropertyInfo( Variant::REAL, "v_offset") ); + p_list->push_back( PropertyInfo( Variant::INT, "rotation_mode", PROPERTY_HINT_ENUM,"None,Y,XY,XYZ")); + p_list->push_back( PropertyInfo( Variant::BOOL, "cubic_interp")); + p_list->push_back( PropertyInfo( Variant::BOOL, "loop")); + p_list->push_back( PropertyInfo( Variant::REAL, "lookahead",PROPERTY_HINT_RANGE,"0.001,1024.0,0.001")); +} + + +void PathFollow::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("set_offset","offset"),&PathFollow::set_offset); + ObjectTypeDB::bind_method(_MD("get_offset"),&PathFollow::get_offset); + + ObjectTypeDB::bind_method(_MD("set_h_offset","h_offset"),&PathFollow::set_h_offset); + ObjectTypeDB::bind_method(_MD("get_h_offset"),&PathFollow::get_h_offset); + + ObjectTypeDB::bind_method(_MD("set_v_offset","v_offset"),&PathFollow::set_v_offset); + ObjectTypeDB::bind_method(_MD("get_v_offset"),&PathFollow::get_v_offset); + + ObjectTypeDB::bind_method(_MD("set_unit_offset","unit_offset"),&PathFollow::set_unit_offset); + ObjectTypeDB::bind_method(_MD("get_unit_offset"),&PathFollow::get_unit_offset); + + ObjectTypeDB::bind_method(_MD("set_rotation_mode","rotation_mode"),&PathFollow::set_rotation_mode); + ObjectTypeDB::bind_method(_MD("get_rotation_mode"),&PathFollow::get_rotation_mode); + + ObjectTypeDB::bind_method(_MD("set_cubic_interpolation","enable"),&PathFollow::set_cubic_interpolation); + ObjectTypeDB::bind_method(_MD("get_cubic_interpolation"),&PathFollow::get_cubic_interpolation); + + ObjectTypeDB::bind_method(_MD("set_loop","loop"),&PathFollow::set_loop); + ObjectTypeDB::bind_method(_MD("has_loop"),&PathFollow::has_loop); + + BIND_CONSTANT( ROTATION_NONE ); + BIND_CONSTANT( ROTATION_Y ); + BIND_CONSTANT( ROTATION_XY ); + BIND_CONSTANT( ROTATION_XYZ ); + +} + +void PathFollow::set_offset(float p_offset) { + + offset=p_offset; + if (path) + _update_transform(); + _change_notify("offset"); + _change_notify("unit_offset"); + +} + +void PathFollow::set_h_offset(float p_h_offset) { + + h_offset=p_h_offset; + if (path) + _update_transform(); + +} + +float PathFollow::get_h_offset() const { + + return h_offset; +} + +void PathFollow::set_v_offset(float p_v_offset) { + + v_offset=p_v_offset; + if (path) + _update_transform(); + +} + +float PathFollow::get_v_offset() const { + + return v_offset; +} + + +float PathFollow::get_offset() const{ + + return offset; +} + +void PathFollow::set_unit_offset(float p_unit_offset) { + + if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length()) + set_offset(p_unit_offset*path->get_curve()->get_baked_length()); + +} + +float PathFollow::get_unit_offset() const{ + + if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length()) + return get_offset()/path->get_curve()->get_baked_length(); + else + return 0; +} + +void PathFollow::set_lookahead(float p_lookahead) { + + lookahead=p_lookahead; + +} + +float PathFollow::get_lookahead() const{ + + return lookahead; +} + +void PathFollow::set_rotation_mode(RotationMode p_rotation_mode) { + + rotation_mode=p_rotation_mode; + _update_transform(); +} + +PathFollow::RotationMode PathFollow::get_rotation_mode() const { + + return rotation_mode; +} + +void PathFollow::set_loop(bool p_loop) { + + loop=p_loop; +} + +bool PathFollow::has_loop() const{ + + return loop; +} + + +PathFollow::PathFollow() { + + offset=0; + h_offset=0; + v_offset=0; + path=NULL; + rotation_mode=ROTATION_XYZ; + cubic=true; + loop=true; + lookahead=0.1; +} diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 15ec60514a..a80fdce64c 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -193,7 +193,7 @@ StaticBody::~StaticBody() { -void RigidBody::_body_enter_scene(ObjectID p_id) { +void RigidBody::_body_enter_tree(ObjectID p_id) { Object *obj = ObjectDB::get_instance(p_id); Node *node = obj ? obj->cast_to<Node>() : NULL; @@ -201,9 +201,9 @@ void RigidBody::_body_enter_scene(ObjectID p_id) { Map<ObjectID,BodyState>::Element *E=contact_monitor->body_map.find(p_id); ERR_FAIL_COND(!E); - ERR_FAIL_COND(E->get().in_scene); + ERR_FAIL_COND(E->get().in_tree); - E->get().in_scene=true; + E->get().in_tree=true; emit_signal(SceneStringNames::get_singleton()->body_enter,node); for(int i=0;i<E->get().shapes.size();i++) { @@ -213,15 +213,15 @@ void RigidBody::_body_enter_scene(ObjectID p_id) { } -void RigidBody::_body_exit_scene(ObjectID p_id) { +void RigidBody::_body_exit_tree(ObjectID p_id) { Object *obj = ObjectDB::get_instance(p_id); Node *node = obj ? obj->cast_to<Node>() : NULL; ERR_FAIL_COND(!node); Map<ObjectID,BodyState>::Element *E=contact_monitor->body_map.find(p_id); ERR_FAIL_COND(!E); - ERR_FAIL_COND(!E->get().in_scene); - E->get().in_scene=false; + ERR_FAIL_COND(!E->get().in_tree); + E->get().in_tree=false; emit_signal(SceneStringNames::get_singleton()->body_exit,node); for(int i=0;i<E->get().shapes.size();i++) { @@ -246,11 +246,11 @@ void RigidBody::_body_inout(int p_status, ObjectID p_instance, int p_body_shape, E = contact_monitor->body_map.insert(objid,BodyState()); //E->get().rc=0; - E->get().in_scene=node && node->is_inside_scene(); + E->get().in_tree=node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_scene,make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene,make_binds(objid)); - if (E->get().in_scene) { + node->connect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree,make_binds(objid)); + node->connect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree,make_binds(objid)); + if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->body_enter,node); } } @@ -261,7 +261,7 @@ void RigidBody::_body_inout(int p_status, ObjectID p_instance, int p_body_shape, E->get().shapes.insert(ShapePair(p_body_shape,p_local_shape)); - if (E->get().in_scene) { + if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->body_enter_shape,objid,node,p_body_shape,p_local_shape); } @@ -272,21 +272,21 @@ void RigidBody::_body_inout(int p_status, ObjectID p_instance, int p_body_shape, if (node) E->get().shapes.erase(ShapePair(p_body_shape,p_local_shape)); - bool in_scene = E->get().in_scene; + bool in_tree = E->get().in_tree; if (E->get().shapes.empty()) { if (node) { - node->disconnect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_scene); - node->disconnect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene); - if (in_scene) + node->disconnect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree); + node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree); + if (in_tree) emit_signal(SceneStringNames::get_singleton()->body_exit,obj); } contact_monitor->body_map.erase(E); } - if (node && in_scene) { + if (node && in_tree) { emit_signal(SceneStringNames::get_singleton()->body_exit_shape,objid,obj,p_body_shape,p_local_shape); } @@ -682,8 +682,8 @@ void RigidBody::_bind_methods() { ObjectTypeDB::bind_method(_MD("is_able_to_sleep"),&RigidBody::is_able_to_sleep); ObjectTypeDB::bind_method(_MD("_direct_state_changed"),&RigidBody::_direct_state_changed); - ObjectTypeDB::bind_method(_MD("_body_enter_scene"),&RigidBody::_body_enter_scene); - ObjectTypeDB::bind_method(_MD("_body_exit_scene"),&RigidBody::_body_exit_scene); + ObjectTypeDB::bind_method(_MD("_body_enter_tree"),&RigidBody::_body_enter_tree); + ObjectTypeDB::bind_method(_MD("_body_exit_tree"),&RigidBody::_body_exit_tree); ObjectTypeDB::bind_method(_MD("set_axis_lock","axis_lock"),&RigidBody::set_axis_lock); ObjectTypeDB::bind_method(_MD("get_axis_lock"),&RigidBody::get_axis_lock); @@ -792,7 +792,7 @@ Vector3 KinematicBody::move(const Vector3& p_motion) { colliding=false; - ERR_FAIL_COND_V(!is_inside_scene(),Vector3()); + ERR_FAIL_COND_V(!is_inside_tree(),Vector3()); PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(get_world()->get_space()); ERR_FAIL_COND_V(!dss,Vector3()); const int max_shapes=32; @@ -989,7 +989,7 @@ Vector3 KinematicBody::move_to(const Vector3& p_position) { bool KinematicBody::can_move_to(const Vector3& p_position, bool p_discrete) { - ERR_FAIL_COND_V(!is_inside_scene(),false); + ERR_FAIL_COND_V(!is_inside_tree(),false); PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(get_world()->get_space()); ERR_FAIL_COND_V(!dss,false); @@ -1029,7 +1029,7 @@ bool KinematicBody::can_move_to(const Vector3& p_position, bool p_discrete) { bool KinematicBody::is_colliding() const { - ERR_FAIL_COND_V(!is_inside_scene(),false); + ERR_FAIL_COND_V(!is_inside_tree(),false); return colliding; } diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h index a19ad48c87..f9f028e20d 100644 --- a/scene/3d/physics_body.h +++ b/scene/3d/physics_body.h @@ -163,7 +163,7 @@ private: struct BodyState { //int rc; - bool in_scene; + bool in_tree; VSet<ShapePair> shapes; }; @@ -176,8 +176,8 @@ private: ContactMonitor *contact_monitor; - void _body_enter_scene(ObjectID p_id); - void _body_exit_scene(ObjectID p_id); + void _body_enter_tree(ObjectID p_id); + void _body_exit_tree(ObjectID p_id); void _body_inout(int p_status, ObjectID p_instance, int p_body_shape,int p_local_shape); diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp index 8a79e17d87..8d9257a273 100644 --- a/scene/3d/physics_joint.cpp +++ b/scene/3d/physics_joint.cpp @@ -42,7 +42,7 @@ void Joint::_update_joint(bool p_only_free) { bb=RID(); } - if (p_only_free || !is_inside_scene()) + if (p_only_free || !is_inside_tree()) return; Node *node_a = has_node( get_node_a() ) ? get_node( get_node_a() ) : (Node*)NULL; @@ -131,7 +131,7 @@ void Joint::_notification(int p_what) { case NOTIFICATION_READY: { _update_joint(); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { if (joint.is_valid()) { _update_joint(true); PhysicsServer::get_singleton()->free(joint); diff --git a/scene/3d/proximity_group.cpp b/scene/3d/proximity_group.cpp index b3378c7698..a30a23aa53 100644 --- a/scene/3d/proximity_group.cpp +++ b/scene/3d/proximity_group.cpp @@ -119,7 +119,7 @@ void ProximityGroup::_notification(int what) { switch (what) { - case NOTIFICATION_EXIT_SCENE: + case NOTIFICATION_EXIT_TREE: ++group_version; clear_groups(); break; @@ -135,7 +135,7 @@ void ProximityGroup::broadcast(String p_name, Variant p_params) { E = groups.front(); while (E) { - get_scene()->call_group(SceneMainLoop::GROUP_CALL_DEFAULT, E->key(), "_proximity_group_broadcast", p_name, p_params); + get_tree()->call_group(SceneTree::GROUP_CALL_DEFAULT, E->key(), "_proximity_group_broadcast", p_name, p_params); E = E->next(); }; diff --git a/scene/3d/quad.cpp b/scene/3d/quad.cpp index 78dd56141c..8ee232fef4 100644 --- a/scene/3d/quad.cpp +++ b/scene/3d/quad.cpp @@ -31,7 +31,7 @@ void Quad::_update() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; Vector3 normal; @@ -171,14 +171,14 @@ void Quad::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { if (pending_update) _update(); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { pending_update=true; diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp index e36e2da14f..6bc0c677c0 100644 --- a/scene/3d/ray_cast.cpp +++ b/scene/3d/ray_cast.cpp @@ -33,7 +33,7 @@ void RayCast::set_cast_to(const Vector3& p_point) { cast_to=p_point; - if (is_inside_scene() && get_scene()->is_editor_hint()) + if (is_inside_tree() && get_tree()->is_editor_hint()) update_gizmo(); } @@ -72,7 +72,7 @@ Vector3 RayCast::get_collision_normal() const{ void RayCast::set_enabled(bool p_enabled) { enabled=p_enabled; - if (is_inside_scene() && !get_scene()->is_editor_hint()) + if (is_inside_tree() && !get_tree()->is_editor_hint()) set_fixed_process(p_enabled); if (!p_enabled) collided=false; @@ -91,9 +91,9 @@ void RayCast::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { - if (enabled && !get_scene()->is_editor_hint()) { + if (enabled && !get_tree()->is_editor_hint()) { set_fixed_process(true); Node *p = get_parent(); while( p && p->cast_to<Spatial>() ) { @@ -113,7 +113,7 @@ void RayCast::_notification(int p_what) { } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { if (enabled) { set_fixed_process(false); diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp index fa1d3ecf6b..3f9e6c7f13 100644 --- a/scene/3d/room_instance.cpp +++ b/scene/3d/room_instance.cpp @@ -147,7 +147,7 @@ void Room::set_room( const Ref<RoomBounds>& p_room ) { set_base(RID()); } - if (!is_inside_scene()) + if (!is_inside_tree()) return; diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index 737f7d2dce..f53ee7d6bf 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -243,10 +243,10 @@ void Skeleton::set_bone_global_pose(int p_bone,const Transform& p_pose) { ERR_FAIL_INDEX(p_bone,bones.size()); if (bones[p_bone].parent==-1) { - set_bone_pose(p_bone,bones[p_bone].rest.inverse() * p_pose); + set_bone_pose(p_bone,bones[p_bone].rest_global_inverse * p_pose); //fast } else { - set_bone_pose(p_bone, bones[p_bone].rest.inverse() * (get_bone_global_pose(bones[p_bone].parent).affine_inverse() * p_pose)); + set_bone_pose(p_bone, bones[p_bone].rest.affine_inverse() * (get_bone_global_pose(bones[p_bone].parent).affine_inverse() * p_pose)); //slow } @@ -404,7 +404,7 @@ void Skeleton::clear_bones() { void Skeleton::set_bone_pose(int p_bone, const Transform& p_pose) { ERR_FAIL_INDEX( p_bone, bones.size() ); - ERR_FAIL_COND( !is_inside_scene() ); + ERR_FAIL_COND( !is_inside_tree() ); bones[p_bone].pose=p_pose; @@ -442,7 +442,7 @@ void Skeleton::_make_dirty() { if (dirty) return; - if (!is_inside_scene()) { + if (!is_inside_tree()) { dirty=true; return; } diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index d304095d33..a5b009823c 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -76,7 +76,7 @@ void Spatial::_notify_dirty() { if (!data.ignore_notification && !xform_change.in_list()) { - get_scene()->xform_change_list.add(&xform_change); + get_tree()->xform_change_list.add(&xform_change); } } @@ -91,7 +91,7 @@ void Spatial::_update_local_transform() const { } void Spatial::_propagate_transform_changed(Spatial *p_origin) { - if (!is_inside_scene()) { + if (!is_inside_tree()) { return; } @@ -110,7 +110,7 @@ void Spatial::_propagate_transform_changed(Spatial *p_origin) { if (!data.ignore_notification && !xform_change.in_list()) { - get_scene()->xform_change_list.add(&xform_change); + get_tree()->xform_change_list.add(&xform_change); } data.dirty|=DIRTY_GLOBAL; @@ -121,7 +121,7 @@ void Spatial::_propagate_transform_changed(Spatial *p_origin) { void Spatial::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { Node *p = get_parent(); if (p) @@ -132,7 +132,7 @@ void Spatial::_notification(int p_what) { else data.C=NULL; - if (data.toplevel && !get_scene()->is_editor_hint()) { + if (data.toplevel && !get_tree()->is_editor_hint()) { if (data.parent) { data.local_transform = data.parent->get_global_transform() * get_transform(); @@ -147,11 +147,11 @@ void Spatial::_notification(int p_what) { notification(NOTIFICATION_ENTER_WORLD); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { notification(NOTIFICATION_EXIT_WORLD,true); if (xform_change.in_list()) - get_scene()->xform_change_list.remove(&xform_change); + get_tree()->xform_change_list.remove(&xform_change); if (data.C) data.parent->data.children.erase(data.C); data.parent=NULL; @@ -177,10 +177,10 @@ void Spatial::_notification(int p_what) { get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world,NULL,0); } #ifdef TOOLS_ENABLED - if (get_scene()->is_editor_hint()) { + if (get_tree()->is_editor_hint()) { // get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,SceneStringNames::get_singleton()->_spatial_editor_group,SceneStringNames::get_singleton()->_request_gizmo,this); - get_scene()->call_group(0,SceneStringNames::get_singleton()->_spatial_editor_group,SceneStringNames::get_singleton()->_request_gizmo,this); + get_tree()->call_group(0,SceneStringNames::get_singleton()->_spatial_editor_group,SceneStringNames::get_singleton()->_request_gizmo,this); if (!data.gizmo_disabled) { if (data.gizmo.is_valid()) @@ -257,7 +257,7 @@ Transform Spatial::get_transform() const { } Transform Spatial::get_global_transform() const { - ERR_FAIL_COND_V(!is_inside_scene(), Transform()); + ERR_FAIL_COND_V(!is_inside_tree(), Transform()); if (data.dirty & DIRTY_GLOBAL) { @@ -460,7 +460,7 @@ void Spatial::set_as_toplevel(bool p_enabled) { if (data.toplevel==p_enabled) return; - if (is_inside_scene() && !get_scene()->is_editor_hint()) { + if (is_inside_tree() && !get_tree()->is_editor_hint()) { if (p_enabled) set_transform(get_global_transform()); @@ -537,7 +537,7 @@ void Spatial::show() { data.visible=true; - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (!data.parent || is_visible()) { diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h index 7036ef63ca..49ecf5779b 100644 --- a/scene/3d/spatial.h +++ b/scene/3d/spatial.h @@ -130,7 +130,7 @@ public: enum { - NOTIFICATION_TRANSFORM_CHANGED=SceneMainLoop::NOTIFICATION_TRANSFORM_CHANGED, + NOTIFICATION_TRANSFORM_CHANGED=SceneTree::NOTIFICATION_TRANSFORM_CHANGED, NOTIFICATION_ENTER_WORLD=41, NOTIFICATION_EXIT_WORLD=42, NOTIFICATION_VISIBILITY_CHANGED=43, diff --git a/scene/3d/spatial_stream_player.cpp b/scene/3d/spatial_stream_player.cpp index 25448498cb..51009662d6 100644 --- a/scene/3d/spatial_stream_player.cpp +++ b/scene/3d/spatial_stream_player.cpp @@ -74,7 +74,7 @@ Ref<AudioStream> SpatialStreamPlayer::get_stream() const { void SpatialStreamPlayer::play() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (stream.is_null()) return; @@ -89,7 +89,7 @@ void SpatialStreamPlayer::play() { void SpatialStreamPlayer::stop() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (stream.is_null()) return; diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 334a15e724..a6a8919d13 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -37,7 +37,7 @@ void SpriteBase3D::_propagate_color_changed() { void SpriteBase3D::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { if (!pending_update) _im_update(); @@ -52,7 +52,7 @@ void SpriteBase3D::_notification(int p_what) { } } - if (p_what==NOTIFICATION_EXIT_SCENE) { + if (p_what==NOTIFICATION_EXIT_TREE) { if (parent_sprite) { diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp index 4cf905e4ee..ba30c118f0 100644 --- a/scene/3d/vehicle_body.cpp +++ b/scene/3d/vehicle_body.cpp @@ -57,7 +57,7 @@ public: void VehicleWheel::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { if (!get_parent()) return; @@ -73,7 +73,7 @@ void VehicleWheel::_notification(int p_what) { m_wheelAxleCS = get_transform().basis.get_axis(Vector3::AXIS_X).normalized(); } - if (p_what==NOTIFICATION_EXIT_SCENE) { + if (p_what==NOTIFICATION_EXIT_TREE) { if (!get_parent()) return; diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp index 60e311cefe..d4ef2931e9 100644 --- a/scene/3d/visibility_notifier.cpp +++ b/scene/3d/visibility_notifier.cpp @@ -183,7 +183,7 @@ void VisibilityEnabler::_find_nodes(Node* p_node) { if (add) { - p_node->connect(SceneStringNames::get_singleton()->exit_scene,this,"_node_removed",varray(p_node),CONNECT_ONESHOT); + p_node->connect(SceneStringNames::get_singleton()->exit_tree,this,"_node_removed",varray(p_node),CONNECT_ONESHOT); nodes[p_node]=meta; _change_node_state(p_node,false); } @@ -200,9 +200,9 @@ void VisibilityEnabler::_find_nodes(Node* p_node) { void VisibilityEnabler::_notification(int p_what){ - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { - if (get_scene()->is_editor_hint()) + if (get_tree()->is_editor_hint()) return; @@ -215,9 +215,9 @@ void VisibilityEnabler::_notification(int p_what){ } - if (p_what==NOTIFICATION_EXIT_SCENE) { + if (p_what==NOTIFICATION_EXIT_TREE) { - if (get_scene()->is_editor_hint()) + if (get_tree()->is_editor_hint()) return; @@ -228,7 +228,7 @@ void VisibilityEnabler::_notification(int p_what){ if (!visible) _change_node_state(E->key(),true); - E->key()->disconnect(SceneStringNames::get_singleton()->exit_scene,this,"_node_removed"); + E->key()->disconnect(SceneStringNames::get_singleton()->exit_tree,this,"_node_removed"); } nodes.clear(); @@ -271,7 +271,7 @@ void VisibilityEnabler::_node_removed(Node* p_node) { if (!visible) _change_node_state(p_node,true); - p_node->disconnect(SceneStringNames::get_singleton()->exit_scene,this,"_node_removed"); + p_node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,"_node_removed"); nodes.erase(p_node); } diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 398fbdea82..5b40a4d7e5 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -257,7 +257,7 @@ void GeometryInstance::_find_baked_light() { void GeometryInstance::_update_visibility() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; _change_notify("geometry/visible"); diff --git a/scene/animation/animation_cache.cpp b/scene/animation/animation_cache.cpp index 38cfe0d8a9..46eb8d7e88 100644 --- a/scene/animation/animation_cache.cpp +++ b/scene/animation/animation_cache.cpp @@ -30,7 +30,7 @@ -void AnimationCache::_node_exit_scene(Node *p_node) { +void AnimationCache::_node_exit_tree(Node *p_node) { //it is one shot, so it disconnects upon arrival @@ -59,7 +59,7 @@ void AnimationCache::_clear_cache() { while(connected_nodes.size()) { - connected_nodes.front()->get()->disconnect("exit_scene",this,"_node_exit_scene"); + connected_nodes.front()->get()->disconnect("exit_tree",this,"_node_exit_tree"); connected_nodes.erase(connected_nodes.front()); } path_cache.clear();; @@ -73,7 +73,7 @@ void AnimationCache::_update_cache() { cache_valid=false; ERR_FAIL_COND(!root); - ERR_FAIL_COND(!root->is_inside_scene()); + ERR_FAIL_COND(!root->is_inside_tree()); ERR_FAIL_COND(animation.is_null()); for(int i=0;i<animation->get_track_count();i++) { @@ -206,7 +206,7 @@ void AnimationCache::_update_cache() { if (!connected_nodes.has(path.node)) { connected_nodes.insert(path.node); - path.node->connect("exit_scene",this,"_node_exit_scene",Node::make_binds(path.node),CONNECT_ONESHOT); + path.node->connect("exit_tree",this,"_node_exit_tree",Node::make_binds(path.node),CONNECT_ONESHOT); } @@ -368,7 +368,7 @@ void AnimationCache::set_animation(const Ref<Animation>& p_animation) { void AnimationCache::_bind_methods() { - ObjectTypeDB::bind_method(_MD("_node_exit_scene"),&AnimationCache::_node_exit_scene); + ObjectTypeDB::bind_method(_MD("_node_exit_tree"),&AnimationCache::_node_exit_tree); ObjectTypeDB::bind_method(_MD("_animation_changed"),&AnimationCache::_animation_changed); } diff --git a/scene/animation/animation_cache.h b/scene/animation/animation_cache.h index 72ee8f1860..d00b122faa 100644 --- a/scene/animation/animation_cache.h +++ b/scene/animation/animation_cache.h @@ -58,7 +58,7 @@ class AnimationCache : public Object { bool cache_dirty; bool cache_valid; - void _node_exit_scene(Node *p_node); + void _node_exit_tree(Node *p_node); void _clear_cache(); void _update_cache(); diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 9a3c7e71ec..2fbbd54d9f 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -189,7 +189,7 @@ void AnimationPlayer::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { if (!processing) { //make sure that a previous process state was not saved @@ -202,7 +202,7 @@ void AnimationPlayer::_notification(int p_what) { } break; case NOTIFICATION_READY: { - if (!get_scene()->is_editor_hint() && animation_set.has(autoplay)) { + if (!get_tree()->is_editor_hint() && animation_set.has(autoplay)) { play(autoplay); } } break; @@ -221,7 +221,7 @@ void AnimationPlayer::_notification(int p_what) { if (processing) _animation_process( get_fixed_process_delta_time() ); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { stop_all(); clear_caches(); @@ -261,8 +261,8 @@ void AnimationPlayer::_generate_node_caches(AnimationData* p_anim) { } { - if (!child->is_connected("exit_scene",this,"_node_removed")) - child->connect("exit_scene",this,"_node_removed",make_binds(child),CONNECT_ONESHOT); + if (!child->is_connected("exit_tree",this,"_node_removed")) + child->connect("exit_tree",this,"_node_removed",make_binds(child),CONNECT_ONESHOT); } TrackNodeCacheKey key; @@ -348,7 +348,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData* p_anim,float p Animation *a=p_anim->animation.operator->(); - bool can_call = is_inside_scene() && !get_scene()->is_editor_hint(); + bool can_call = is_inside_tree() && !get_tree()->is_editor_hint(); for (int i=0;i<a->get_track_count();i++) { @@ -922,7 +922,7 @@ void AnimationPlayer::play(const StringName& p_name, float p_custom_blend, float _set_process(true); // always process when starting an animation playing = true; - if (is_inside_scene() && get_scene()->is_editor_hint()) + if (is_inside_tree() && get_tree()->is_editor_hint()) return; // no next in this case diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index 2d1821bc5c..b55cc0d1a3 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -1586,7 +1586,7 @@ void AnimationTreePlayer::_update_sources() { if (master==NodePath()) return; - if (!is_inside_scene()) + if (!is_inside_tree()) return; Node *m = get_node(master); diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 7e7d57c3c2..59793815f5 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -75,7 +75,7 @@ void Tween::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { if (!processing) { //make sure that a previous process state was not saved @@ -102,7 +102,7 @@ void Tween::_notification(int p_what) { if (processing) _tween_process( get_fixed_process_delta_time() ); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { stop_all(); } break; diff --git a/scene/audio/event_player.cpp b/scene/audio/event_player.cpp index e5b2be53ca..dc46f4711c 100644 --- a/scene/audio/event_player.cpp +++ b/scene/audio/event_player.cpp @@ -33,13 +33,13 @@ void EventPlayer::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { //set_idle_process(false); //don't annoy - if (playback.is_valid() && autoplay && !get_scene()->is_editor_hint()) + if (playback.is_valid() && autoplay && !get_tree()->is_editor_hint()) play(); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { stop(); //wathever it may be doing, stop } break; @@ -75,7 +75,7 @@ Ref<EventStream> EventPlayer::get_stream() const { void EventPlayer::play() { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); if (playback.is_null()) { return; } @@ -93,7 +93,7 @@ void EventPlayer::play() { void EventPlayer::stop() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (playback.is_null()) return; @@ -241,7 +241,7 @@ bool EventPlayer::is_paused() const { void EventPlayer::_set_play(bool p_play) { _play=p_play; - if (is_inside_scene()) { + if (is_inside_tree()) { if(_play) play(); else diff --git a/scene/audio/sound_room_params.cpp b/scene/audio/sound_room_params.cpp index 3e0a64b3f1..01d373ebff 100644 --- a/scene/audio/sound_room_params.cpp +++ b/scene/audio/sound_room_params.cpp @@ -53,7 +53,7 @@ void SoundRoomParams::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { #if 0 Node *n=this; Room *room_instance=NULL; @@ -81,7 +81,7 @@ void SoundRoomParams::_notification(int p_what) { #endif } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { room=RID(); diff --git a/scene/audio/stream_player.cpp b/scene/audio/stream_player.cpp index 5084c1295b..73025fb52c 100644 --- a/scene/audio/stream_player.cpp +++ b/scene/audio/stream_player.cpp @@ -33,13 +33,13 @@ void StreamPlayer::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { //set_idle_process(false); //don't annoy - if (stream.is_valid() && autoplay && !get_scene()->is_editor_hint()) + if (stream.is_valid() && autoplay && !get_tree()->is_editor_hint()) play(); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { stop(); //wathever it may be doing, stop } break; @@ -75,7 +75,7 @@ Ref<AudioStream> StreamPlayer::get_stream() const { void StreamPlayer::play() { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); if (stream.is_null()) return; if (stream->is_playing()) @@ -91,7 +91,7 @@ void StreamPlayer::play() { void StreamPlayer::stop() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (stream.is_null()) return; @@ -214,7 +214,7 @@ bool StreamPlayer::is_paused() const { void StreamPlayer::_set_play(bool p_play) { _play=p_play; - if (is_inside_scene()) { + if (is_inside_tree()) { if(_play) play(); else diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index cf9fcfa72a..442fd286dd 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -211,7 +211,7 @@ void BaseButton::_notification(int p_what) { } } - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { CanvasItem *ci=this; while(ci) { @@ -227,7 +227,7 @@ void BaseButton::_notification(int p_what) { } } - if (p_what==NOTIFICATION_EXIT_SCENE) { + if (p_what==NOTIFICATION_EXIT_TREE) { if (group) group->_remove_button(this); diff --git a/scene/gui/button_group.cpp b/scene/gui/button_group.cpp index 58b323c24d..94cc0a8d51 100644 --- a/scene/gui/button_group.cpp +++ b/scene/gui/button_group.cpp @@ -117,7 +117,7 @@ BaseButton *ButtonGroup::get_focused_button() const{ int ButtonGroup::get_pressed_button_index() const { //in tree order, this is bizarre - ERR_FAIL_COND_V(!is_inside_scene(),0); + ERR_FAIL_COND_V(!is_inside_tree(),0); BaseButton *pressed = get_pressed_button(); if (!pressed) diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index 6543a0388d..bb61723acf 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -67,7 +67,7 @@ void Container::remove_child_notify(Node *p_child) { void Container::_sort_children() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; notification(NOTIFICATION_SORT_CHILDREN); @@ -101,7 +101,7 @@ void Container::fit_child_in_rect(Control *p_child,const Rect2& p_rect) { void Container::queue_sort() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (pending_sort) @@ -115,7 +115,7 @@ void Container::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { pending_sort=false; queue_sort(); } break; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index fc24294a70..aea0aacf42 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -183,7 +183,7 @@ bool Control::_set(const StringName& p_name, const Variant& p_value) { void Control::_update_minimum_size() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; data.pending_min_size_update=false; @@ -341,7 +341,7 @@ void Control::_notification(int p_notification) { switch(p_notification) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { if (data.window==this) { @@ -365,7 +365,7 @@ void Control::_notification(int p_notification) { window->drag_attempted=false; window->drag_preview=NULL; - if (get_scene()->is_editor_hint()) { + if (get_tree()->is_editor_hint()) { Node *n = this; while(n) { @@ -385,7 +385,7 @@ void Control::_notification(int p_notification) { _size_changed(); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { if (data.window) { @@ -630,7 +630,7 @@ void Control::_notification(int p_notification) { } } break; - case SceneMainLoop::NOTIFICATION_WM_UNFOCUS_REQUEST: { + case SceneTree::NOTIFICATION_WM_UNFOCUS_REQUEST: { if (!window) return; @@ -710,7 +710,7 @@ void Control::drop_data(const Point2& p_point,const Variant& p_data){ void Control::force_drag(const Variant& p_data,Control *p_control) { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND(!data.window); ERR_FAIL_COND(p_data.get_type()==Variant::NIL); @@ -728,8 +728,8 @@ void Control::set_drag_preview(Control *p_control) { ERR_FAIL_NULL(p_control); ERR_FAIL_COND( !((Object*)p_control)->cast_to<Control>()); - ERR_FAIL_COND(!is_inside_scene() || !data.window); - ERR_FAIL_COND(p_control->is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree() || !data.window); + ERR_FAIL_COND(p_control->is_inside_tree()); ERR_FAIL_COND(p_control->get_parent()!=NULL); if (data.window->window->drag_preview) { @@ -963,8 +963,8 @@ void Control::_window_input_event(InputEvent p_event) { if (top->data.modal_exclusive) { //cancel event, sorry, modal exclusive EATS UP ALL - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); - get_scene()->set_input_as_handled(); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->set_input_as_handled(); return; // no one gets the event if exclusive NO ONE } @@ -1034,8 +1034,8 @@ void Control::_window_input_event(InputEvent p_event) { _window_call_input(window->mouse_focus,p_event); } - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); - get_scene()->set_input_as_handled(); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->set_input_as_handled(); } else { @@ -1079,8 +1079,8 @@ void Control::_window_input_event(InputEvent p_event) { } - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); - get_scene()->set_input_as_handled(); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->set_input_as_handled(); } } break; @@ -1147,7 +1147,7 @@ void Control::_window_input_event(InputEvent p_event) { window->mouse_over=over; - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_cancel_tooltip"); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_tooltip"); if (window->drag_preview) { window->drag_preview->set_pos(pos); @@ -1203,8 +1203,8 @@ void Control::_window_input_event(InputEvent p_event) { - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); - get_scene()->set_input_as_handled(); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->set_input_as_handled(); if (window->drag_data.get_type()!=Variant::NIL && p_event.mouse_motion.button_mask&BUTTON_MASK_LEFT) { @@ -1230,7 +1230,7 @@ void Control::_window_input_event(InputEvent p_event) { if (window->key_event_accepted) { - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); break; } } @@ -1290,7 +1290,7 @@ void Control::_window_input_event(InputEvent p_event) { if (next) { next->grab_focus(); - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); } } @@ -1305,7 +1305,7 @@ Control *Control::get_window() const { bool Control::is_window() const { - return (is_inside_scene() && window); + return (is_inside_tree() && window); } @@ -1607,7 +1607,7 @@ bool Control::has_constant(const StringName& p_name,const StringName& p_type) co Size2 Control::get_parent_area_size() const { - ERR_FAIL_COND_V(!is_inside_scene(),Size2()); + ERR_FAIL_COND_V(!is_inside_tree(),Size2()); Size2 parent_size; @@ -1624,7 +1624,7 @@ Size2 Control::get_parent_area_size() const { void Control::_size_changed() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; Size2 parent_size = get_parent_area_size(); @@ -1677,7 +1677,7 @@ void Control::_size_changed() { float Control::_get_parent_range(int p_idx) const { - if (!is_inside_scene()) { + if (!is_inside_tree()) { return 1.0; @@ -1748,7 +1748,7 @@ float Control::_a2s(float p_val, AnchorType p_anchor,float p_range) const { void Control::set_anchor(Margin p_margin,AnchorType p_anchor) { - if (!is_inside_scene()) { + if (!is_inside_tree()) { data.anchor[p_margin]=p_anchor; } else { @@ -1980,7 +1980,7 @@ void Control::add_constant_override(const StringName& p_name, int p_constant) { void Control::set_focus_mode(FocusMode p_focus_mode) { - if (is_inside_scene() && p_focus_mode == FOCUS_NONE && data.focus_mode!=FOCUS_NONE && has_focus()) + if (is_inside_tree() && p_focus_mode == FOCUS_NONE && data.focus_mode!=FOCUS_NONE && has_focus()) release_focus(); data.focus_mode=p_focus_mode; @@ -2178,7 +2178,7 @@ bool Control::has_focus() const { void Control::grab_focus() { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND(!data.window); if (data.focus_mode==FOCUS_NONE) @@ -2188,7 +2188,7 @@ void Control::grab_focus() { if (data.window->window->key_focus && data.window->window->key_focus==this) return; - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_window_remove_focus"); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_window_remove_focus"); data.window->window->key_focus=this; notification(NOTIFICATION_FOCUS_ENTER); #ifdef DEBUG_ENABLED @@ -2202,13 +2202,13 @@ void Control::grab_focus() { void Control::release_focus() { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND(!data.window); if (!has_focus()) return; - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_window_remove_focus"); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_window_remove_focus"); //data.window->window->key_focus=this; //notification(NOTIFICATION_FOCUS_ENTER); update(); @@ -2217,12 +2217,12 @@ void Control::release_focus() { bool Control::is_toplevel_control() const { - return is_inside_scene() && (!data.parent_canvas_item && !window && is_set_as_toplevel()); + return is_inside_tree() && (!data.parent_canvas_item && !window && is_set_as_toplevel()); } void Control::show_modal(bool p_exclusive) { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND(!data.SI && data.window!=this); ERR_FAIL_COND(!data.window); @@ -2282,7 +2282,7 @@ void Control::_modal_stack_remove() { if (!pfoc) return; - if (!pfoc->is_inside_scene() || !pfoc->is_visible()) + if (!pfoc->is_inside_tree() || !pfoc->is_visible()) return; pfoc->grab_focus(); } else { @@ -2332,13 +2332,13 @@ void Control::set_theme(const Ref<Theme>& p_theme) { void Control::_window_accept_event() { window->key_event_accepted=true; - if (is_inside_scene()) - get_scene()->set_input_as_handled(); + if (is_inside_tree()) + get_tree()->set_input_as_handled(); } void Control::accept_event() { - if (is_inside_scene() && get_window()) + if (is_inside_tree() && get_window()) get_window()->_window_accept_event(); } @@ -2585,7 +2585,7 @@ float Control::get_stretch_ratio() const { void Control::grab_click_focus() { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); if (data.window && data.window->window->mouse_focus) { @@ -2620,7 +2620,7 @@ void Control::grab_click_focus() { void Control::minimum_size_changed() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (data.pending_min_size_update) @@ -2663,7 +2663,7 @@ bool Control::is_stopping_mouse() const { Control *Control::get_focus_owner() const { - ERR_FAIL_COND_V(!is_inside_scene(),NULL); + ERR_FAIL_COND_V(!is_inside_tree(),NULL); ERR_FAIL_COND_V(!window,NULL); return window->key_focus; } diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 90393a1296..a82cfc7ea6 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -93,7 +93,7 @@ void WindowDialog::_notification(int p_what) { } break; case NOTIFICATION_THEME_CHANGED: - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { close_button->set_normal_texture( get_icon("close","WindowDialog")); close_button->set_pressed_texture( get_icon("close","WindowDialog")); diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 36940655d4..d2e1e7f0b9 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -339,7 +339,7 @@ int Label::get_longest_line_width() const { int Label::get_line_count() const { - if (!is_inside_scene()) + if (!is_inside_tree()) return 1; if (word_cache_dirty) const_cast<Label*>(this)->regenerate_word_cache(); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index a77a40327f..68c990033a 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -572,7 +572,7 @@ void LineEdit::set_cursor_pos(int p_pos) { // set_window_pos(cursor_pos-get_window_lengt//h()); // } - if (!is_inside_scene()) { + if (!is_inside_tree()) { window_pos=cursor_pos; return; diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index fa4a313115..78cc1bcdef 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -192,7 +192,7 @@ void OptionButton::_select(int p_idx,bool p_emit) { set_text( popup->get_item_text( current ) ); set_icon( popup->get_item_icon( current ) ); - if (is_inside_scene() && p_emit) + if (is_inside_tree() && p_emit) emit_signal("item_selected",current); } diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index bc0fa9675e..4d0b678925 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -42,7 +42,7 @@ void Range::Shared::emit_value_changed() { for (Set<Range*>::Element *E=owners.front();E;E=E->next()) { Range *r=E->get(); - if (!r->is_inside_scene()) + if (!r->is_inside_tree()) continue; r->_value_changed_notify(); } @@ -59,7 +59,7 @@ void Range::Shared::emit_changed() { for (Set<Range*>::Element *E=owners.front();E;E=E->next()) { Range *r=E->get(); - if (!r->is_inside_scene()) + if (!r->is_inside_tree()) continue; r->_changed_notify(); } diff --git a/scene/gui/reference_frame.cpp b/scene/gui/reference_frame.cpp index 679c2cc1e2..44ba3a8972 100644 --- a/scene/gui/reference_frame.cpp +++ b/scene/gui/reference_frame.cpp @@ -32,9 +32,9 @@ void ReferenceFrame::_notification(int p_what) { if (p_what==NOTIFICATION_DRAW) { - if (!is_inside_scene()) + if (!is_inside_tree()) return; - if (get_scene()->is_editor_hint()) + if (get_tree()->is_editor_hint()) draw_style_box(get_stylebox("border"),Rect2(Point2(),get_size())) ; } } diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index c661a804b3..aaf96114c6 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -293,7 +293,7 @@ void ScrollBar::_notification(int p_what) { } - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { if (has_node(drag_slave_path)) { @@ -303,16 +303,16 @@ void ScrollBar::_notification(int p_what) { if (drag_slave) { drag_slave->connect("input_event",this,"_drag_slave_input"); - drag_slave->connect("exit_scene",this,"_drag_slave_exit",varray(),CONNECT_ONESHOT); + drag_slave->connect("exit_tree",this,"_drag_slave_exit",varray(),CONNECT_ONESHOT); } } - if (p_what==NOTIFICATION_EXIT_SCENE) { + if (p_what==NOTIFICATION_EXIT_TREE) { if (drag_slave) { drag_slave->disconnect("input_event",this,"_drag_slave_input"); - drag_slave->disconnect("exit_scene",this,"_drag_slave_exit"); + drag_slave->disconnect("exit_tree",this,"_drag_slave_exit"); } drag_slave=NULL; @@ -635,18 +635,18 @@ void ScrollBar::_drag_slave_input(const InputEvent& p_input) { void ScrollBar::set_drag_slave(const NodePath& p_path) { - if (is_inside_scene()) { + if (is_inside_tree()) { if (drag_slave) { drag_slave->disconnect("input_event",this,"_drag_slave_input"); - drag_slave->disconnect("exit_scene",this,"_drag_slave_exit"); + drag_slave->disconnect("exit_tree",this,"_drag_slave_exit"); } } drag_slave=NULL; drag_slave_path=p_path; - if (is_inside_scene()) { + if (is_inside_tree()) { if (has_node(p_path)) { Node *n = get_node(p_path); @@ -655,7 +655,7 @@ void ScrollBar::set_drag_slave(const NodePath& p_path) { if (drag_slave) { drag_slave->connect("input_event",this,"_drag_slave_input"); - drag_slave->connect("exit_scene",this,"_drag_slave_exit",varray(),CONNECT_ONESHOT); + drag_slave->connect("exit_tree",this,"_drag_slave_exit",varray(),CONNECT_ONESHOT); } } } diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index c8f9ed16b5..95354df519 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -169,7 +169,7 @@ void ScrollContainer::_update_scrollbar_pos() { void ScrollContainer::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_SCENE || p_what == NOTIFICATION_THEME_CHANGED) { + if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { call_deferred("_update_scrollbar_pos"); }; diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 59f4386996..9ac67e92f5 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -122,7 +122,7 @@ void SpinBox::_notification(int p_what) { //_value_changed(0); - } else if (p_what==NOTIFICATION_ENTER_SCENE) { + } else if (p_what==NOTIFICATION_ENTER_TREE) { _value_changed(0); } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 6aabfa35a8..4a0a77e6db 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -360,7 +360,7 @@ void TextEdit::_update_scrollbars() { void TextEdit::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { _update_caches(); if (cursor_changed_dirty) @@ -1868,7 +1868,7 @@ void TextEdit::_base_insert_text(int p_line, int p_char,const String& p_text,int if (!text_changed_dirty && !setting_text) { - if (is_inside_scene()) + if (is_inside_tree()) MessageQueue::get_singleton()->push_call(this,"_text_changed_emit"); text_changed_dirty=true; } @@ -1921,7 +1921,7 @@ void TextEdit::_base_remove_text(int p_from_line, int p_from_column,int p_to_lin if (!text_changed_dirty && !setting_text) { - if (is_inside_scene()) + if (is_inside_tree()) MessageQueue::get_singleton()->push_call(this,"_text_changed_emit"); text_changed_dirty=true; } @@ -2133,7 +2133,7 @@ void TextEdit::cursor_set_column(int p_col) { if (!cursor_changed_dirty) { - if (is_inside_scene()) + if (is_inside_tree()) MessageQueue::get_singleton()->push_call(this,"_cursor_changed_emit"); cursor_changed_dirty=true; } @@ -2165,7 +2165,7 @@ void TextEdit::cursor_set_line(int p_row) { if (!cursor_changed_dirty) { - if (is_inside_scene()) + if (is_inside_tree()) MessageQueue::get_singleton()->push_call(this,"_cursor_changed_emit"); cursor_changed_dirty=true; } diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index a39c61ecac..db9142cb99 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1499,7 +1499,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_ case TreeItem::CELL_MODE_STRING: { //nothing in particular - if (select_mode==SELECT_MULTI && (get_scene()->get_last_event_id() == focus_in_id || !already_cursor)) { + if (select_mode==SELECT_MULTI && (get_tree()->get_last_event_id() == focus_in_id || !already_cursor)) { bring_up_editor=false; } @@ -1575,7 +1575,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_ editor_text=String::num( p_item->cells[col].val, Math::decimals( p_item->cells[col].step ) ); bring_up_value_editor=false; - if (select_mode==SELECT_MULTI && get_scene()->get_last_event_id() == focus_in_id) + if (select_mode==SELECT_MULTI && get_tree()->get_last_event_id() == focus_in_id) bring_up_editor=false; } @@ -2343,7 +2343,7 @@ void Tree::_notification(int p_what) { if (p_what==NOTIFICATION_FOCUS_ENTER) { - focus_in_id=get_scene()->get_last_event_id(); + focus_in_id=get_tree()->get_last_event_id(); } if (p_what==NOTIFICATION_MOUSE_EXIT) { @@ -2353,7 +2353,7 @@ void Tree::_notification(int p_what) { } } - if (p_what==NOTIFICATION_ENTER_SCENE) { + if (p_what==NOTIFICATION_ENTER_TREE) { update_cache();; } @@ -2811,7 +2811,7 @@ int Tree::get_item_offset(TreeItem *p_item) const { void Tree::ensure_cursor_is_visible() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; TreeItem *selected = get_selected(); diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index 0d77560d7b..857ea25d0f 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -32,10 +32,10 @@ void VideoPlayer::_notification(int p_notification) { switch (p_notification) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { //set_idle_process(false); //don't annoy - if (stream.is_valid() && autoplay && !get_scene()->is_editor_hint()) + if (stream.is_valid() && autoplay && !get_tree()->is_editor_hint()) play(); } break; @@ -48,7 +48,7 @@ void VideoPlayer::_notification(int p_notification) { if (!stream->is_playing()) return; - stream->update(get_scene()->get_idle_process_time()); + stream->update(get_tree()->get_idle_process_time()); int prev_width = texture->get_width(); stream->pop_frame(texture); if (prev_width == 0) { @@ -118,7 +118,7 @@ Ref<VideoStream> VideoPlayer::get_stream() const { void VideoPlayer::play() { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); if (stream.is_null()) return; stream->play(); @@ -127,7 +127,7 @@ void VideoPlayer::play() { void VideoPlayer::stop() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (stream.is_null()) return; diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index 5006f55daf..ae842577a9 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -144,7 +144,7 @@ void CanvasLayer::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { Node *n = this; vp=NULL; @@ -169,7 +169,7 @@ void CanvasLayer::_notification(int p_what) { } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { VisualServer::get_singleton()->viewport_remove_canvas(viewport,canvas->get_canvas()); viewport=RID(); @@ -180,7 +180,7 @@ void CanvasLayer::_notification(int p_what) { Size2 CanvasLayer::get_viewport_size() const { - if (!is_inside_scene()) + if (!is_inside_tree()) return Size2(1,1); Rect2 r = vp->get_visible_rect(); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 667b4639a9..292e4d1a7b 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -64,7 +64,7 @@ void Node::_notification(int p_notification) { } } break; - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { if (data.pause_mode==PAUSE_MODE_INHERIT) { @@ -83,12 +83,12 @@ void Node::_notification(int p_notification) { if (data.unhandled_key_input) add_to_group("_vp_unhandled_key_input"+itos(get_viewport()->get_instance_ID())); - get_scene()->node_count++; + get_tree()->node_count++; } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { - get_scene()->node_count--; + get_tree()->node_count--; if (data.input) remove_from_group("_vp_input"+itos(get_viewport()->get_instance_ID())); if (data.unhandled_input) @@ -104,7 +104,7 @@ void Node::_notification(int p_notification) { Variant::CallError err; get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_ready,NULL,0); } - //emit_signal(SceneStringNames::get_singleton()->enter_scene); + //emit_signal(SceneStringNames::get_singleton()->enter_tree); } break; case NOTIFICATION_POSTINITIALIZE: { @@ -150,11 +150,11 @@ void Node::_propagate_ready() { } -void Node::_propagate_enter_scene() { - // this needs to happen to all childs before any ENTER_SCENE +void Node::_propagate_enter_tree() { + // this needs to happen to all childs before any enter_tree if (data.parent) { - data.scene=data.parent->data.scene; + data.tree=data.parent->data.tree; data.depth=data.parent->data.depth+1; } else { @@ -165,25 +165,25 @@ void Node::_propagate_enter_scene() { if (!data.viewport) data.viewport = data.parent->data.viewport; - data.inside_scene=true; + data.inside_tree=true; const StringName *K=NULL; while ((K=data.grouped.next(K))) { - data.scene->add_to_group(*K,this); + data.tree->add_to_group(*K,this); } - notification(NOTIFICATION_ENTER_SCENE); + notification(NOTIFICATION_ENTER_TREE); if (get_script_instance()) { Variant::CallError err; - get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_enter_scene,NULL,0); + get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_enter_tree,NULL,0); } - emit_signal(SceneStringNames::get_singleton()->enter_scene); + emit_signal(SceneStringNames::get_singleton()->enter_tree); data.blocked++; @@ -191,8 +191,8 @@ void Node::_propagate_enter_scene() { for (int i=0;i<data.children.size();i++) { - if (!data.children[i]->is_inside_scene()) // could have been added in ENTER_SCENE - data.children[i]->_propagate_enter_scene(); + if (!data.children[i]->is_inside_tree()) // could have been added in enter_tree + data.children[i]->_propagate_enter_tree(); } data.blocked--; @@ -201,7 +201,7 @@ void Node::_propagate_enter_scene() { -void Node::_propagate_exit_scene() { +void Node::_propagate_exit_tree() { //block while removing children @@ -209,7 +209,7 @@ void Node::_propagate_exit_scene() { for (int i=data.children.size()-1;i>=0;i--) { - data.children[i]->_propagate_exit_scene(); + data.children[i]->_propagate_exit_tree(); } data.blocked--; @@ -217,29 +217,29 @@ void Node::_propagate_exit_scene() { if (get_script_instance()) { Variant::CallError err; - get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_scene,NULL,0); + get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_tree,NULL,0); } - emit_signal(SceneStringNames::get_singleton()->exit_scene); + emit_signal(SceneStringNames::get_singleton()->exit_tree); - notification(NOTIFICATION_EXIT_SCENE,true); - if (data.scene) - data.scene->node_removed(this); + notification(NOTIFICATION_EXIT_TREE,true); + if (data.tree) + data.tree->node_removed(this); // exit groups const StringName *K=NULL; while ((K=data.grouped.next(K))) { - data.scene->remove_from_group(*K,this); + data.tree->remove_from_group(*K,this); } data.viewport = NULL; - if (data.scene) - data.scene->tree_changed(); + if (data.tree) + data.tree->tree_changed(); - data.inside_scene=false; - data.scene=NULL; + data.inside_tree=false; + data.tree=NULL; data.depth=-1; } @@ -260,8 +260,8 @@ void Node::move_child(Node *p_child,int p_pos) { data.children.remove( p_child->data.pos ); data.children.insert( p_pos, p_child ); - if (data.scene) { - data.scene->tree_changed(); + if (data.tree) { + data.tree->tree_changed(); } data.blocked++; @@ -333,7 +333,7 @@ void Node::set_pause_mode(PauseMode p_mode) { bool prev_inherits=data.pause_mode==PAUSE_MODE_INHERIT; data.pause_mode=p_mode; - if (!is_inside_scene()) + if (!is_inside_tree()) return; //pointless if ((data.pause_mode==PAUSE_MODE_INHERIT) == prev_inherits) return; ///nothing changed @@ -372,9 +372,9 @@ void Node::_propagate_pause_owner(Node*p_owner) { bool Node::can_process() const { - ERR_FAIL_COND_V( !is_inside_scene(), false ); + ERR_FAIL_COND_V( !is_inside_tree(), false ); - if (get_scene()->is_paused()) { + if (get_tree()->is_paused()) { if (data.pause_mode==PAUSE_MODE_PROCESS) return true; @@ -395,8 +395,8 @@ bool Node::can_process() const { float Node::get_fixed_process_delta_time() const { - if (data.scene) - return data.scene->get_fixed_process_time(); + if (data.tree) + return data.tree->get_fixed_process_time(); else return 0; } @@ -419,8 +419,8 @@ void Node::set_process(bool p_idle_process) { float Node::get_process_delta_time() const { - if (data.scene) - return data.scene->get_idle_process_time(); + if (data.tree) + return data.tree->get_idle_process_time(); else return 0; } @@ -442,7 +442,7 @@ void Node::set_process_input(bool p_enable) { return; data.input=p_enable; - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (p_enable) @@ -462,7 +462,7 @@ void Node::set_process_unhandled_input(bool p_enable) { if (p_enable==data.unhandled_input) return; data.unhandled_input=p_enable; - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (p_enable) @@ -482,7 +482,7 @@ void Node::set_process_unhandled_key_input(bool p_enable) { if (p_enable==data.unhandled_key_input) return; data.unhandled_key_input=p_enable; - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (p_enable) @@ -520,10 +520,10 @@ void Node::set_name(const String& p_name) { data.parent->_validate_child_name(this); } - if (is_inside_scene()) { + if (is_inside_tree()) { emit_signal("renamed"); - get_scene()->tree_changed(); + get_tree()->tree_changed(); } } @@ -630,8 +630,8 @@ void Node::_add_child_nocheck(Node* p_child,const StringName& p_name) { data.children.push_back( p_child ); p_child->data.parent=this; - if (data.scene) { - p_child->_set_scene(data.scene); + if (data.tree) { + p_child->_set_tree(data.tree); } /* Notify */ @@ -719,7 +719,7 @@ void Node::remove_child(Node *p_child) { //if (data.scene) { does not matter - p_child->_set_scene(NULL); + p_child->_set_tree(NULL); //} remove_child_notify(p_child); @@ -755,7 +755,7 @@ Node *Node::get_child(int p_index) const { Node *Node::_get_node(const NodePath& p_path) const { - ERR_FAIL_COND_V( !data.inside_scene && p_path.is_absolute(), NULL ); + ERR_FAIL_COND_V( !data.inside_tree && p_path.is_absolute(), NULL ); Node *current=NULL; Node *root=NULL; @@ -851,8 +851,8 @@ bool Node::is_a_parent_of(const Node *p_node) const { bool Node::is_greater_than(const Node *p_node) const { ERR_FAIL_NULL_V(p_node,false); - ERR_FAIL_COND_V( !data.inside_scene, false ); - ERR_FAIL_COND_V( !p_node->data.inside_scene, false ); + ERR_FAIL_COND_V( !data.inside_tree, false ); + ERR_FAIL_COND_V( !p_node->data.inside_tree, false ); ERR_FAIL_COND_V( data.depth<0, false); ERR_FAIL_COND_V( p_node->data.depth<0, false); @@ -1023,7 +1023,7 @@ NodePath Node::get_path_to(const Node *p_node) const { NodePath Node::get_path() const { - ERR_FAIL_COND_V(!is_inside_scene(),NodePath()); + ERR_FAIL_COND_V(!is_inside_tree(),NodePath()); const Node *n = this; Vector<StringName> path; @@ -1052,8 +1052,8 @@ void Node::add_to_group(const StringName& p_identifier,bool p_persistent) { GroupData gd; - if (data.scene) - data.scene->add_to_group(p_identifier,this); + if (data.tree) + data.tree->add_to_group(p_identifier,this); gd.persistent=p_persistent; @@ -1070,8 +1070,8 @@ void Node::remove_from_group(const StringName& p_identifier) { ERR_FAIL_COND(!g); - if (data.scene) - data.scene->remove_from_group(p_identifier,this); + if (data.tree) + data.tree->remove_from_group(p_identifier,this); data.grouped.erase(p_identifier); @@ -1131,7 +1131,7 @@ void Node::_propagate_reverse_notification(int p_notification) { void Node::_propagate_deferred_notification(int p_notification, bool p_reverse) { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); data.blocked++; @@ -1624,29 +1624,29 @@ Node *Node::get_node_and_resource(const NodePath& p_path,RES& r_res) const { return node; } -void Node::_set_scene(SceneMainLoop *p_scene) { +void Node::_set_tree(SceneTree *p_tree) { - SceneMainLoop *tree_changed_a=NULL; - SceneMainLoop *tree_changed_b=NULL; + SceneTree *tree_changed_a=NULL; + SceneTree *tree_changed_b=NULL; // ERR_FAIL_COND(p_scene && data.parent && !data.parent->data.scene); //nobug if both are null - if (data.scene) { - _propagate_exit_scene(); + if (data.tree) { + _propagate_exit_tree(); - tree_changed_a=data.scene; + tree_changed_a=data.tree; } - data.scene=p_scene; + data.tree=p_tree; - if (data.scene) { + if (data.tree) { - _propagate_enter_scene(); + _propagate_enter_tree(); _propagate_ready(); //reverse_notification(NOTIFICATION_READY); - tree_changed_b=data.scene; + tree_changed_b=data.tree; } @@ -1664,7 +1664,7 @@ static void _Node_debug_sn(Object *p_obj) { if (!n) return; - if (n->is_inside_scene()) + if (n->is_inside_tree()) return; Node *p=n; @@ -1696,8 +1696,8 @@ void Node::print_stray_nodes() { void Node::queue_delete() { - ERR_FAIL_COND( !is_inside_scene() ); - get_scene()->queue_delete(this); + ERR_FAIL_COND( !is_inside_tree() ); + get_tree()->queue_delete(this); } Array Node::_get_children() const { @@ -1742,7 +1742,7 @@ void Node::_bind_methods() { ObjectTypeDB::bind_method(_MD("has_node_and_resource","path"),&Node::has_node_and_resource); ObjectTypeDB::bind_method(_MD("get_node_and_resource","path"),&Node::_get_node_and_resource); - ObjectTypeDB::bind_method(_MD("is_inside_scene"),&Node::is_inside_scene); + ObjectTypeDB::bind_method(_MD("is_inside_tree"),&Node::is_inside_tree); ObjectTypeDB::bind_method(_MD("is_a_parent_of","node:Node"),&Node::is_a_parent_of); ObjectTypeDB::bind_method(_MD("is_greater_than","node:Node"),&Node::is_greater_than); ObjectTypeDB::bind_method(_MD("get_path"),&Node::get_path); @@ -1779,7 +1779,7 @@ void Node::_bind_methods() { ObjectTypeDB::bind_method(_MD("print_stray_nodes"),&Node::_print_stray_nodes); ObjectTypeDB::bind_method(_MD("get_position_in_parent"),&Node::get_position_in_parent); - ObjectTypeDB::bind_method(_MD("get_scene:SceneMainLoop"),&Node::get_scene); + ObjectTypeDB::bind_method(_MD("get_tree:SceneTree"),&Node::get_tree); ObjectTypeDB::bind_method(_MD("duplicate:Node"),&Node::duplicate); ObjectTypeDB::bind_method(_MD("replace_by","node:Node","keep_data"),&Node::replace_by,DEFVAL(false)); @@ -1794,8 +1794,8 @@ void Node::_bind_methods() { #endif - BIND_CONSTANT( NOTIFICATION_ENTER_SCENE ); - BIND_CONSTANT( NOTIFICATION_EXIT_SCENE ); + BIND_CONSTANT( NOTIFICATION_ENTER_TREE ); + BIND_CONSTANT( NOTIFICATION_EXIT_TREE ); BIND_CONSTANT( NOTIFICATION_MOVED_IN_PARENT ); //BIND_CONSTANT( NOTIFICATION_PARENT_DECONFIGURED ); BIND_CONSTANT( NOTIFICATION_READY ); @@ -1812,8 +1812,8 @@ void Node::_bind_methods() { BIND_CONSTANT( PAUSE_MODE_PROCESS ); ADD_SIGNAL( MethodInfo("renamed") ); - ADD_SIGNAL( MethodInfo("enter_scene") ); - ADD_SIGNAL( MethodInfo("exit_scene") ); + ADD_SIGNAL( MethodInfo("enter_tree") ); + ADD_SIGNAL( MethodInfo("exit_tree") ); // ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/process" ),_SCS("set_process"),_SCS("is_processing") ); // ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/fixed_process" ), _SCS("set_fixed_process"),_SCS("is_fixed_processing") ); @@ -1823,8 +1823,8 @@ void Node::_bind_methods() { BIND_VMETHOD( MethodInfo("_process",PropertyInfo(Variant::REAL,"delta")) ); BIND_VMETHOD( MethodInfo("_fixed_process",PropertyInfo(Variant::REAL,"delta")) ); - BIND_VMETHOD( MethodInfo("_enter_scene") ); - BIND_VMETHOD( MethodInfo("_exit_scene") ); + BIND_VMETHOD( MethodInfo("_enter_tree") ); + BIND_VMETHOD( MethodInfo("_exit_tree") ); BIND_VMETHOD( MethodInfo("_ready") ); BIND_VMETHOD( MethodInfo("_input",PropertyInfo(Variant::INPUT_EVENT,"event")) ); BIND_VMETHOD( MethodInfo("_unhandled_input",PropertyInfo(Variant::INPUT_EVENT,"event")) ); @@ -1841,10 +1841,10 @@ Node::Node() { data.depth=-1; data.blocked=0; data.parent=NULL; - data.scene=NULL; + data.tree=NULL; data.fixed_process=false; data.idle_process=false; - data.inside_scene=false; + data.inside_tree=false; data.owner=NULL; data.OW=NULL; diff --git a/scene/main/node.h b/scene/main/node.h index f1ecf497e0..9229e2f9bb 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -80,8 +80,8 @@ private: int depth; int blocked; // safeguard that throws an error when attempting to modify the tree in a harmful way while being traversed. StringName name; - SceneMainLoop *scene; - bool inside_scene; + SceneTree *tree; + bool inside_tree; #ifdef TOOLS_ENABLED NodePath import_path; //path used when imported, used by scene editors to keep tracking #endif @@ -118,9 +118,9 @@ private: void _propagate_reverse_notification(int p_notification); void _propagate_deferred_notification(int p_notification, bool p_reverse); - void _propagate_enter_scene(); + void _propagate_enter_tree(); void _propagate_ready(); - void _propagate_exit_scene(); + void _propagate_exit_tree(); void _propagate_validate_owner(); void _print_stray_nodes(); void _propagate_pause_owner(Node*p_owner); @@ -130,9 +130,9 @@ private: Array _get_children() const; Array _get_groups() const; -friend class SceneMainLoop; +friend class SceneTree; - void _set_scene(SceneMainLoop *p_scene); + void _set_tree(SceneTree *p_tree); protected: void _block() { data.blocked++; } @@ -158,8 +158,8 @@ public: enum { // you can make your own, but don't use the same numbers as other notifications in other nodes - NOTIFICATION_ENTER_SCENE=10, - NOTIFICATION_EXIT_SCENE =11, + NOTIFICATION_ENTER_TREE=10, + NOTIFICATION_EXIT_TREE =11, NOTIFICATION_MOVED_IN_PARENT =12, NOTIFICATION_READY=13, //NOTIFICATION_PARENT_DECONFIGURED =15, - it's confusing, it's going away @@ -187,9 +187,9 @@ public: Node *get_node_and_resource(const NodePath& p_path,RES& r_res) const; Node *get_parent() const; - _FORCE_INLINE_ SceneMainLoop *get_scene() const { ERR_FAIL_COND_V( !data.scene, NULL ); return data.scene; } + _FORCE_INLINE_ SceneTree *get_tree() const { ERR_FAIL_COND_V( !data.tree, NULL ); return data.tree; } - _FORCE_INLINE_ bool is_inside_scene() const { return data.inside_scene; } + _FORCE_INLINE_ bool is_inside_tree() const { return data.inside_tree; } bool is_a_parent_of(const Node *p_node) const; bool is_greater_than(const Node *p_node) const; diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index c51974167d..47089638bb 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -43,13 +43,13 @@ #include "viewport.h" -void SceneMainLoop::tree_changed() { +void SceneTree::tree_changed() { tree_version++; emit_signal(tree_changed_name); } -void SceneMainLoop::node_removed(Node *p_node) { +void SceneTree::node_removed(Node *p_node) { emit_signal(node_removed_name,p_node); if (call_lock>0) @@ -59,7 +59,7 @@ void SceneMainLoop::node_removed(Node *p_node) { } -void SceneMainLoop::add_to_group(const StringName& p_group, Node *p_node) { +void SceneTree::add_to_group(const StringName& p_group, Node *p_node) { Map<StringName,Group>::Element *E=group_map.find(p_group); if (!E) { @@ -74,7 +74,7 @@ void SceneMainLoop::add_to_group(const StringName& p_group, Node *p_node) { E->get().last_tree_version=0; } -void SceneMainLoop::remove_from_group(const StringName& p_group, Node *p_node) { +void SceneTree::remove_from_group(const StringName& p_group, Node *p_node) { Map<StringName,Group>::Element *E=group_map.find(p_group); ERR_FAIL_COND(!E); @@ -85,7 +85,7 @@ void SceneMainLoop::remove_from_group(const StringName& p_group, Node *p_node) { group_map.erase(E); } -void SceneMainLoop::_flush_transform_notifications() { +void SceneTree::_flush_transform_notifications() { SelfList<Node>* n = xform_change_list.first(); while(n) { @@ -98,7 +98,7 @@ void SceneMainLoop::_flush_transform_notifications() { } } -void SceneMainLoop::_flush_ugc() { +void SceneTree::_flush_ugc() { ugc_locked=true; @@ -118,7 +118,7 @@ void SceneMainLoop::_flush_ugc() { ugc_locked=false; } -void SceneMainLoop::_update_group_order(Group& g) { +void SceneTree::_update_group_order(Group& g) { if (g.last_tree_version==tree_version) return; @@ -134,7 +134,7 @@ void SceneMainLoop::_update_group_order(Group& g) { } -void SceneMainLoop::call_group(uint32_t p_call_flags,const StringName& p_group,const StringName& p_function,VARIANT_ARG_DECLARE) { +void SceneTree::call_group(uint32_t p_call_flags,const StringName& p_group,const StringName& p_function,VARIANT_ARG_DECLARE) { Map<StringName,Group>::Element *E=group_map.find(p_group); if (!E) @@ -216,7 +216,7 @@ void SceneMainLoop::call_group(uint32_t p_call_flags,const StringName& p_group,c call_skip.clear(); } -void SceneMainLoop::notify_group(uint32_t p_call_flags,const StringName& p_group,int p_notification) { +void SceneTree::notify_group(uint32_t p_call_flags,const StringName& p_group,int p_notification) { Map<StringName,Group>::Element *E=group_map.find(p_group); if (!E) @@ -266,7 +266,7 @@ void SceneMainLoop::notify_group(uint32_t p_call_flags,const StringName& p_group call_skip.clear(); } -void SceneMainLoop::set_group(uint32_t p_call_flags,const StringName& p_group,const String& p_name,const Variant& p_value) { +void SceneTree::set_group(uint32_t p_call_flags,const StringName& p_group,const String& p_name,const Variant& p_value) { Map<StringName,Group>::Element *E=group_map.find(p_group); if (!E) @@ -316,12 +316,12 @@ void SceneMainLoop::set_group(uint32_t p_call_flags,const StringName& p_group,co call_skip.clear(); } -void SceneMainLoop::set_input_as_handled() { +void SceneTree::set_input_as_handled() { input_handled=true; } -void SceneMainLoop::input_text( const String& p_text ) { +void SceneTree::input_text( const String& p_text ) { root_lock++; @@ -330,16 +330,17 @@ void SceneMainLoop::input_text( const String& p_text ) { } -void SceneMainLoop::input_event( const InputEvent& p_event ) { +void SceneTree::input_event( const InputEvent& p_event ) { root_lock++; - last_id=p_event.ID; + //last_id=p_event.ID; input_handled=false; InputEvent ev = p_event; + ev.ID=++last_id; //this should work better #if 0 switch(ev.type) { @@ -393,7 +394,7 @@ void SceneMainLoop::input_event( const InputEvent& p_event ) { #endif - MainLoop::input_event(p_event); + MainLoop::input_event(ev); #if 0 _call_input_pause("input","_input",ev); @@ -415,7 +416,7 @@ void SceneMainLoop::input_event( const InputEvent& p_event ) { //transform for the rest #else - call_group(GROUP_CALL_REALTIME,"_viewports","_vp_input",p_event); //special one for GUI, as controls use their own process check + call_group(GROUP_CALL_REALTIME,"_viewports","_vp_input",ev); //special one for GUI, as controls use their own process check #endif if (ScriptDebugger::get_singleton() && ScriptDebugger::get_singleton()->is_remote() && ev.type==InputEvent::KEY && ev.key.pressed && !ev.key.echo && ev.key.scancode==KEY_F8) { @@ -440,7 +441,7 @@ void SceneMainLoop::input_event( const InputEvent& p_event ) { } #else - call_group(GROUP_CALL_REALTIME,"_viewports","_vp_unhandled_input",p_event); //special one for GUI, as controls use their own process check + call_group(GROUP_CALL_REALTIME,"_viewports","_vp_unhandled_input",ev); //special one for GUI, as controls use their own process check #endif input_handled=true; @@ -455,7 +456,7 @@ void SceneMainLoop::input_event( const InputEvent& p_event ) { } -void SceneMainLoop::init() { +void SceneTree::init() { //_quit=false; accept_quit=true; @@ -466,12 +467,12 @@ void SceneMainLoop::init() { editor_hint=false; pause=false; - root->_set_scene(this); + root->_set_tree(this); MainLoop::init(); } -bool SceneMainLoop::iteration(float p_time) { +bool SceneTree::iteration(float p_time) { root_lock++; @@ -496,7 +497,7 @@ bool SceneMainLoop::iteration(float p_time) { return _quit; } -bool SceneMainLoop::idle(float p_time){ +bool SceneTree::idle(float p_time){ // print_line("ram: "+itos(OS::get_singleton()->get_static_memory_usage())+" sram: "+itos(OS::get_singleton()->get_dynamic_memory_usage())); @@ -538,7 +539,7 @@ bool SceneMainLoop::idle(float p_time){ return _quit; } -void SceneMainLoop::finish() { +void SceneTree::finish() { _flush_delete_queue(); @@ -549,7 +550,7 @@ void SceneMainLoop::finish() { MainLoop::finish(); if (root) { - root->_set_scene(NULL); + root->_set_tree(NULL); memdelete(root); //delete root } @@ -564,12 +565,12 @@ void SceneMainLoop::finish() { } -void SceneMainLoop::quit() { +void SceneTree::quit() { _quit=true; } -void SceneMainLoop::_notification(int p_notification) { +void SceneTree::_notification(int p_notification) { @@ -602,22 +603,22 @@ void SceneMainLoop::_notification(int p_notification) { }; -void SceneMainLoop::set_auto_accept_quit(bool p_enable) { +void SceneTree::set_auto_accept_quit(bool p_enable) { accept_quit=p_enable; } -void SceneMainLoop::set_editor_hint(bool p_enabled) { +void SceneTree::set_editor_hint(bool p_enabled) { editor_hint=p_enabled; } -bool SceneMainLoop::is_editor_hint() const { +bool SceneTree::is_editor_hint() const { return editor_hint; } -void SceneMainLoop::set_pause(bool p_enabled) { +void SceneTree::set_pause(bool p_enabled) { if (p_enabled==pause) return; @@ -628,12 +629,12 @@ void SceneMainLoop::set_pause(bool p_enabled) { get_root()->propagate_notification(p_enabled ? Node::NOTIFICATION_PAUSED : Node::NOTIFICATION_UNPAUSED); } -bool SceneMainLoop::is_paused() const { +bool SceneTree::is_paused() const { return pause; } -void SceneMainLoop::_call_input_pause(const StringName& p_group,const StringName& p_method,const InputEvent& p_input) { +void SceneTree::_call_input_pause(const StringName& p_group,const StringName& p_method,const InputEvent& p_input) { Map<StringName,Group>::Element *E=group_map.find(p_group); if (!E) @@ -678,7 +679,7 @@ void SceneMainLoop::_call_input_pause(const StringName& p_group,const StringName call_skip.clear(); } -void SceneMainLoop::_notify_group_pause(const StringName& p_group,int p_notification) { +void SceneTree::_notify_group_pause(const StringName& p_group,int p_notification) { Map<StringName,Group>::Element *E=group_map.find(p_group); if (!E) @@ -728,13 +729,13 @@ void SceneMainLoop::_update_listener_2d() { } */ -uint32_t SceneMainLoop::get_last_event_id() const { +uint32_t SceneTree::get_last_event_id() const { return last_id; } -Variant SceneMainLoop::_call_group(const Variant** p_args, int p_argcount, Variant::CallError& r_error) { +Variant SceneTree::_call_group(const Variant** p_args, int p_argcount, Variant::CallError& r_error) { r_error.error=Variant::CallError::CALL_OK; @@ -759,13 +760,13 @@ Variant SceneMainLoop::_call_group(const Variant** p_args, int p_argcount, Varia } -int64_t SceneMainLoop::get_frame() const { +int64_t SceneTree::get_frame() const { return current_frame; } -Array SceneMainLoop::_get_nodes_in_group(const StringName& p_group) { +Array SceneTree::_get_nodes_in_group(const StringName& p_group) { Array ret; Map<StringName,Group>::Element *E=group_map.find(p_group); @@ -788,7 +789,7 @@ Array SceneMainLoop::_get_nodes_in_group(const StringName& p_group) { return ret; } -void SceneMainLoop::get_nodes_in_group(const StringName& p_group,List<Node*> *p_list) { +void SceneTree::get_nodes_in_group(const StringName& p_group,List<Node*> *p_list) { Map<StringName,Group>::Element *E=group_map.find(p_group); @@ -818,9 +819,9 @@ static void _fill_array(Node *p_node, Array& array, int p_level) { } } -void SceneMainLoop::_debugger_request_tree(void *self) { +void SceneTree::_debugger_request_tree(void *self) { - SceneMainLoop *sml = (SceneMainLoop *)self; + SceneTree *sml = (SceneTree *)self; Array arr; _fill_array(sml->root,arr,0); @@ -828,7 +829,7 @@ void SceneMainLoop::_debugger_request_tree(void *self) { } -void SceneMainLoop::_flush_delete_queue() { +void SceneTree::_flush_delete_queue() { _THREAD_SAFE_METHOD_ @@ -842,7 +843,7 @@ void SceneMainLoop::_flush_delete_queue() { } } -void SceneMainLoop::queue_delete(Object *p_object) { +void SceneTree::queue_delete(Object *p_object) { _THREAD_SAFE_METHOD_ ERR_FAIL_NULL(p_object); @@ -850,13 +851,13 @@ void SceneMainLoop::queue_delete(Object *p_object) { } -int SceneMainLoop::get_node_count() const { +int SceneTree::get_node_count() const { return node_count; } -void SceneMainLoop::_update_root_rect() { +void SceneTree::_update_root_rect() { if (stretch_mode==STRETCH_MODE_DISABLED) { @@ -959,7 +960,7 @@ void SceneMainLoop::_update_root_rect() { } -void SceneMainLoop::set_screen_stretch(StretchMode p_mode,StretchAspect p_aspect,const Size2 p_minsize) { +void SceneTree::set_screen_stretch(StretchMode p_mode,StretchAspect p_aspect,const Size2 p_minsize) { stretch_mode=p_mode; stretch_aspect=p_aspect; @@ -969,50 +970,50 @@ void SceneMainLoop::set_screen_stretch(StretchMode p_mode,StretchAspect p_aspect #ifdef TOOLS_ENABLED -void SceneMainLoop::set_edited_scene_root(Node *p_node) { +void SceneTree::set_edited_scene_root(Node *p_node) { edited_scene_root=p_node; } -Node *SceneMainLoop::get_edited_scene_root() const { +Node *SceneTree::get_edited_scene_root() const { return edited_scene_root; } #endif -void SceneMainLoop::_bind_methods() { +void SceneTree::_bind_methods() { //ObjectTypeDB::bind_method(_MD("call_group","call_flags","group","method","arg1","arg2"),&SceneMainLoop::_call_group,DEFVAL(Variant()),DEFVAL(Variant())); - ObjectTypeDB::bind_method(_MD("notify_group","call_flags","group","notification"),&SceneMainLoop::notify_group); - ObjectTypeDB::bind_method(_MD("set_group","call_flags","group","property","value"),&SceneMainLoop::set_group); + ObjectTypeDB::bind_method(_MD("notify_group","call_flags","group","notification"),&SceneTree::notify_group); + ObjectTypeDB::bind_method(_MD("set_group","call_flags","group","property","value"),&SceneTree::set_group); - ObjectTypeDB::bind_method(_MD("get_nodes_in_group"),&SceneMainLoop::_get_nodes_in_group); + ObjectTypeDB::bind_method(_MD("get_nodes_in_group"),&SceneTree::_get_nodes_in_group); - ObjectTypeDB::bind_method(_MD("get_root:Viewport"),&SceneMainLoop::get_root); + ObjectTypeDB::bind_method(_MD("get_root:Viewport"),&SceneTree::get_root); - ObjectTypeDB::bind_method(_MD("set_auto_accept_quit","enabled"),&SceneMainLoop::set_auto_accept_quit); + ObjectTypeDB::bind_method(_MD("set_auto_accept_quit","enabled"),&SceneTree::set_auto_accept_quit); - ObjectTypeDB::bind_method(_MD("set_editor_hint","enable"),&SceneMainLoop::set_editor_hint); - ObjectTypeDB::bind_method(_MD("is_editor_hint"),&SceneMainLoop::is_editor_hint); + ObjectTypeDB::bind_method(_MD("set_editor_hint","enable"),&SceneTree::set_editor_hint); + ObjectTypeDB::bind_method(_MD("is_editor_hint"),&SceneTree::is_editor_hint); #ifdef TOOLS_ENABLED - ObjectTypeDB::bind_method(_MD("set_edited_scene_root","scene"),&SceneMainLoop::set_edited_scene_root); - ObjectTypeDB::bind_method(_MD("get_edited_scene_root"),&SceneMainLoop::get_edited_scene_root); + ObjectTypeDB::bind_method(_MD("set_edited_scene_root","scene"),&SceneTree::set_edited_scene_root); + ObjectTypeDB::bind_method(_MD("get_edited_scene_root"),&SceneTree::get_edited_scene_root); #endif - ObjectTypeDB::bind_method(_MD("set_pause","enable"),&SceneMainLoop::set_pause); - ObjectTypeDB::bind_method(_MD("is_paused"),&SceneMainLoop::is_paused); - ObjectTypeDB::bind_method(_MD("set_input_as_handled"),&SceneMainLoop::set_input_as_handled); + ObjectTypeDB::bind_method(_MD("set_pause","enable"),&SceneTree::set_pause); + ObjectTypeDB::bind_method(_MD("is_paused"),&SceneTree::is_paused); + ObjectTypeDB::bind_method(_MD("set_input_as_handled"),&SceneTree::set_input_as_handled); - ObjectTypeDB::bind_method(_MD("get_node_count"),&SceneMainLoop::get_node_count); - ObjectTypeDB::bind_method(_MD("get_frame"),&SceneMainLoop::get_frame); - ObjectTypeDB::bind_method(_MD("quit"),&SceneMainLoop::quit); + ObjectTypeDB::bind_method(_MD("get_node_count"),&SceneTree::get_node_count); + ObjectTypeDB::bind_method(_MD("get_frame"),&SceneTree::get_frame); + ObjectTypeDB::bind_method(_MD("quit"),&SceneTree::quit); - ObjectTypeDB::bind_method(_MD("set_screen_stretch","mode","aspect","minsize"),&SceneMainLoop::set_screen_stretch); + ObjectTypeDB::bind_method(_MD("set_screen_stretch","mode","aspect","minsize"),&SceneTree::set_screen_stretch); - ObjectTypeDB::bind_method(_MD("queue_delete","obj"),&SceneMainLoop::queue_delete); + ObjectTypeDB::bind_method(_MD("queue_delete","obj"),&SceneTree::queue_delete); MethodInfo mi; @@ -1026,7 +1027,7 @@ void SceneMainLoop::_bind_methods() { defargs.push_back(Variant()); } - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"call_group",&SceneMainLoop::_call_group,mi,defargs); + ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"call_group",&SceneTree::_call_group,mi,defargs); ADD_SIGNAL( MethodInfo("tree_changed") ); ADD_SIGNAL( MethodInfo("node_removed",PropertyInfo( Variant::OBJECT, "node") ) ); @@ -1047,14 +1048,14 @@ void SceneMainLoop::_bind_methods() { } -SceneMainLoop::SceneMainLoop() { +SceneTree::SceneTree() { _quit=false; initialized=false; tree_version=1; fixed_process_time=1; idle_process_time=1; - last_id=0; + last_id=1; root=NULL; current_frame=0; tree_changed_name="tree_changed"; @@ -1095,7 +1096,7 @@ SceneMainLoop::SceneMainLoop() { } -SceneMainLoop::~SceneMainLoop() { +SceneTree::~SceneTree() { } diff --git a/scene/main/scene_main_loop.h b/scene/main/scene_main_loop.h index bfa755ff7c..31a823ab1a 100644 --- a/scene/main/scene_main_loop.h +++ b/scene/main/scene_main_loop.h @@ -41,16 +41,16 @@ */ -class SceneMainLoop; +class SceneTree; class Node; class Viewport; -class SceneMainLoop : public MainLoop { +class SceneTree : public MainLoop { _THREAD_SAFE_CLASS_ - OBJ_TYPE( SceneMainLoop, MainLoop ); + OBJ_TYPE( SceneTree, MainLoop ); public: @@ -234,14 +234,14 @@ public: Node *get_edited_scene_root() const; #endif - SceneMainLoop(); - ~SceneMainLoop(); + SceneTree(); + ~SceneTree(); }; -VARIANT_ENUM_CAST( SceneMainLoop::StretchMode ); -VARIANT_ENUM_CAST( SceneMainLoop::StretchAspect ); +VARIANT_ENUM_CAST( SceneTree::StretchMode ); +VARIANT_ENUM_CAST( SceneTree::StretchAspect ); diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp index 8e80f868c6..2ae918f3f3 100644 --- a/scene/main/timer.cpp +++ b/scene/main/timer.cpp @@ -38,7 +38,7 @@ void Timer::_notification(int p_what) { if (autostart) { #ifdef TOOLS_ENABLED - if (get_scene()->is_editor_hint() && get_scene()->get_edited_scene_root() && (get_scene()->get_edited_scene_root()==this || get_scene()->get_edited_scene_root()->is_a_parent_of(this))) + if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root()==this || get_tree()->get_edited_scene_root()->is_a_parent_of(this))) break; #endif start(); } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index ac496cac4e..e6c787cf9e 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -113,7 +113,7 @@ void Viewport::_update_stretch_transform() { void Viewport::_update_rect() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; Node *parent = get_parent(); @@ -175,7 +175,7 @@ void Viewport::_parent_visibility_changed() { } -void Viewport::_vp_enter_scene() { +void Viewport::_vp_enter_tree() { Node *parent = get_parent(); //none? @@ -200,7 +200,7 @@ void Viewport::_vp_enter_scene() { } -void Viewport::_vp_exit_scene() { +void Viewport::_vp_exit_tree() { Node *parent = get_parent(); if (parent && parent->cast_to<Control>()) { @@ -231,14 +231,14 @@ void Viewport::_vp_exit_scene() { void Viewport::update_worlds() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; Rect2 xformed_rect = (global_canvas_transform * canvas_transform).affine_inverse().xform(get_visible_rect()); find_world_2d()->_update_viewport(this,xformed_rect); find_world_2d()->_update(); - find_world()->_update(get_scene()->get_frame()); + find_world()->_update(get_tree()->get_frame()); } @@ -280,11 +280,11 @@ void Viewport::_notification(int p_what) { switch( p_what ) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { if (!render_target) - _vp_enter_scene(); + _vp_enter_tree(); this->parent=NULL; Node *parent=get_parent(); @@ -334,7 +334,7 @@ void Viewport::_notification(int p_what) { } #endif } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { @@ -342,7 +342,7 @@ void Viewport::_notification(int p_what) { world_2d->_remove_viewport(this); if (!render_target) - _vp_exit_scene(); + _vp_exit_tree(); VisualServer::get_singleton()->viewport_set_scenario(viewport,RID()); SpatialSoundServer::get_singleton()->listener_set_space(listener,RID()); @@ -551,7 +551,7 @@ Rect2 Viewport::get_rect() const { void Viewport::_update_listener() { - if (is_inside_scene() && audio_listener && camera && (!get_parent() || (get_parent()->cast_to<Control>() && get_parent()->cast_to<Control>()->is_visible()))) { + if (is_inside_tree() && audio_listener && camera && (!get_parent() || (get_parent()->cast_to<Control>() && get_parent()->cast_to<Control>()->is_visible()))) { SpatialSoundServer::get_singleton()->listener_set_space(listener,find_world()->get_sound_space()); } else { SpatialSoundServer::get_singleton()->listener_set_space(listener,RID()); @@ -562,7 +562,7 @@ void Viewport::_update_listener() { void Viewport::_update_listener_2d() { - if (is_inside_scene() && audio_listener && (!get_parent() || (get_parent()->cast_to<Control>() && get_parent()->cast_to<Control>()->is_visible()))) + if (is_inside_tree() && audio_listener && (!get_parent() || (get_parent()->cast_to<Control>() && get_parent()->cast_to<Control>()->is_visible()))) SpatialSound2DServer::get_singleton()->listener_set_space(listener_2d,find_world_2d()->get_sound_space()); else SpatialSound2DServer::get_singleton()->listener_set_space(listener_2d,RID()); @@ -741,7 +741,7 @@ void Viewport::_propagate_enter_world(Node *p_node) { if (p_node!=this) { - if (!p_node->is_inside_scene()) //may not have entered scene yet + if (!p_node->is_inside_tree()) //may not have entered scene yet return; Spatial *s = p_node->cast_to<Spatial>(); @@ -770,7 +770,7 @@ void Viewport::_propagate_exit_world(Node *p_node) { if (p_node!=this) { - if (!p_node->is_inside_scene()) //may have exited scene already + if (!p_node->is_inside_tree()) //may have exited scene already return; Spatial *s = p_node->cast_to<Spatial>(); @@ -801,7 +801,7 @@ void Viewport::set_world(const Ref<World>& p_world) { if (world==p_world) return; - if (is_inside_scene()) + if (is_inside_tree()) _propagate_exit_world(this); #ifndef _3D_DISABLED @@ -811,7 +811,7 @@ void Viewport::set_world(const Ref<World>& p_world) { world=p_world; - if (is_inside_scene()) + if (is_inside_tree()) _propagate_enter_world(this); #ifndef _3D_DISABLED @@ -821,7 +821,7 @@ void Viewport::set_world(const Ref<World>& p_world) { //propagate exit - if (is_inside_scene()) { + if (is_inside_tree()) { VisualServer::get_singleton()->viewport_set_scenario(viewport,find_world()->get_scenario()); } @@ -909,12 +909,12 @@ void Viewport::set_as_render_target(bool p_enable){ render_target=p_enable; VS::get_singleton()->viewport_set_as_render_target(viewport,p_enable); - if (is_inside_scene()) { + if (is_inside_tree()) { if (p_enable) - _vp_exit_scene(); + _vp_exit_tree(); else - _vp_enter_scene(); + _vp_enter_tree(); } if (p_enable) { @@ -1102,24 +1102,24 @@ void Viewport::_vp_unhandled_input(const InputEvent& p_ev) { void Viewport::input(const InputEvent& p_event) { - ERR_FAIL_COND(!is_inside_scene()); - get_scene()->_call_input_pause(input_group,"_input",p_event); - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REVERSE|SceneMainLoop::GROUP_CALL_REALTIME|SceneMainLoop::GROUP_CALL_MULIILEVEL,gui_input_group,"_gui_input",p_event); //special one for GUI, as controls use their own process check + ERR_FAIL_COND(!is_inside_tree()); + get_tree()->_call_input_pause(input_group,"_input",p_event); + get_tree()->call_group(SceneTree::GROUP_CALL_REVERSE|SceneTree::GROUP_CALL_REALTIME|SceneTree::GROUP_CALL_MULIILEVEL,gui_input_group,"_gui_input",p_event); //special one for GUI, as controls use their own process check } void Viewport::unhandled_input(const InputEvent& p_event) { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); - get_scene()->_call_input_pause(unhandled_input_group,"_unhandled_input",p_event); + get_tree()->_call_input_pause(unhandled_input_group,"_unhandled_input",p_event); //call_group(GROUP_CALL_REVERSE|GROUP_CALL_REALTIME|GROUP_CALL_MULIILEVEL,"unhandled_input","_unhandled_input",ev); - if (!get_scene()->input_handled && p_event.type==InputEvent::KEY) { - get_scene()->_call_input_pause(unhandled_key_input_group,"_unhandled_key_input",p_event); + if (!get_tree()->input_handled && p_event.type==InputEvent::KEY) { + get_tree()->_call_input_pause(unhandled_key_input_group,"_unhandled_key_input",p_event); //call_group(GROUP_CALL_REVERSE|GROUP_CALL_REALTIME|GROUP_CALL_MULIILEVEL,"unhandled_key_input","_unhandled_key_input",ev); } - if (physics_object_picking && !get_scene()->input_handled) { + if (physics_object_picking && !get_tree()->input_handled) { if (p_event.type==InputEvent::MOUSE_BUTTON || p_event.type==InputEvent::MOUSE_MOTION || p_event.type==InputEvent::SCREEN_DRAG || p_event.type==InputEvent::SCREEN_TOUCH) { physics_picking_events.push_back(p_event); @@ -1134,7 +1134,7 @@ void Viewport::set_use_own_world(bool p_world) { return; - if (is_inside_scene()) + if (is_inside_tree()) _propagate_exit_world(this); #ifndef _3D_DISABLED @@ -1147,7 +1147,7 @@ void Viewport::set_use_own_world(bool p_world) { else own_world=Ref<World>( memnew( World )); - if (is_inside_scene()) + if (is_inside_tree()) _propagate_enter_world(this); #ifndef _3D_DISABLED @@ -1157,7 +1157,7 @@ void Viewport::set_use_own_world(bool p_world) { //propagate exit - if (is_inside_scene()) { + if (is_inside_tree()) { VisualServer::get_singleton()->viewport_set_scenario(viewport,find_world()->get_scenario()); } diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 37f1b357c6..4bb5735731 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -159,8 +159,8 @@ friend class RenderTargetTexture; _FORCE_INLINE_ Matrix32 _get_input_pre_xform() const; - void _vp_enter_scene(); - void _vp_exit_scene(); + void _vp_enter_tree(); + void _vp_exit_tree(); void _vp_input(const InputEvent& p_ev); void _vp_unhandled_input(const InputEvent& p_ev); diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 679f474ada..741deccdbe 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -566,7 +566,7 @@ void register_scene_types() { ObjectTypeDB::register_type<PackedScene>(); - ObjectTypeDB::register_type<SceneMainLoop>(); + ObjectTypeDB::register_type<SceneTree>(); OS::get_singleton()->yield(); //may take time to init diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index 1d99eb6d1f..df9b02ea3f 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -41,8 +41,8 @@ SceneStringNames::SceneStringNames() { visibility_changed=StaticCString::create("visibility_changed"); input_event=StaticCString::create("input_event"); shader_shader=StaticCString::create("shader/shader"); - enter_scene=StaticCString::create("enter_scene"); - exit_scene=StaticCString::create("exit_scene"); + enter_tree=StaticCString::create("enter_tree"); + exit_tree=StaticCString::create("exit_tree"); item_rect_changed=StaticCString::create("item_rect_changed"); size_flags_changed=StaticCString::create("size_flags_changed"); minimum_size_changed=StaticCString::create("minimum_size_changed"); @@ -74,8 +74,8 @@ SceneStringNames::SceneStringNames() { _fixed_process=StaticCString::create("_fixed_process"); _process=StaticCString::create("_process"); - _enter_scene=StaticCString::create("_enter_scene"); - _exit_scene=StaticCString::create("_exit_scene"); + _enter_tree=StaticCString::create("_enter_tree"); + _exit_tree=StaticCString::create("_exit_tree"); _enter_world=StaticCString::create("_enter_world"); _exit_world=StaticCString::create("_exit_world"); _ready=StaticCString::create("_ready"); @@ -98,8 +98,8 @@ SceneStringNames::SceneStringNames() { enter_camera=StaticCString::create("enter_camera"); exit_camera=StaticCString::create("exit_camera"); - _body_enter_scene = StaticCString::create("_body_enter_scene"); - _body_exit_scene = StaticCString::create("_body_exit_scene"); + _body_enter_tree = StaticCString::create("_body_enter_tree"); + _body_exit_tree = StaticCString::create("_body_exit_tree"); _input_event=StaticCString::create("_input_event"); diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index dd4f8789c2..11799b9e86 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -56,8 +56,8 @@ public: StringName _input_event; StringName item_rect_changed; StringName shader_shader; - StringName enter_scene; - StringName exit_scene; + StringName enter_tree; + StringName exit_tree; StringName size_flags_changed; StringName minimum_size_changed; StringName idle; @@ -89,8 +89,8 @@ public: StringName _process; StringName _enter_world; StringName _exit_world; - StringName _enter_scene; - StringName _exit_scene; + StringName _enter_tree; + StringName _exit_tree; StringName _draw; StringName _input; StringName _ready; @@ -116,8 +116,8 @@ public: StringName enter_camera; StringName exit_camera; - StringName _body_enter_scene; - StringName _body_exit_scene; + StringName _body_enter_tree; + StringName _body_exit_tree; StringName changed; StringName _shader_changed; diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp index 0bd21219bf..d13c7ea73c 100644 --- a/tools/doc/doc_data.cpp +++ b/tools/doc/doc_data.cpp @@ -724,6 +724,7 @@ Error DocData::_load(Ref<XMLParser> parser) { class_list[name]=ClassDoc(); ClassDoc& c = class_list[name]; +// print_line("class: "+name); c.name=name; if (parser->has_attribute("inherits")) c.inherits = parser->get_attribute_value("inherits"); @@ -809,7 +810,7 @@ Error DocData::_load(Ref<XMLParser> parser) { ERR_FAIL_V(ERR_FILE_CORRUPT); } - } else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name()=="members") + } else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name()=="theme_items") break; //end of <constants> } 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(); diff --git a/tools/export/blender25/io_scene_dae/export_dae.py b/tools/export/blender25/io_scene_dae/export_dae.py index a92b97b8a9..d3337033c8 100644 --- a/tools/export/blender25/io_scene_dae/export_dae.py +++ b/tools/export/blender25/io_scene_dae/export_dae.py @@ -185,7 +185,11 @@ class DaeExporter: else: #export relative, always, no one wants absolute paths. - imgpath = os.path.relpath(imgpath,os.path.dirname(self.path)).replace("\\","/") # export unix compatible always + try: + imgpath = os.path.relpath(imgpath,os.path.dirname(self.path)).replace("\\","/") # export unix compatible always + except: + pass #fails sometimes, not sure why + imgid = self.new_id("image") |