mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
fixed a subroot bug about traversing siblings
This commit is contained in:
parent
ef8c0570c8
commit
b3f4f2588d
@ -99,7 +99,13 @@ build_hierarchy(const string &subroot) {
|
||||
if (bar != string::npos) {
|
||||
node_name = path.substr(bar + 1);
|
||||
if (node_name == subroot) {
|
||||
mayaegg_cat.info() << "node name: " << node_name << endl;
|
||||
// mark its parent node name
|
||||
//mayaegg_cat.info() << path.substr(0,bar) << endl;
|
||||
size_t new_bar = path.substr(0,bar).rfind("|");
|
||||
if (new_bar != string::npos) {
|
||||
_subroot_parent_name = path.substr(new_bar+1,bar-(new_bar+1));
|
||||
mayaegg_cat.info() << "subroot parent name: " << _subroot_parent_name << endl;
|
||||
}
|
||||
status = dag_iterator.reset(dag_iterator.item(),MItDag::kDepthFirst, MFn::kTransform);
|
||||
if (!status) {
|
||||
status.perror("MItDag constructor");
|
||||
@ -604,8 +610,10 @@ r_build_node(const string &path) {
|
||||
// create each node along the path.
|
||||
MayaNodeDesc *node_desc;
|
||||
|
||||
//mayaegg_cat.info() << "path: " << path << endl;
|
||||
if (path.empty()) {
|
||||
// This is the top.
|
||||
//mayaegg_cat.info() << "found empty path: " << path << endl;
|
||||
node_desc = _root;
|
||||
|
||||
} else {
|
||||
@ -618,17 +626,22 @@ r_build_node(const string &path) {
|
||||
parent_path = path.substr(0, bar);
|
||||
//mayaegg_cat.info() << "parent_path: " << parent_path << endl;
|
||||
local_name = path.substr(bar + 1);
|
||||
if (local_name == _subroot_parent_name) {
|
||||
node_desc = _root;
|
||||
}
|
||||
} else {
|
||||
local_name = path;
|
||||
}
|
||||
//mayaegg_cat.info() << "local_name: " << local_name << endl;
|
||||
|
||||
if (node_desc != _root) {
|
||||
MayaNodeDesc *parent_node_desc = r_build_node(parent_path);
|
||||
if (parent_node_desc == (MayaNodeDesc *)NULL)
|
||||
mayaegg_cat.info() << "empty parent: " << local_name << endl;
|
||||
node_desc = new MayaNodeDesc(this, parent_node_desc, local_name);
|
||||
_nodes.push_back(node_desc);
|
||||
}
|
||||
}
|
||||
|
||||
_nodes_by_path.insert(NodesByPath::value_type(path, node_desc));
|
||||
return node_desc;
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
void reset_sliders();
|
||||
|
||||
public:
|
||||
string _subroot_parent_name;
|
||||
PT(MayaNodeDesc) _root;
|
||||
float _fps;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user