improve copy_subgraph: quick_add_new_child()
This commit is contained in:
parent
aa3c504345
commit
bd86134b15
|
|
@ -2499,7 +2499,7 @@ r_copy_children(const PandaNode *from, PandaNode::InstanceMap &inst_map,
|
|||
inst_map[source_child] = dest_child;
|
||||
}
|
||||
|
||||
add_child(dest_child, sort, current_thread);
|
||||
quick_add_new_child(dest_child, sort, current_thread);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2646,6 +2646,30 @@ stage_replace_child(PandaNode *orig_child, PandaNode *new_child,
|
|||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PandaNode::quick_add_new_child
|
||||
// Access: Private
|
||||
// Description: Similar to add_child(), but performs fewer checks.
|
||||
// The purpose of this method is to add a child node
|
||||
// that was newly constructed, to a parent node that was
|
||||
// newly constructed, so we know we have to make fewer
|
||||
// sanity checks. This is a private method; do not call
|
||||
// it directly.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PandaNode::
|
||||
quick_add_new_child(PandaNode *child_node, int sort, Thread *current_thread) {
|
||||
// Apply this operation to the current stage as well as to all
|
||||
// upstream stages.
|
||||
OPEN_ITERATE_CURRENT_AND_UPSTREAM(_cycler, current_thread) {
|
||||
CDStageWriter cdata(_cycler, pipeline_stage, current_thread);
|
||||
CDStageWriter cdata_child(child_node->_cycler, pipeline_stage, current_thread);
|
||||
|
||||
cdata->modify_down()->insert(DownConnection(child_node, sort));
|
||||
cdata_child->modify_up()->insert(UpConnection(this));
|
||||
}
|
||||
CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PandaNode::report_cycle
|
||||
// Access: Private
|
||||
|
|
|
|||
|
|
@ -307,6 +307,9 @@ private:
|
|||
bool stage_replace_child(PandaNode *orig_child, PandaNode *new_child,
|
||||
int pipeline_stage, Thread *current_thread);
|
||||
|
||||
void quick_add_new_child(PandaNode *child_node, int sort,
|
||||
Thread *current_thread);
|
||||
|
||||
INLINE bool verify_child_no_cycles(PandaNode *child_node);
|
||||
void report_cycle(PandaNode *node);
|
||||
bool find_node_above(PandaNode *node);
|
||||
|
|
|
|||
Loading…
Reference in New Issue