This documentation is for the free plugin Py4D in CINEMA 4D R11.5 and not for the C4DSDK of Python in CINEMA 4D R12. For R12, please visit PluginCafe.com
To get an overview of the class members, check out the diagram.
Returns the active document of Cinema 4D.
| Return type: | BaseDocument |
|---|---|
| Returns: | The actve document. |
Get the first document in the list of documents within CINEMA.
| Return type: | BaseDocument |
|---|---|
| Returns: | The first document. |
Set doc as active document in Cinema 4D.
| Parameter: | doc (The document) – BaseDocument |
|---|
Saves the document to a file.
| Parameters: |
|
|---|
Renders the document to a bitmap. You need to initialize the image with the size of the renderdata:
import c4d
from c4d import bitmaps, documents
doc = documents.GetActiveDocument()
rd = doc.GetActiveRenderData().GetData()
bmp = bitmaps.BaseBitmap()
#init the bitmap with the result size
bmp.Init(width=320, height=240, depth=32)
documents.RenderDocument(doc, rd, bmp)
bitmaps.ShowBitmap(bmp)
| Parameters: |
|
|---|
Merges two documents
| Parameters: |
|
|---|---|
| Return type: | bool |
| Returns: | True if successful, otherwise False. |
Loads a file into Cinema 4D (file, image, ...) and opens it.
| Parameter: | fn (str) – The file to load. |
|---|
Remove and free all resources of this document.
| Parameter: | doc (BaseDocument) – The document to free. |
|---|
Insert a document into the CINEMA editor list of documents.
| Parameter: | doc (BaseDocument) – The document to insert. |
|---|
Loads a document file and returns it at BaseDocument.
| Parameters: |
|
|---|---|
| Return type: | |
| Returns: | Returns the document on success, otherwise None. |
Close all open documents in Cinema 4D.
| Return type: | bool |
|---|---|
| Returns: | Returns True on success, otherwise False |
Controls the time of the active document doc. Unlike BaseDocument.SetTime() it handles running animation.
| Parameters: |
|
|---|---|
| Return type: | bool |
| Returns: | Returns True on success, otherwise False |
Controls the animation in the active document doc.
| Parameters: |
|
|---|---|
| Return type: | bool |
| Returns: | Returns True on success, otherwise False |
Used for modeling tools with GUI input. Applies the last modeling undo so that new values of the modeling tool can be applied. An example from the edge cut code:
from c4d import documents, plugins
class TestTool(plugins.ToolData):
def MouseInput(self, doc, data, draw, win, msg):
if not doc: return False
if doc.GetMode() == documents.Medges:
active = p.GetActiveObjects(True)
#undo step before
InteractiveModeling_Restart(doc)
self.ModelingEdgeCut(active, utils.MODIFY_EDGESELECTION, data, doc, win, msg, True)
c4d.EventAdd()
return True
| Parameter: | doc (BaseDocument) – The document. |
|---|---|
| Return type: | bool |
| Returns: | True if successful, otherwise False. |
A helper routine to copy the objects t_objects of document doc to a new document (returned). All materials associated are also copied over and the links are corrected.
| Parameters: |
|
|---|---|
| Return type: | |
| Returns: | The document containing the isolated objects. |
Stop the external renderer.
| Return type: | bool |
|---|---|
| Returns: | True if the rendering has been canceled, otherwise False. |