mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Merge pull request #86743 from Mickeon/autocompletion-optimise-object
Optimise comparisons for Object's `get_argument_options`
This commit is contained in:
@@ -1545,8 +1545,9 @@ void AnimationNodeBlendTree::_node_changed(const StringName &p_node) {
|
||||
emit_signal(SNAME("node_changed"), p_node);
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
void AnimationNodeBlendTree::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
|
||||
String pf = p_function;
|
||||
const String pf = p_function;
|
||||
bool add_node_options = false;
|
||||
if (p_idx == 0) {
|
||||
add_node_options = (pf == "get_node" || pf == "has_node" || pf == "rename_node" || pf == "remove_node" || pf == "set_node_position" || pf == "get_node_position" || pf == "connect_node" || pf == "disconnect_node");
|
||||
@@ -1554,12 +1555,13 @@ void AnimationNodeBlendTree::get_argument_options(const StringName &p_function,
|
||||
add_node_options = (pf == "connect_node" || pf == "disconnect_node");
|
||||
}
|
||||
if (add_node_options) {
|
||||
for (KeyValue<StringName, Node> E : nodes) {
|
||||
for (const KeyValue<StringName, Node> &E : nodes) {
|
||||
r_options->push_back(String(E.key).quote());
|
||||
}
|
||||
}
|
||||
AnimationRootNode::get_argument_options(p_function, p_idx, r_options);
|
||||
}
|
||||
#endif
|
||||
|
||||
void AnimationNodeBlendTree::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("add_node", "name", "node", "position"), &AnimationNodeBlendTree::add_node, DEFVAL(Vector2()));
|
||||
|
||||
@@ -454,7 +454,9 @@ public:
|
||||
|
||||
virtual Ref<AnimationNode> get_child_by_name(const StringName &p_name) const override;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override;
|
||||
#endif
|
||||
|
||||
AnimationNodeBlendTree();
|
||||
~AnimationNodeBlendTree();
|
||||
|
||||
@@ -2152,8 +2152,9 @@ void AnimationMixer::_notification(int p_what) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
void AnimationMixer::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
|
||||
String pf = p_function;
|
||||
const String pf = p_function;
|
||||
if (p_idx == 0) {
|
||||
if (pf == "get_animation" || pf == "has_animation") {
|
||||
List<StringName> al;
|
||||
@@ -2171,6 +2172,7 @@ void AnimationMixer::get_argument_options(const StringName &p_function, int p_id
|
||||
}
|
||||
Node::get_argument_options(p_function, p_idx, r_options);
|
||||
}
|
||||
#endif
|
||||
|
||||
void AnimationMixer::_bind_methods() {
|
||||
/* ---- Data lists ---- */
|
||||
|
||||
@@ -326,7 +326,10 @@ protected:
|
||||
void _get_property_list(List<PropertyInfo> *p_list) const;
|
||||
void _notification(int p_what);
|
||||
virtual void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override;
|
||||
#endif
|
||||
|
||||
static void _bind_methods();
|
||||
void _node_removed(Node *p_node);
|
||||
|
||||
@@ -1793,8 +1793,9 @@ void AnimationNodeStateMachine::_animation_node_removed(const ObjectID &p_oid, c
|
||||
AnimationRootNode::_animation_node_removed(p_oid, p_node);
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
void AnimationNodeStateMachine::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
|
||||
String pf = p_function;
|
||||
const String pf = p_function;
|
||||
bool add_state_options = false;
|
||||
if (p_idx == 0) {
|
||||
add_state_options = (pf == "get_node" || pf == "has_node" || pf == "rename_node" || pf == "remove_node" || pf == "replace_node" || pf == "set_node_position" || pf == "get_node_position");
|
||||
@@ -1802,12 +1803,13 @@ void AnimationNodeStateMachine::get_argument_options(const StringName &p_functio
|
||||
add_state_options = (pf == "has_transition" || pf == "add_transition" || pf == "remove_transition");
|
||||
}
|
||||
if (add_state_options) {
|
||||
for (KeyValue<StringName, State> E : states) {
|
||||
for (const KeyValue<StringName, State> &E : states) {
|
||||
r_options->push_back(String(E.key).quote());
|
||||
}
|
||||
}
|
||||
AnimationRootNode::get_argument_options(p_function, p_idx, r_options);
|
||||
}
|
||||
#endif
|
||||
|
||||
void AnimationNodeStateMachine::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("add_node", "name", "node", "position"), &AnimationNodeStateMachine::add_node, DEFVAL(Vector2()));
|
||||
|
||||
@@ -215,7 +215,9 @@ public:
|
||||
|
||||
virtual Ref<AnimationNode> get_child_by_name(const StringName &p_name) const override;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override;
|
||||
#endif
|
||||
|
||||
AnimationNodeStateMachine();
|
||||
};
|
||||
|
||||
@@ -725,9 +725,10 @@ double AnimationPlayer::get_blend_time(const StringName &p_animation1, const Str
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
void AnimationPlayer::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
|
||||
String pf = p_function;
|
||||
if (p_idx == 0 && (p_function == "play" || p_function == "play_backwards" || p_function == "has_animation" || p_function == "queue")) {
|
||||
const String pf = p_function;
|
||||
if (p_idx == 0 && (pf == "play" || pf == "play_backwards" || pf == "has_animation" || pf == "queue")) {
|
||||
List<StringName> al;
|
||||
get_animation_list(&al);
|
||||
for (const StringName &name : al) {
|
||||
@@ -736,6 +737,7 @@ void AnimationPlayer::get_argument_options(const StringName &p_function, int p_i
|
||||
}
|
||||
AnimationMixer::get_argument_options(p_function, p_idx, r_options);
|
||||
}
|
||||
#endif
|
||||
|
||||
void AnimationPlayer::_animation_removed(const StringName &p_name, const StringName &p_library) {
|
||||
AnimationMixer::_animation_removed(p_name, p_library);
|
||||
|
||||
@@ -188,7 +188,9 @@ public:
|
||||
double get_current_animation_position() const;
|
||||
double get_current_animation_length() const;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override;
|
||||
#endif
|
||||
|
||||
virtual void advance(double p_time) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user