Panda3D
Public Member Functions | Static Public Member Functions

InternalName Class Reference

Encodes a string name in a hash table, mapping it to a pointer. More...

Inheritance diagram for InternalName:
TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

List of all members.

Public Member Functions

InternalName append (string basename)
 Constructs a new InternalName based on this name, with the indicated string following it.
bool encodeToBamStream (basic_stringchar data)
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
string encodeToBamStream ()
 Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string.
bool encodeToBamStream (basic_stringchar data, BamWriter writer)
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
int findAncestor (string basename)
 Returns the index of the ancestor with the indicated basename, or -1 if no ancestor has that basename.
InternalName const getAncestor (int n)
 Returns the ancestor with the indicated index number.
UpdateSeq getBamModified ()
 Returns the current bam_modified counter.
string getBasename ()
 Return the name represented by just this particular InternalName object, ignoring its parents names.
string getName ()
 Returns the complete name represented by the InternalName and all of its parents.
string getNetBasename (int n)
 Returns the basename of this name prefixed by the indicated number of ancestors.
InternalName getParent ()
 Return the parent of this InternalName.
int getRefCount ()
 Returns the current reference count.
InternalName const getTop ()
 Returns the oldest ancestor in the InternalName's chain, not counting the root.
TypeHandle getType ()
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly.
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type.
 markBamModified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.
 output (ostream out)
PyObject reduce (PyObject self)
 This special Python method is implement to provide support for the pickle module.
PyObject reducePersist (PyObject self, PyObject pickler)
 This special Python method is implement to provide support for the pickle module.
 ref ()
 Explicitly increments the reference count.
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus.
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
bool unref ()
 Explicitly decrements the reference count.

Static Public Member Functions

static TypedWritableReferenceCount decodeFromBamStream (string data, BamReader reader)
 Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.
static TypedWritableReferenceCount decodeFromBamStream (string data)
 Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.
static InternalName getAspectRatio ()
 Returns the standard InternalName "aspect_ratio".
static InternalName getBinormal ()
 Returns the standard InternalName "binormal".
static InternalName getBinormalName (string name)
 Returns the InternalName "binormal.name", where name is the supplied string.
static InternalName getCamera ()
 Returns the standard InternalName "camera".
static TypeHandle getClassType ()
static InternalName getColor ()
 Returns the standard InternalName "color".
static InternalName getError ()
 Returns the standard InternalName "error".
static InternalName getIndex ()
 Returns the standard InternalName "index".
static InternalName getModel ()
 Returns the standard InternalName "model".
static InternalName getMorph (InternalName column, string slider)
 Returns an InternalName derived from the given base column name and the given slider name, which is the column header for the offset vector that should be applied to the base column name when the named morph slider is engaged.
static InternalName getNormal ()
 Returns the standard InternalName "normal".
static InternalName getRoot ()
 Returns the standard root InternalName.
static InternalName getRotate ()
 Returns the standard InternalName "rotate".
static InternalName getSize ()
 Returns the standard InternalName "size".
static InternalName getTangent ()
 Returns the standard InternalName "tangent".
static InternalName getTangentName (string name)
 Returns the InternalName "tangent.name", where name is the supplied string.
static InternalName getTexcoord ()
 Returns the standard InternalName "texcoord".
static InternalName getTexcoordName (string name)
 Returns the InternalName "texcoord.name", where name is the supplied string.
static InternalName getTransformBlend ()
 Returns the standard InternalName "transform_blend".
static InternalName getTransformIndex ()
 Returns the standard InternalName "transform_index".
static InternalName getTransformWeight ()
 Returns the standard InternalName "transform_weight".
static InternalName getVertex ()
 Returns the standard InternalName "vertex".
static InternalName getView ()
 Returns the standard InternalName "view".
static InternalName getWorld ()
 Returns the standard InternalName "world".
static InternalName make (string name, int index)
 Make using a string and an integer.
static InternalName make (string name)
 The public interface for constructing an InternalName pointer.

Detailed Description

Encodes a string name in a hash table, mapping it to a pointer.

This is used to tokenify names so they may be used efficiently in low-level Panda structures, for instance to differentiate the multiple sets of texture coordinates that might be stored on a Geom.

InternalNames are hierarchical, with the '.' used by convention as a separator character. You can construct a single InternalName as a composition of one or more other names, or by giving it a source string directly.


Member Function Documentation

InternalName append ( string  basename)

Constructs a new InternalName based on this name, with the indicated string following it.

This is a cheaper way to construct a hierarchical name than InternalName.make(parent->get_name() + ".basename").

static TypedWritableReferenceCount decodeFromBamStream ( string  data,
BamReader  reader 
) [static, inherited]

Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.

Returns NULL on error.

This method is intended to replace decode_raw_from_bam_stream() when you know the stream in question returns an object of type TypedWritableReferenceCount, allowing for easier reference count management. Note that the caller is still responsible for maintaining the reference count on the return value.

static TypedWritableReferenceCount decodeFromBamStream ( string  data) [static, inherited]

Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.

Returns NULL on error.

This method is intended to replace decode_raw_from_bam_stream() when you know the stream in question returns an object of type TypedWritableReferenceCount, allowing for easier reference count management. Note that the caller is still responsible for maintaining the reference count on the return value.

string encodeToBamStream ( ) [inherited]

Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string.

Returns empty string on failure.

This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.

bool encodeToBamStream ( basic_stringchar  data,
BamWriter  writer 
) [inherited]

Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.

Returns true on success, false on failure.

This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.

bool encodeToBamStream ( basic_stringchar  data) [inherited]

Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.

Returns true on success, false on failure.

This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.

int findAncestor ( string  basename)

Returns the index of the ancestor with the indicated basename, or -1 if no ancestor has that basename.

Returns 0 if this name has the basename.

This index value may be passed to get_ancestor() or get_net_basename() to retrieve more information about the indicated name.

InternalName const getAncestor ( int  n)

Returns the ancestor with the indicated index number.

0 is this name itself, 1 is the name's parent, 2 is the parent's parent, and so on. If there are not enough ancestors, returns the root InternalName.

static InternalName getAspectRatio ( ) [static]

Returns the standard InternalName "aspect_ratio".

This is the column header for the floating-point aspect ratio value, which is used to define non-square points. This number is the ratio x / y, where y is the point size (above).

UpdateSeq getBamModified ( ) [inherited]

Returns the current bam_modified counter.

This counter is normally incremented automatically whenever the object is modified.

string getBasename ( )

Return the name represented by just this particular InternalName object, ignoring its parents names.

This is everything after the rightmost dot.

static InternalName getBinormal ( ) [static]

Returns the standard InternalName "binormal".

This is the column header for the tangent vector associated with each vertex, which is a unit vector usually perpendicular to both the normal and the tangent, and in the direction of the V texture coordinate change. It is used for deriving bump maps.

static InternalName getBinormalName ( string  name) [static]

Returns the InternalName "binormal.name", where name is the supplied string.

This is the column header for the binormal associated with the named texture coordinate set.

static InternalName getCamera ( ) [static]

Returns the standard InternalName "camera".

This is used as a keyword in the shader subsystem.

static TypeHandle getClassType ( ) [static]

Reimplemented from TypedWritableReferenceCount.

static InternalName getColor ( ) [static]

Returns the standard InternalName "color".

This is the column header for the 4-component color value for each vertex.

static InternalName getError ( ) [static]

Returns the standard InternalName "error".

static InternalName getIndex ( ) [static]

Returns the standard InternalName "index".

This is the column header for the integer vertex index. It is not used in the vertex data itself, but is used in the GeomPrimitive structure to index into the vertex data.

static InternalName getModel ( ) [static]

Returns the standard InternalName "model".

This is used as a keyword in the shader subsystem.

static InternalName getMorph ( InternalName  column,
string  slider 
) [static]

Returns an InternalName derived from the given base column name and the given slider name, which is the column header for the offset vector that should be applied to the base column name when the named morph slider is engaged.

Each morph slider requires a set of n morph columns, one for each base column it applies to.

string getName ( )

Returns the complete name represented by the InternalName and all of its parents.

string getNetBasename ( int  n)

Returns the basename of this name prefixed by the indicated number of ancestors.

0 is this name's basename, 1 is parent.basename, 2 is grandparent.parent.basename, and so on.

static InternalName getNormal ( ) [static]

Returns the standard InternalName "normal".

This is the column header for the 3-d lighting normal for each vertex.

InternalName getParent ( )

Return the parent of this InternalName.

All names have a parent, except the root name.

int getRefCount ( ) [inherited]

Returns the current reference count.

static InternalName getRoot ( ) [static]

Returns the standard root InternalName.

This is the root of all other InternalNames. It has no name itself, and it is the only InternalName with no parent.

static InternalName getRotate ( ) [static]

Returns the standard InternalName "rotate".

This is the column header for the floating-point rotate value, which represents a number of degrees counter-clockwise to rotate each point or point sprite.

static InternalName getSize ( ) [static]

Returns the standard InternalName "size".

This is the column header for the floating-point size value, which overrides the thickness parameter of the RenderModeAttrib on a per-vertex (e.g. per-point) basis.

static InternalName getTangent ( ) [static]

Returns the standard InternalName "tangent".

This is the column header for the tangent vector associated with each vertex, which is a unit vector usually perpendicular to the normal and in the direction of the U texture coordinate change. It is used for deriving bump maps.

static InternalName getTangentName ( string  name) [static]

Returns the InternalName "tangent.name", where name is the supplied string.

This is the column header for the tangent associated with the named texture coordinate set.

static InternalName getTexcoord ( ) [static]

Returns the standard InternalName "texcoord".

This is the column header for the default texture coordinate set for each vertex. It is also used for identifying the default texture coordinate set in a TextureStage.

static InternalName getTexcoordName ( string  name) [static]

Returns the InternalName "texcoord.name", where name is the supplied string.

This is the column header for the named texture coordinate set for each vertex. It is also used for identifying the named texture coordinate set in a TextureStage.

InternalName const getTop ( )

Returns the oldest ancestor in the InternalName's chain, not counting the root.

This will be the first name in the string, e.g. "texcoord.foo.bar" will return the InternalName "texcoord".

static InternalName getTransformBlend ( ) [static]

Returns the standard InternalName "transform_blend".

This is the column header for the integer transform_blend index, which is used to define vertex animation on the CPU by indexing to a particular vertex weighting from the TransformBlendTable.

static InternalName getTransformIndex ( ) [static]

Returns the standard InternalName "transform_index".

This is the column header for the n-component transform_index value, which is used in conjuntion with "transform_weight" to define vertex animation on the graphics card. The transform_index value specifies the nth transform, by lookup in the TransformTable. The transform_index column may be omitted, in which case the nth transform is the nth entry in the table.

static InternalName getTransformWeight ( ) [static]

Returns the standard InternalName "transform_weight".

This is the column header for the n-component transform_weight value, which is used in conjuntion with "transform_index" to define vertex animation on the graphics card. The transform_weight value specifies the weight of the nth transform. By convention, there are 1 fewer weight values than transforms, since the weights are assumed to sum to 1 (and the last value is therefore implicit).

TypeHandle getType ( ) [inherited]

Reimplemented in AnimChannelBase.

int getTypeIndex ( ) [inherited]

Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

This is equivalent to get_type().get_index().

static InternalName getVertex ( ) [static]

Returns the standard InternalName "vertex".

This is the column header for the 3-d or 4-d vertex position information for each vertex.

static InternalName getView ( ) [static]

Returns the standard InternalName "view".

This is used as a keyword in the shader subsystem.

static InternalName getWorld ( ) [static]

Returns the standard InternalName "world".

This is used as a keyword in the shader subsystem.

bool isExactType ( TypeHandle  handle) [inherited]

Returns true if the current object is the indicated type exactly.

bool isOfType ( TypeHandle  handle) [inherited]

Returns true if the current object is or derives from the indicated type.

static InternalName make ( string  name,
int  index 
) [static]

Make using a string and an integer.

Concatenates the two.

static InternalName make ( string  name) [static]

The public interface for constructing an InternalName pointer.

This will return a new InternalName representing the indicated name, if this is the first time the particular name has been requested; if the name is already in use, it will return the existing pointer.

If the string contains the '.' character, the string will be divided at the dots and the so-defined hierarchy of names will be registered. This is handled transparently.

markBamModified ( ) [inherited]

Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.

This should normally not need to be called by user code; it should be called internally when the object has been changed in a way that legitimately requires its retransmission to any connected clients.

output ( ostream  out)
PyObject reduce ( PyObject  self) [inherited]

This special Python method is implement to provide support for the pickle module.

This hooks into the native pickle and cPickle modules, but it cannot properly handle self-referential BAM objects.

PyObject reducePersist ( PyObject  self,
PyObject  pickler 
) [inherited]

This special Python method is implement to provide support for the pickle module.

This is similar to __reduce__, but it provides additional support for the missing persistent-state object needed to properly support self-referential BAM objects written to the pickle stream. This hooks into the pickle and cPickle modules implemented in direct/src/stdpy.

ref ( ) [inherited]

Explicitly increments the reference count.

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

bool testRefCountIntegrity ( ) [inherited]

Does some easy checks to make sure that the reference count isn't completely bogus.

Returns true if ok, false otherwise.

Reimplemented in NodeReferenceCount, CachedTypedWritableReferenceCount, and NodeCachedReferenceCount.

bool testRefCountNonzero ( ) [inherited]

Does some easy checks to make sure that the reference count isn't zero, or completely bogus.

Returns true if ok, false otherwise.

bool unref ( ) [inherited]

Explicitly decrements the reference count.

Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete().

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is true if the new reference count is nonzero, false if it is zero.

Reimplemented in GeomVertexArrayFormat, and GeomVertexFormat.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties