panda3d.direct.DCField

from panda3d.direct import DCField
class DCField

Bases: DCPackerInterface, DCKeywordList

A single field of a Distributed Class, either atomic or molecular.

Inheritance diagram

Inheritance diagram of DCField

getNumber() → int

Returns a unique index number associated with this field. This is defined implicitly when the .dc file(s) are read.

getClass() → DCClass

Returns the DCClass pointer for the class that contains this field.

Return type

DCClass

asField() → DCField
Return type

DCField

asField() → DCField
Return type

DCField

asAtomicField() → DCAtomicField

Returns the same field pointer converted to an atomic field pointer, if this is in fact an atomic field; otherwise, returns NULL.

Return type

DCAtomicField

asAtomicField() → DCAtomicField

Returns the same field pointer converted to an atomic field pointer, if this is in fact an atomic field; otherwise, returns NULL.

Return type

DCAtomicField

asMolecularField() → DCMolecularField

Returns the same field pointer converted to a molecular field pointer, if this is in fact a molecular field; otherwise, returns NULL.

Return type

DCMolecularField

asMolecularField() → DCMolecularField

Returns the same field pointer converted to a molecular field pointer, if this is in fact a molecular field; otherwise, returns NULL.

Return type

DCMolecularField

asParameter() → DCParameter
Return type

DCParameter

asParameter() → DCParameter
Return type

DCParameter

formatData(packed_data: bytes, show_field_names: bool) → str

Given a blob that represents the packed data for this field, returns a string formatting it for human consumption. Returns empty string if there is an error.

parseString(formatted_string: str) → bytes

Given a human-formatted string (for instance, as returned by formatData(), above) that represents the value of this field, parse the string and return the corresponding packed data. Returns empty string if there is an error.

validateRanges(packed_data: bytes) → bool

Verifies that all of the packed values in the field data are within the specified ranges and that there are no extra bytes on the end of the record. Returns true if all fields are valid, false otherwise.

hasDefaultValue() → bool

Returns true if a default value has been explicitly established for this field, false otherwise.

getDefaultValue() → bytes

Returns the default value for this field. If a default value has been explicitly set (e.g. hasDefaultValue() returns true), returns that value; otherwise, returns an implicit default for the field.

isBogusField() → bool

Returns true if the field has been flagged as a bogus field. This is set for fields that are generated by the parser as placeholder for missing fields, as when reading a partial file; it should not occur in a normal valid dc file.

isRequired() → bool

Returns true if the “required” flag is set for this field, false otherwise.

isBroadcast() → bool

Returns true if the “broadcast” flag is set for this field, false otherwise.

isRam() → bool

Returns true if the “ram” flag is set for this field, false otherwise.

isDb() → bool

Returns true if the “db” flag is set for this field, false otherwise.

isClsend() → bool

Returns true if the “clsend” flag is set for this field, false otherwise.

isClrecv() → bool

Returns true if the “clrecv” flag is set for this field, false otherwise.

isOwnsend() → bool

Returns true if the “ownsend” flag is set for this field, false otherwise.

isOwnrecv() → bool

Returns true if the “ownrecv” flag is set for this field, false otherwise.

isAirecv() → bool

Returns true if the “airecv” flag is set for this field, false otherwise.

output(out: ostream) → None

Write a string representation of this instance to <out>.

write(out: ostream, indent_level: int) → None

Write a string representation of this instance to <out>.

packArgs(packer: DCPacker, sequence: object) → bool

Packs the Python arguments from the indicated tuple into the packer. Returns true on success, false on failure.

It is assumed that the packer is currently positioned on this field.

unpackArgs(packer: DCPacker) → object

Unpacks the values from the packer, beginning at the current point in the unpack_buffer, into a Python tuple and returns the tuple.

It is assumed that the packer is currently positioned on this field.

receiveUpdate(packer: DCPacker, distobj: object) → None

Extracts the update message out of the datagram and applies it to the indicated object by calling the appropriate method.

clientFormatUpdate(do_id: DOID_TYPE, args: object) → Datagram

Generates a datagram containing the message necessary to send an update for the indicated distributed object from the client.

Return type

Datagram

aiFormatUpdate(do_id: DOID_TYPE, to_id: CHANNEL_TYPE, from_id: CHANNEL_TYPE, args: object) → Datagram

Generates a datagram containing the message necessary to send an update for the indicated distributed object from the AI.

Return type

Datagram

aiFormatUpdateMsgType(do_id: DOID_TYPE, to_id: CHANNEL_TYPE, from_id: CHANNEL_TYPE, msg_type: int, args: object) → Datagram

Generates a datagram containing the message necessary to send an update, with the msg type, for the indicated distributed object from the AI.

Return type

Datagram