allow relative operations between unrelated NodePaths

This commit is contained in:
David Rose 2002-03-18 17:32:35 +00:00
parent f24e3a090f
commit b35309a45e

View File

@ -2483,11 +2483,12 @@ r_get_net_state(qpNodePathComponent *comp) const {
// Access: Private // Access: Private
// Description: Recursively determines the net state changes to the // Description: Recursively determines the net state changes to the
// indicated component node from the nth node above it. // indicated component node from the nth node above it.
// If n exceeds the length of the path, this returns the
// net transform from the root of the graph.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
CPT(RenderState) qpNodePath:: CPT(RenderState) qpNodePath::
r_get_partial_state(qpNodePathComponent *comp, int n) const { r_get_partial_state(qpNodePathComponent *comp, int n) const {
nassertr(comp != (qpNodePathComponent *)NULL, RenderState::make_empty()); if (n == 0 || comp == (qpNodePathComponent *)NULL) {
if (n == 0) {
return RenderState::make_empty(); return RenderState::make_empty();
} else { } else {
CPT(RenderState) state = comp->get_node()->get_state(); CPT(RenderState) state = comp->get_node()->get_state();
@ -2516,11 +2517,12 @@ r_get_net_transform(qpNodePathComponent *comp) const {
// Access: Private // Access: Private
// Description: Recursively determines the net transform to the // Description: Recursively determines the net transform to the
// indicated component node from the nth node above it. // indicated component node from the nth node above it.
// If n exceeds the length of the path, this returns the
// net transform from the root of the graph.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
CPT(TransformState) qpNodePath:: CPT(TransformState) qpNodePath::
r_get_partial_transform(qpNodePathComponent *comp, int n) const { r_get_partial_transform(qpNodePathComponent *comp, int n) const {
nassertr(comp != (qpNodePathComponent *)NULL, TransformState::make_identity()); if (n == 0 || comp == (qpNodePathComponent *)NULL) {
if (n == 0) {
return TransformState::make_identity(); return TransformState::make_identity();
} else { } else {
CPT(TransformState) transform = comp->get_node()->get_transform(); CPT(TransformState) transform = comp->get_node()->get_transform();