Compare commits
No commits in common. "f1a42302a6c19d174177b1580af0b534ac28ce60" and "0554691e46bdd10962ef7d6f7098004697f20a15" have entirely different histories.
f1a42302a6
...
0554691e46
@ -16,7 +16,7 @@ void BLTAnimationNode::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_input_names"), &BLTAnimationNode::get_input_names_as_typed_array);
|
||||
ClassDB::bind_method(D_METHOD("get_input_count"), &BLTAnimationNode::get_input_count);
|
||||
ClassDB::bind_method(D_METHOD("get_input_index", "node"), &BLTAnimationNode::get_input_index);
|
||||
ClassDB::bind_method(D_METHOD("get_input_index"), &BLTAnimationNode::get_input_index);
|
||||
}
|
||||
|
||||
void BLTAnimationNode::get_parameter_list(List<PropertyInfo> *r_list) const {
|
||||
@ -545,10 +545,6 @@ bool BLTAnimationNodeBlendTree::BLTBlendTreeGraph::remove_node(const Ref<BLTAnim
|
||||
}
|
||||
}
|
||||
|
||||
if (connection_info.parent_node_index > removed_node_index) {
|
||||
connection_info.parent_node_index--;
|
||||
}
|
||||
|
||||
// Map connected subtrees
|
||||
HashSet<int> old_indices = connection_info.input_subtree_node_indices;
|
||||
connection_info.input_subtree_node_indices.clear();
|
||||
@ -567,14 +563,13 @@ bool BLTAnimationNodeBlendTree::BLTBlendTreeGraph::remove_node(const Ref<BLTAnim
|
||||
void BLTAnimationNodeBlendTree::BLTBlendTreeGraph::sort_nodes_and_references() {
|
||||
LocalVector<int> sorted_node_indices = get_sorted_node_indices();
|
||||
|
||||
LocalVector<Ref<BLTAnimationNode>> sorted_nodes;
|
||||
Vector<Ref<BLTAnimationNode>> sorted_nodes;
|
||||
LocalVector<NodeConnectionInfo> old_node_connection_info = node_connection_info;
|
||||
for (unsigned int i = 0; i < sorted_node_indices.size(); i++) {
|
||||
int node_index = sorted_node_indices[i];
|
||||
sorted_nodes.push_back(nodes[node_index]);
|
||||
node_connection_info[i] = old_node_connection_info[node_index];
|
||||
}
|
||||
|
||||
nodes = sorted_nodes;
|
||||
|
||||
for (NodeConnectionInfo &connection_info : node_connection_info) {
|
||||
@ -591,20 +586,6 @@ LocalVector<int> BLTAnimationNodeBlendTree::BLTBlendTreeGraph::get_sorted_node_i
|
||||
sort_nodes_recursive(0, result);
|
||||
result.reverse();
|
||||
|
||||
HashSet<int> connected_node_indices;
|
||||
for (int node_index : result) {
|
||||
connected_node_indices.insert(node_index);
|
||||
}
|
||||
|
||||
// Ensure that nodes that are not reachable from the root node are still added to
|
||||
// the sorted nodes indices.
|
||||
for (Ref<BLTAnimationNode> &node : nodes) {
|
||||
int node_index = find_node_index(node);
|
||||
if (!connected_node_indices.has(node_index)) {
|
||||
result.push_back(node_index);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -198,7 +198,7 @@ func _on_blend_tree_graph_edit_connection_request(from_node: StringName, from_po
|
||||
|
||||
func _on_blend_tree_graph_edit_end_node_move() -> void:
|
||||
for graph_node:GraphNode in selected_nodes.keys():
|
||||
graph_node_to_blend_tree_node[graph_node].position = graph_node.position_offset
|
||||
graph_node_to_blend_tree_node[graph_node].position = graph_node.position
|
||||
|
||||
|
||||
func _on_blend_tree_graph_edit_begin_node_move() -> void:
|
||||
|
||||
@ -537,14 +537,7 @@ TEST_CASE_FIXTURE(BlendTreeFixture, "[SceneTree][Blendalot][BlendTreeGraph][Chan
|
||||
CHECK(blend_tree_graph.node_connection_info[0].input_subtree_node_indices.size() == 6);
|
||||
CHECK(blend_tree_graph.node_connection_info[blend2_node_a_index_pre_remove].input_subtree_node_indices.size() == 5);
|
||||
|
||||
SUBCASE("Removing the output node does nothing") {
|
||||
int num_nodes = blend_tree_graph.nodes.size();
|
||||
int num_connections = blend_tree_graph.connections.size();
|
||||
CHECK(blend_tree_graph.remove_node(blend_tree_graph.get_output_node()) == false);
|
||||
CHECK(blend_tree_graph.connections.size() == num_connections);
|
||||
}
|
||||
|
||||
SUBCASE("Remove a node with no children") {
|
||||
SUBCASE("Remove animation_sampler_node_a") {
|
||||
blend_tree_graph.remove_node(animation_sampler_node_a);
|
||||
|
||||
for (const BLTBlendTreeConnection &connection : blend_tree_graph.connections) {
|
||||
@ -568,12 +561,8 @@ TEST_CASE_FIXTURE(BlendTreeFixture, "[SceneTree][Blendalot][BlendTreeGraph][Chan
|
||||
CHECK(blend_tree_graph.node_connection_info[blend2_node_b_index_post_remove].input_subtree_node_indices.has(animation_sampler_node_b_index_post_remove));
|
||||
}
|
||||
|
||||
SUBCASE("Remove a node with parent and children") {
|
||||
int num_nodes = blend_tree_graph.nodes.size();
|
||||
SUBCASE("Remove blend2_node_a") {
|
||||
blend_tree_graph.remove_node(blend2_node_a);
|
||||
blend_tree_graph.sort_nodes_and_references();
|
||||
|
||||
CHECK(blend_tree_graph.nodes.size() == num_nodes - 1);
|
||||
|
||||
for (const BLTBlendTreeConnection &connection : blend_tree_graph.connections) {
|
||||
bool is_connection_with_removed_node = connection.source_node == blend2_node_a || connection.target_node == blend2_node_a;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user