View restartcinema.pyp
import os, c4d
class RestartMeCommand(c4d.plugins.CommandData):
def Execute(self, doc):
return c4d.RestartMe()
if __name__ == "__main__":
try:
path, file = os.path.split(__file__)
bmp = c4d.bitmaps.BaseBitmap()
View printcallstack.py
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.
"""
View c4d-hierarchy-iterating-generators.py
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.
View c4d-listtagsonobject.py
import c4d
"""
This script lists all tags attached to the selected object, by name and plugin ID.
It also shows if a tag is visible or invisible.
"""
def ListTagsOnObject(op):
resultStr = 'Tags on object "' + op.GetName() + '": '
View c4d-messagetostring.cpp
#include "c4d_general.h"
#include "c4d_plugin.h"
#include "ge_sys_math.h"
#include "c4d_string.h"
#include "ge_prepass.h"
#include "c4d_baselist.h"
#include "c4d_commanddata.h"
#include "c4d_falloffdata.h"
#include "c4d_messageplugin.h"
#include "c4d_baseeffectordata.h"
View c4d-hidedescription.cpp
/// Show or hide an element from a node's description
///
/// param[in] node The node whose description we're changing
/// param[in] descr The description we're changing
/// param[in] MyDescID The ID of the element
/// param[in] show Pass true to show, or false to hide
/// return False if an error occurred, otherwise true
static Bool ShowDescription(GeListNode *node, Description *descr, Int32 descID, Bool show)
{
AutoAlloc<AtomArray> ar;
View c4d-matrix-target.cpp
/// Align a matrix to a target, using an up vector
///
/// @param[in] pos The position we're targeting from
/// @param[in] targetPos The position we're targeting at
/// @param[in] upVector The up vector, to avoid gimbal lock. Defaults to +Y
/// @return A matrix with an offset of 'pos', targeting 'targetPos' with its Z axis.
static inline Matrix Target(const Vector &pos, const Vector &targetPos, const Vector &upVector = Vector(0.0, 1.0, 0.0))
{
Matrix m(DC); // New matrix. Don't call default constructor, as we're filling the values now anyway.
m.off = pos; // Set position
View c4d-restartcommand.cpp
#include "c4d.h"
class RestartCommand : public CommandData
{
virtual Bool Execute(BaseDocument *doc)
{
if (GeOutString("Really restart?", GEMB_ICONQUESTION|GEMB_YESNO) == GEMB_R_YES)
RestartApplication();
return true;
}
View c4d-get-vertex-normal.cpp
/// Return the normal vector for a vertex of a polygon object.
/// The normal is computed as an average of the normals of all polygons that are neighbors to the specified vertex.
///
/// @param[in] op The PolygonObject
/// @param[in] neighbor Pointer to a Neighbor object. Must already be initialized, caller owns the pointed object.
/// @param[in] pointIndex The index of the vertex we want the normal of
/// @return The normal of the point in local object space
static Vector GetVertexNormal(PolygonObject *op, Neighbor *neighbor, Int32 pointIndex)
{
// Variables
View c4d-dynamicdescription.cpp
#include "c4d-dynamicdescription.h"
Bool IsSingleID(const DescID &id, const DescID *singleid)
{
return !singleid || id.IsPartOf(*singleid, NULL);
}
Bool DescriptionAddCycle(Description *description, Int32 id, Int32 groupId, const String &name, const BaseContainer &cycleItems, BaseContainer *cycleIcons, Int32 defaultValue)