instanceUnderNode

This commit is contained in:
David Rose 2002-03-20 16:30:12 +00:00
parent 9e8307ca53
commit ddd3f7048b
2 changed files with 18 additions and 5 deletions

View File

@ -267,6 +267,22 @@ instance_to(const qpNodePath &other, int sort) const {
return new_instance; return new_instance;
} }
////////////////////////////////////////////////////////////////////
// Function: qpNodePath::instance_under_node
// Access: Published
// Description: Behaves like instance_to(), but implicitly creates a
// new node to instance the geometry under, and returns a
// NodePath to that new node. This allows the
// programmer to set a unique state and/or transform on
// this instance.
////////////////////////////////////////////////////////////////////
qpNodePath qpNodePath::
instance_under_node(const qpNodePath &other, const string &name, int sort) const {
qpNodePath new_node = other.attach_new_node(name, sort);
instance_to(new_node);
return new_node;
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: qpNodePath::copy_to // Function: qpNodePath::copy_to
// Access: Published // Access: Published
@ -275,11 +291,6 @@ instance_to(const qpNodePath &other, int sort) const {
// descendents, which is then parented to the indicated // descendents, which is then parented to the indicated
// node. A qpNodePath to the newly created copy is // node. A qpNodePath to the newly created copy is
// returned. // returned.
//
// Certain kinds of nodes (like a Camera, for instance,
// whose pointer value is important) may not be copied;
// if one of these is encountered, the node will be
// instanced, instead of actually copied.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
qpNodePath qpNodePath:: qpNodePath qpNodePath::
copy_to(const qpNodePath &other, int sort) const { copy_to(const qpNodePath &other, int sort) const {

View File

@ -196,6 +196,8 @@ PUBLISHED:
void reparent_to(const qpNodePath &other, int sort = 0); void reparent_to(const qpNodePath &other, int sort = 0);
void wrt_reparent_to(const qpNodePath &other, int sort = 0); void wrt_reparent_to(const qpNodePath &other, int sort = 0);
qpNodePath instance_to(const qpNodePath &other, int sort = 0) const; qpNodePath instance_to(const qpNodePath &other, int sort = 0) const;
qpNodePath instance_under_node(const qpNodePath &other, const string &name,
int sort = 0) const;
qpNodePath copy_to(const qpNodePath &other, int sort = 0) const; qpNodePath copy_to(const qpNodePath &other, int sort = 0) const;
qpNodePath attach_new_node(PandaNode *node, int sort = 0) const; qpNodePath attach_new_node(PandaNode *node, int sort = 0) const;
INLINE qpNodePath attach_new_node(const string &name, int sort = 0) const; INLINE qpNodePath attach_new_node(const string &name, int sort = 0) const;