38 int hierarchy_match_flags) {
39 PartBundles::const_iterator pbi;
41 for (pbi = parts.begin(); pbi != parts.end(); ++pbi) {
43 AnimBundles::const_iterator abi;
44 for (abi = anims.begin(); abi != anims.end(); ++abi) {
46 if (chan_cat.is_info()) {
48 <<
"Attempting to bind " << *part <<
" to " << *anim <<
"\n";
52 part->bind_anim(anim, hierarchy_match_flags);
53 string name = (*abi)->get_name();
55 name = anim->get_name();
57 if (control !=
nullptr) {
58 if (controls.
find_anim(name) !=
nullptr) {
64 new_name = name +
'.' + format_string(index);
65 }
while (controls.
find_anim(new_name) !=
nullptr);
72 if (chan_cat.is_info()) {
73 if (control ==
nullptr) {
78 <<
"Bind succeeded, index "
79 << control->get_channel_index() <<
"; accessible as "
93 if (node->
is_of_type(AnimBundleNode::get_class_type())) {
96 anims[bundle->get_name()].insert(bundle);
98 }
else if (node->
is_of_type(PartBundleNode::get_class_type())) {
100 int num_bundles = bn->get_num_bundles();
101 for (
int i = 0; i < num_bundles; ++i) {
103 parts[bundle->get_name()].insert(bundle);
109 for (
int i = 0; i < num_children; i++) {
110 r_find_bundles(cr.
get_child(i), anims, parts);
124 int hierarchy_match_flags) {
130 r_find_bundles(root_node, anims, parts);
132 if (chan_cat.is_debug()) {
134 Anims::const_iterator ai;
135 for (ai = anims.begin(); ai != anims.end(); ++ai) {
136 anim_count += (int)(*ai).second.size();
139 <<
"Found " << anim_count <<
" anims:\n";
140 for (ai = anims.begin(); ai != anims.end(); ++ai) {
141 chan_cat.debug(
false)
142 <<
" " << (*ai).first;
143 if ((*ai).second.size() != 1) {
144 chan_cat.debug(
false)
145 <<
"*" << ((*ai).second.size());
148 chan_cat.debug(
false)
152 Parts::const_iterator pi;
153 for (pi = parts.begin(); pi != parts.end(); ++pi) {
154 part_count += (int)(*pi).second.size();
157 <<
"Found " << part_count <<
" parts:\n";
158 for (pi = parts.begin(); pi != parts.end(); ++pi) {
159 chan_cat.debug(
false)
160 <<
" " << (*pi).first;
161 if ((*pi).second.size() != 1) {
162 chan_cat.debug(
false)
163 <<
"*" << ((*pi).second.size());
166 chan_cat.debug(
false)
172 Anims::const_iterator ai = anims.begin();
173 Parts::const_iterator pi = parts.begin();
175 while (ai != anims.end() && pi != parts.end()) {
176 if ((*ai).first < (*pi).first) {
178 if (hierarchy_match_flags & PartGroup::HMF_ok_wrong_root_name) {
179 AnimBundles::const_iterator abi;
180 for (abi = (*ai).second.begin(); abi != (*ai).second.end(); ++abi) {
181 extra_anims.insert(*abi);
186 }
else if ((*pi).first < (*ai).first) {
188 if (hierarchy_match_flags & PartGroup::HMF_ok_wrong_root_name) {
189 PartBundles::const_iterator pbi;
190 for (pbi = (*pi).second.begin(); pbi != (*pi).second.end(); ++pbi) {
191 extra_parts.insert(*pbi);
198 bind_anims((*pi).second, (*ai).second, controls,
199 hierarchy_match_flags);
207 if (hierarchy_match_flags & PartGroup::HMF_ok_wrong_root_name) {
210 while (ai != anims.end()) {
212 if (hierarchy_match_flags & PartGroup::HMF_ok_wrong_root_name) {
213 AnimBundles::const_iterator abi;
214 for (abi = (*ai).second.begin(); abi != (*ai).second.end(); ++abi) {
215 extra_anims.insert(*abi);
221 while (pi != parts.end()) {
223 if (hierarchy_match_flags & PartGroup::HMF_ok_wrong_root_name) {
224 PartBundles::const_iterator pbi;
225 for (pbi = (*pi).second.begin(); pbi != (*pi).second.end(); ++pbi) {
226 extra_parts.insert(*pbi);
232 bind_anims(extra_parts, extra_anims, controls,
233 hierarchy_match_flags);