Replace find with contains/has where applicable
* Replaces `find(...) != -1` with `contains` for `String` * Replaces `find(...) == -1` with `!contains` for `String` * Replaces `find(...) != -1` with `has` for containers * Replaces `find(...) == -1` with `!has` for containers
This commit is contained in:
@ -57,9 +57,9 @@ bool SkinTool::_capture_nodes_in_skin(const Vector<Ref<GLTFNode>> &nodes, Ref<GL
|
||||
|
||||
if (found_joint) {
|
||||
// Mark it if we happen to find another skins joint...
|
||||
if (current_node->joint && p_skin->joints.find(p_node_index) < 0) {
|
||||
if (current_node->joint && !p_skin->joints.has(p_node_index)) {
|
||||
p_skin->joints.push_back(p_node_index);
|
||||
} else if (p_skin->non_joints.find(p_node_index) < 0) {
|
||||
} else if (!p_skin->non_joints.has(p_node_index)) {
|
||||
p_skin->non_joints.push_back(p_node_index);
|
||||
}
|
||||
}
|
||||
@ -79,7 +79,7 @@ void SkinTool::_capture_nodes_for_multirooted_skin(Vector<Ref<GLTFNode>> &r_node
|
||||
const SkinNodeIndex parent = r_nodes[node_index]->parent;
|
||||
disjoint_set.insert(node_index);
|
||||
|
||||
if (p_skin->joints.find(parent) >= 0) {
|
||||
if (p_skin->joints.has(parent)) {
|
||||
disjoint_set.create_union(parent, node_index);
|
||||
}
|
||||
}
|
||||
@ -109,9 +109,9 @@ void SkinTool::_capture_nodes_for_multirooted_skin(Vector<Ref<GLTFNode>> &r_node
|
||||
while (r_nodes[current_node]->height > maxHeight) {
|
||||
SkinNodeIndex parent = r_nodes[current_node]->parent;
|
||||
|
||||
if (r_nodes[parent]->joint && p_skin->joints.find(parent) < 0) {
|
||||
if (r_nodes[parent]->joint && !p_skin->joints.has(parent)) {
|
||||
p_skin->joints.push_back(parent);
|
||||
} else if (p_skin->non_joints.find(parent) < 0) {
|
||||
} else if (!p_skin->non_joints.has(parent)) {
|
||||
p_skin->non_joints.push_back(parent);
|
||||
}
|
||||
|
||||
@ -138,9 +138,9 @@ void SkinTool::_capture_nodes_for_multirooted_skin(Vector<Ref<GLTFNode>> &r_node
|
||||
const SkinNodeIndex current_node = roots[i];
|
||||
const SkinNodeIndex parent = r_nodes[current_node]->parent;
|
||||
|
||||
if (r_nodes[parent]->joint && p_skin->joints.find(parent) < 0) {
|
||||
if (r_nodes[parent]->joint && !p_skin->joints.has(parent)) {
|
||||
p_skin->joints.push_back(parent);
|
||||
} else if (p_skin->non_joints.find(parent) < 0) {
|
||||
} else if (!p_skin->non_joints.has(parent)) {
|
||||
p_skin->non_joints.push_back(parent);
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ Error SkinTool::_expand_skin(Vector<Ref<GLTFNode>> &r_nodes, Ref<GLTFSkin> p_ski
|
||||
const SkinNodeIndex parent = r_nodes[node_index]->parent;
|
||||
disjoint_set.insert(node_index);
|
||||
|
||||
if (all_skin_nodes.find(parent) >= 0) {
|
||||
if (all_skin_nodes.has(parent)) {
|
||||
disjoint_set.create_union(parent, node_index);
|
||||
}
|
||||
}
|
||||
@ -216,7 +216,7 @@ Error SkinTool::_verify_skin(Vector<Ref<GLTFNode>> &r_nodes, Ref<GLTFSkin> p_ski
|
||||
const SkinNodeIndex parent = r_nodes[node_index]->parent;
|
||||
disjoint_set.insert(node_index);
|
||||
|
||||
if (all_skin_nodes.find(parent) >= 0) {
|
||||
if (all_skin_nodes.has(parent)) {
|
||||
disjoint_set.create_union(parent, node_index);
|
||||
}
|
||||
}
|
||||
@ -365,7 +365,7 @@ Error SkinTool::_determine_skeletons(
|
||||
for (int j = 0; j < groups.size() && i != j; ++j) {
|
||||
const Vector<SkinNodeIndex> &group = groups[j];
|
||||
|
||||
if (group.find(node_i_parent) >= 0) {
|
||||
if (group.has(node_i_parent)) {
|
||||
const SkinNodeIndex node_j = highest_group_members[j];
|
||||
skeleton_sets.create_union(node_i, node_j);
|
||||
}
|
||||
@ -393,7 +393,7 @@ Error SkinTool::_determine_skeletons(
|
||||
// If any of the the skeletons nodes exist in a skin, that skin now maps to the skeleton
|
||||
for (int i = 0; i < skeleton_nodes.size(); ++i) {
|
||||
SkinNodeIndex skel_node_i = skeleton_nodes[i];
|
||||
if (skin->joints.find(skel_node_i) >= 0 || skin->non_joints.find(skel_node_i) >= 0) {
|
||||
if (skin->joints.has(skel_node_i) || skin->non_joints.has(skel_node_i)) {
|
||||
skin->skeleton = skel_i;
|
||||
continue;
|
||||
}
|
||||
@ -454,7 +454,7 @@ Error SkinTool::_reparent_non_joint_skeleton_subtrees(
|
||||
subtree_set.insert(node_i);
|
||||
|
||||
const SkinNodeIndex parent_i = nodes[node_i]->parent;
|
||||
if (parent_i >= 0 && p_non_joints.find(parent_i) >= 0 && !nodes[parent_i]->joint) {
|
||||
if (parent_i >= 0 && p_non_joints.has(parent_i) && !nodes[parent_i]->joint) {
|
||||
subtree_set.create_union(parent_i, node_i);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user