diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/animation/animation_tree.cpp | 34 | ||||
-rw-r--r-- | scene/gui/scroll_bar.cpp | 2 |
2 files changed, 36 insertions, 0 deletions
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index eb00f91bb3..03c3c78768 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -37,9 +37,20 @@ #include "servers/audio/audio_stream.h" void AnimationNode::get_parameter_list(List<PropertyInfo> *r_list) const { + if (get_script_instance()) { + Array parameters = get_script_instance()->call("get_parameter_list"); + for (int i = 0; i < parameters.size(); i++) { + Dictionary d = parameters[i]; + ERR_CONTINUE(d.empty()); + r_list->push_back(PropertyInfo::from_dict(d)); + } + } } Variant AnimationNode::get_parameter_default_value(const StringName &p_parameter) const { + if (get_script_instance()) { + return get_script_instance()->call("get_parameter_default_value"); + } return Variant(); } @@ -62,6 +73,18 @@ Variant AnimationNode::get_parameter(const StringName &p_name) const { } void AnimationNode::get_child_nodes(List<ChildNode> *r_child_nodes) { + + if (get_script_instance()) { + Dictionary cn = get_script_instance()->call("get_child_nodes"); + List<Variant> keys; + cn.get_key_list(&keys); + for (List<Variant>::Element *E = keys.front(); E; E = E->next()) { + ChildNode child; + child.name = E->get(); + child.node = cn[E->get()]; + r_child_nodes->push_back(child); + } + } } void AnimationNode::blend_animation(const StringName &p_animation, float p_time, float p_delta, bool p_seeked, float p_blend) { @@ -373,6 +396,9 @@ void AnimationNode::_validate_property(PropertyInfo &property) const { } Ref<AnimationNode> AnimationNode::get_child_by_name(const StringName &p_name) { + if (get_script_instance()) { + return get_script_instance()->call("get_child_by_nane"); + } return Ref<AnimationNode>(); } @@ -403,6 +429,14 @@ void AnimationNode::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter_enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_filter_enabled", "is_filter_enabled"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "filters", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_filters", "_get_filters"); + BIND_VMETHOD(MethodInfo(Variant::DICTIONARY, "get_child_nodes")); + BIND_VMETHOD(MethodInfo(Variant::ARRAY, "get_parameter_list")); + BIND_VMETHOD(MethodInfo(Variant::OBJECT, "get_child_by_name", PropertyInfo(Variant::STRING, "name"))); + { + MethodInfo mi = MethodInfo(Variant::NIL, "get_parameter_default_value", PropertyInfo(Variant::STRING, "name")); + mi.return_val.usage = PROPERTY_USAGE_NIL_IS_VARIANT; + BIND_VMETHOD(mi); + } BIND_VMETHOD(MethodInfo("process", PropertyInfo(Variant::REAL, "time"), PropertyInfo(Variant::BOOL, "seek"))); BIND_VMETHOD(MethodInfo(Variant::STRING, "get_caption")); BIND_VMETHOD(MethodInfo(Variant::STRING, "has_filter")); diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index 07380f45cc..0e68476439 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -330,6 +330,8 @@ void ScrollBar::_notification(int p_what) { if (Math::abs(vel) >= dist) { set_value(target_scroll); + scrolling = false; + set_physics_process_internal(false); } else { set_value(get_value() + vel); } |