mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 04:06:14 +00:00
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
This commit is contained in:
parent
d14baf6e41
commit
0dbedd18fc
@ -58,7 +58,7 @@
|
|||||||
namespace TestGUI {
|
namespace TestGUI {
|
||||||
|
|
||||||
|
|
||||||
class TestMainLoop : public SceneMainLoop {
|
class TestMainLoop : public SceneTree {
|
||||||
|
|
||||||
|
|
||||||
Control *control;
|
Control *control;
|
||||||
@ -72,7 +72,7 @@ public:
|
|||||||
}
|
}
|
||||||
virtual void init() {
|
virtual void init() {
|
||||||
|
|
||||||
SceneMainLoop::init();
|
SceneTree::init();
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -141,11 +141,11 @@ InputEvent::operator String() const {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputEvent::set_as_action(const String& p_action) {
|
void InputEvent::set_as_action(const String& p_action, bool p_pressed) {
|
||||||
|
|
||||||
type=ACTION;
|
type=ACTION;
|
||||||
action.action=InputMap::get_singleton()->get_action_id(p_action);
|
action.action=InputMap::get_singleton()->get_action_id(p_action);
|
||||||
action.pressed=false;
|
action.pressed=p_pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputEvent::is_pressed() const {
|
bool InputEvent::is_pressed() const {
|
||||||
|
@ -288,7 +288,7 @@ struct InputEvent {
|
|||||||
bool is_pressed() const;
|
bool is_pressed() const;
|
||||||
bool is_action(const String& p_action) const;
|
bool is_action(const String& p_action) const;
|
||||||
bool is_echo() 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;
|
bool operator==(const InputEvent &p_event) const;
|
||||||
operator String() const;
|
operator String() const;
|
||||||
|
@ -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_PTR0R( InputEvent, is_pressed );
|
||||||
VCALL_PTR1R( InputEvent, is_action );
|
VCALL_PTR1R( InputEvent, is_action );
|
||||||
VCALL_PTR0R( InputEvent, is_echo );
|
VCALL_PTR0R( InputEvent, is_echo );
|
||||||
|
//VCALL_PTR2( InputEvent, set_as_action );
|
||||||
|
|
||||||
struct ConstructData {
|
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());
|
ADDFUNC0(INPUT_EVENT,BOOL,InputEvent,is_pressed,varray());
|
||||||
ADDFUNC1(INPUT_EVENT,BOOL,InputEvent,is_action,STRING,"action",varray());
|
ADDFUNC1(INPUT_EVENT,BOOL,InputEvent,is_action,STRING,"action",varray());
|
||||||
ADDFUNC0(INPUT_EVENT,BOOL,InputEvent,is_echo,varray());
|
ADDFUNC0(INPUT_EVENT,BOOL,InputEvent,is_echo,varray());
|
||||||
|
//ADDFUNC2(INPUT_EVENT,NIL,InputEvent,set_as_action,STRING,"action",BOOL,"pressed",varray());
|
||||||
|
|
||||||
/* REGISTER CONSTRUCTORS */
|
/* REGISTER CONSTRUCTORS */
|
||||||
|
|
||||||
|
BIN
demos/2d/shower_of_bullets/bullet.png
Normal file
BIN
demos/2d/shower_of_bullets/bullet.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 477 B |
76
demos/2d/shower_of_bullets/bullets.gd
Normal file
76
demos/2d/shower_of_bullets/bullets.gd
Normal file
@ -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
demos/2d/shower_of_bullets/engine.cfg
Normal file
16
demos/2d/shower_of_bullets/engine.cfg
Normal file
@ -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
Normal file
BIN
demos/2d/shower_of_bullets/face_happy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
demos/2d/shower_of_bullets/face_sad.png
Normal file
BIN
demos/2d/shower_of_bullets/face_sad.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
demos/2d/shower_of_bullets/icon.png
Normal file
BIN
demos/2d/shower_of_bullets/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
32
demos/2d/shower_of_bullets/shower.gd
Normal file
32
demos/2d/shower_of_bullets/shower.gd
Normal file
@ -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
Normal file
BIN
demos/2d/shower_of_bullets/shower.scn
Normal file
Binary file not shown.
@ -12,12 +12,12 @@ func goto_scene(scene):
|
|||||||
#instance the new scene
|
#instance the new scene
|
||||||
current_scene = s.instance()
|
current_scene = s.instance()
|
||||||
#add it to the active scene, as child of root
|
#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():
|
func _ready():
|
||||||
# get the current scene
|
# get the current scene
|
||||||
# it is always the last child of root,
|
# it is always the last child of root,
|
||||||
# after the autoloaded nodes
|
# 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 )
|
current_scene = root.get_child( root.get_child_count() -1 )
|
||||||
|
@ -5,11 +5,11 @@ extends Spatial
|
|||||||
func _on_pause_pressed():
|
func _on_pause_pressed():
|
||||||
get_node("pause_popup").set_exclusive(true)
|
get_node("pause_popup").set_exclusive(true)
|
||||||
get_node("pause_popup").popup()
|
get_node("pause_popup").popup()
|
||||||
get_scene().set_pause(true)
|
get_tree().set_pause(true)
|
||||||
|
|
||||||
|
|
||||||
func _on_unpause_pressed():
|
func _on_unpause_pressed():
|
||||||
get_node("pause_popup").hide()
|
get_node("pause_popup").hide()
|
||||||
get_scene().set_pause(false)
|
get_tree().set_pause(false)
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,6 +37,9 @@
|
|||||||
#include "include/theoraplayer/TheoraException.h"
|
#include "include/theoraplayer/TheoraException.h"
|
||||||
|
|
||||||
#include "core/ring_buffer.h"
|
#include "core/ring_buffer.h"
|
||||||
|
#include "core/os/thread_safe.h"
|
||||||
|
|
||||||
|
static TheoraVideoManager* mgr = NULL;
|
||||||
|
|
||||||
class TPDataFA : public TheoraDataSource {
|
class TPDataFA : public TheoraDataSource {
|
||||||
|
|
||||||
@ -107,6 +110,8 @@ public:
|
|||||||
|
|
||||||
class AudioStreamInput : public AudioStreamResampled {
|
class AudioStreamInput : public AudioStreamResampled {
|
||||||
|
|
||||||
|
_THREAD_SAFE_CLASS_;
|
||||||
|
|
||||||
int channels;
|
int channels;
|
||||||
int freq;
|
int freq;
|
||||||
|
|
||||||
@ -114,16 +119,28 @@ class AudioStreamInput : public AudioStreamResampled {
|
|||||||
mutable RingBuffer<float> rb;
|
mutable RingBuffer<float> rb;
|
||||||
int rb_power;
|
int rb_power;
|
||||||
int total_wrote;
|
int total_wrote;
|
||||||
|
bool playing;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void play() {
|
virtual void play() {
|
||||||
|
|
||||||
|
_THREAD_SAFE_METHOD_
|
||||||
_setup(channels, freq, 256);
|
_setup(channels, freq, 256);
|
||||||
stream_rid=AudioServer::get_singleton()->audio_stream_create(get_audio_stream());
|
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_active(stream_rid,true);
|
||||||
AudioServer::get_singleton()->stream_set_volume_scale(stream_rid,1);
|
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 bool is_playing() const { return true; };
|
||||||
|
|
||||||
virtual void set_paused(bool p_paused) {};
|
virtual void set_paused(bool p_paused) {};
|
||||||
@ -141,12 +158,13 @@ public:
|
|||||||
virtual float get_pos() const { return 0; };
|
virtual float get_pos() const { return 0; };
|
||||||
virtual void seek_pos(float p_time) {};
|
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; };
|
virtual bool _can_mix() const { return true; };
|
||||||
|
|
||||||
void input(float* p_data, int p_samples) {
|
void input(float* p_data, int p_samples) {
|
||||||
|
|
||||||
|
_THREAD_SAFE_METHOD_;
|
||||||
if (rb.space_left() < p_samples) {
|
if (rb.space_left() < p_samples) {
|
||||||
rb_power += 1;
|
rb_power += 1;
|
||||||
rb.resize(rb_power);
|
rb.resize(rb_power);
|
||||||
@ -156,6 +174,7 @@ public:
|
|||||||
|
|
||||||
void update() {
|
void update() {
|
||||||
|
|
||||||
|
_THREAD_SAFE_METHOD_;
|
||||||
int todo = get_todo();
|
int todo = get_todo();
|
||||||
int16_t* buffer = get_write_buffer();
|
int16_t* buffer = get_write_buffer();
|
||||||
int samples = rb.data_left();
|
int samples = rb.data_left();
|
||||||
@ -181,12 +200,18 @@ public:
|
|||||||
|
|
||||||
AudioStreamInput(int p_channels, int p_freq) {
|
AudioStreamInput(int p_channels, int p_freq) {
|
||||||
|
|
||||||
|
playing = false;
|
||||||
channels = p_channels;
|
channels = p_channels;
|
||||||
freq = p_freq;
|
freq = p_freq;
|
||||||
total_wrote = 0;
|
total_wrote = 0;
|
||||||
rb_power = 12;
|
rb_power = 12;
|
||||||
rb.resize(rb_power);
|
rb.resize(rb_power);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
~AudioStreamInput() {
|
||||||
|
|
||||||
|
stop();
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class TPAudioGodot : public TheoraAudioInterface, TheoraTimer {
|
class TPAudioGodot : public TheoraAudioInterface, TheoraTimer {
|
||||||
@ -398,8 +423,10 @@ void VideoStreamTheoraplayer::set_file(const String& p_file) {
|
|||||||
audio_factory = memnew(TPAudioGodotFactory);
|
audio_factory = memnew(TPAudioGodotFactory);
|
||||||
};
|
};
|
||||||
|
|
||||||
mgr = memnew(TheoraVideoManager);
|
if (mgr == NULL) {
|
||||||
mgr->setAudioInterfaceFactory(audio_factory);
|
mgr = memnew(TheoraVideoManager);
|
||||||
|
mgr->setAudioInterfaceFactory(audio_factory);
|
||||||
|
};
|
||||||
|
|
||||||
if (p_file.find(".mp4") != -1) {
|
if (p_file.find(".mp4") != -1) {
|
||||||
|
|
||||||
@ -425,15 +452,18 @@ void VideoStreamTheoraplayer::set_file(const String& p_file) {
|
|||||||
|
|
||||||
VideoStreamTheoraplayer::~VideoStreamTheoraplayer() {
|
VideoStreamTheoraplayer::~VideoStreamTheoraplayer() {
|
||||||
|
|
||||||
if (mgr) {
|
//if (mgr) {
|
||||||
memdelete(mgr);
|
// memdelete(mgr);
|
||||||
|
//};
|
||||||
|
//mgr = NULL;
|
||||||
|
if (clip) {
|
||||||
|
delete clip; // created by video manager with new
|
||||||
};
|
};
|
||||||
mgr = NULL;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
VideoStreamTheoraplayer::VideoStreamTheoraplayer() {
|
VideoStreamTheoraplayer::VideoStreamTheoraplayer() {
|
||||||
|
|
||||||
mgr = NULL;
|
//mgr = NULL;
|
||||||
clip = NULL;
|
clip = NULL;
|
||||||
started = false;
|
started = false;
|
||||||
playing = false;
|
playing = false;
|
||||||
|
@ -13,7 +13,6 @@ class VideoStreamTheoraplayer : public VideoStream {
|
|||||||
OBJ_TYPE(VideoStreamTheoraplayer,VideoStream);
|
OBJ_TYPE(VideoStreamTheoraplayer,VideoStream);
|
||||||
|
|
||||||
mutable DVector<uint8_t> data;
|
mutable DVector<uint8_t> data;
|
||||||
TheoraVideoManager* mgr;
|
|
||||||
TheoraVideoClip* clip;
|
TheoraVideoClip* clip;
|
||||||
bool started;
|
bool started;
|
||||||
bool playing;
|
bool playing;
|
||||||
|
@ -961,7 +961,7 @@ bool Main::start() {
|
|||||||
|
|
||||||
MainLoop *main_loop=NULL;
|
MainLoop *main_loop=NULL;
|
||||||
if (editor) {
|
if (editor) {
|
||||||
main_loop = memnew(SceneMainLoop);
|
main_loop = memnew(SceneTree);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (test!="") {
|
if (test!="") {
|
||||||
@ -979,7 +979,7 @@ bool Main::start() {
|
|||||||
ERR_EXPLAIN("Can't load script: "+script);
|
ERR_EXPLAIN("Can't load script: "+script);
|
||||||
ERR_FAIL_COND_V(script_res.is_null(),false);
|
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();
|
StringName instance_type=script_res->get_instance_base_type();
|
||||||
@ -1005,7 +1005,7 @@ bool Main::start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!main_loop && main_loop_type=="")
|
if (!main_loop && main_loop_type=="")
|
||||||
main_loop_type="SceneMainLoop";
|
main_loop_type="SceneTree";
|
||||||
|
|
||||||
if (!main_loop) {
|
if (!main_loop) {
|
||||||
if (!ObjectTypeDB::type_exists(main_loop_type)) {
|
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
|
#ifdef TOOLS_ENABLED
|
||||||
|
|
||||||
@ -1060,19 +1060,19 @@ bool Main::start() {
|
|||||||
String stretch_aspect = GLOBAL_DEF("display/stretch_aspect","ignore");
|
String stretch_aspect = GLOBAL_DEF("display/stretch_aspect","ignore");
|
||||||
Size2i stretch_size = Size2(GLOBAL_DEF("display/width",0),GLOBAL_DEF("display/height",0));
|
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")
|
if (stretch_mode=="2d")
|
||||||
sml_sm=SceneMainLoop::STRETCH_MODE_2D;
|
sml_sm=SceneTree::STRETCH_MODE_2D;
|
||||||
else if (stretch_mode=="viewport")
|
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")
|
if (stretch_aspect=="keep")
|
||||||
sml_aspect=SceneMainLoop::STRETCH_ASPECT_KEEP;
|
sml_aspect=SceneTree::STRETCH_ASPECT_KEEP;
|
||||||
else if (stretch_aspect=="keep_width")
|
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")
|
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);
|
sml->set_screen_stretch(sml_sm,sml_aspect,stretch_size);
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ float Performance::get_monitor(Monitor p_monitor) const {
|
|||||||
MainLoop *ml = OS::get_singleton()->get_main_loop();
|
MainLoop *ml = OS::get_singleton()->get_main_loop();
|
||||||
if (!ml)
|
if (!ml)
|
||||||
return 0;
|
return 0;
|
||||||
SceneMainLoop *sml = ml->cast_to<SceneMainLoop>();
|
SceneTree *sml = ml->cast_to<SceneTree>();
|
||||||
if (!sml)
|
if (!sml)
|
||||||
return 0;
|
return 0;
|
||||||
return sml->get_node_count();
|
return sml->get_node_count();
|
||||||
|
@ -1158,7 +1158,7 @@ GDParser::Node* GDParser::_reduce_expression(Node *p_node,bool p_to_const) {
|
|||||||
cn->value=v;
|
cn->value=v;
|
||||||
return cn;
|
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]);
|
ConstantNode *ca = static_cast<ConstantNode*>(op->arguments[0]);
|
||||||
IdentifierNode *ib = static_cast<IdentifierNode*>(op->arguments[1]);
|
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>();
|
ConstantNode *cn = alloc_node<ConstantNode>();
|
||||||
cn->value=v;
|
cn->value=v;
|
||||||
return cn;
|
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;
|
return op;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//validate assignment (don't assign to cosntant expression
|
//validate assignment (don't assign to cosntant expression
|
||||||
|
@ -677,7 +677,7 @@ void GridMap::_octant_clear_baked(const OctantKey &p_key) {
|
|||||||
g.bake_instance=RID();
|
g.bake_instance=RID();
|
||||||
g.baked=Ref<Mesh>();
|
g.baked=Ref<Mesh>();
|
||||||
|
|
||||||
if (is_inside_scene())
|
if (is_inside_tree())
|
||||||
_octant_enter_world(p_key);
|
_octant_enter_world(p_key);
|
||||||
g.dirty=true;
|
g.dirty=true;
|
||||||
_queue_dirty_map();
|
_queue_dirty_map();
|
||||||
|
@ -974,7 +974,7 @@ void GridMapEditor::update_grid() {
|
|||||||
|
|
||||||
void GridMapEditor::_notification(int p_what) {
|
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");
|
theme_pallete->connect("cell_selected", this,"_item_selected_cbk");
|
||||||
edit_mode->connect("item_selected", this,"_edit_mode_changed");
|
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++) {
|
for(int i=0;i<3;i++) {
|
||||||
|
|
||||||
grid[i]=VS::get_singleton()->mesh_create();
|
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());
|
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_scene()->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_selection_transform();
|
||||||
_update_duplicate_indicator();
|
_update_duplicate_indicator();
|
||||||
|
|
||||||
} else if (p_what==NOTIFICATION_EXIT_SCENE) {
|
} else if (p_what==NOTIFICATION_EXIT_TREE) {
|
||||||
|
|
||||||
for(int i=0;i<3;i++) {
|
for(int i=0;i<3;i++) {
|
||||||
|
|
||||||
@ -1025,7 +1025,7 @@ void GridMapEditor::_notification(int p_what) {
|
|||||||
|
|
||||||
if (lock_view) {
|
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;
|
Plane p;
|
||||||
p.normal[edit_axis]=1.0;
|
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);
|
Ref<Mesh> mesh = node->get_theme()->get_item_mesh(selected_pallete);
|
||||||
if (!mesh.is_null() && mesh->get_rid().is_valid()) {
|
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);
|
VisualServer::get_singleton()->instance_set_transform(cursor_instance,cursor_transform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -928,7 +928,7 @@ void OS_Windows::process_joysticks() {
|
|||||||
|
|
||||||
if ( (joysticks[i].last_buttons & (1<<j)) != (jinfo.dwButtons & (1<<j)) ) {
|
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.joy_button.pressed = jinfo.dwButtons & 1<<j;
|
||||||
ievent.ID = ++last_id;
|
ievent.ID = ++last_id;
|
||||||
input->parse_input_event(ievent);
|
input->parse_input_event(ievent);
|
||||||
|
@ -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);
|
Object *obj = ObjectDB::get_instance(p_id);
|
||||||
Node *node = obj ? obj->cast_to<Node>() : NULL;
|
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);
|
Map<ObjectID,BodyState>::Element *E=body_map.find(p_id);
|
||||||
ERR_FAIL_COND(!E);
|
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);
|
emit_signal(SceneStringNames::get_singleton()->body_enter,node);
|
||||||
for(int i=0;i<E->get().shapes.size();i++) {
|
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);
|
Object *obj = ObjectDB::get_instance(p_id);
|
||||||
Node *node = obj ? obj->cast_to<Node>() : NULL;
|
Node *node = obj ? obj->cast_to<Node>() : NULL;
|
||||||
ERR_FAIL_COND(!node);
|
ERR_FAIL_COND(!node);
|
||||||
Map<ObjectID,BodyState>::Element *E=body_map.find(p_id);
|
Map<ObjectID,BodyState>::Element *E=body_map.find(p_id);
|
||||||
ERR_FAIL_COND(!E);
|
ERR_FAIL_COND(!E);
|
||||||
ERR_FAIL_COND(!E->get().in_scene);
|
ERR_FAIL_COND(!E->get().in_tree);
|
||||||
E->get().in_scene=false;
|
E->get().in_tree=false;
|
||||||
emit_signal(SceneStringNames::get_singleton()->body_exit,node);
|
emit_signal(SceneStringNames::get_singleton()->body_exit,node);
|
||||||
for(int i=0;i<E->get().shapes.size();i++) {
|
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 = body_map.insert(objid,BodyState());
|
||||||
E->get().rc=0;
|
E->get().rc=0;
|
||||||
E->get().in_scene=node && node->is_inside_scene();
|
E->get().in_tree=node && node->is_inside_tree();
|
||||||
if (node) {
|
if (node) {
|
||||||
node->connect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_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_scene,this,SceneStringNames::get_singleton()->_body_exit_scene,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) {
|
if (E->get().in_tree) {
|
||||||
emit_signal(SceneStringNames::get_singleton()->body_enter,node);
|
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));
|
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);
|
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 (E->get().rc==0) {
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
node->disconnect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_scene);
|
node->disconnect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree);
|
||||||
node->disconnect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene);
|
node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree);
|
||||||
if (E->get().in_scene)
|
if (E->get().in_tree)
|
||||||
emit_signal(SceneStringNames::get_singleton()->body_exit,obj);
|
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;
|
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);
|
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());
|
Object *obj = ObjectDB::get_instance(E->key());
|
||||||
Node *node = obj ? obj->cast_to<Node>() : NULL;
|
Node *node = obj ? obj->cast_to<Node>() : NULL;
|
||||||
ERR_CONTINUE(!node);
|
ERR_CONTINUE(!node);
|
||||||
if (!E->get().in_scene)
|
if (!E->get().in_tree)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for(int i=0;i<E->get().shapes.size();i++) {
|
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);
|
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()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree);
|
||||||
node->disconnect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene);
|
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) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
_clear_monitoring();
|
_clear_monitoring();
|
||||||
} break;
|
} break;
|
||||||
@ -266,8 +266,8 @@ bool Area2D::is_monitoring_enabled() const {
|
|||||||
|
|
||||||
void Area2D::_bind_methods() {
|
void Area2D::_bind_methods() {
|
||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("_body_enter_scene","id"),&Area2D::_body_enter_scene);
|
ObjectTypeDB::bind_method(_MD("_body_enter_tree","id"),&Area2D::_body_enter_tree);
|
||||||
ObjectTypeDB::bind_method(_MD("_body_exit_scene","id"),&Area2D::_body_exit_scene);
|
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("set_space_override_mode","enable"),&Area2D::set_space_override_mode);
|
||||||
ObjectTypeDB::bind_method(_MD("get_space_override_mode"),&Area2D::get_space_override_mode);
|
ObjectTypeDB::bind_method(_MD("get_space_override_mode"),&Area2D::get_space_override_mode);
|
||||||
|
@ -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_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_enter_tree(ObjectID p_id);
|
||||||
void _body_exit_scene(ObjectID p_id);
|
void _body_exit_tree(ObjectID p_id);
|
||||||
|
|
||||||
struct ShapePair {
|
struct ShapePair {
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ private:
|
|||||||
struct BodyState {
|
struct BodyState {
|
||||||
|
|
||||||
int rc;
|
int rc;
|
||||||
bool in_scene;
|
bool in_tree;
|
||||||
VSet<ShapePair> shapes;
|
VSet<ShapePair> shapes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -33,10 +33,10 @@
|
|||||||
void Camera2D::_update_scroll() {
|
void Camera2D::_update_scroll() {
|
||||||
|
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (get_scene()->is_editor_hint()) {
|
if (get_tree()->is_editor_hint()) {
|
||||||
update(); //will just be drawn
|
update(); //will just be drawn
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ void Camera2D::_update_scroll() {
|
|||||||
if (viewport) {
|
if (viewport) {
|
||||||
viewport->set_canvas_transform( xform );
|
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() {
|
Matrix32 Camera2D::get_camera_transform() {
|
||||||
|
|
||||||
if (!get_scene())
|
if (!get_tree())
|
||||||
return Matrix32();
|
return Matrix32();
|
||||||
|
|
||||||
Size2 screen_size = get_viewport_rect().size;
|
Size2 screen_size = get_viewport_rect().size;
|
||||||
@ -213,7 +213,7 @@ void Camera2D::_notification(int p_what) {
|
|||||||
_update_scroll();
|
_update_scroll();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
viewport = NULL;
|
viewport = NULL;
|
||||||
Node *n=this;
|
Node *n=this;
|
||||||
@ -239,7 +239,7 @@ void Camera2D::_notification(int p_what) {
|
|||||||
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
if (is_current()) {
|
if (is_current()) {
|
||||||
if (viewport) {
|
if (viewport) {
|
||||||
@ -316,10 +316,10 @@ bool Camera2D::is_current() const {
|
|||||||
|
|
||||||
void Camera2D::make_current() {
|
void Camera2D::make_current() {
|
||||||
|
|
||||||
if (!is_inside_scene()) {
|
if (!is_inside_tree()) {
|
||||||
current=true;
|
current=true;
|
||||||
} else {
|
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
bool CanvasItem::is_visible() const {
|
bool CanvasItem::is_visible() const {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const CanvasItem *p=this;
|
const CanvasItem *p=this;
|
||||||
@ -92,7 +92,7 @@ void CanvasItem::show() {
|
|||||||
hidden=false;
|
hidden=false;
|
||||||
VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,true);
|
VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,true);
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (is_visible()) {
|
if (is_visible()) {
|
||||||
@ -106,11 +106,11 @@ void CanvasItem::hide() {
|
|||||||
if (hidden)
|
if (hidden)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool propagate=is_inside_scene() && is_visible();
|
bool propagate=is_inside_tree() && is_visible();
|
||||||
hidden=true;
|
hidden=true;
|
||||||
VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,false);
|
VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,false);
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
if (propagate)
|
if (propagate)
|
||||||
_propagate_visibility_changed(false);
|
_propagate_visibility_changed(false);
|
||||||
@ -147,7 +147,7 @@ void CanvasItem::_update_callback() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!is_inside_scene()) {
|
if (!is_inside_tree()) {
|
||||||
pending_update=false;
|
pending_update=false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ void CanvasItem::_sort_children() {
|
|||||||
|
|
||||||
pending_children_sort=false;
|
pending_children_sort=false;
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(int i=0;i<get_child_count();i++) {
|
for(int i=0;i<get_child_count();i++) {
|
||||||
@ -243,7 +243,7 @@ void CanvasItem::_sort_children() {
|
|||||||
|
|
||||||
void CanvasItem::_raise_self() {
|
void CanvasItem::_raise_self() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VisualServer::get_singleton()->canvas_item_raise(canvas_item);
|
VisualServer::get_singleton()->canvas_item_raise(canvas_item);
|
||||||
@ -283,7 +283,7 @@ void CanvasItem::_enter_canvas() {
|
|||||||
group = "root_canvas"+itos(canvas.get_id());
|
group = "root_canvas"+itos(canvas.get_id());
|
||||||
|
|
||||||
add_to_group(group);
|
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 {
|
} else {
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ void CanvasItem::_notification(int p_what) {
|
|||||||
|
|
||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
first_draw=true;
|
first_draw=true;
|
||||||
pending_children_sort=false;
|
pending_children_sort=false;
|
||||||
@ -324,14 +324,14 @@ void CanvasItem::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
_enter_canvas();
|
_enter_canvas();
|
||||||
if (!block_transform_notify && !xform_change.in_list()) {
|
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;
|
} break;
|
||||||
case NOTIFICATION_MOVED_IN_PARENT: {
|
case NOTIFICATION_MOVED_IN_PARENT: {
|
||||||
|
|
||||||
|
|
||||||
if (group!="") {
|
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 {
|
} else {
|
||||||
CanvasItem *p = get_parent_item();
|
CanvasItem *p = get_parent_item();
|
||||||
ERR_FAIL_COND(!p);
|
ERR_FAIL_COND(!p);
|
||||||
@ -340,9 +340,9 @@ void CanvasItem::_notification(int p_what) {
|
|||||||
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (xform_change.in_list())
|
if (xform_change.in_list())
|
||||||
get_scene()->xform_change_list.remove(&xform_change);
|
get_tree()->xform_change_list.remove(&xform_change);
|
||||||
_exit_canvas();
|
_exit_canvas();
|
||||||
if (C) {
|
if (C) {
|
||||||
get_parent()->cast_to<CanvasItem>()->children_items.erase(C);
|
get_parent()->cast_to<CanvasItem>()->children_items.erase(C);
|
||||||
@ -379,7 +379,7 @@ bool CanvasItem::_is_visible_() const {
|
|||||||
|
|
||||||
void CanvasItem::update() {
|
void CanvasItem::update() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
if (pending_update)
|
if (pending_update)
|
||||||
return;
|
return;
|
||||||
@ -406,7 +406,7 @@ void CanvasItem::set_as_toplevel(bool p_toplevel) {
|
|||||||
if (toplevel==p_toplevel)
|
if (toplevel==p_toplevel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!is_inside_scene()) {
|
if (!is_inside_tree()) {
|
||||||
toplevel=p_toplevel;
|
toplevel=p_toplevel;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -630,8 +630,8 @@ void CanvasItem::_notify_transform(CanvasItem *p_node) {
|
|||||||
|
|
||||||
if (!p_node->xform_change.in_list()) {
|
if (!p_node->xform_change.in_list()) {
|
||||||
if (!p_node->block_transform_notify) {
|
if (!p_node->block_transform_notify) {
|
||||||
if (p_node->is_inside_scene())
|
if (p_node->is_inside_tree())
|
||||||
get_scene()->xform_change_list.add(&p_node->xform_change);
|
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 {
|
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();
|
return get_viewport()->get_visible_rect();
|
||||||
}
|
}
|
||||||
|
|
||||||
RID CanvasItem::get_canvas() const {
|
RID CanvasItem::get_canvas() const {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(!is_inside_scene(),RID());
|
ERR_FAIL_COND_V(!is_inside_tree(),RID());
|
||||||
|
|
||||||
if (canvas_layer)
|
if (canvas_layer)
|
||||||
return canvas_layer->get_world_2d()->get_canvas();
|
return canvas_layer->get_world_2d()->get_canvas();
|
||||||
@ -677,7 +677,7 @@ CanvasItem *CanvasItem::get_toplevel() const {
|
|||||||
|
|
||||||
Ref<World2D> CanvasItem::get_world_2d() 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();
|
CanvasItem *tl=get_toplevel();
|
||||||
|
|
||||||
@ -693,7 +693,7 @@ Ref<World2D> CanvasItem::get_world_2d() const {
|
|||||||
|
|
||||||
RID CanvasItem::get_viewport_rid() 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();
|
return get_viewport()->get_viewport();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -824,7 +824,7 @@ void CanvasItem::_bind_methods() {
|
|||||||
|
|
||||||
Matrix32 CanvasItem::get_canvas_transform() const {
|
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)
|
if (canvas_layer)
|
||||||
return canvas_layer->get_transform();
|
return canvas_layer->get_transform();
|
||||||
@ -835,7 +835,7 @@ Matrix32 CanvasItem::get_canvas_transform() const {
|
|||||||
|
|
||||||
Matrix32 CanvasItem::get_viewport_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) {
|
if (canvas_layer) {
|
||||||
|
|
||||||
|
@ -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();
|
void item_rect_changed();
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
NOTIFICATION_TRANSFORM_CHANGED=SceneMainLoop::NOTIFICATION_TRANSFORM_CHANGED, //unique
|
NOTIFICATION_TRANSFORM_CHANGED=SceneTree::NOTIFICATION_TRANSFORM_CHANGED, //unique
|
||||||
NOTIFICATION_DRAW=30,
|
NOTIFICATION_DRAW=30,
|
||||||
NOTIFICATION_VISIBILITY_CHANGED=31,
|
NOTIFICATION_VISIBILITY_CHANGED=31,
|
||||||
NOTIFICATION_ENTER_CANVAS=32,
|
NOTIFICATION_ENTER_CANVAS=32,
|
||||||
|
@ -45,7 +45,7 @@ void CollisionObject2D::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
if (area)
|
if (area)
|
||||||
Physics2DServer::get_singleton()->area_set_transform(rid,get_global_transform());
|
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());
|
Physics2DServer::get_singleton()->body_set_state(rid,Physics2DServer::BODY_STATE_TRANSFORM,get_global_transform());
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
if (area) {
|
if (area) {
|
||||||
Physics2DServer::get_singleton()->area_set_space(rid,RID());
|
Physics2DServer::get_singleton()->area_set_space(rid,RID());
|
||||||
|
@ -95,7 +95,7 @@ void CollisionPolygon2D::_notification(int p_what) {
|
|||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
break;
|
break;
|
||||||
_update_parent();
|
_update_parent();
|
||||||
|
|
||||||
|
@ -72,12 +72,12 @@ void CollisionShape2D::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
unparenting=false;
|
unparenting=false;
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
break;
|
break;
|
||||||
_update_parent();
|
_update_parent();
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
void Joint2D::_update_joint() {
|
void Joint2D::_update_joint() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (joint.is_valid()) {
|
if (joint.is_valid()) {
|
||||||
@ -86,7 +86,7 @@ void Joint2D::_notification(int p_what) {
|
|||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_READY: {
|
||||||
_update_joint();
|
_update_joint();
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (joint.is_valid()) {
|
if (joint.is_valid()) {
|
||||||
|
|
||||||
Physics2DServer::get_singleton()->free(joint);
|
Physics2DServer::get_singleton()->free(joint);
|
||||||
@ -145,7 +145,7 @@ void PinJoint2D::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
case NOTIFICATION_DRAW: {
|
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,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);
|
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) {
|
switch(p_what) {
|
||||||
case NOTIFICATION_DRAW: {
|
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,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);
|
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) {
|
switch(p_what) {
|
||||||
case NOTIFICATION_DRAW: {
|
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,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);
|
draw_line(Point2(-10,length),Point2(+10,length),Color(0.7,0.6,0.0,0.5),3);
|
||||||
|
@ -130,7 +130,7 @@ void Node2D::_update_transform() {
|
|||||||
|
|
||||||
VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(),_mat);
|
VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(),_mat);
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ void Node2D::set_transform(const Matrix32& p_transform) {
|
|||||||
|
|
||||||
VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(),_mat);
|
VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(),_mat);
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_notify_transform();
|
_notify_transform();
|
||||||
|
@ -36,13 +36,13 @@ void ParallaxBackground::_notification(int p_what) {
|
|||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
group_name = "__cameras_"+itos(get_viewport().get_id());
|
group_name = "__cameras_"+itos(get_viewport().get_id());
|
||||||
add_to_group(group_name);
|
add_to_group(group_name);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
remove_from_group(group_name);
|
remove_from_group(group_name);
|
||||||
} break;
|
} break;
|
||||||
@ -78,7 +78,7 @@ void ParallaxBackground::set_scroll_offset(const Point2& p_ofs) {
|
|||||||
|
|
||||||
void ParallaxBackground::_update_scroll() {
|
void ParallaxBackground::_update_scroll() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Vector2 ofs = base_offset+offset*base_scale;
|
Vector2 ofs = base_offset+offset*base_scale;
|
||||||
|
@ -74,7 +74,7 @@ void ParallaxLayer::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
orig_offset=get_pos();
|
orig_offset=get_pos();
|
||||||
orig_scale=get_scale();
|
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) {
|
void ParallaxLayer::set_base_offset_and_scale(const Point2& p_offset,float p_scale) {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
if (get_scene()->is_editor_hint())
|
if (get_tree()->is_editor_hint())
|
||||||
return;
|
return;
|
||||||
Point2 new_ofs = ((orig_offset+p_offset)*motion_scale)*p_scale;
|
Point2 new_ofs = ((orig_offset+p_offset)*motion_scale)*p_scale;
|
||||||
|
|
||||||
|
@ -34,14 +34,14 @@ void ParticleAttractor2D::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
_update_owner();
|
_update_owner();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
|
|
||||||
if (!get_scene()->is_editor_hint())
|
if (!get_tree()->is_editor_hint())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Vector2 pv;
|
Vector2 pv;
|
||||||
@ -58,7 +58,7 @@ void ParticleAttractor2D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (owner) {
|
if (owner) {
|
||||||
_set_owner(NULL);
|
_set_owner(NULL);
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ void ParticleAttractor2D::_owner_exited() {
|
|||||||
|
|
||||||
void ParticleAttractor2D::_update_owner() {
|
void ParticleAttractor2D::_update_owner() {
|
||||||
|
|
||||||
if (!is_inside_scene() || !has_node(path)) {
|
if (!is_inside_tree() || !has_node(path)) {
|
||||||
_set_owner(NULL);
|
_set_owner(NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ void ParticleAttractor2D::_set_owner(Particles2D* p_owner) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (owner) {
|
if (owner) {
|
||||||
owner->disconnect("exit_scene",this,"_owner_exited");
|
owner->disconnect("exit_tree",this,"_owner_exited");
|
||||||
owner->attractors.erase(this);
|
owner->attractors.erase(this);
|
||||||
owner=NULL;
|
owner=NULL;
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ void ParticleAttractor2D::_set_owner(Particles2D* p_owner) {
|
|||||||
|
|
||||||
if (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);
|
owner->attractors.insert(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -457,7 +457,7 @@ void Particles2D::_notification(int p_what) {
|
|||||||
_process_particles( get_process_delta_time() );
|
_process_particles( get_process_delta_time() );
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
float ppt=preprocess;
|
float ppt=preprocess;
|
||||||
while(ppt>0) {
|
while(ppt>0) {
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
void Path2D::_notification(int p_what) {
|
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!!
|
//draw the curve!!
|
||||||
|
|
||||||
for(int i=0;i<curve->get_point_count();i++) {
|
for(int i=0;i<curve->get_point_count();i++) {
|
||||||
@ -52,7 +52,7 @@ void Path2D::_notification(int p_what) {
|
|||||||
void Path2D::_curve_changed() {
|
void Path2D::_curve_changed() {
|
||||||
|
|
||||||
|
|
||||||
if (is_inside_scene() && get_scene()->is_editor_hint())
|
if (is_inside_tree() && get_tree()->is_editor_hint())
|
||||||
update();
|
update();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ void PathFollow2D::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
Node *parent=get_parent();
|
Node *parent=get_parent();
|
||||||
if (parent) {
|
if (parent) {
|
||||||
@ -147,7 +147,7 @@ void PathFollow2D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
|
|
||||||
path=NULL;
|
path=NULL;
|
||||||
|
@ -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);
|
Object *obj = ObjectDB::get_instance(p_id);
|
||||||
Node *node = obj ? obj->cast_to<Node>() : NULL;
|
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);
|
Object *obj = ObjectDB::get_instance(p_id);
|
||||||
Node *node = obj ? obj->cast_to<Node>() : NULL;
|
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 = contact_monitor->body_map.insert(objid,BodyState());
|
||||||
// E->get().rc=0;
|
// E->get().rc=0;
|
||||||
E->get().in_scene=node && node->is_inside_scene();
|
E->get().in_scene=node && node->is_inside_tree();
|
||||||
if (node) {
|
if (node) {
|
||||||
node->connect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_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_scene,this,SceneStringNames::get_singleton()->_body_exit_scene,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) {
|
if (E->get().in_scene) {
|
||||||
emit_signal(SceneStringNames::get_singleton()->body_enter,node);
|
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 (E->get().shapes.empty()) {
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
node->disconnect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_scene);
|
node->disconnect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree);
|
||||||
node->disconnect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene);
|
node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree);
|
||||||
if (in_scene)
|
if (in_scene)
|
||||||
emit_signal(SceneStringNames::get_singleton()->body_exit,obj);
|
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("is_able_to_sleep"),&RigidBody2D::is_able_to_sleep);
|
||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("_direct_state_changed"),&RigidBody2D::_direct_state_changed);
|
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_enter_tree"),&RigidBody2D::_body_enter_tree);
|
||||||
ObjectTypeDB::bind_method(_MD("_body_exit_scene"),&RigidBody2D::_body_exit_scene);
|
ObjectTypeDB::bind_method(_MD("_body_exit_tree"),&RigidBody2D::_body_exit_tree);
|
||||||
|
|
||||||
BIND_VMETHOD(MethodInfo("_integrate_forces",PropertyInfo(Variant::OBJECT,"state:Physics2DDirectBodyState")));
|
BIND_VMETHOD(MethodInfo("_integrate_forces",PropertyInfo(Variant::OBJECT,"state:Physics2DDirectBodyState")));
|
||||||
|
|
||||||
@ -803,7 +803,7 @@ Vector2 KinematicBody2D::move(const Vector2& p_motion) {
|
|||||||
|
|
||||||
|
|
||||||
colliding=false;
|
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());
|
Physics2DDirectSpaceState *dss = Physics2DServer::get_singleton()->space_get_direct_state(get_world_2d()->get_space());
|
||||||
ERR_FAIL_COND_V(!dss,Vector2());
|
ERR_FAIL_COND_V(!dss,Vector2());
|
||||||
const int max_shapes=32;
|
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) {
|
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());
|
Physics2DDirectSpaceState *dss = Physics2DServer::get_singleton()->space_get_direct_state(get_world_2d()->get_space());
|
||||||
ERR_FAIL_COND_V(!dss,false);
|
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 {
|
bool KinematicBody2D::is_colliding() const {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(!is_inside_scene(),false);
|
ERR_FAIL_COND_V(!is_inside_tree(),false);
|
||||||
|
|
||||||
return colliding;
|
return colliding;
|
||||||
}
|
}
|
||||||
|
@ -170,8 +170,8 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
ContactMonitor *contact_monitor;
|
ContactMonitor *contact_monitor;
|
||||||
void _body_enter_scene(ObjectID p_id);
|
void _body_enter_tree(ObjectID p_id);
|
||||||
void _body_exit_scene(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);
|
void _body_inout(int p_status, ObjectID p_instance, int p_body_shape,int p_local_shape);
|
||||||
|
@ -45,14 +45,14 @@ void Position2D::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
break;
|
break;
|
||||||
if (get_scene()->is_editor_hint())
|
if (get_tree()->is_editor_hint())
|
||||||
_draw_cross();
|
_draw_cross();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
void RayCast2D::set_cast_to(const Vector2& p_point) {
|
void RayCast2D::set_cast_to(const Vector2& p_point) {
|
||||||
|
|
||||||
cast_to=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();
|
update();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ Vector2 RayCast2D::get_collision_normal() const{
|
|||||||
void RayCast2D::set_enabled(bool p_enabled) {
|
void RayCast2D::set_enabled(bool p_enabled) {
|
||||||
|
|
||||||
enabled=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);
|
set_fixed_process(p_enabled);
|
||||||
if (!p_enabled)
|
if (!p_enabled)
|
||||||
collided=false;
|
collided=false;
|
||||||
@ -101,15 +101,15 @@ void RayCast2D::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(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);
|
set_fixed_process(true);
|
||||||
else
|
else
|
||||||
set_fixed_process(false);
|
set_fixed_process(false);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
set_fixed_process(false);
|
set_fixed_process(false);
|
||||||
@ -118,7 +118,7 @@ void RayCast2D::_notification(int p_what) {
|
|||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
|
|
||||||
if (!get_scene()->is_editor_hint())
|
if (!get_tree()->is_editor_hint())
|
||||||
break;
|
break;
|
||||||
Matrix32 xf;
|
Matrix32 xf;
|
||||||
xf.rotate(cast_to.atan2());
|
xf.rotate(cast_to.atan2());
|
||||||
|
@ -45,7 +45,7 @@ void RemoteTransform2D::_update_cache() {
|
|||||||
void RemoteTransform2D::_update_remote() {
|
void RemoteTransform2D::_update_remote() {
|
||||||
|
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!cache)
|
if (!cache)
|
||||||
@ -59,7 +59,7 @@ void RemoteTransform2D::_update_remote() {
|
|||||||
if (!n)
|
if (!n)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!n->is_inside_scene())
|
if (!n->is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//todo make faster
|
//todo make faster
|
||||||
@ -77,7 +77,7 @@ void RemoteTransform2D::_notification(int p_what) {
|
|||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (cache) {
|
if (cache) {
|
||||||
@ -95,7 +95,7 @@ void RemoteTransform2D::_notification(int p_what) {
|
|||||||
void RemoteTransform2D::set_remote_node(const NodePath& p_remote_node) {
|
void RemoteTransform2D::set_remote_node(const NodePath& p_remote_node) {
|
||||||
|
|
||||||
remote_node=p_remote_node;
|
remote_node=p_remote_node;
|
||||||
if (is_inside_scene())
|
if (is_inside_tree())
|
||||||
_update_cache();
|
_update_cache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class RemoteTransform2D : public Node2D {
|
|||||||
|
|
||||||
void _update_remote();
|
void _update_remote();
|
||||||
void _update_cache();
|
void _update_cache();
|
||||||
void _node_exited_scene();
|
//void _node_exited_scene();
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
@ -89,7 +89,7 @@ void SamplePlayer2D::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
SpatialSound2DServer::get_singleton()->source_set_polyphony(get_source_rid(),polyphony);
|
SpatialSound2DServer::get_singleton()->source_set_polyphony(get_source_rid(),polyphony);
|
||||||
|
|
||||||
|
@ -69,9 +69,9 @@ void TouchScreenButton::_notification(int p_what) {
|
|||||||
|
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
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;
|
return;
|
||||||
|
|
||||||
if (finger_pressed!=-1) {
|
if (finger_pressed!=-1) {
|
||||||
@ -87,13 +87,13 @@ void TouchScreenButton::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} 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;
|
return;
|
||||||
update();
|
update();
|
||||||
|
|
||||||
if (!get_scene()->is_editor_hint())
|
if (!get_tree()->is_editor_hint())
|
||||||
set_process_input(true);
|
set_process_input(true);
|
||||||
|
|
||||||
if (action.operator String()!="" && InputMap::get_singleton()->has_action(action)) {
|
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) {
|
void TouchScreenButton::_input(const InputEvent& p_event) {
|
||||||
|
|
||||||
if (!get_scene())
|
if (!get_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (p_event.device != 0)
|
if (p_event.device != 0)
|
||||||
@ -149,7 +149,7 @@ void TouchScreenButton::_input(const InputEvent& p_event) {
|
|||||||
ie.ID=0;
|
ie.ID=0;
|
||||||
ie.action.action=action_id;
|
ie.action.action=action_id;
|
||||||
ie.action.pressed=false;
|
ie.action.pressed=false;
|
||||||
get_scene()->input_event(ie);
|
get_tree()->input_event(ie);
|
||||||
}
|
}
|
||||||
finger_pressed=-1;
|
finger_pressed=-1;
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ void TouchScreenButton::_input(const InputEvent& p_event) {
|
|||||||
ie.ID=0;
|
ie.ID=0;
|
||||||
ie.action.action=action_id;
|
ie.action.action=action_id;
|
||||||
ie.action.pressed=true;
|
ie.action.pressed=true;
|
||||||
get_scene()->input_event(ie);
|
get_tree()->input_event(ie);
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
@ -213,7 +213,7 @@ void TouchScreenButton::_input(const InputEvent& p_event) {
|
|||||||
ie.ID=0;
|
ie.ID=0;
|
||||||
ie.action.action=action_id;
|
ie.action.action=action_id;
|
||||||
ie.action.pressed=false;
|
ie.action.pressed=false;
|
||||||
get_scene()->input_event(ie);
|
get_tree()->input_event(ie);
|
||||||
}
|
}
|
||||||
finger_pressed=-1;
|
finger_pressed=-1;
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ void TouchScreenButton::_input(const InputEvent& p_event) {
|
|||||||
ie.ID=0;
|
ie.ID=0;
|
||||||
ie.action.action=action_id;
|
ie.action.action=action_id;
|
||||||
ie.action.pressed=true;
|
ie.action.pressed=true;
|
||||||
get_scene()->input_event(ie);
|
get_tree()->input_event(ie);
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ void TouchScreenButton::_input(const InputEvent& p_event) {
|
|||||||
ie.ID=0;
|
ie.ID=0;
|
||||||
ie.action.action=action_id;
|
ie.action.action=action_id;
|
||||||
ie.action.pressed=false;
|
ie.action.pressed=false;
|
||||||
get_scene()->input_event(ie);
|
get_tree()->input_event(ie);
|
||||||
}
|
}
|
||||||
finger_pressed=-1;
|
finger_pressed=-1;
|
||||||
update();
|
update();
|
||||||
|
@ -39,7 +39,7 @@ void SoundPlayer2D::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
//find the sound space
|
//find the sound space
|
||||||
|
|
||||||
source_rid = SpatialSound2DServer::get_singleton()->source_create(get_world_2d()->get_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());
|
SpatialSound2DServer::get_singleton()->source_set_transform(source_rid,get_global_transform());
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
if (source_rid.is_valid())
|
if (source_rid.is_valid())
|
||||||
SpatialSound2DServer::get_singleton()->free(source_rid);
|
SpatialSound2DServer::get_singleton()->free(source_rid);
|
||||||
|
@ -365,7 +365,7 @@ void ViewportSprite::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
if (!viewport_path.is_empty()) {
|
if (!viewport_path.is_empty()) {
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ void ViewportSprite::_notification(int p_what) {
|
|||||||
item_rect_changed();
|
item_rect_changed();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
if (texture.is_valid()) {
|
if (texture.is_valid()) {
|
||||||
|
|
||||||
@ -422,7 +422,7 @@ void ViewportSprite::set_viewport_path(const NodePath& p_viewport) {
|
|||||||
|
|
||||||
viewport_path=p_viewport;
|
viewport_path=p_viewport;
|
||||||
update();
|
update();
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (texture.is_valid()) {
|
if (texture.is_valid()) {
|
||||||
|
@ -33,7 +33,7 @@ void TileMap::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
pending_update=true;
|
pending_update=true;
|
||||||
_update_dirty_quadrants();
|
_update_dirty_quadrants();
|
||||||
@ -43,7 +43,7 @@ void TileMap::_notification(int p_what) {
|
|||||||
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
_update_quadrant_space(RID());
|
_update_quadrant_space(RID());
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ void TileMap::_update_quadrant_space(const RID& p_space) {
|
|||||||
|
|
||||||
void TileMap::_update_quadrant_transform() {
|
void TileMap::_update_quadrant_transform() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Matrix32 global_transform = get_global_transform();
|
Matrix32 global_transform = get_global_transform();
|
||||||
@ -164,7 +164,7 @@ void TileMap::_update_dirty_quadrants() {
|
|||||||
|
|
||||||
if (!pending_update)
|
if (!pending_update)
|
||||||
return;
|
return;
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
if (!tile_set.is_valid())
|
if (!tile_set.is_valid())
|
||||||
return;
|
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_FRICTION,friction);
|
||||||
Physics2DServer::get_singleton()->body_set_param(q.static_body,Physics2DServer::BODY_PARAM_BOUNCE,bounce);
|
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;
|
xform = get_global_transform() * xform;
|
||||||
RID space = get_world_2d()->get_space();
|
RID space = get_world_2d()->get_space();
|
||||||
Physics2DServer::get_singleton()->body_set_space(q.static_body,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)
|
if (pending_update)
|
||||||
return;
|
return;
|
||||||
pending_update=true;
|
pending_update=true;
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
call_deferred("_update_dirty_quadrants");
|
call_deferred("_update_dirty_quadrants");
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ void VisibilityNotifier2D::_exit_viewport(Viewport* p_viewport){
|
|||||||
void VisibilityNotifier2D::set_rect(const Rect2& p_rect){
|
void VisibilityNotifier2D::set_rect(const Rect2& p_rect){
|
||||||
|
|
||||||
rect=p_rect;
|
rect=p_rect;
|
||||||
if (is_inside_scene())
|
if (is_inside_tree())
|
||||||
get_world_2d()->_update_notifier(this,get_global_transform().xform(rect));
|
get_world_2d()->_update_notifier(this,get_global_transform().xform(rect));
|
||||||
|
|
||||||
_change_notify("rect");
|
_change_notify("rect");
|
||||||
@ -85,7 +85,7 @@ void VisibilityNotifier2D::_notification(int p_what) {
|
|||||||
|
|
||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
//get_world_2d()->
|
//get_world_2d()->
|
||||||
get_world_2d()->_register_notifier(this,get_global_transform().xform(rect));
|
get_world_2d()->_register_notifier(this,get_global_transform().xform(rect));
|
||||||
@ -97,12 +97,12 @@ void VisibilityNotifier2D::_notification(int p_what) {
|
|||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_DRAW: {
|
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));
|
draw_rect(rect,Color(1,0.5,1,0.2));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
get_world_2d()->_remove_notifier(this);
|
get_world_2d()->_remove_notifier(this);
|
||||||
} break;
|
} break;
|
||||||
@ -190,7 +190,7 @@ void VisibilityEnabler2D::_find_nodes(Node* p_node) {
|
|||||||
|
|
||||||
if (add) {
|
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;
|
nodes[p_node]=meta;
|
||||||
_change_node_state(p_node,false);
|
_change_node_state(p_node,false);
|
||||||
}
|
}
|
||||||
@ -207,9 +207,9 @@ void VisibilityEnabler2D::_find_nodes(Node* p_node) {
|
|||||||
|
|
||||||
void VisibilityEnabler2D::_notification(int p_what){
|
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;
|
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;
|
return;
|
||||||
|
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ void VisibilityEnabler2D::_notification(int p_what){
|
|||||||
|
|
||||||
if (!visible)
|
if (!visible)
|
||||||
_change_node_state(E->key(),true);
|
_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();
|
nodes.clear();
|
||||||
|
@ -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);
|
Object *obj = ObjectDB::get_instance(p_id);
|
||||||
Node *node = obj ? obj->cast_to<Node>() : NULL;
|
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);
|
Map<ObjectID,BodyState>::Element *E=body_map.find(p_id);
|
||||||
ERR_FAIL_COND(!E);
|
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);
|
emit_signal(SceneStringNames::get_singleton()->body_enter,node);
|
||||||
for(int i=0;i<E->get().shapes.size();i++) {
|
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);
|
Object *obj = ObjectDB::get_instance(p_id);
|
||||||
Node *node = obj ? obj->cast_to<Node>() : NULL;
|
Node *node = obj ? obj->cast_to<Node>() : NULL;
|
||||||
ERR_FAIL_COND(!node);
|
ERR_FAIL_COND(!node);
|
||||||
Map<ObjectID,BodyState>::Element *E=body_map.find(p_id);
|
Map<ObjectID,BodyState>::Element *E=body_map.find(p_id);
|
||||||
ERR_FAIL_COND(!E);
|
ERR_FAIL_COND(!E);
|
||||||
ERR_FAIL_COND(!E->get().in_scene);
|
ERR_FAIL_COND(!E->get().in_tree);
|
||||||
E->get().in_scene=false;
|
E->get().in_tree=false;
|
||||||
emit_signal(SceneStringNames::get_singleton()->body_exit,node);
|
emit_signal(SceneStringNames::get_singleton()->body_exit,node);
|
||||||
for(int i=0;i<E->get().shapes.size();i++) {
|
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 = body_map.insert(objid,BodyState());
|
||||||
E->get().rc=0;
|
E->get().rc=0;
|
||||||
E->get().in_scene=node && node->is_inside_scene();
|
E->get().in_tree=node && node->is_inside_tree();
|
||||||
if (node) {
|
if (node) {
|
||||||
node->connect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_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_scene,this,SceneStringNames::get_singleton()->_body_exit_scene,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) {
|
if (E->get().in_tree) {
|
||||||
emit_signal(SceneStringNames::get_singleton()->body_enter,node);
|
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));
|
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);
|
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 (E->get().rc==0) {
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
node->disconnect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_scene);
|
node->disconnect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree);
|
||||||
node->disconnect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene);
|
node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree);
|
||||||
if (E->get().in_scene)
|
if (E->get().in_tree)
|
||||||
emit_signal(SceneStringNames::get_singleton()->body_exit,obj);
|
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;
|
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);
|
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());
|
Object *obj = ObjectDB::get_instance(E->key());
|
||||||
Node *node = obj ? obj->cast_to<Node>() : NULL;
|
Node *node = obj ? obj->cast_to<Node>() : NULL;
|
||||||
ERR_CONTINUE(!node);
|
ERR_CONTINUE(!node);
|
||||||
if (!E->get().in_scene)
|
if (!E->get().in_tree)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for(int i=0;i<E->get().shapes.size();i++) {
|
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);
|
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()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree);
|
||||||
node->disconnect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene);
|
node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void Area::_notification(int p_what) {
|
void Area::_notification(int p_what) {
|
||||||
|
|
||||||
if (p_what==NOTIFICATION_EXIT_SCENE) {
|
if (p_what==NOTIFICATION_EXIT_TREE) {
|
||||||
_clear_monitoring();
|
_clear_monitoring();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -258,8 +258,8 @@ bool Area::is_monitoring_enabled() const {
|
|||||||
|
|
||||||
void Area::_bind_methods() {
|
void Area::_bind_methods() {
|
||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("_body_enter_scene","id"),&Area::_body_enter_scene);
|
ObjectTypeDB::bind_method(_MD("_body_enter_tree","id"),&Area::_body_enter_tree);
|
||||||
ObjectTypeDB::bind_method(_MD("_body_exit_scene","id"),&Area::_body_exit_scene);
|
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("set_space_override_mode","enable"),&Area::set_space_override_mode);
|
||||||
ObjectTypeDB::bind_method(_MD("get_space_override_mode"),&Area::get_space_override_mode);
|
ObjectTypeDB::bind_method(_MD("get_space_override_mode"),&Area::get_space_override_mode);
|
||||||
|
@ -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_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_enter_tree(ObjectID p_id);
|
||||||
void _body_exit_scene(ObjectID p_id);
|
void _body_exit_tree(ObjectID p_id);
|
||||||
|
|
||||||
struct ShapePair {
|
struct ShapePair {
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ private:
|
|||||||
struct BodyState {
|
struct BodyState {
|
||||||
|
|
||||||
int rc;
|
int rc;
|
||||||
bool in_scene;
|
bool in_tree;
|
||||||
VSet<ShapePair> shapes;
|
VSet<ShapePair> shapes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ void CollisionShape::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
unparenting=false;
|
unparenting=false;
|
||||||
|
|
||||||
//indicator_instance = VisualServer::get_singleton()->instance_create2(indicator,get_world()->get_scenario());
|
//indicator_instance = VisualServer::get_singleton()->instance_create2(indicator,get_world()->get_scenario());
|
||||||
@ -331,7 +331,7 @@ void CollisionShape::_notification(int p_what) {
|
|||||||
_update_body();
|
_update_body();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
/* if (indicator_instance.is_valid()) {
|
/* if (indicator_instance.is_valid()) {
|
||||||
VisualServer::get_singleton()->free(indicator_instance);
|
VisualServer::get_singleton()->free(indicator_instance);
|
||||||
indicator_instance=RID();
|
indicator_instance=RID();
|
||||||
|
@ -102,12 +102,12 @@ void BoneAttachment::_check_unbind() {
|
|||||||
|
|
||||||
void BoneAttachment::set_bone_name(const String& p_name) {
|
void BoneAttachment::set_bone_name(const String& p_name) {
|
||||||
|
|
||||||
if (is_inside_scene())
|
if (is_inside_tree())
|
||||||
_check_unbind();
|
_check_unbind();
|
||||||
|
|
||||||
bone_name=p_name;
|
bone_name=p_name;
|
||||||
|
|
||||||
if (is_inside_scene())
|
if (is_inside_tree())
|
||||||
_check_bind();
|
_check_bind();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,11 +120,11 @@ void BoneAttachment::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
_check_bind();
|
_check_bind();
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
_check_unbind();
|
_check_unbind();
|
||||||
} break;
|
} break;
|
||||||
|
@ -121,7 +121,7 @@ bool Camera::_get(const StringName& p_name,Variant &r_ret) const {
|
|||||||
r_ret= int(keep_aspect);
|
r_ret= int(keep_aspect);
|
||||||
else if (p_name=="current") {
|
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;
|
r_ret=current;
|
||||||
} else {
|
} else {
|
||||||
r_ret=is_current();
|
r_ret=is_current();
|
||||||
@ -182,7 +182,7 @@ void Camera::_update_camera() {
|
|||||||
// if (viewport_ptr && is_inside_scene() && is_current())
|
// if (viewport_ptr && is_inside_scene() && is_current())
|
||||||
// viewport_ptr->_camera_transform_changed_notify();
|
// viewport_ptr->_camera_transform_changed_notify();
|
||||||
|
|
||||||
if (is_inside_scene() && is_current()) {
|
if (is_inside_tree() && is_current()) {
|
||||||
if (viewport_ptr) {
|
if (viewport_ptr) {
|
||||||
viewport_ptr->_camera_transform_changed_notify();
|
viewport_ptr->_camera_transform_changed_notify();
|
||||||
}
|
}
|
||||||
@ -309,7 +309,7 @@ void Camera::make_current() {
|
|||||||
|
|
||||||
current=true;
|
current=true;
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (viewport_ptr) {
|
if (viewport_ptr) {
|
||||||
@ -324,7 +324,7 @@ void Camera::_camera_make_next_current(Node *p_exclude) {
|
|||||||
|
|
||||||
if (this==p_exclude)
|
if (this==p_exclude)
|
||||||
return;
|
return;
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
if (get_viewport()->get_camera()!=NULL)
|
if (get_viewport()->get_camera()!=NULL)
|
||||||
return;
|
return;
|
||||||
@ -336,14 +336,14 @@ void Camera::_camera_make_next_current(Node *p_exclude) {
|
|||||||
void Camera::clear_current() {
|
void Camera::clear_current() {
|
||||||
|
|
||||||
current=false;
|
current=false;
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (viewport_ptr) {
|
if (viewport_ptr) {
|
||||||
if (viewport_ptr->get_camera()==this) {
|
if (viewport_ptr->get_camera()==this) {
|
||||||
viewport_ptr->_set_camera(NULL);
|
viewport_ptr->_set_camera(NULL);
|
||||||
//a group is used beause this needs to be in order to be deterministic
|
//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 {
|
bool Camera::is_current() const {
|
||||||
|
|
||||||
if (is_inside_scene()) {
|
if (is_inside_tree()) {
|
||||||
if (viewport_ptr)
|
if (viewport_ptr)
|
||||||
return viewport_ptr->get_camera()==this;
|
return viewport_ptr->get_camera()==this;
|
||||||
} else
|
} 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 {
|
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_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 {
|
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_EXPLAIN("Camera is not inside scene.");
|
||||||
ERR_FAIL_COND_V(!is_inside_scene(),Vector3());
|
ERR_FAIL_COND_V(!is_inside_tree(),Vector3());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#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 {
|
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_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;
|
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 {
|
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_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;
|
Size2 viewport_size = viewport_ptr->get_visible_rect().size;
|
||||||
|
@ -199,9 +199,9 @@ void CollisionObject::_mouse_exit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CollisionObject::_update_pickable() {
|
void CollisionObject::_update_pickable() {
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
bool pickable = ray_pickable && is_inside_scene() && is_visible();
|
bool pickable = ray_pickable && is_inside_tree() && is_visible();
|
||||||
if (area)
|
if (area)
|
||||||
PhysicsServer::get_singleton()->area_set_ray_pickable(rid,pickable);
|
PhysicsServer::get_singleton()->area_set_ray_pickable(rid,pickable);
|
||||||
else
|
else
|
||||||
|
@ -86,7 +86,7 @@ void CollisionPolygon::_notification(int p_what) {
|
|||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
break;
|
break;
|
||||||
_update_parent();
|
_update_parent();
|
||||||
|
|
||||||
|
@ -32,9 +32,9 @@
|
|||||||
void InterpolatedCamera::_notification(int p_what) {
|
void InterpolatedCamera::_notification(int p_what) {
|
||||||
|
|
||||||
switch(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);
|
set_fixed_process(false);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
@ -109,7 +109,7 @@ void InterpolatedCamera::set_interpolation_enabled(bool p_enable) {
|
|||||||
return;
|
return;
|
||||||
enabled=p_enable;
|
enabled=p_enable;
|
||||||
if (p_enable) {
|
if (p_enable) {
|
||||||
if (is_inside_scene() && get_scene()->is_editor_hint())
|
if (is_inside_tree() && get_tree()->is_editor_hint())
|
||||||
return;
|
return;
|
||||||
set_process(true);
|
set_process(true);
|
||||||
} else
|
} else
|
||||||
|
@ -432,7 +432,7 @@ void Light::approximate_opengl_attenuation(float p_constant, float p_linear, flo
|
|||||||
|
|
||||||
void Light::_update_visibility() {
|
void Light::_update_visibility() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
@ -440,10 +440,10 @@ bool editor_ok=true;
|
|||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
if (editor_only) {
|
if (editor_only) {
|
||||||
if (!get_scene()->is_editor_hint()) {
|
if (!get_tree()->is_editor_hint()) {
|
||||||
editor_ok=false;
|
editor_ok=false;
|
||||||
} else {
|
} 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
|
#endif
|
||||||
@ -456,7 +456,7 @@ bool editor_ok=true;
|
|||||||
|
|
||||||
void Light::_notification(int p_what) {
|
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();
|
_update_visibility();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ void MeshInstance::_resolve_skeleton_path(){
|
|||||||
void MeshInstance::set_skeleton_path(const NodePath &p_skeleton) {
|
void MeshInstance::set_skeleton_path(const NodePath &p_skeleton) {
|
||||||
|
|
||||||
skeleton_path = p_skeleton;
|
skeleton_path = p_skeleton;
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
_resolve_skeleton_path();
|
_resolve_skeleton_path();
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ void MeshInstance::create_convex_collision() {
|
|||||||
|
|
||||||
void MeshInstance::_notification(int p_what) {
|
void MeshInstance::_notification(int p_what) {
|
||||||
|
|
||||||
if (p_what==NOTIFICATION_ENTER_SCENE) {
|
if (p_what==NOTIFICATION_ENTER_TREE) {
|
||||||
_resolve_skeleton_path();
|
_resolve_skeleton_path();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ void NavigationMeshInstance::set_enabled(bool p_enabled) {
|
|||||||
return;
|
return;
|
||||||
enabled=p_enabled;
|
enabled=p_enabled;
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
@ -152,7 +152,7 @@ void NavigationMeshInstance::_notification(int p_what) {
|
|||||||
|
|
||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
Spatial *c=this;
|
Spatial *c=this;
|
||||||
while(c) {
|
while(c) {
|
||||||
@ -178,7 +178,7 @@ void NavigationMeshInstance::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
if (navigation) {
|
if (navigation) {
|
||||||
|
|
||||||
|
@ -26,363 +26,363 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
#include "scene/scene_string_names.h"
|
#include "scene/scene_string_names.h"
|
||||||
|
|
||||||
void Path::_notification(int p_what) {
|
void Path::_notification(int p_what) {
|
||||||
#if 0
|
#if 0
|
||||||
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_scene() && get_scene()->is_editor_hint()) {
|
||||||
//draw the curve!!
|
//draw the curve!!
|
||||||
|
|
||||||
for(int i=0;i<curve->get_point_count();i++) {
|
for(int i=0;i<curve->get_point_count();i++) {
|
||||||
|
|
||||||
Vector2 prev_p=curve->get_point_pos(i);
|
Vector2 prev_p=curve->get_point_pos(i);
|
||||||
|
|
||||||
for(int j=1;j<=8;j++) {
|
for(int j=1;j<=8;j++) {
|
||||||
|
|
||||||
real_t frac = j/8.0;
|
real_t frac = j/8.0;
|
||||||
Vector2 p = curve->interpolate(i,frac);
|
Vector2 p = curve->interpolate(i,frac);
|
||||||
draw_line(prev_p,p,Color(0.5,0.6,1.0,0.7),2);
|
draw_line(prev_p,p,Color(0.5,0.6,1.0,0.7),2);
|
||||||
prev_p=p;
|
prev_p=p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Path::_curve_changed() {
|
void Path::_curve_changed() {
|
||||||
|
|
||||||
|
|
||||||
if (is_inside_scene() && get_scene()->is_editor_hint())
|
if (is_inside_tree() && get_tree()->is_editor_hint())
|
||||||
update_gizmo();
|
update_gizmo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Path::set_curve(const Ref<Curve3D>& p_curve) {
|
void Path::set_curve(const Ref<Curve3D>& p_curve) {
|
||||||
|
|
||||||
if (curve.is_valid()) {
|
if (curve.is_valid()) {
|
||||||
curve->disconnect("changed",this,"_curve_changed");
|
curve->disconnect("changed",this,"_curve_changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
curve=p_curve;
|
curve=p_curve;
|
||||||
|
|
||||||
if (curve.is_valid()) {
|
if (curve.is_valid()) {
|
||||||
curve->connect("changed",this,"_curve_changed");
|
curve->connect("changed",this,"_curve_changed");
|
||||||
}
|
}
|
||||||
_curve_changed();
|
_curve_changed();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Curve3D> Path::get_curve() const{
|
Ref<Curve3D> Path::get_curve() const{
|
||||||
|
|
||||||
return curve;
|
return curve;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Path::_bind_methods() {
|
void Path::_bind_methods() {
|
||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("set_curve","curve:Curve3D"),&Path::set_curve);
|
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("get_curve:Curve3D","curve"),&Path::get_curve);
|
||||||
ObjectTypeDB::bind_method(_MD("_curve_changed"),&Path::_curve_changed);
|
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"));
|
ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve3D"), _SCS("set_curve"),_SCS("get_curve"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Path::Path() {
|
Path::Path() {
|
||||||
|
|
||||||
set_curve(Ref<Curve3D>( memnew( Curve3D ))); //create one by default
|
set_curve(Ref<Curve3D>( memnew( Curve3D ))); //create one by default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
|
|
||||||
|
|
||||||
void PathFollow::_update_transform() {
|
void PathFollow::_update_transform() {
|
||||||
|
|
||||||
|
|
||||||
if (!path)
|
if (!path)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Ref<Curve3D> c =path->get_curve();
|
Ref<Curve3D> c =path->get_curve();
|
||||||
if (!c.is_valid())
|
if (!c.is_valid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
float o = offset;
|
float o = offset;
|
||||||
if (loop)
|
if (loop)
|
||||||
o=Math::fposmod(o,c->get_baked_length());
|
o=Math::fposmod(o,c->get_baked_length());
|
||||||
|
|
||||||
Vector3 pos = c->interpolate_baked(o,cubic);
|
Vector3 pos = c->interpolate_baked(o,cubic);
|
||||||
Transform t=get_transform();
|
Transform t=get_transform();
|
||||||
|
|
||||||
|
|
||||||
if (rotation_mode!=ROTATION_NONE) {
|
if (rotation_mode!=ROTATION_NONE) {
|
||||||
|
|
||||||
Vector3 n = (c->interpolate_baked(o+lookahead,cubic)-pos).normalized();
|
Vector3 n = (c->interpolate_baked(o+lookahead,cubic)-pos).normalized();
|
||||||
|
|
||||||
if (rotation_mode==ROTATION_Y) {
|
if (rotation_mode==ROTATION_Y) {
|
||||||
|
|
||||||
n.y=0;
|
n.y=0;
|
||||||
n.normalize();
|
n.normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n.length()<CMP_EPSILON) {//nothing, use previous
|
if (n.length()<CMP_EPSILON) {//nothing, use previous
|
||||||
n=-t.get_basis().get_axis(2).normalized();
|
n=-t.get_basis().get_axis(2).normalized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Vector3 up = Vector3(0,1,0);
|
Vector3 up = Vector3(0,1,0);
|
||||||
|
|
||||||
if (rotation_mode==ROTATION_XYZ) {
|
if (rotation_mode==ROTATION_XYZ) {
|
||||||
|
|
||||||
float tilt = c->interpolate_baked_tilt(o);
|
float tilt = c->interpolate_baked_tilt(o);
|
||||||
if (tilt!=0) {
|
if (tilt!=0) {
|
||||||
|
|
||||||
Matrix3 rot(-n,tilt); //remember.. lookat will be znegative.. znegative!! we abide by opengl clan.
|
Matrix3 rot(-n,tilt); //remember.. lookat will be znegative.. znegative!! we abide by opengl clan.
|
||||||
up=rot.xform(up);
|
up=rot.xform(up);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t.set_look_at(pos,pos+n,up);
|
t.set_look_at(pos,pos+n,up);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
t.origin=pos;
|
t.origin=pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
t.origin+=t.basis.get_axis(0)*h_offset + t.basis.get_axis(1)*v_offset;
|
t.origin+=t.basis.get_axis(0)*h_offset + t.basis.get_axis(1)*v_offset;
|
||||||
set_transform(t);
|
set_transform(t);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathFollow::_notification(int p_what) {
|
void PathFollow::_notification(int p_what) {
|
||||||
|
|
||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
Node *parent=get_parent();
|
Node *parent=get_parent();
|
||||||
if (parent) {
|
if (parent) {
|
||||||
|
|
||||||
path=parent->cast_to<Path>();
|
path=parent->cast_to<Path>();
|
||||||
if (path) {
|
if (path) {
|
||||||
_update_transform();
|
_update_transform();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
|
|
||||||
path=NULL;
|
path=NULL;
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathFollow::set_cubic_interpolation(bool p_enable) {
|
void PathFollow::set_cubic_interpolation(bool p_enable) {
|
||||||
|
|
||||||
cubic=p_enable;
|
cubic=p_enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PathFollow::get_cubic_interpolation() const {
|
bool PathFollow::get_cubic_interpolation() const {
|
||||||
|
|
||||||
return cubic;
|
return cubic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PathFollow::_set(const StringName& p_name, const Variant& p_value) {
|
bool PathFollow::_set(const StringName& p_name, const Variant& p_value) {
|
||||||
|
|
||||||
if (p_name==SceneStringNames::get_singleton()->offset) {
|
if (p_name==SceneStringNames::get_singleton()->offset) {
|
||||||
set_offset(p_value);
|
set_offset(p_value);
|
||||||
} else if (p_name==SceneStringNames::get_singleton()->unit_offset) {
|
} else if (p_name==SceneStringNames::get_singleton()->unit_offset) {
|
||||||
set_unit_offset(p_value);
|
set_unit_offset(p_value);
|
||||||
} else if (p_name==SceneStringNames::get_singleton()->rotation_mode) {
|
} else if (p_name==SceneStringNames::get_singleton()->rotation_mode) {
|
||||||
set_rotation_mode(RotationMode(p_value.operator int()));
|
set_rotation_mode(RotationMode(p_value.operator int()));
|
||||||
} else if (p_name==SceneStringNames::get_singleton()->v_offset) {
|
} else if (p_name==SceneStringNames::get_singleton()->v_offset) {
|
||||||
set_v_offset(p_value);
|
set_v_offset(p_value);
|
||||||
} else if (p_name==SceneStringNames::get_singleton()->h_offset) {
|
} else if (p_name==SceneStringNames::get_singleton()->h_offset) {
|
||||||
set_h_offset(p_value);
|
set_h_offset(p_value);
|
||||||
} else if (String(p_name)=="cubic_interp") {
|
} else if (String(p_name)=="cubic_interp") {
|
||||||
set_cubic_interpolation(p_value);
|
set_cubic_interpolation(p_value);
|
||||||
} else if (String(p_name)=="loop") {
|
} else if (String(p_name)=="loop") {
|
||||||
set_loop(p_value);
|
set_loop(p_value);
|
||||||
} else if (String(p_name)=="lookahead") {
|
} else if (String(p_name)=="lookahead") {
|
||||||
set_lookahead(p_value);
|
set_lookahead(p_value);
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PathFollow::_get(const StringName& p_name,Variant &r_ret) const{
|
bool PathFollow::_get(const StringName& p_name,Variant &r_ret) const{
|
||||||
|
|
||||||
if (p_name==SceneStringNames::get_singleton()->offset) {
|
if (p_name==SceneStringNames::get_singleton()->offset) {
|
||||||
r_ret=get_offset();
|
r_ret=get_offset();
|
||||||
} else if (p_name==SceneStringNames::get_singleton()->unit_offset) {
|
} else if (p_name==SceneStringNames::get_singleton()->unit_offset) {
|
||||||
r_ret=get_unit_offset();
|
r_ret=get_unit_offset();
|
||||||
} else if (p_name==SceneStringNames::get_singleton()->rotation_mode) {
|
} else if (p_name==SceneStringNames::get_singleton()->rotation_mode) {
|
||||||
r_ret=get_rotation_mode();
|
r_ret=get_rotation_mode();
|
||||||
} else if (p_name==SceneStringNames::get_singleton()->v_offset) {
|
} else if (p_name==SceneStringNames::get_singleton()->v_offset) {
|
||||||
r_ret=get_v_offset();
|
r_ret=get_v_offset();
|
||||||
} else if (p_name==SceneStringNames::get_singleton()->h_offset) {
|
} else if (p_name==SceneStringNames::get_singleton()->h_offset) {
|
||||||
r_ret=get_h_offset();
|
r_ret=get_h_offset();
|
||||||
} else if (String(p_name)=="cubic_interp") {
|
} else if (String(p_name)=="cubic_interp") {
|
||||||
r_ret=cubic;
|
r_ret=cubic;
|
||||||
} else if (String(p_name)=="loop") {
|
} else if (String(p_name)=="loop") {
|
||||||
r_ret=loop;
|
r_ret=loop;
|
||||||
} else if (String(p_name)=="lookahead") {
|
} else if (String(p_name)=="lookahead") {
|
||||||
r_ret=lookahead;
|
r_ret=lookahead;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
void PathFollow::_get_property_list( List<PropertyInfo> *p_list) const{
|
void PathFollow::_get_property_list( List<PropertyInfo> *p_list) const{
|
||||||
|
|
||||||
float max=10000;
|
float max=10000;
|
||||||
if (path && path->get_curve().is_valid())
|
if (path && path->get_curve().is_valid())
|
||||||
max=path->get_curve()->get_baked_length();
|
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, "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, "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, "h_offset") );
|
||||||
p_list->push_back( PropertyInfo( Variant::REAL, "v_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::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, "cubic_interp"));
|
||||||
p_list->push_back( PropertyInfo( Variant::BOOL, "loop"));
|
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"));
|
p_list->push_back( PropertyInfo( Variant::REAL, "lookahead",PROPERTY_HINT_RANGE,"0.001,1024.0,0.001"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PathFollow::_bind_methods() {
|
void PathFollow::_bind_methods() {
|
||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("set_offset","offset"),&PathFollow::set_offset);
|
ObjectTypeDB::bind_method(_MD("set_offset","offset"),&PathFollow::set_offset);
|
||||||
ObjectTypeDB::bind_method(_MD("get_offset"),&PathFollow::get_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("set_h_offset","h_offset"),&PathFollow::set_h_offset);
|
||||||
ObjectTypeDB::bind_method(_MD("get_h_offset"),&PathFollow::get_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("set_v_offset","v_offset"),&PathFollow::set_v_offset);
|
||||||
ObjectTypeDB::bind_method(_MD("get_v_offset"),&PathFollow::get_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("set_unit_offset","unit_offset"),&PathFollow::set_unit_offset);
|
||||||
ObjectTypeDB::bind_method(_MD("get_unit_offset"),&PathFollow::get_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("set_rotation_mode","rotation_mode"),&PathFollow::set_rotation_mode);
|
||||||
ObjectTypeDB::bind_method(_MD("get_rotation_mode"),&PathFollow::get_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("set_cubic_interpolation","enable"),&PathFollow::set_cubic_interpolation);
|
||||||
ObjectTypeDB::bind_method(_MD("get_cubic_interpolation"),&PathFollow::get_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("set_loop","loop"),&PathFollow::set_loop);
|
||||||
ObjectTypeDB::bind_method(_MD("has_loop"),&PathFollow::has_loop);
|
ObjectTypeDB::bind_method(_MD("has_loop"),&PathFollow::has_loop);
|
||||||
|
|
||||||
BIND_CONSTANT( ROTATION_NONE );
|
BIND_CONSTANT( ROTATION_NONE );
|
||||||
BIND_CONSTANT( ROTATION_Y );
|
BIND_CONSTANT( ROTATION_Y );
|
||||||
BIND_CONSTANT( ROTATION_XY );
|
BIND_CONSTANT( ROTATION_XY );
|
||||||
BIND_CONSTANT( ROTATION_XYZ );
|
BIND_CONSTANT( ROTATION_XYZ );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathFollow::set_offset(float p_offset) {
|
void PathFollow::set_offset(float p_offset) {
|
||||||
|
|
||||||
offset=p_offset;
|
offset=p_offset;
|
||||||
if (path)
|
if (path)
|
||||||
_update_transform();
|
_update_transform();
|
||||||
_change_notify("offset");
|
_change_notify("offset");
|
||||||
_change_notify("unit_offset");
|
_change_notify("unit_offset");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathFollow::set_h_offset(float p_h_offset) {
|
void PathFollow::set_h_offset(float p_h_offset) {
|
||||||
|
|
||||||
h_offset=p_h_offset;
|
h_offset=p_h_offset;
|
||||||
if (path)
|
if (path)
|
||||||
_update_transform();
|
_update_transform();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float PathFollow::get_h_offset() const {
|
float PathFollow::get_h_offset() const {
|
||||||
|
|
||||||
return h_offset;
|
return h_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathFollow::set_v_offset(float p_v_offset) {
|
void PathFollow::set_v_offset(float p_v_offset) {
|
||||||
|
|
||||||
v_offset=p_v_offset;
|
v_offset=p_v_offset;
|
||||||
if (path)
|
if (path)
|
||||||
_update_transform();
|
_update_transform();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float PathFollow::get_v_offset() const {
|
float PathFollow::get_v_offset() const {
|
||||||
|
|
||||||
return v_offset;
|
return v_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float PathFollow::get_offset() const{
|
float PathFollow::get_offset() const{
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathFollow::set_unit_offset(float p_unit_offset) {
|
void PathFollow::set_unit_offset(float p_unit_offset) {
|
||||||
|
|
||||||
if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length())
|
if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length())
|
||||||
set_offset(p_unit_offset*path->get_curve()->get_baked_length());
|
set_offset(p_unit_offset*path->get_curve()->get_baked_length());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float PathFollow::get_unit_offset() const{
|
float PathFollow::get_unit_offset() const{
|
||||||
|
|
||||||
if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length())
|
if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length())
|
||||||
return get_offset()/path->get_curve()->get_baked_length();
|
return get_offset()/path->get_curve()->get_baked_length();
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathFollow::set_lookahead(float p_lookahead) {
|
void PathFollow::set_lookahead(float p_lookahead) {
|
||||||
|
|
||||||
lookahead=p_lookahead;
|
lookahead=p_lookahead;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float PathFollow::get_lookahead() const{
|
float PathFollow::get_lookahead() const{
|
||||||
|
|
||||||
return lookahead;
|
return lookahead;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathFollow::set_rotation_mode(RotationMode p_rotation_mode) {
|
void PathFollow::set_rotation_mode(RotationMode p_rotation_mode) {
|
||||||
|
|
||||||
rotation_mode=p_rotation_mode;
|
rotation_mode=p_rotation_mode;
|
||||||
_update_transform();
|
_update_transform();
|
||||||
}
|
}
|
||||||
|
|
||||||
PathFollow::RotationMode PathFollow::get_rotation_mode() const {
|
PathFollow::RotationMode PathFollow::get_rotation_mode() const {
|
||||||
|
|
||||||
return rotation_mode;
|
return rotation_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathFollow::set_loop(bool p_loop) {
|
void PathFollow::set_loop(bool p_loop) {
|
||||||
|
|
||||||
loop=p_loop;
|
loop=p_loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PathFollow::has_loop() const{
|
bool PathFollow::has_loop() const{
|
||||||
|
|
||||||
return loop;
|
return loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PathFollow::PathFollow() {
|
PathFollow::PathFollow() {
|
||||||
|
|
||||||
offset=0;
|
offset=0;
|
||||||
h_offset=0;
|
h_offset=0;
|
||||||
v_offset=0;
|
v_offset=0;
|
||||||
path=NULL;
|
path=NULL;
|
||||||
rotation_mode=ROTATION_XYZ;
|
rotation_mode=ROTATION_XYZ;
|
||||||
cubic=true;
|
cubic=true;
|
||||||
loop=true;
|
loop=true;
|
||||||
lookahead=0.1;
|
lookahead=0.1;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
Object *obj = ObjectDB::get_instance(p_id);
|
||||||
Node *node = obj ? obj->cast_to<Node>() : NULL;
|
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);
|
Map<ObjectID,BodyState>::Element *E=contact_monitor->body_map.find(p_id);
|
||||||
ERR_FAIL_COND(!E);
|
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);
|
emit_signal(SceneStringNames::get_singleton()->body_enter,node);
|
||||||
|
|
||||||
for(int i=0;i<E->get().shapes.size();i++) {
|
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);
|
Object *obj = ObjectDB::get_instance(p_id);
|
||||||
Node *node = obj ? obj->cast_to<Node>() : NULL;
|
Node *node = obj ? obj->cast_to<Node>() : NULL;
|
||||||
ERR_FAIL_COND(!node);
|
ERR_FAIL_COND(!node);
|
||||||
Map<ObjectID,BodyState>::Element *E=contact_monitor->body_map.find(p_id);
|
Map<ObjectID,BodyState>::Element *E=contact_monitor->body_map.find(p_id);
|
||||||
ERR_FAIL_COND(!E);
|
ERR_FAIL_COND(!E);
|
||||||
ERR_FAIL_COND(!E->get().in_scene);
|
ERR_FAIL_COND(!E->get().in_tree);
|
||||||
E->get().in_scene=false;
|
E->get().in_tree=false;
|
||||||
emit_signal(SceneStringNames::get_singleton()->body_exit,node);
|
emit_signal(SceneStringNames::get_singleton()->body_exit,node);
|
||||||
for(int i=0;i<E->get().shapes.size();i++) {
|
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 = contact_monitor->body_map.insert(objid,BodyState());
|
||||||
//E->get().rc=0;
|
//E->get().rc=0;
|
||||||
E->get().in_scene=node && node->is_inside_scene();
|
E->get().in_tree=node && node->is_inside_tree();
|
||||||
if (node) {
|
if (node) {
|
||||||
node->connect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_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_scene,this,SceneStringNames::get_singleton()->_body_exit_scene,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) {
|
if (E->get().in_tree) {
|
||||||
emit_signal(SceneStringNames::get_singleton()->body_enter,node);
|
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));
|
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);
|
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)
|
if (node)
|
||||||
E->get().shapes.erase(ShapePair(p_body_shape,p_local_shape));
|
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 (E->get().shapes.empty()) {
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
node->disconnect(SceneStringNames::get_singleton()->enter_scene,this,SceneStringNames::get_singleton()->_body_enter_scene);
|
node->disconnect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree);
|
||||||
node->disconnect(SceneStringNames::get_singleton()->exit_scene,this,SceneStringNames::get_singleton()->_body_exit_scene);
|
node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree);
|
||||||
if (in_scene)
|
if (in_tree)
|
||||||
emit_signal(SceneStringNames::get_singleton()->body_exit,obj);
|
emit_signal(SceneStringNames::get_singleton()->body_exit,obj);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
contact_monitor->body_map.erase(E);
|
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);
|
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("is_able_to_sleep"),&RigidBody::is_able_to_sleep);
|
||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("_direct_state_changed"),&RigidBody::_direct_state_changed);
|
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_enter_tree"),&RigidBody::_body_enter_tree);
|
||||||
ObjectTypeDB::bind_method(_MD("_body_exit_scene"),&RigidBody::_body_exit_scene);
|
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("set_axis_lock","axis_lock"),&RigidBody::set_axis_lock);
|
||||||
ObjectTypeDB::bind_method(_MD("get_axis_lock"),&RigidBody::get_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;
|
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());
|
PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(get_world()->get_space());
|
||||||
ERR_FAIL_COND_V(!dss,Vector3());
|
ERR_FAIL_COND_V(!dss,Vector3());
|
||||||
const int max_shapes=32;
|
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) {
|
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());
|
PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(get_world()->get_space());
|
||||||
ERR_FAIL_COND_V(!dss,false);
|
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 {
|
bool KinematicBody::is_colliding() const {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(!is_inside_scene(),false);
|
ERR_FAIL_COND_V(!is_inside_tree(),false);
|
||||||
|
|
||||||
return colliding;
|
return colliding;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ private:
|
|||||||
struct BodyState {
|
struct BodyState {
|
||||||
|
|
||||||
//int rc;
|
//int rc;
|
||||||
bool in_scene;
|
bool in_tree;
|
||||||
VSet<ShapePair> shapes;
|
VSet<ShapePair> shapes;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -176,8 +176,8 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
ContactMonitor *contact_monitor;
|
ContactMonitor *contact_monitor;
|
||||||
void _body_enter_scene(ObjectID p_id);
|
void _body_enter_tree(ObjectID p_id);
|
||||||
void _body_exit_scene(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);
|
void _body_inout(int p_status, ObjectID p_instance, int p_body_shape,int p_local_shape);
|
||||||
|
@ -42,7 +42,7 @@ void Joint::_update_joint(bool p_only_free) {
|
|||||||
bb=RID();
|
bb=RID();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_only_free || !is_inside_scene())
|
if (p_only_free || !is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Node *node_a = has_node( get_node_a() ) ? get_node( get_node_a() ) : (Node*)NULL;
|
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: {
|
case NOTIFICATION_READY: {
|
||||||
_update_joint();
|
_update_joint();
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (joint.is_valid()) {
|
if (joint.is_valid()) {
|
||||||
_update_joint(true);
|
_update_joint(true);
|
||||||
PhysicsServer::get_singleton()->free(joint);
|
PhysicsServer::get_singleton()->free(joint);
|
||||||
|
@ -119,7 +119,7 @@ void ProximityGroup::_notification(int what) {
|
|||||||
|
|
||||||
switch (what) {
|
switch (what) {
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_SCENE:
|
case NOTIFICATION_EXIT_TREE:
|
||||||
++group_version;
|
++group_version;
|
||||||
clear_groups();
|
clear_groups();
|
||||||
break;
|
break;
|
||||||
@ -135,7 +135,7 @@ void ProximityGroup::broadcast(String p_name, Variant p_params) {
|
|||||||
E = groups.front();
|
E = groups.front();
|
||||||
while (E) {
|
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();
|
E = E->next();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
void Quad::_update() {
|
void Quad::_update() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Vector3 normal;
|
Vector3 normal;
|
||||||
@ -171,14 +171,14 @@ void Quad::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
if (pending_update)
|
if (pending_update)
|
||||||
_update();
|
_update();
|
||||||
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
pending_update=true;
|
pending_update=true;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
void RayCast::set_cast_to(const Vector3& p_point) {
|
void RayCast::set_cast_to(const Vector3& p_point) {
|
||||||
|
|
||||||
cast_to=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();
|
update_gizmo();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ Vector3 RayCast::get_collision_normal() const{
|
|||||||
void RayCast::set_enabled(bool p_enabled) {
|
void RayCast::set_enabled(bool p_enabled) {
|
||||||
|
|
||||||
enabled=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);
|
set_fixed_process(p_enabled);
|
||||||
if (!p_enabled)
|
if (!p_enabled)
|
||||||
collided=false;
|
collided=false;
|
||||||
@ -91,9 +91,9 @@ void RayCast::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(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);
|
set_fixed_process(true);
|
||||||
Node *p = get_parent();
|
Node *p = get_parent();
|
||||||
while( p && p->cast_to<Spatial>() ) {
|
while( p && p->cast_to<Spatial>() ) {
|
||||||
@ -113,7 +113,7 @@ void RayCast::_notification(int p_what) {
|
|||||||
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
set_fixed_process(false);
|
set_fixed_process(false);
|
||||||
|
@ -147,7 +147,7 @@ void Room::set_room( const Ref<RoomBounds>& p_room ) {
|
|||||||
set_base(RID());
|
set_base(RID());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,10 +243,10 @@ void Skeleton::set_bone_global_pose(int p_bone,const Transform& p_pose) {
|
|||||||
ERR_FAIL_INDEX(p_bone,bones.size());
|
ERR_FAIL_INDEX(p_bone,bones.size());
|
||||||
if (bones[p_bone].parent==-1) {
|
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 {
|
} 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) {
|
void Skeleton::set_bone_pose(int p_bone, const Transform& p_pose) {
|
||||||
|
|
||||||
ERR_FAIL_INDEX( p_bone, bones.size() );
|
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;
|
bones[p_bone].pose=p_pose;
|
||||||
@ -442,7 +442,7 @@ void Skeleton::_make_dirty() {
|
|||||||
if (dirty)
|
if (dirty)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!is_inside_scene()) {
|
if (!is_inside_tree()) {
|
||||||
dirty=true;
|
dirty=true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ void Spatial::_notify_dirty() {
|
|||||||
|
|
||||||
if (!data.ignore_notification && !xform_change.in_list()) {
|
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) {
|
void Spatial::_propagate_transform_changed(Spatial *p_origin) {
|
||||||
|
|
||||||
if (!is_inside_scene()) {
|
if (!is_inside_tree()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ void Spatial::_propagate_transform_changed(Spatial *p_origin) {
|
|||||||
|
|
||||||
if (!data.ignore_notification && !xform_change.in_list()) {
|
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;
|
data.dirty|=DIRTY_GLOBAL;
|
||||||
@ -121,7 +121,7 @@ void Spatial::_propagate_transform_changed(Spatial *p_origin) {
|
|||||||
void Spatial::_notification(int p_what) {
|
void Spatial::_notification(int p_what) {
|
||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
Node *p = get_parent();
|
Node *p = get_parent();
|
||||||
if (p)
|
if (p)
|
||||||
@ -132,7 +132,7 @@ void Spatial::_notification(int p_what) {
|
|||||||
else
|
else
|
||||||
data.C=NULL;
|
data.C=NULL;
|
||||||
|
|
||||||
if (data.toplevel && !get_scene()->is_editor_hint()) {
|
if (data.toplevel && !get_tree()->is_editor_hint()) {
|
||||||
|
|
||||||
if (data.parent) {
|
if (data.parent) {
|
||||||
data.local_transform = data.parent->get_global_transform() * get_transform();
|
data.local_transform = data.parent->get_global_transform() * get_transform();
|
||||||
@ -147,11 +147,11 @@ void Spatial::_notification(int p_what) {
|
|||||||
notification(NOTIFICATION_ENTER_WORLD);
|
notification(NOTIFICATION_ENTER_WORLD);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
notification(NOTIFICATION_EXIT_WORLD,true);
|
notification(NOTIFICATION_EXIT_WORLD,true);
|
||||||
if (xform_change.in_list())
|
if (xform_change.in_list())
|
||||||
get_scene()->xform_change_list.remove(&xform_change);
|
get_tree()->xform_change_list.remove(&xform_change);
|
||||||
if (data.C)
|
if (data.C)
|
||||||
data.parent->data.children.erase(data.C);
|
data.parent->data.children.erase(data.C);
|
||||||
data.parent=NULL;
|
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);
|
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world,NULL,0);
|
||||||
}
|
}
|
||||||
#ifdef TOOLS_ENABLED
|
#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(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_disabled) {
|
||||||
|
|
||||||
if (data.gizmo.is_valid())
|
if (data.gizmo.is_valid())
|
||||||
@ -257,7 +257,7 @@ Transform Spatial::get_transform() const {
|
|||||||
}
|
}
|
||||||
Transform Spatial::get_global_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) {
|
if (data.dirty & DIRTY_GLOBAL) {
|
||||||
|
|
||||||
@ -460,7 +460,7 @@ void Spatial::set_as_toplevel(bool p_enabled) {
|
|||||||
|
|
||||||
if (data.toplevel==p_enabled)
|
if (data.toplevel==p_enabled)
|
||||||
return;
|
return;
|
||||||
if (is_inside_scene() && !get_scene()->is_editor_hint()) {
|
if (is_inside_tree() && !get_tree()->is_editor_hint()) {
|
||||||
|
|
||||||
if (p_enabled)
|
if (p_enabled)
|
||||||
set_transform(get_global_transform());
|
set_transform(get_global_transform());
|
||||||
@ -537,7 +537,7 @@ void Spatial::show() {
|
|||||||
|
|
||||||
data.visible=true;
|
data.visible=true;
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!data.parent || is_visible()) {
|
if (!data.parent || is_visible()) {
|
||||||
|
@ -130,7 +130,7 @@ public:
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
||||||
NOTIFICATION_TRANSFORM_CHANGED=SceneMainLoop::NOTIFICATION_TRANSFORM_CHANGED,
|
NOTIFICATION_TRANSFORM_CHANGED=SceneTree::NOTIFICATION_TRANSFORM_CHANGED,
|
||||||
NOTIFICATION_ENTER_WORLD=41,
|
NOTIFICATION_ENTER_WORLD=41,
|
||||||
NOTIFICATION_EXIT_WORLD=42,
|
NOTIFICATION_EXIT_WORLD=42,
|
||||||
NOTIFICATION_VISIBILITY_CHANGED=43,
|
NOTIFICATION_VISIBILITY_CHANGED=43,
|
||||||
|
@ -74,7 +74,7 @@ Ref<AudioStream> SpatialStreamPlayer::get_stream() const {
|
|||||||
|
|
||||||
void SpatialStreamPlayer::play() {
|
void SpatialStreamPlayer::play() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
if (stream.is_null())
|
if (stream.is_null())
|
||||||
return;
|
return;
|
||||||
@ -89,7 +89,7 @@ void SpatialStreamPlayer::play() {
|
|||||||
|
|
||||||
void SpatialStreamPlayer::stop() {
|
void SpatialStreamPlayer::stop() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
if (stream.is_null())
|
if (stream.is_null())
|
||||||
return;
|
return;
|
||||||
|
@ -37,7 +37,7 @@ void SpriteBase3D::_propagate_color_changed() {
|
|||||||
|
|
||||||
void SpriteBase3D::_notification(int p_what) {
|
void SpriteBase3D::_notification(int p_what) {
|
||||||
|
|
||||||
if (p_what==NOTIFICATION_ENTER_SCENE) {
|
if (p_what==NOTIFICATION_ENTER_TREE) {
|
||||||
|
|
||||||
if (!pending_update)
|
if (!pending_update)
|
||||||
_im_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) {
|
if (parent_sprite) {
|
||||||
|
@ -57,7 +57,7 @@ public:
|
|||||||
void VehicleWheel::_notification(int p_what) {
|
void VehicleWheel::_notification(int p_what) {
|
||||||
|
|
||||||
|
|
||||||
if (p_what==NOTIFICATION_ENTER_SCENE) {
|
if (p_what==NOTIFICATION_ENTER_TREE) {
|
||||||
|
|
||||||
if (!get_parent())
|
if (!get_parent())
|
||||||
return;
|
return;
|
||||||
@ -73,7 +73,7 @@ void VehicleWheel::_notification(int p_what) {
|
|||||||
m_wheelAxleCS = get_transform().basis.get_axis(Vector3::AXIS_X).normalized();
|
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())
|
if (!get_parent())
|
||||||
return;
|
return;
|
||||||
|
@ -183,7 +183,7 @@ void VisibilityEnabler::_find_nodes(Node* p_node) {
|
|||||||
|
|
||||||
if (add) {
|
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;
|
nodes[p_node]=meta;
|
||||||
_change_node_state(p_node,false);
|
_change_node_state(p_node,false);
|
||||||
}
|
}
|
||||||
@ -200,9 +200,9 @@ void VisibilityEnabler::_find_nodes(Node* p_node) {
|
|||||||
|
|
||||||
void VisibilityEnabler::_notification(int p_what){
|
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;
|
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;
|
return;
|
||||||
|
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ void VisibilityEnabler::_notification(int p_what){
|
|||||||
|
|
||||||
if (!visible)
|
if (!visible)
|
||||||
_change_node_state(E->key(),true);
|
_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();
|
nodes.clear();
|
||||||
@ -271,7 +271,7 @@ void VisibilityEnabler::_node_removed(Node* p_node) {
|
|||||||
|
|
||||||
if (!visible)
|
if (!visible)
|
||||||
_change_node_state(p_node,true);
|
_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);
|
nodes.erase(p_node);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ void GeometryInstance::_find_baked_light() {
|
|||||||
|
|
||||||
void GeometryInstance::_update_visibility() {
|
void GeometryInstance::_update_visibility() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_change_notify("geometry/visible");
|
_change_notify("geometry/visible");
|
||||||
|
@ -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
|
//it is one shot, so it disconnects upon arrival
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ void AnimationCache::_clear_cache() {
|
|||||||
|
|
||||||
while(connected_nodes.size()) {
|
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());
|
connected_nodes.erase(connected_nodes.front());
|
||||||
}
|
}
|
||||||
path_cache.clear();;
|
path_cache.clear();;
|
||||||
@ -73,7 +73,7 @@ void AnimationCache::_update_cache() {
|
|||||||
cache_valid=false;
|
cache_valid=false;
|
||||||
|
|
||||||
ERR_FAIL_COND(!root);
|
ERR_FAIL_COND(!root);
|
||||||
ERR_FAIL_COND(!root->is_inside_scene());
|
ERR_FAIL_COND(!root->is_inside_tree());
|
||||||
ERR_FAIL_COND(animation.is_null());
|
ERR_FAIL_COND(animation.is_null());
|
||||||
|
|
||||||
for(int i=0;i<animation->get_track_count();i++) {
|
for(int i=0;i<animation->get_track_count();i++) {
|
||||||
@ -206,7 +206,7 @@ void AnimationCache::_update_cache() {
|
|||||||
|
|
||||||
if (!connected_nodes.has(path.node)) {
|
if (!connected_nodes.has(path.node)) {
|
||||||
connected_nodes.insert(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() {
|
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);
|
ObjectTypeDB::bind_method(_MD("_animation_changed"),&AnimationCache::_animation_changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class AnimationCache : public Object {
|
|||||||
bool cache_dirty;
|
bool cache_dirty;
|
||||||
bool cache_valid;
|
bool cache_valid;
|
||||||
|
|
||||||
void _node_exit_scene(Node *p_node);
|
void _node_exit_tree(Node *p_node);
|
||||||
|
|
||||||
void _clear_cache();
|
void _clear_cache();
|
||||||
void _update_cache();
|
void _update_cache();
|
||||||
|
@ -189,7 +189,7 @@ void AnimationPlayer::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
if (!processing) {
|
if (!processing) {
|
||||||
//make sure that a previous process state was not saved
|
//make sure that a previous process state was not saved
|
||||||
@ -202,7 +202,7 @@ void AnimationPlayer::_notification(int p_what) {
|
|||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_READY: {
|
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);
|
play(autoplay);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
@ -221,7 +221,7 @@ void AnimationPlayer::_notification(int p_what) {
|
|||||||
if (processing)
|
if (processing)
|
||||||
_animation_process( get_fixed_process_delta_time() );
|
_animation_process( get_fixed_process_delta_time() );
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
stop_all();
|
stop_all();
|
||||||
clear_caches();
|
clear_caches();
|
||||||
@ -261,8 +261,8 @@ void AnimationPlayer::_generate_node_caches(AnimationData* p_anim) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!child->is_connected("exit_scene",this,"_node_removed"))
|
if (!child->is_connected("exit_tree",this,"_node_removed"))
|
||||||
child->connect("exit_scene",this,"_node_removed",make_binds(child),CONNECT_ONESHOT);
|
child->connect("exit_tree",this,"_node_removed",make_binds(child),CONNECT_ONESHOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackNodeCacheKey key;
|
TrackNodeCacheKey key;
|
||||||
@ -348,7 +348,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData* p_anim,float p
|
|||||||
|
|
||||||
|
|
||||||
Animation *a=p_anim->animation.operator->();
|
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++) {
|
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
|
_set_process(true); // always process when starting an animation
|
||||||
playing = true;
|
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
|
return; // no next in this case
|
||||||
|
|
||||||
|
|
||||||
|
@ -1586,7 +1586,7 @@ void AnimationTreePlayer::_update_sources() {
|
|||||||
|
|
||||||
if (master==NodePath())
|
if (master==NodePath())
|
||||||
return;
|
return;
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Node *m = get_node(master);
|
Node *m = get_node(master);
|
||||||
|
@ -75,7 +75,7 @@ void Tween::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
if (!processing) {
|
if (!processing) {
|
||||||
//make sure that a previous process state was not saved
|
//make sure that a previous process state was not saved
|
||||||
@ -102,7 +102,7 @@ void Tween::_notification(int p_what) {
|
|||||||
if (processing)
|
if (processing)
|
||||||
_tween_process( get_fixed_process_delta_time() );
|
_tween_process( get_fixed_process_delta_time() );
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
stop_all();
|
stop_all();
|
||||||
} break;
|
} break;
|
||||||
|
@ -33,13 +33,13 @@ void EventPlayer::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
//set_idle_process(false); //don't annoy
|
//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();
|
play();
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
stop(); //wathever it may be doing, stop
|
stop(); //wathever it may be doing, stop
|
||||||
} break;
|
} break;
|
||||||
@ -75,7 +75,7 @@ Ref<EventStream> EventPlayer::get_stream() const {
|
|||||||
|
|
||||||
void EventPlayer::play() {
|
void EventPlayer::play() {
|
||||||
|
|
||||||
ERR_FAIL_COND(!is_inside_scene());
|
ERR_FAIL_COND(!is_inside_tree());
|
||||||
if (playback.is_null()) {
|
if (playback.is_null()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ void EventPlayer::play() {
|
|||||||
|
|
||||||
void EventPlayer::stop() {
|
void EventPlayer::stop() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
if (playback.is_null())
|
if (playback.is_null())
|
||||||
return;
|
return;
|
||||||
@ -241,7 +241,7 @@ bool EventPlayer::is_paused() const {
|
|||||||
void EventPlayer::_set_play(bool p_play) {
|
void EventPlayer::_set_play(bool p_play) {
|
||||||
|
|
||||||
_play=p_play;
|
_play=p_play;
|
||||||
if (is_inside_scene()) {
|
if (is_inside_tree()) {
|
||||||
if(_play)
|
if(_play)
|
||||||
play();
|
play();
|
||||||
else
|
else
|
||||||
|
@ -53,7 +53,7 @@ void SoundRoomParams::_notification(int p_what) {
|
|||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
#if 0
|
#if 0
|
||||||
Node *n=this;
|
Node *n=this;
|
||||||
Room *room_instance=NULL;
|
Room *room_instance=NULL;
|
||||||
@ -81,7 +81,7 @@ void SoundRoomParams::_notification(int p_what) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
room=RID();
|
room=RID();
|
||||||
|
|
||||||
|
@ -33,13 +33,13 @@ void StreamPlayer::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
//set_idle_process(false); //don't annoy
|
//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();
|
play();
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
stop(); //wathever it may be doing, stop
|
stop(); //wathever it may be doing, stop
|
||||||
} break;
|
} break;
|
||||||
@ -75,7 +75,7 @@ Ref<AudioStream> StreamPlayer::get_stream() const {
|
|||||||
|
|
||||||
void StreamPlayer::play() {
|
void StreamPlayer::play() {
|
||||||
|
|
||||||
ERR_FAIL_COND(!is_inside_scene());
|
ERR_FAIL_COND(!is_inside_tree());
|
||||||
if (stream.is_null())
|
if (stream.is_null())
|
||||||
return;
|
return;
|
||||||
if (stream->is_playing())
|
if (stream->is_playing())
|
||||||
@ -91,7 +91,7 @@ void StreamPlayer::play() {
|
|||||||
|
|
||||||
void StreamPlayer::stop() {
|
void StreamPlayer::stop() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
if (stream.is_null())
|
if (stream.is_null())
|
||||||
return;
|
return;
|
||||||
@ -214,7 +214,7 @@ bool StreamPlayer::is_paused() const {
|
|||||||
void StreamPlayer::_set_play(bool p_play) {
|
void StreamPlayer::_set_play(bool p_play) {
|
||||||
|
|
||||||
_play=p_play;
|
_play=p_play;
|
||||||
if (is_inside_scene()) {
|
if (is_inside_tree()) {
|
||||||
if(_play)
|
if(_play)
|
||||||
play();
|
play();
|
||||||
else
|
else
|
||||||
|
@ -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;
|
CanvasItem *ci=this;
|
||||||
while(ci) {
|
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)
|
if (group)
|
||||||
group->_remove_button(this);
|
group->_remove_button(this);
|
||||||
|
@ -117,7 +117,7 @@ BaseButton *ButtonGroup::get_focused_button() const{
|
|||||||
int ButtonGroup::get_pressed_button_index() const {
|
int ButtonGroup::get_pressed_button_index() const {
|
||||||
//in tree order, this is bizarre
|
//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();
|
BaseButton *pressed = get_pressed_button();
|
||||||
if (!pressed)
|
if (!pressed)
|
||||||
|
@ -67,7 +67,7 @@ void Container::remove_child_notify(Node *p_child) {
|
|||||||
|
|
||||||
void Container::_sort_children() {
|
void Container::_sort_children() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
notification(NOTIFICATION_SORT_CHILDREN);
|
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() {
|
void Container::queue_sort() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pending_sort)
|
if (pending_sort)
|
||||||
@ -115,7 +115,7 @@ void Container::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
pending_sort=false;
|
pending_sort=false;
|
||||||
queue_sort();
|
queue_sort();
|
||||||
} break;
|
} break;
|
||||||
|
@ -183,7 +183,7 @@ bool Control::_set(const StringName& p_name, const Variant& p_value) {
|
|||||||
|
|
||||||
void Control::_update_minimum_size() {
|
void Control::_update_minimum_size() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
data.pending_min_size_update=false;
|
data.pending_min_size_update=false;
|
||||||
@ -341,7 +341,7 @@ void Control::_notification(int p_notification) {
|
|||||||
|
|
||||||
switch(p_notification) {
|
switch(p_notification) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
if (data.window==this) {
|
if (data.window==this) {
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ void Control::_notification(int p_notification) {
|
|||||||
window->drag_attempted=false;
|
window->drag_attempted=false;
|
||||||
window->drag_preview=NULL;
|
window->drag_preview=NULL;
|
||||||
|
|
||||||
if (get_scene()->is_editor_hint()) {
|
if (get_tree()->is_editor_hint()) {
|
||||||
|
|
||||||
Node *n = this;
|
Node *n = this;
|
||||||
while(n) {
|
while(n) {
|
||||||
@ -385,7 +385,7 @@ void Control::_notification(int p_notification) {
|
|||||||
_size_changed();
|
_size_changed();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
if (data.window) {
|
if (data.window) {
|
||||||
|
|
||||||
@ -630,7 +630,7 @@ void Control::_notification(int p_notification) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case SceneMainLoop::NOTIFICATION_WM_UNFOCUS_REQUEST: {
|
case SceneTree::NOTIFICATION_WM_UNFOCUS_REQUEST: {
|
||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
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) {
|
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(!data.window);
|
||||||
ERR_FAIL_COND(p_data.get_type()==Variant::NIL);
|
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_NULL(p_control);
|
||||||
ERR_FAIL_COND( !((Object*)p_control)->cast_to<Control>());
|
ERR_FAIL_COND( !((Object*)p_control)->cast_to<Control>());
|
||||||
ERR_FAIL_COND(!is_inside_scene() || !data.window);
|
ERR_FAIL_COND(!is_inside_tree() || !data.window);
|
||||||
ERR_FAIL_COND(p_control->is_inside_scene());
|
ERR_FAIL_COND(p_control->is_inside_tree());
|
||||||
ERR_FAIL_COND(p_control->get_parent()!=NULL);
|
ERR_FAIL_COND(p_control->get_parent()!=NULL);
|
||||||
|
|
||||||
if (data.window->window->drag_preview) {
|
if (data.window->window->drag_preview) {
|
||||||
@ -963,8 +963,8 @@ void Control::_window_input_event(InputEvent p_event) {
|
|||||||
|
|
||||||
if (top->data.modal_exclusive) {
|
if (top->data.modal_exclusive) {
|
||||||
//cancel event, sorry, modal exclusive EATS UP ALL
|
//cancel event, sorry, modal exclusive EATS UP ALL
|
||||||
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);
|
||||||
get_scene()->set_input_as_handled();
|
get_tree()->set_input_as_handled();
|
||||||
return; // no one gets the event if exclusive NO ONE
|
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);
|
_window_call_input(window->mouse_focus,p_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
get_scene()->set_input_as_handled();
|
get_tree()->set_input_as_handled();
|
||||||
|
|
||||||
} else {
|
} 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_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID);
|
||||||
get_scene()->set_input_as_handled();
|
get_tree()->set_input_as_handled();
|
||||||
|
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
@ -1147,7 +1147,7 @@ void Control::_window_input_event(InputEvent p_event) {
|
|||||||
|
|
||||||
window->mouse_over=over;
|
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) {
|
if (window->drag_preview) {
|
||||||
window->drag_preview->set_pos(pos);
|
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_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID);
|
||||||
get_scene()->set_input_as_handled();
|
get_tree()->set_input_as_handled();
|
||||||
|
|
||||||
|
|
||||||
if (window->drag_data.get_type()!=Variant::NIL && p_event.mouse_motion.button_mask&BUTTON_MASK_LEFT) {
|
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) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1290,7 +1290,7 @@ void Control::_window_input_event(InputEvent p_event) {
|
|||||||
|
|
||||||
if (next) {
|
if (next) {
|
||||||
next->grab_focus();
|
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 {
|
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 {
|
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;
|
Size2 parent_size;
|
||||||
|
|
||||||
@ -1624,7 +1624,7 @@ Size2 Control::get_parent_area_size() const {
|
|||||||
|
|
||||||
void Control::_size_changed() {
|
void Control::_size_changed() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Size2 parent_size = get_parent_area_size();
|
Size2 parent_size = get_parent_area_size();
|
||||||
@ -1677,7 +1677,7 @@ void Control::_size_changed() {
|
|||||||
|
|
||||||
float Control::_get_parent_range(int p_idx) const {
|
float Control::_get_parent_range(int p_idx) const {
|
||||||
|
|
||||||
if (!is_inside_scene()) {
|
if (!is_inside_tree()) {
|
||||||
|
|
||||||
return 1.0;
|
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) {
|
void Control::set_anchor(Margin p_margin,AnchorType p_anchor) {
|
||||||
|
|
||||||
if (!is_inside_scene()) {
|
if (!is_inside_tree()) {
|
||||||
|
|
||||||
data.anchor[p_margin]=p_anchor;
|
data.anchor[p_margin]=p_anchor;
|
||||||
} else {
|
} 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) {
|
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();
|
release_focus();
|
||||||
|
|
||||||
data.focus_mode=p_focus_mode;
|
data.focus_mode=p_focus_mode;
|
||||||
@ -2178,7 +2178,7 @@ bool Control::has_focus() const {
|
|||||||
|
|
||||||
void Control::grab_focus() {
|
void Control::grab_focus() {
|
||||||
|
|
||||||
ERR_FAIL_COND(!is_inside_scene());
|
ERR_FAIL_COND(!is_inside_tree());
|
||||||
ERR_FAIL_COND(!data.window);
|
ERR_FAIL_COND(!data.window);
|
||||||
|
|
||||||
if (data.focus_mode==FOCUS_NONE)
|
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)
|
if (data.window->window->key_focus && data.window->window->key_focus==this)
|
||||||
return;
|
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;
|
data.window->window->key_focus=this;
|
||||||
notification(NOTIFICATION_FOCUS_ENTER);
|
notification(NOTIFICATION_FOCUS_ENTER);
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
@ -2202,13 +2202,13 @@ void Control::grab_focus() {
|
|||||||
|
|
||||||
void Control::release_focus() {
|
void Control::release_focus() {
|
||||||
|
|
||||||
ERR_FAIL_COND(!is_inside_scene());
|
ERR_FAIL_COND(!is_inside_tree());
|
||||||
ERR_FAIL_COND(!data.window);
|
ERR_FAIL_COND(!data.window);
|
||||||
|
|
||||||
if (!has_focus())
|
if (!has_focus())
|
||||||
return;
|
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;
|
//data.window->window->key_focus=this;
|
||||||
//notification(NOTIFICATION_FOCUS_ENTER);
|
//notification(NOTIFICATION_FOCUS_ENTER);
|
||||||
update();
|
update();
|
||||||
@ -2217,12 +2217,12 @@ void Control::release_focus() {
|
|||||||
|
|
||||||
bool Control::is_toplevel_control() const {
|
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) {
|
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.SI && data.window!=this);
|
||||||
ERR_FAIL_COND(!data.window);
|
ERR_FAIL_COND(!data.window);
|
||||||
|
|
||||||
@ -2282,7 +2282,7 @@ void Control::_modal_stack_remove() {
|
|||||||
if (!pfoc)
|
if (!pfoc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pfoc->is_inside_scene() || !pfoc->is_visible())
|
if (!pfoc->is_inside_tree() || !pfoc->is_visible())
|
||||||
return;
|
return;
|
||||||
pfoc->grab_focus();
|
pfoc->grab_focus();
|
||||||
} else {
|
} else {
|
||||||
@ -2332,13 +2332,13 @@ void Control::set_theme(const Ref<Theme>& p_theme) {
|
|||||||
void Control::_window_accept_event() {
|
void Control::_window_accept_event() {
|
||||||
|
|
||||||
window->key_event_accepted=true;
|
window->key_event_accepted=true;
|
||||||
if (is_inside_scene())
|
if (is_inside_tree())
|
||||||
get_scene()->set_input_as_handled();
|
get_tree()->set_input_as_handled();
|
||||||
|
|
||||||
}
|
}
|
||||||
void Control::accept_event() {
|
void Control::accept_event() {
|
||||||
|
|
||||||
if (is_inside_scene() && get_window())
|
if (is_inside_tree() && get_window())
|
||||||
get_window()->_window_accept_event();
|
get_window()->_window_accept_event();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2585,7 +2585,7 @@ float Control::get_stretch_ratio() const {
|
|||||||
|
|
||||||
void Control::grab_click_focus() {
|
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) {
|
if (data.window && data.window->window->mouse_focus) {
|
||||||
|
|
||||||
@ -2620,7 +2620,7 @@ void Control::grab_click_focus() {
|
|||||||
|
|
||||||
void Control::minimum_size_changed() {
|
void Control::minimum_size_changed() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (data.pending_min_size_update)
|
if (data.pending_min_size_update)
|
||||||
@ -2663,7 +2663,7 @@ bool Control::is_stopping_mouse() const {
|
|||||||
|
|
||||||
Control *Control::get_focus_owner() 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);
|
ERR_FAIL_COND_V(!window,NULL);
|
||||||
return window->key_focus;
|
return window->key_focus;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ void WindowDialog::_notification(int p_what) {
|
|||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_THEME_CHANGED:
|
case NOTIFICATION_THEME_CHANGED:
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
close_button->set_normal_texture( get_icon("close","WindowDialog"));
|
close_button->set_normal_texture( get_icon("close","WindowDialog"));
|
||||||
close_button->set_pressed_texture( get_icon("close","WindowDialog"));
|
close_button->set_pressed_texture( get_icon("close","WindowDialog"));
|
||||||
|
@ -339,7 +339,7 @@ int Label::get_longest_line_width() const {
|
|||||||
|
|
||||||
int Label::get_line_count() const {
|
int Label::get_line_count() const {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return 1;
|
return 1;
|
||||||
if (word_cache_dirty)
|
if (word_cache_dirty)
|
||||||
const_cast<Label*>(this)->regenerate_word_cache();
|
const_cast<Label*>(this)->regenerate_word_cache();
|
||||||
|
@ -572,7 +572,7 @@ void LineEdit::set_cursor_pos(int p_pos) {
|
|||||||
// set_window_pos(cursor_pos-get_window_lengt//h());
|
// set_window_pos(cursor_pos-get_window_lengt//h());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (!is_inside_scene()) {
|
if (!is_inside_tree()) {
|
||||||
|
|
||||||
window_pos=cursor_pos;
|
window_pos=cursor_pos;
|
||||||
return;
|
return;
|
||||||
|
@ -192,7 +192,7 @@ void OptionButton::_select(int p_idx,bool p_emit) {
|
|||||||
set_text( popup->get_item_text( current ) );
|
set_text( popup->get_item_text( current ) );
|
||||||
set_icon( popup->get_item_icon( 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);
|
emit_signal("item_selected",current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ void Range::Shared::emit_value_changed() {
|
|||||||
|
|
||||||
for (Set<Range*>::Element *E=owners.front();E;E=E->next()) {
|
for (Set<Range*>::Element *E=owners.front();E;E=E->next()) {
|
||||||
Range *r=E->get();
|
Range *r=E->get();
|
||||||
if (!r->is_inside_scene())
|
if (!r->is_inside_tree())
|
||||||
continue;
|
continue;
|
||||||
r->_value_changed_notify();
|
r->_value_changed_notify();
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ void Range::Shared::emit_changed() {
|
|||||||
|
|
||||||
for (Set<Range*>::Element *E=owners.front();E;E=E->next()) {
|
for (Set<Range*>::Element *E=owners.front();E;E=E->next()) {
|
||||||
Range *r=E->get();
|
Range *r=E->get();
|
||||||
if (!r->is_inside_scene())
|
if (!r->is_inside_tree())
|
||||||
continue;
|
continue;
|
||||||
r->_changed_notify();
|
r->_changed_notify();
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,9 @@ void ReferenceFrame::_notification(int p_what) {
|
|||||||
|
|
||||||
if (p_what==NOTIFICATION_DRAW) {
|
if (p_what==NOTIFICATION_DRAW) {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
if (get_scene()->is_editor_hint())
|
if (get_tree()->is_editor_hint())
|
||||||
draw_style_box(get_stylebox("border"),Rect2(Point2(),get_size())) ;
|
draw_style_box(get_stylebox("border"),Rect2(Point2(),get_size())) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)) {
|
if (has_node(drag_slave_path)) {
|
||||||
@ -303,16 +303,16 @@ void ScrollBar::_notification(int p_what) {
|
|||||||
|
|
||||||
if (drag_slave) {
|
if (drag_slave) {
|
||||||
drag_slave->connect("input_event",this,"_drag_slave_input");
|
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) {
|
if (drag_slave) {
|
||||||
drag_slave->disconnect("input_event",this,"_drag_slave_input");
|
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=NULL;
|
||||||
@ -635,18 +635,18 @@ void ScrollBar::_drag_slave_input(const InputEvent& p_input) {
|
|||||||
|
|
||||||
void ScrollBar::set_drag_slave(const NodePath& p_path) {
|
void ScrollBar::set_drag_slave(const NodePath& p_path) {
|
||||||
|
|
||||||
if (is_inside_scene()) {
|
if (is_inside_tree()) {
|
||||||
|
|
||||||
if (drag_slave) {
|
if (drag_slave) {
|
||||||
drag_slave->disconnect("input_event",this,"_drag_slave_input");
|
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=NULL;
|
||||||
drag_slave_path=p_path;
|
drag_slave_path=p_path;
|
||||||
|
|
||||||
if (is_inside_scene()) {
|
if (is_inside_tree()) {
|
||||||
|
|
||||||
if (has_node(p_path)) {
|
if (has_node(p_path)) {
|
||||||
Node *n = get_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) {
|
if (drag_slave) {
|
||||||
drag_slave->connect("input_event",this,"_drag_slave_input");
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ void ScrollContainer::_update_scrollbar_pos() {
|
|||||||
|
|
||||||
void ScrollContainer::_notification(int p_what) {
|
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");
|
call_deferred("_update_scrollbar_pos");
|
||||||
};
|
};
|
||||||
|
@ -122,7 +122,7 @@ void SpinBox::_notification(int p_what) {
|
|||||||
|
|
||||||
|
|
||||||
//_value_changed(0);
|
//_value_changed(0);
|
||||||
} else if (p_what==NOTIFICATION_ENTER_SCENE) {
|
} else if (p_what==NOTIFICATION_ENTER_TREE) {
|
||||||
|
|
||||||
_value_changed(0);
|
_value_changed(0);
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ void TextEdit::_update_scrollbars() {
|
|||||||
void TextEdit::_notification(int p_what) {
|
void TextEdit::_notification(int p_what) {
|
||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
_update_caches();
|
_update_caches();
|
||||||
if (cursor_changed_dirty)
|
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 (!text_changed_dirty && !setting_text) {
|
||||||
|
|
||||||
if (is_inside_scene())
|
if (is_inside_tree())
|
||||||
MessageQueue::get_singleton()->push_call(this,"_text_changed_emit");
|
MessageQueue::get_singleton()->push_call(this,"_text_changed_emit");
|
||||||
text_changed_dirty=true;
|
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 (!text_changed_dirty && !setting_text) {
|
||||||
|
|
||||||
if (is_inside_scene())
|
if (is_inside_tree())
|
||||||
MessageQueue::get_singleton()->push_call(this,"_text_changed_emit");
|
MessageQueue::get_singleton()->push_call(this,"_text_changed_emit");
|
||||||
text_changed_dirty=true;
|
text_changed_dirty=true;
|
||||||
}
|
}
|
||||||
@ -2133,7 +2133,7 @@ void TextEdit::cursor_set_column(int p_col) {
|
|||||||
|
|
||||||
if (!cursor_changed_dirty) {
|
if (!cursor_changed_dirty) {
|
||||||
|
|
||||||
if (is_inside_scene())
|
if (is_inside_tree())
|
||||||
MessageQueue::get_singleton()->push_call(this,"_cursor_changed_emit");
|
MessageQueue::get_singleton()->push_call(this,"_cursor_changed_emit");
|
||||||
cursor_changed_dirty=true;
|
cursor_changed_dirty=true;
|
||||||
}
|
}
|
||||||
@ -2165,7 +2165,7 @@ void TextEdit::cursor_set_line(int p_row) {
|
|||||||
|
|
||||||
if (!cursor_changed_dirty) {
|
if (!cursor_changed_dirty) {
|
||||||
|
|
||||||
if (is_inside_scene())
|
if (is_inside_tree())
|
||||||
MessageQueue::get_singleton()->push_call(this,"_cursor_changed_emit");
|
MessageQueue::get_singleton()->push_call(this,"_cursor_changed_emit");
|
||||||
cursor_changed_dirty=true;
|
cursor_changed_dirty=true;
|
||||||
}
|
}
|
||||||
|
@ -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: {
|
case TreeItem::CELL_MODE_STRING: {
|
||||||
//nothing in particular
|
//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;
|
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 ) );
|
editor_text=String::num( p_item->cells[col].val, Math::decimals( p_item->cells[col].step ) );
|
||||||
bring_up_value_editor=false;
|
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;
|
bring_up_editor=false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2343,7 +2343,7 @@ void Tree::_notification(int p_what) {
|
|||||||
|
|
||||||
if (p_what==NOTIFICATION_FOCUS_ENTER) {
|
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) {
|
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();;
|
update_cache();;
|
||||||
}
|
}
|
||||||
@ -2811,7 +2811,7 @@ int Tree::get_item_offset(TreeItem *p_item) const {
|
|||||||
|
|
||||||
void Tree::ensure_cursor_is_visible() {
|
void Tree::ensure_cursor_is_visible() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TreeItem *selected = get_selected();
|
TreeItem *selected = get_selected();
|
||||||
|
@ -32,10 +32,10 @@ void VideoPlayer::_notification(int p_notification) {
|
|||||||
|
|
||||||
switch (p_notification) {
|
switch (p_notification) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
//set_idle_process(false); //don't annoy
|
//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();
|
play();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ void VideoPlayer::_notification(int p_notification) {
|
|||||||
if (!stream->is_playing())
|
if (!stream->is_playing())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
stream->update(get_scene()->get_idle_process_time());
|
stream->update(get_tree()->get_idle_process_time());
|
||||||
int prev_width = texture->get_width();
|
int prev_width = texture->get_width();
|
||||||
stream->pop_frame(texture);
|
stream->pop_frame(texture);
|
||||||
if (prev_width == 0) {
|
if (prev_width == 0) {
|
||||||
@ -118,7 +118,7 @@ Ref<VideoStream> VideoPlayer::get_stream() const {
|
|||||||
|
|
||||||
void VideoPlayer::play() {
|
void VideoPlayer::play() {
|
||||||
|
|
||||||
ERR_FAIL_COND(!is_inside_scene());
|
ERR_FAIL_COND(!is_inside_tree());
|
||||||
if (stream.is_null())
|
if (stream.is_null())
|
||||||
return;
|
return;
|
||||||
stream->play();
|
stream->play();
|
||||||
@ -127,7 +127,7 @@ void VideoPlayer::play() {
|
|||||||
|
|
||||||
void VideoPlayer::stop() {
|
void VideoPlayer::stop() {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
if (stream.is_null())
|
if (stream.is_null())
|
||||||
return;
|
return;
|
||||||
|
@ -144,7 +144,7 @@ void CanvasLayer::_notification(int p_what) {
|
|||||||
|
|
||||||
switch(p_what) {
|
switch(p_what) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_SCENE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
Node *n = this;
|
Node *n = this;
|
||||||
vp=NULL;
|
vp=NULL;
|
||||||
@ -169,7 +169,7 @@ void CanvasLayer::_notification(int p_what) {
|
|||||||
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_SCENE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
|
||||||
VisualServer::get_singleton()->viewport_remove_canvas(viewport,canvas->get_canvas());
|
VisualServer::get_singleton()->viewport_remove_canvas(viewport,canvas->get_canvas());
|
||||||
viewport=RID();
|
viewport=RID();
|
||||||
@ -180,7 +180,7 @@ void CanvasLayer::_notification(int p_what) {
|
|||||||
|
|
||||||
Size2 CanvasLayer::get_viewport_size() const {
|
Size2 CanvasLayer::get_viewport_size() const {
|
||||||
|
|
||||||
if (!is_inside_scene())
|
if (!is_inside_tree())
|
||||||
return Size2(1,1);
|
return Size2(1,1);
|
||||||
|
|
||||||
Rect2 r = vp->get_visible_rect();
|
Rect2 r = vp->get_visible_rect();
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user