Expose AnimationNode(StateMachine/BlendTree).get_node_list()
This commit is contained in:
parent
2d3bdcac35
commit
d193af78c5
8 changed files with 50 additions and 16 deletions
|
|
@ -1427,16 +1427,24 @@ void AnimationNodeStateMachine::_rename_transitions(const StringName &p_name, co
|
|||
updating_transitions = false;
|
||||
}
|
||||
|
||||
void AnimationNodeStateMachine::get_node_list(List<StringName> *r_nodes) const {
|
||||
List<StringName> nodes;
|
||||
LocalVector<StringName> AnimationNodeStateMachine::get_node_list() const {
|
||||
LocalVector<StringName> nodes;
|
||||
nodes.reserve(states.size());
|
||||
for (const KeyValue<StringName, State> &E : states) {
|
||||
nodes.push_back(E.key);
|
||||
}
|
||||
nodes.sort_custom<StringName::AlphCompare>();
|
||||
return nodes;
|
||||
}
|
||||
|
||||
for (const StringName &E : nodes) {
|
||||
r_nodes->push_back(E);
|
||||
TypedArray<StringName> AnimationNodeStateMachine::get_node_list_as_typed_array() const {
|
||||
TypedArray<StringName> typed_arr;
|
||||
LocalVector<StringName> vec = get_node_list();
|
||||
typed_arr.resize(vec.size());
|
||||
for (uint32_t i = 0; i < vec.size(); i++) {
|
||||
typed_arr[i] = vec[i];
|
||||
}
|
||||
return typed_arr;
|
||||
}
|
||||
|
||||
bool AnimationNodeStateMachine::has_transition(const StringName &p_from, const StringName &p_to) const {
|
||||
|
|
@ -1796,6 +1804,7 @@ void AnimationNodeStateMachine::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("rename_node", "name", "new_name"), &AnimationNodeStateMachine::rename_node);
|
||||
ClassDB::bind_method(D_METHOD("has_node", "name"), &AnimationNodeStateMachine::has_node);
|
||||
ClassDB::bind_method(D_METHOD("get_node_name", "node"), &AnimationNodeStateMachine::get_node_name);
|
||||
ClassDB::bind_method(D_METHOD("get_node_list"), &AnimationNodeStateMachine::get_node_list_as_typed_array);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_node_position", "name", "position"), &AnimationNodeStateMachine::set_node_position);
|
||||
ClassDB::bind_method(D_METHOD("get_node_position", "name"), &AnimationNodeStateMachine::get_node_position);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue