This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import c4d | |
""" | |
This script demonstrates two generator functions, AllChildren() and AllParents(). | |
To test this, use any scene with a reasonably complex hierarchy, select any one object and run the script. | |
""" | |
def AllChildren(startOp, maxDepth = 0, currentRecursionDepth = 1): | |
"""Yield all objects that are part of startOp's child hierarchy. | |
Set maxDepth to a value != 0 to restrict recursion to a certain depth. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect | |
def PrintCallstack(printArgs = False): | |
"""Print the callstack, starting from top calling function | |
down to the function that called PrintCallstack(). | |
To also print out all arguments passed to the calling function, | |
including the arguments' values, set printArgs to True. | |
Careful, this can get quite overwhelming. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Name-US:Restart Cinema 4D | |
Description-US:Restart Cinema 4D (hold SHIFT to skip the question) | |
Name-DE:Cinema 4D neustarten | |
Description-DE:Cinema 4D neustarten (SHIFT halten, um die Abfrage zu überspringen) | |
""" | |
import c4d | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Name-US:Close all documents | |
Description-US:Close all open documents, even the unsaved ones (hold SHIFT to skip the question) | |
Name-DE:Alle Dokumente schließen | |
Description-DE:Schließt alle Dokumente, auch die ungespeicherten (SHIFT halten um die Abfrage zu unterdrücken) | |
""" | |
import c4d | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# | |
# Example calls: | |
# | |
# python getc4dresid.py --module lbwss --plugin osurfacespread | |
# Get some free resource IDs from plugin "Osurfacespread" in module "lbwss" | |
# | |
# python getc4dresid.py --module cinea4dsdk --plugin oatom --limit 1 | |
# Get the next free resource ID from plugin "Oatom" in module "cinema4dsdk" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Name-US:Multi Instance test | |
Description-US:Create a bunch of colored object clones using the R20 MultiInstance feature | |
""" | |
import c4d, time | |
COUNT_X = 200 | |
COUNT_Z = 300 | |
MARGIN = 150.0 | |
NOISE_HEIGHT = 1200.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import c4d | |
def calc_polygon_area(polygon, points, mtx = c4d.Matrix()): | |
"""Calculate the area of a polygon | |
@param polygon A CPolygon object | |
@param points List of c4d.Vector with point positions | |
@param mtx Optional globla matrix of the polygon object, to take object scale into account | |
@return The area of the polygon | |
""" | |
# Calculate area for the triangular polygon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Name-US:Save as template | |
Description-US:Saves the current document as template (hold CTRL to remove existing template, hold SHIFT to skip question dialog) | |
Name-DE:Als Template speichern | |
Description-DE:Speichert das aktuelle Dokument als Template (CTRL gedrückt halten um vorhandenes Template zu entfernen, SHIFT gedrückt halten um Abfrage zu überspringen) | |
""" | |
import os | |
import c4d | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Name-US:Create random scene... | |
Description-US:Create random scene (hold SHIFT to use previous settings, hold CTRL to forget previous settings) | |
""" | |
import sys | |
import time | |
import json | |
import random | |
import c4d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Name-US:Export document as JSON | |
Description-US:Export document to JSON | |
""" | |
import c4d | |
import json | |
def serialize_data(data): | |
"""Serialize special data types |