Panda3D
Classes | Public Member Functions | Static Public Member Functions | Friends

NodePathComponent Class Reference

This is one component of a NodePath. More...

#include "nodePathComponent.h"

Inheritance diagram for NodePathComponent:
ReferenceCount MemoryBase

List of all members.

Classes

class  CData

Public Member Functions

bool fix_length (int pipeline_stage, Thread *current_thread)
 Checks that the length indicated by the component is one more than the length of its predecessor.
int get_key () const
 Returns an index number that is guaranteed to be unique for this particular NodePathComponent, and not to be reused for the lifetime of the application (barring integer overflow).
int get_length (int pipeline_stage, Thread *current_thread) const
 Returns the length of the path to this node.
NodePathComponentget_next (int pipeline_stage, Thread *current_thread) const
 Returns the next component in the path.
PandaNodeget_node () const
 Returns the node referenced by this component.
bool has_key () const
 Returns true if the key for this component has already been generated, false otherwise.
bool is_top_node (int pipeline_stage, Thread *current_thread) const
 Returns true if this component represents the top node in the path.
void output (ostream &out) const
 The recursive implementation of NodePath::output(), this writes the names of each node component in order from beginning to end, by first walking to the end of the linked list and then outputting from there.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()

Friends

class PandaNode

Detailed Description

This is one component of a NodePath.

These are stored on each PandaNode, as many as one for each of the possible instances of the node (but they only exist when they are requested, to minimize memory waste). A NodePath represents a singly-linked list of these from an arbitrary component in the graph to the root.

This whole NodePath system is used to disambiguate instances in the scene graph, and the NodePathComponents are stored in the nodes themselves to allow the nodes to keep these up to date as the scene graph is manipulated.

Definition at line 48 of file nodePathComponent.h.


Member Function Documentation

bool NodePathComponent::fix_length ( int  pipeline_stage,
Thread current_thread 
)

Checks that the length indicated by the component is one more than the length of its predecessor.

If this is broken, fixes it and returns true indicating the component has been changed; otherwise, returns false.

Definition at line 132 of file nodePathComponent.cxx.

int NodePathComponent::get_key ( ) const

Returns an index number that is guaranteed to be unique for this particular NodePathComponent, and not to be reused for the lifetime of the application (barring integer overflow).

Definition at line 74 of file nodePathComponent.cxx.

int NodePathComponent::get_length ( int  pipeline_stage,
Thread current_thread 
) const

Returns the length of the path to this node.

Definition at line 105 of file nodePathComponent.cxx.

Referenced by NodePath::verify_complete().

NodePathComponent * NodePathComponent::get_next ( int  pipeline_stage,
Thread current_thread 
) const
PandaNode * NodePathComponent::get_node ( ) const [inline]

Returns the node referenced by this component.

Definition at line 76 of file nodePathComponent.I.

Referenced by NodePath::get_hidden_ancestor(), NodePath::get_node(), NodePath::get_stashed_ancestor(), output(), and NodePath::verify_complete().

bool NodePathComponent::has_key ( ) const [inline]

Returns true if the key for this component has already been generated, false otherwise.

Even if this returns false, calling get_key() will still return a valid key; that will simply cause the key to be generated on-the-fly.

Definition at line 91 of file nodePathComponent.I.

bool NodePathComponent::is_top_node ( int  pipeline_stage,
Thread current_thread 
) const

Returns true if this component represents the top node in the path.

Definition at line 94 of file nodePathComponent.cxx.

Referenced by NodePath::get_top().

void NodePathComponent::output ( ostream &  out) const

The recursive implementation of NodePath::output(), this writes the names of each node component in order from beginning to end, by first walking to the end of the linked list and then outputting from there.

Definition at line 158 of file nodePathComponent.cxx.

References PandaNode::find_parent(), PandaNode::find_stashed(), Thread::get_current_thread(), get_next(), get_node(), Thread::get_pipeline_stage(), Namable::has_name(), and output().

Referenced by output().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations