Ver código fonte

SceneMainLoop -> SceneTree
-=-=-=-=-=-=-=-=-=-=-=-=-=-

*YOUR SOURCE MIGHT NOT WORK*
For mor information on fix:
https://github.com/okamstudio/godot/wiki/devel_scene_tree

Other stuff:
-Shower of bullets demo
-Fixes all around

Juan Linietsky 11 anos atrás
pai
commit
0dbedd18fc
100 arquivos alterados com 962 adições e 786 exclusões
  1. 2 2
      bin/tests/test_gui.cpp
  2. 2 2
      core/os/input_event.cpp
  3. 1 1
      core/os/input_event.h
  4. 2 0
      core/variant_call.cpp
  5. BIN
      demos/2d/shower_of_bullets/bullet.png
  6. 76 0
      demos/2d/shower_of_bullets/bullets.gd
  7. 16 0
      demos/2d/shower_of_bullets/engine.cfg
  8. BIN
      demos/2d/shower_of_bullets/face_happy.png
  9. BIN
      demos/2d/shower_of_bullets/face_sad.png
  10. BIN
      demos/2d/shower_of_bullets/icon.png
  11. 32 0
      demos/2d/shower_of_bullets/shower.gd
  12. BIN
      demos/2d/shower_of_bullets/shower.scn
  13. 2 2
      demos/misc/autoload/global.gd
  14. 2 2
      demos/misc/pause/spinpause.gd
  15. 38 8
      drivers/theoraplayer/video_stream_theoraplayer.cpp
  16. 0 1
      drivers/theoraplayer/video_stream_theoraplayer.h
  17. 12 12
      main/main.cpp
  18. 1 1
      main/performance.cpp
  19. 22 1
      modules/gdscript/gd_parser.cpp
  20. 1 1
      modules/gridmap/grid_map.cpp
  21. 7 7
      modules/gridmap/grid_map_editor_plugin.cpp
  22. 1 1
      platform/windows/os_windows.cpp
  23. 21 21
      scene/2d/area_2d.cpp
  24. 3 3
      scene/2d/area_2d.h
  25. 8 8
      scene/2d/camera_2d.cpp
  26. 23 23
      scene/2d/canvas_item.cpp
  27. 2 2
      scene/2d/canvas_item.h
  28. 2 2
      scene/2d/collision_object_2d.cpp
  29. 1 1
      scene/2d/collision_polygon_2d.cpp
  30. 2 2
      scene/2d/collision_shape_2d.cpp
  31. 5 5
      scene/2d/joints_2d.cpp
  32. 2 2
      scene/2d/node_2d.cpp
  33. 3 3
      scene/2d/parallax_background.cpp
  34. 3 3
      scene/2d/parallax_layer.cpp
  35. 7 7
      scene/2d/particles_2d.cpp
  36. 4 4
      scene/2d/path_2d.cpp
  37. 12 12
      scene/2d/physics_body_2d.cpp
  38. 2 2
      scene/2d/physics_body_2d.h
  39. 3 3
      scene/2d/position_2d.cpp
  40. 6 6
      scene/2d/ray_cast_2d.cpp
  41. 4 4
      scene/2d/remote_transform_2d.cpp
  42. 1 1
      scene/2d/remote_transform_2d.h
  43. 1 1
      scene/2d/sample_player_2d.cpp
  44. 11 11
      scene/2d/screen_button.cpp
  45. 2 2
      scene/2d/sound_player_2d.cpp
  46. 3 3
      scene/2d/sprite.cpp
  47. 6 6
      scene/2d/tile_map.cpp
  48. 10 10
      scene/2d/visibility_notifier_2d.cpp
  49. 21 21
      scene/3d/area.cpp
  50. 3 3
      scene/3d/area.h
  51. 2 2
      scene/3d/body_shape.cpp
  52. 4 4
      scene/3d/bone_attachment.cpp
  53. 15 15
      scene/3d/camera.cpp
  54. 2 2
      scene/3d/collision_object.cpp
  55. 1 1
      scene/3d/collision_polygon.cpp
  56. 3 3
      scene/3d/interpolated_camera.cpp
  57. 4 4
      scene/3d/light.cpp
  58. 2 2
      scene/3d/mesh_instance.cpp
  59. 3 3
      scene/3d/navigation_mesh.cpp
  60. 360 360
      scene/3d/path.cpp
  61. 21 21
      scene/3d/physics_body.cpp
  62. 3 3
      scene/3d/physics_body.h
  63. 2 2
      scene/3d/physics_joint.cpp
  64. 2 2
      scene/3d/proximity_group.cpp
  65. 3 3
      scene/3d/quad.cpp
  66. 5 5
      scene/3d/ray_cast.cpp
  67. 1 1
      scene/3d/room_instance.cpp
  68. 4 4
      scene/3d/skeleton.cpp
  69. 12 12
      scene/3d/spatial.cpp
  70. 1 1
      scene/3d/spatial.h
  71. 2 2
      scene/3d/spatial_stream_player.cpp
  72. 2 2
      scene/3d/sprite_3d.cpp
  73. 2 2
      scene/3d/vehicle_body.cpp
  74. 7 7
      scene/3d/visibility_notifier.cpp
  75. 1 1
      scene/3d/visual_instance.cpp
  76. 5 5
      scene/animation/animation_cache.cpp
  77. 1 1
      scene/animation/animation_cache.h
  78. 7 7
      scene/animation/animation_player.cpp
  79. 1 1
      scene/animation/animation_tree_player.cpp
  80. 2 2
      scene/animation/tween.cpp
  81. 6 6
      scene/audio/event_player.cpp
  82. 2 2
      scene/audio/sound_room_params.cpp
  83. 6 6
      scene/audio/stream_player.cpp
  84. 2 2
      scene/gui/base_button.cpp
  85. 1 1
      scene/gui/button_group.cpp
  86. 3 3
      scene/gui/container.cpp
  87. 38 38
      scene/gui/control.cpp
  88. 1 1
      scene/gui/dialogs.cpp
  89. 1 1
      scene/gui/label.cpp
  90. 1 1
      scene/gui/line_edit.cpp
  91. 1 1
      scene/gui/option_button.cpp
  92. 2 2
      scene/gui/range.cpp
  93. 2 2
      scene/gui/reference_frame.cpp
  94. 8 8
      scene/gui/scroll_bar.cpp
  95. 1 1
      scene/gui/scroll_container.cpp
  96. 1 1
      scene/gui/spin_box.cpp
  97. 5 5
      scene/gui/text_edit.cpp
  98. 5 5
      scene/gui/tree.cpp
  99. 5 5
      scene/gui/video_player.cpp
  100. 3 3
      scene/main/canvas_layer.cpp

+ 2 - 2
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

+ 2 - 2
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 {

+ 1 - 1
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;

+ 2 - 0
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 */
 

BIN
demos/2d/shower_of_bullets/bullet.png


+ 76 - 0
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
+
+

+ 16 - 0
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

BIN
demos/2d/shower_of_bullets/face_happy.png


BIN
demos/2d/shower_of_bullets/face_sad.png


BIN
demos/2d/shower_of_bullets/icon.png


+ 32 - 0
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

BIN
demos/2d/shower_of_bullets/shower.scn


+ 2 - 2
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 )

+ 2 - 2
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)
 	
 	

+ 38 - 8
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;

+ 0 - 1
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;

+ 12 - 12
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);
 

+ 1 - 1
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();

+ 22 - 1
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

+ 1 - 1
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();

+ 7 - 7
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);
 			}
 		}

+ 1 - 1
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);

+ 21 - 21
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);

+ 3 - 3
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;
 	};
 

+ 8 - 8
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);
 	}
 }
 

+ 23 - 23
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) {
 

+ 2 - 2
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,

+ 2 - 2
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());

+ 1 - 1
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();
 

+ 2 - 2
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();
 

+ 5 - 5
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);

+ 2 - 2
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();

+ 3 - 3
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;

+ 3 - 3
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;
 

+ 7 - 7
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) {

+ 4 - 4
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;

+ 12 - 12
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;
 }

+ 2 - 2
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);

+ 3 - 3
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;

+ 6 - 6
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());

+ 4 - 4
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();
 }
 

+ 1 - 1
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();

+ 1 - 1
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);
 

+ 11 - 11
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();

+ 2 - 2
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);

+ 3 - 3
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()) {

+ 6 - 6
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");
 }

+ 10 - 10
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();

+ 21 - 21
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);

+ 3 - 3
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;
 	};
 

+ 2 - 2
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();

+ 4 - 4
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;

+ 15 - 15
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;

+ 2 - 2
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

+ 1 - 1
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();
 

+ 3 - 3
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

+ 4 - 4
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();
 	}
 }

+ 2 - 2
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();
 	}
 }

+ 3 - 3
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) {
 

+ 360 - 360
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;
+}

+ 21 - 21
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;
 }

+ 3 - 3
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);

+ 2 - 2
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);

+ 2 - 2
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();
 	};
 

+ 3 - 3
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;
 

+ 5 - 5
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);

+ 1 - 1
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;
 
 

+ 4 - 4
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;
 	}

+ 12 - 12
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()) {

+ 1 - 1
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,

+ 2 - 2
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;

+ 2 - 2
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) {

+ 2 - 2
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;

+ 7 - 7
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);
 
 }

+ 1 - 1
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");

+ 5 - 5
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);
 }
 

+ 1 - 1
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();

+ 7 - 7
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
 
 

+ 1 - 1
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);

+ 2 - 2
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;

+ 6 - 6
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

+ 2 - 2
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();
 

+ 6 - 6
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

+ 2 - 2
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);

+ 1 - 1
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)

+ 3 - 3
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;

+ 38 - 38
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;
 }

+ 1 - 1
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"));

+ 1 - 1
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();

+ 1 - 1
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;

+ 1 - 1
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);
 }
 

+ 2 - 2
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();
 	}

+ 2 - 2
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())) ;
 	}
 }

+ 8 - 8
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);
 		}
 	}
 }

+ 1 - 1
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");
 	};

+ 1 - 1
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);
 	}

+ 5 - 5
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;
 	}

+ 5 - 5
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();

+ 5 - 5
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;

+ 3 - 3
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();

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff