From b085c40edfac45ec1c8b866c789f6e9bab7e5e08 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 4 Jan 2017 01:16:14 -0300 Subject: -Conversion of most properties to a simpler syntax, easier to use by script -Modified help to display properties GDScript can still not make use of them, though. --- scene/animation/animation_player.cpp | 15 ++++++++------- scene/animation/animation_tree_player.cpp | 3 ++- scene/animation/tween.cpp | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'scene/animation') diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 03f8b2d5bc..97efb26753 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -465,7 +465,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData* p_anim,float p ERR_PRINTS("Position key at time "+rtos(p_time)+" in Animation Track '"+String(pa->owner->path)+"' not of type Vector2()"); } #endif - static_cast(pa->object)->set_pos(value); + static_cast(pa->object)->set_position(value); } break; case SP_NODE2D_ROT: { #ifdef DEBUG_ENABLED @@ -474,7 +474,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData* p_anim,float p } #endif - static_cast(pa->object)->set_rot(Math::deg2rad(value)); + static_cast(pa->object)->set_rotation(Math::deg2rad(value)); } break; case SP_NODE2D_SCALE: { #ifdef DEBUG_ENABLED @@ -679,7 +679,7 @@ void AnimationPlayer::_animation_update_transforms() { ERR_PRINTS("Position key at time "+rtos(playback.current.pos)+" in Animation '"+get_current_animation()+"', Track '"+String(pa->owner->path)+"' not of type Vector2()"); } #endif - static_cast(pa->object)->set_pos(pa->value_accum); + static_cast(pa->object)->set_position(pa->value_accum); } break; case SP_NODE2D_ROT: { #ifdef DEBUG_ENABLED @@ -688,7 +688,7 @@ void AnimationPlayer::_animation_update_transforms() { } #endif - static_cast(pa->object)->set_rot(Math::deg2rad(pa->value_accum)); + static_cast(pa->object)->set_rotation(Math::deg2rad(pa->value_accum)); } break; case SP_NODE2D_SCALE: { #ifdef DEBUG_ENABLED @@ -1348,9 +1348,10 @@ void AnimationPlayer::_bind_methods() { ClassDB::bind_method(_MD("advance","delta"),&AnimationPlayer::advance); - ADD_PROPERTY( PropertyInfo( Variant::INT, "playback/process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), _SCS("set_animation_process_mode"), _SCS("get_animation_process_mode")); - ADD_PROPERTY( PropertyInfo( Variant::REAL, "playback/default_blend_time", PROPERTY_HINT_RANGE, "0,4096,0.01"), _SCS("set_default_blend_time"), _SCS("get_default_blend_time")); - ADD_PROPERTY( PropertyInfo( Variant::NODE_PATH, "root/root"), _SCS("set_root"), _SCS("get_root")); + ADD_GROUP("Playback","playback_"); + ADD_PROPERTY( PropertyInfo( Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), _SCS("set_animation_process_mode"), _SCS("get_animation_process_mode")); + ADD_PROPERTY( PropertyInfo( Variant::REAL, "playback_default_blend_time", PROPERTY_HINT_RANGE, "0,4096,0.01"), _SCS("set_default_blend_time"), _SCS("get_default_blend_time")); + ADD_PROPERTY( PropertyInfo( Variant::NODE_PATH, "root_node"), _SCS("set_root"), _SCS("get_root")); ADD_SIGNAL( MethodInfo("finished") ); ADD_SIGNAL( MethodInfo("animation_changed", PropertyInfo(Variant::STRING,"old_name"), PropertyInfo(Variant::STRING,"new_name")) ); diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index 6f32e6781f..2ed8e52615 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -1926,7 +1926,8 @@ void AnimationTreePlayer::_bind_methods() { ClassDB::bind_method(_MD("recompute_caches"),&AnimationTreePlayer::recompute_caches); - ADD_PROPERTY(PropertyInfo(Variant::INT, "playback/process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), _SCS("set_animation_process_mode"), _SCS("get_animation_process_mode")); + ADD_GROUP("Playback","playback_"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), _SCS("set_animation_process_mode"), _SCS("get_animation_process_mode")); BIND_CONSTANT( NODE_OUTPUT ); BIND_CONSTANT( NODE_ANIMATION ); diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 83575276d5..02fef7ec29 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -225,7 +225,7 @@ void Tween::_bind_methods() { ADD_SIGNAL( MethodInfo("tween_step", PropertyInfo( Variant::OBJECT,"object"), PropertyInfo( Variant::STRING,"key"), PropertyInfo( Variant::REAL,"elapsed"), PropertyInfo( Variant::OBJECT,"value")) ); ADD_SIGNAL( MethodInfo("tween_complete", PropertyInfo( Variant::OBJECT,"object"), PropertyInfo( Variant::STRING,"key")) ); - ADD_PROPERTY( PropertyInfo( Variant::INT, "playback/process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), _SCS("set_tween_process_mode"), _SCS("get_tween_process_mode")); + ADD_PROPERTY( PropertyInfo( Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), _SCS("set_tween_process_mode"), _SCS("get_tween_process_mode")); BIND_CONSTANT(TWEEN_PROCESS_FIXED); BIND_CONSTANT(TWEEN_PROCESS_IDLE); -- cgit v1.2.3