From b260bfab636f6edffb3696830cc00314c6cb1bad Mon Sep 17 00:00:00 2001 From: sanikoyes Date: Wed, 7 Jan 2015 19:46:01 +0800 Subject: [PATCH 01/30] Add call deferred support for Tween --- scene/animation/tween.cpp | 111 +++++++++++++++++++++++++++++++++++--- scene/animation/tween.h | 14 +++-- 2 files changed, 114 insertions(+), 11 deletions(-) diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index f668e525904..8b87ecf7116 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -138,7 +138,8 @@ void Tween::_bind_methods() { ObjectTypeDB::bind_method(_MD("interpolate_property","object","property","initial_val","final_val","times_in_sec","trans_type","ease_type","delay"),&Tween::interpolate_property, DEFVAL(0) ); ObjectTypeDB::bind_method(_MD("interpolate_method","object","method","initial_val","final_val","times_in_sec","trans_type","ease_type","delay"),&Tween::interpolate_method, DEFVAL(0) ); - ObjectTypeDB::bind_method(_MD("interpolate_callback","object","times_in_sec","callback","args"),&Tween::interpolate_callback, DEFVAL(Variant()) ); + ObjectTypeDB::bind_method(_MD("interpolate_callback","object","times_in_sec","callback","arg1", "arg2","arg3","arg4","arg5"),&Tween::interpolate_callback, DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()) ); + ObjectTypeDB::bind_method(_MD("interpolate_deferred_callback","object","times_in_sec","callback","arg1","arg2","arg3","arg4","arg5"),&Tween::interpolate_deferred_callback, DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()) ); ObjectTypeDB::bind_method(_MD("follow_property","object","property","initial_val","target","target_property","times_in_sec","trans_type","ease_type","delay"),&Tween::follow_property, DEFVAL(0) ); ObjectTypeDB::bind_method(_MD("follow_method","object","method","initial_val","target","target_method","times_in_sec","trans_type","ease_type","delay"),&Tween::follow_method, DEFVAL(0) ); ObjectTypeDB::bind_method(_MD("targeting_property","object","property","initial","initial_val","final_val","times_in_sec","trans_type","ease_type","delay"),&Tween::targeting_property, DEFVAL(0) ); @@ -513,11 +514,33 @@ void Tween::_tween_process(float p_delta) { if(data.finish) { Variant::CallError error; - if (data.arg.get_type() != Variant::NIL) { - Variant *arg[1] = { &data.arg }; - object->call(data.key, (const Variant **) arg, 1, error); - } else { - object->call(data.key, NULL, 0, error); + if (data.call_deferred) { + + switch (data.args) { + case 0: + object->call_deferred(data.key); break; + case 1: + object->call_deferred(data.key, data.arg[0]); break; + case 2: + object->call_deferred(data.key, data.arg[0], data.arg[1]); break; + case 3: + object->call_deferred(data.key, data.arg[0], data.arg[1], data.arg[2]); break; + case 4: + object->call_deferred(data.key, data.arg[0], data.arg[1], data.arg[2], data.arg[3]); break; + case 5: + object->call_deferred(data.key, data.arg[0], data.arg[1], data.arg[2], data.arg[3], data.arg[4]); break; + } + + } + else { + Variant *arg[5] = { + &data.arg[0], + &data.arg[1], + &data.arg[2], + &data.arg[3], + &data.arg[4], + }; + object->call(data.key, (const Variant **) arg, data.args, error); } } continue; @@ -1003,7 +1026,7 @@ bool Tween::interpolate_method(Object *p_object bool Tween::interpolate_callback(Object *p_object , real_t p_times_in_sec , String p_callback - , Variant p_arg + , VARIANT_ARG_DECLARE ) { ERR_FAIL_COND_V(pending_update != 0, false); @@ -1016,13 +1039,85 @@ bool Tween::interpolate_callback(Object *p_object data.active = true; data.type = INTER_CALLBACK; data.finish = false; + data.call_deferred = false; data.elapsed = 0; data.id = p_object->get_instance_ID(); data.key = p_callback; data.times_in_sec = p_times_in_sec; data.delay = 0; - data.arg = p_arg; + + int args=0; + if (p_arg5.get_type()!=Variant::NIL) + args=5; + else if (p_arg4.get_type()!=Variant::NIL) + args=4; + else if (p_arg3.get_type()!=Variant::NIL) + args=3; + else if (p_arg2.get_type()!=Variant::NIL) + args=2; + else if (p_arg1.get_type()!=Variant::NIL) + args=1; + else + args=0; + + data.args = args; + data.arg[0] = p_arg1; + data.arg[1] = p_arg2; + data.arg[2] = p_arg3; + data.arg[3] = p_arg4; + data.arg[4] = p_arg5; + + pending_update ++; + interpolates.push_back(data); + pending_update --; + return true; +} + +bool Tween::interpolate_deferred_callback(Object *p_object + , real_t p_times_in_sec + , String p_callback + , VARIANT_ARG_DECLARE +) { + + ERR_FAIL_COND_V(pending_update != 0, false); + ERR_FAIL_COND_V(p_object == NULL, false); + ERR_FAIL_COND_V(p_times_in_sec < 0, false); + + ERR_FAIL_COND_V(!p_object->has_method(p_callback), false); + + InterpolateData data; + data.active = true; + data.type = INTER_CALLBACK; + data.finish = false; + data.call_deferred = true; + data.elapsed = 0; + + data.id = p_object->get_instance_ID(); + data.key = p_callback; + data.times_in_sec = p_times_in_sec; + data.delay = 0; + + int args=0; + if (p_arg5.get_type()!=Variant::NIL) + args=5; + else if (p_arg4.get_type()!=Variant::NIL) + args=4; + else if (p_arg3.get_type()!=Variant::NIL) + args=3; + else if (p_arg2.get_type()!=Variant::NIL) + args=2; + else if (p_arg1.get_type()!=Variant::NIL) + args=1; + else + args=0; + + data.args = args; + data.arg[0] = p_arg1; + data.arg[1] = p_arg2; + data.arg[2] = p_arg3; + data.arg[3] = p_arg4; + data.arg[4] = p_arg5; pending_update ++; interpolates.push_back(data); diff --git a/scene/animation/tween.h b/scene/animation/tween.h index 3e23cc362a5..d34c9e6ba2e 100644 --- a/scene/animation/tween.h +++ b/scene/animation/tween.h @@ -83,6 +83,7 @@ private: bool active; InterpolateType type; bool finish; + bool call_deferred; real_t elapsed; ObjectID id; StringName key; @@ -95,7 +96,8 @@ private: TransitionType trans_type; EaseType ease_type; real_t delay; - Variant arg; + int args; + Variant arg[5]; }; String autoplay; @@ -178,10 +180,16 @@ public: , real_t p_delay = 0 ); - bool interpolate_callback(Object *p_node + bool interpolate_callback(Object *p_object , real_t p_times_in_sec , String p_callback - , Variant p_arg = Variant() + , VARIANT_ARG_DECLARE + ); + + bool interpolate_deferred_callback(Object *p_object + , real_t p_times_in_sec + , String p_callback + , VARIANT_ARG_DECLARE ); bool follow_property(Object *p_node From 75c3090e9f1160aceaf7ff2caedc250a4b22ec38 Mon Sep 17 00:00:00 2001 From: yg2f Date: Sat, 10 Jan 2015 15:50:27 +0100 Subject: [PATCH 02/30] fix_environment_ressource_cubemap_support this fix goes hands in hands with #1170. Cubemap ressources can be loaded and created into an Environment ressource. --- scene/resources/environment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index df18e4f0f5c..3c4bc3ac754 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -111,7 +111,7 @@ void Environment::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::INT,"background/mode",PROPERTY_HINT_ENUM,"Keep,Default Color,Color,Texture,Cubemap,Texture RGBE,Cubemap RGBE"),_SCS("set_background"),_SCS("get_background")); ADD_PROPERTYI( PropertyInfo(Variant::COLOR,"background/color"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_COLOR); ADD_PROPERTYI( PropertyInfo(Variant::OBJECT,"background/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_TEXTURE); - ADD_PROPERTYI( PropertyInfo(Variant::OBJECT,"background/cubemap",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_CUBEMAP); + ADD_PROPERTYI( PropertyInfo(Variant::OBJECT,"background/cubemap",PROPERTY_HINT_RESOURCE_TYPE,"CubeMap"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_CUBEMAP); ADD_PROPERTYI( PropertyInfo(Variant::REAL,"background/energy",PROPERTY_HINT_RANGE,"0,128,0.01"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_ENERGY); ADD_PROPERTYI( PropertyInfo(Variant::REAL,"background/scale",PROPERTY_HINT_RANGE,"0.001,16,0.001"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_SCALE); ADD_PROPERTYI( PropertyInfo(Variant::REAL,"background/glow",PROPERTY_HINT_RANGE,"0.00,8,0.01"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_GLOW); From 9bbc3f0c94bfdbaceb507e4ccaf388950d84d8f0 Mon Sep 17 00:00:00 2001 From: Dana Olson Date: Sun, 11 Jan 2015 00:08:32 -0500 Subject: [PATCH 03/30] fix naming of duplicated nodes, closes #1161, adds separator character preferences --- scene/register_scene_types.cpp | 2 +- tools/editor/editor_settings.cpp | 4 ++++ tools/editor/scene_tree_dock.cpp | 24 +++++++++++++++++++----- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index cf499791189..631a52dea07 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -272,7 +272,7 @@ void register_scene_types() { ObjectTypeDB::register_type(); // ObjectTypeDB::register_type(); - ObjectTypeDB::add_compatibility_type("EmptyControl","control"); + ObjectTypeDB::add_compatibility_type("EmptyControl","Control"); ObjectTypeDB::register_type