The base class of many other classes.
Parameters: | type (int) – The id of the object, e.g: (Ocube). See also: Descriptions in CINEMA 4D. |
---|---|
Return type: | BaseList2D |
Returns: | The new object. |
Uses a description ID as a key into the container, and stores the specified data.
See also
Parameters: |
|
---|
Uses a description ID as a key into the container, and retrieves the stored data.
See also
Parameters: | key (int, list or DescID) – The description ID. |
---|---|
Return type: | any |
Returns: | See __setitem__() |
New in version R13.016.
Returns the BaseList2D as string. Called if str() is wrapped around an instance of BaseList2D. (see __str__).
Return type: | str |
---|---|
Returns: | The string representation of BaseList2D. |
Private - Get the track root of this object. To get the tracks of an object use GetCTracks() instead.
Return type: | GeListNode |
---|---|
Returns: | Track root. |
Returns the first CTrack of an object..
Return type: | CTrack |
---|---|
Returns: | First track, or None if there are no tracks. |
Returns all CTracks of an object.
Return type: | list of type CTrack |
---|---|
Returns: | The CTrack |
Find the track for the specified description id.
Parameters: | id (DescID) – The description ID to check. |
---|---|
Return type: | CTrack |
Returns: | The track found, or None if there was no match. |
Inserts a track and automatically places it at the right place (so that Y comes after Y etc.)
Parameters: | track (CTrack) – The track to insert. |
---|
Goes up the next level, e.g. from tag to object or Xpresso node to tag, or object to document, etc.
Return type: | BaseList2D |
---|---|
Returns: | The main object of this object or None. |
Each object contains a number of flags. See GetAllBits() for the flags.
Parameters: | mask (int) – Bit mask of the flags. |
---|
Each object contains a number of flags. See GetAllBits() for the flags.
Parameters: | mask (int) – Bit mask of the flags. |
---|---|
Return type: | bool: |
Returns: | The state of the object flags denoted by mask. |
Deletes the object flags denoted by mask, i.e. sets the corresponding bit’s to 0. See GetAllBits() for the flags.
Parameters: | mask (int) – Bit mask of the flags. |
---|
Toggles the state of the object flags denoted by the mask. See GetAllBits() for the flags.
Parameters: | mask (int) – Bit mask of the flags. |
---|
Returns all of the object’s bits.
Parameters: | mask (int) – The bit | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: | int | ||||||||||||||||||||||||||||||||||||||||||||||||||
Returns: |
The flags:
|
Set the object’s bits. See GetAllBits() to see which bits you can set.
Parameters: | mask (int) – Bit mask of the flags. |
---|
Returns the original bitmap pattern.
Warning
Please, never edit the returned bitmap - read only.
An example:
icon = obj.GetIcon()
print icon["bmp"], icon["x"], icon["y"], icon["w"], icon["h"]
Return type: | dict{bmp: BaseBitmap, x: int, y: int, w: int, h: int} |
---|---|
Returns: | The image and size information like height, width and X/Y position in the icon table. |
Returns the first shader of the object.
Note
Normally you dont have to deal with this list. But if you want to create or modify shader trees via the API you need to read the following lines:
If you’re programming shader links you need to make sure that every shader is referenced only once; it is not allowed that a shader is referenced multiple times. If the referencing object is a shader the referenced shader must be a child of it, otherwise it must be inserted via InsertShader().
Example 1: A tag references a shader. The shader must be inserted into the tag using tag.InsertShader(...); Example 2: A Shader (A) references another shader (B): the shader B must be a child of the shader A.
Return type: | BaseList2D |
---|---|
Returns: | The first shader of the object, or None if there is no shader. |
Get the layer data for this object.
Parameters: |
|
---|---|
Return type: |
dict{solo: bool, view: bool, render: bool, manager: bool, locked: bool, generators: bool, expressions: bool, animation: bool, color: Vector} |
Set the layer data for this object.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False. |
Get the layer of this object.
Parameters: | doc (BaseDocument) – The document. |
---|---|
Return type: | LayerObject |
Returns: | The layer. |
Set the layer of this object.
Parameters: | layer (LayerObject) – The new layer. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False. |
Inserts a shader in the object’s shader list:
import c4d
mat = doc.GetFirstMaterial()
if mat is None: return False
shd = c4d.BaseList2D(c4d.Xbitmap)
mat[c4d.MATERIAL_COLOR_SHADER] = shd
mat.InsertShader(shd)
mat.Message(c4d.MSG_UPDATE)
mat.Update(True, True)
c4d.EventAdd()
Parameters: |
|
---|
Returns the information flags for the object. The interpretation depends on the object type.
Return type: | int |
---|---|
Returns: | The flags. This is the same as the info parameter of the registration function of the registration function of the NodeData. |
Checks if there are any active keyframe selections.
Note
This is not the same as BIT_ACTIVE, it’s the possibility to restrict autokeyframing to certain description parameters. See “Animation->Add Keyframe Selection” in the Attributes Manager.
Return type: | bool |
---|---|
Returns: | True if there is a keyframe selection, otherwise False. |
Clears the current keyframe selection.
Checks if id is included in the keyframe selection.
Parameters: | id (DescID) – The description ID to check. |
---|---|
Return type: | bool |
Returns: | True if thegiven id is selected, otherwise False. |
Sets the keyframe selection status of id to selection.
Parameters: | id (DescID) – The description ID to set. |
---|---|
Returns: | True to select the key, otherwise id is selected, otherwise False. |
Transfer goals from this object to dst. This changes all internal links that point to this object to point to dst instead.
Parameters: |
|
---|
Get a real spline representation of a primitive spline object. This can for example be used to calculate the length of the spline. If the object is a real spline it returns this. Otherwise None.
Return type: | SplineObject |
---|---|
Returns: | The created spline object or None. |
The object’s visibility depends upon its parent, if it has no visibility track this will return the parent’s visibility which is passed. The range of values are 0.0<=visibility<=1.0.
Parameters: | parent (float) – The parent objects visibility. |
---|---|
Return type: | float |
Returns: | The visibility. |
Removes a tag from the object and free its resources.
Parameters: |
|
---|
This method returns the original container of the object. The container is only alive as long as the host object is alive. If you access the container even the host object is dead, Python will raise a ReferenceError. The elements of the container are type protected when you set touch them via __setitem__(), that means, you can just overwrite an element with a new object when its of the same type. When you want to overwrite the element with another type, you need to delete the previous element with del(bc[ELEMENT_ID]), or use the manual BaseContainer.Set* methods.
Raises: |
|
---|---|
Return type: | |
Returns: |
The original container reference. |
New in version R13.016.
Returns a copy of the object’s container.
Return type: | BaseContainer |
---|---|
Returns: | The container reference. |
New in version R13.016.
Sets the object container. By default the contents of bc are merged with the existing container. You can control this behaviour with add.
Note
Don’t forget to send a C4DAtom.Message() if you change any settings.
Parameters: |
|
---|---|
Return type: | |
Returns: |
The container reference. |
Returns the palette number of the object (0-7).
Return type: | int |
---|---|
Returns: | The number |
Set the palette number of the object (0-7).
Raises IndexError: | |
---|---|
If the param c is not between 0-7. | |
Parameters: | c (int) – The number |
The name of the object category, for example Phong, Spline, Bone, etc.
Return type: | str |
---|---|
Returns: | The type name. |
Set the name of the object.
Parameters: | name (str) – Set the name. |
---|
Returns the name of the object.
Return type: | str |
---|---|
Returns: | The name. |
Private.
Scale the object.
Parameters: | scale (float) – The size. |
---|
Triggers the edit action for this object. For most types this brings up the node in the attributes manager. Some still show a separate dialog.
Return type: | bool |
---|---|
Returns: | False if an error occurred, otherwise True. |
Returns the bubble help of the object.
Return type: | str |
---|---|
Returns: | The bubble help. |
Returns the document where the object is stored in.
Return type: | BaseDocument |
---|---|
Returns: | The document if the object is stored in a document, otherwise returns None. |
Allocates a new user data and return its ID. Use c4d.GetCustomDatatypeDefault() to create a default container for user data:
import c4d
def AddLongDataType(obj):
if obj is None: return
bc = c4d.GetCustomDatatypeDefault(c4d.DTYPE_LONG) # Create default container
bc[c4d.DESC_NAME] = "Test" # Rename the entry
element = obj.AddUserData(bc) # Add userdata container
obj[element] = 30 # Assign a value
c4d.EventAdd() # Update
Para bc: | Settings of the new user data. |
---|---|
Return type: | DescID |
Returns: | The description ID. |
Removes a userdata element. There are several ways how to delete a user data.
This function supports several types to identify a user data entry:
obj.RemoveUserData(1)#removes the first user data
obj.RemoveUserData([c4d.ID_USERDATA, 1])
obj.RemoveUserData(c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA), c4d.DescLevel(1)))
Parameters: | id (int, list or DescID) – The id of the userdata. |
---|---|
Return type: | bool |
Returns: | True if the userdata is removed, otherwise False. |
Browse through the user data container sequence:
for id, bc in op.GetUserDataContainer():
print id, bc
Return type: | list[(DescID, BaseContainer),] |
---|---|
Returns: | A list of tuples. |
Insert a new user data with the specified ID.
Parameters: |
|
---|---|
Return type: |
True if the user data was inserted, otherwise False. |
Checks if a highlight handle has been hit, by returning the ID previously returned by ObjectData.DetectHandle(). The handle can then be drawn in the highlight mode.
Parameters: | bd (BaseDraw) – A base draw. |
---|---|
Return type: | int |
Returns: | The Handle ID. |