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) {
|
if (bar != string::npos) {
|
||||||
node_name = path.substr(bar + 1);
|
node_name = path.substr(bar + 1);
|
||||||
if (node_name == subroot) {
|
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);
|
status = dag_iterator.reset(dag_iterator.item(),MItDag::kDepthFirst, MFn::kTransform);
|
||||||
if (!status) {
|
if (!status) {
|
||||||
status.perror("MItDag constructor");
|
status.perror("MItDag constructor");
|
||||||
@ -604,8 +610,10 @@ r_build_node(const string &path) {
|
|||||||
// create each node along the path.
|
// create each node along the path.
|
||||||
MayaNodeDesc *node_desc;
|
MayaNodeDesc *node_desc;
|
||||||
|
|
||||||
|
//mayaegg_cat.info() << "path: " << path << endl;
|
||||||
if (path.empty()) {
|
if (path.empty()) {
|
||||||
// This is the top.
|
// This is the top.
|
||||||
|
//mayaegg_cat.info() << "found empty path: " << path << endl;
|
||||||
node_desc = _root;
|
node_desc = _root;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -618,16 +626,21 @@ r_build_node(const string &path) {
|
|||||||
parent_path = path.substr(0, bar);
|
parent_path = path.substr(0, bar);
|
||||||
//mayaegg_cat.info() << "parent_path: " << parent_path << endl;
|
//mayaegg_cat.info() << "parent_path: " << parent_path << endl;
|
||||||
local_name = path.substr(bar + 1);
|
local_name = path.substr(bar + 1);
|
||||||
|
if (local_name == _subroot_parent_name) {
|
||||||
|
node_desc = _root;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
local_name = path;
|
local_name = path;
|
||||||
}
|
}
|
||||||
//mayaegg_cat.info() << "local_name: " << local_name << endl;
|
//mayaegg_cat.info() << "local_name: " << local_name << endl;
|
||||||
|
|
||||||
MayaNodeDesc *parent_node_desc = r_build_node(parent_path);
|
if (node_desc != _root) {
|
||||||
if (parent_node_desc == (MayaNodeDesc *)NULL)
|
MayaNodeDesc *parent_node_desc = r_build_node(parent_path);
|
||||||
mayaegg_cat.info() << "empty parent: " << local_name << endl;
|
if (parent_node_desc == (MayaNodeDesc *)NULL)
|
||||||
node_desc = new MayaNodeDesc(this, parent_node_desc, local_name);
|
mayaegg_cat.info() << "empty parent: " << local_name << endl;
|
||||||
_nodes.push_back(node_desc);
|
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));
|
_nodes_by_path.insert(NodesByPath::value_type(path, node_desc));
|
||||||
|
@ -71,6 +71,7 @@ public:
|
|||||||
void reset_sliders();
|
void reset_sliders();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
string _subroot_parent_name;
|
||||||
PT(MayaNodeDesc) _root;
|
PT(MayaNodeDesc) _root;
|
||||||
float _fps;
|
float _fps;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user