Skip to content

Commit 7692ecd

Browse files
committed
Python SDK Examples for Cinema 4D 2025.0.0
1 parent a2bf564 commit 7692ecd

35 files changed

+486
-99
lines changed

plugins/py-double_circle_r19/py-double_circle_r19.pyp

+2-2
Original file line numberDiff line numberDiff line change
@@ -332,15 +332,15 @@ class DoubleCircleData(c4d.plugins.ObjectData, DoubleCircleHelper):
332332

333333
# Defines the color of the handle according of the hovered state of the object.
334334
hoverColor = c4d.VIEWCOLOR_ACTIVEPOINT if hitId != 0 else c4d.VIEWCOLOR_SELECTION_PREVIEW
335-
bd.SetPen(c4d.GetViewColor(hoverColor))
335+
bd.SetPen(c4d.GetViewColor(hoverColor), 0)
336336

337337
# Retrieves the information of the current handle.
338338
info = c4d.HandleInfo()
339339
self.GetHandle(op, 0, info)
340340

341341
# Draw the handle to the correct position
342342
bd.DrawHandle(info.position, c4d.DRAWHANDLE_BIG, 0)
343-
bd.SetPen(c4d.GetViewColor(c4d.VIEWCOLOR_ACTIVEPOINT))
343+
bd.SetPen(c4d.GetViewColor(c4d.VIEWCOLOR_ACTIVEPOINT), 0)
344344
bd.DrawLine(info.position, c4d.Vector(0), 0)
345345

346346
return c4d.DRAWRESULT_OK

plugins/py-noise_falloff_r14/py-noise_falloff_r14.pyp

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class NoiseFalloffHelper(object):
7070
"""
7171

7272
# Defines the Draw Color
73-
bd.SetPen(c4d.GetViewColor(c4d.VIEWCOLOR_ACTIVEPOINT))
73+
bd.SetPen(c4d.GetViewColor(c4d.VIEWCOLOR_ACTIVEPOINT), 0)
7474

7575
# According the handle id, defines start/end of the line handle
7676
p1, p2, p3, p4 = c4d.Vector(), c4d.Vector(), c4d.Vector(), c4d.Vector()

plugins/py-ocio_node_2025/py-ocio_node_2025.pyp

+340
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef C4D_SYMBOLS_H__
2+
#define C4D_SYMBOLS_H__
3+
4+
enum
5+
{
6+
// Plugin IDs
7+
PID_OCIO_NODE_2025 = 1064267,
8+
9+
// String IDs
10+
IDS_NME_OCIO_NODE_2025 = 10000,
11+
12+
// End of symbol definition
13+
_DUMMY_ELEMENT_
14+
};
15+
16+
#endif //C4D_SYMBOLS_H__
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#ifndef OOCIONODE2025_H__
2+
#define OOCIONODE2025_H__
3+
4+
enum
5+
{
6+
OCIO_NODE_2025_COLOR = 1000,
7+
};
8+
9+
#endif // OOCIONODE2025_H__
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CONTAINER Oocionode2025
2+
{
3+
NAME Oocionode2025;
4+
INCLUDE Obase;
5+
6+
GROUP ID_OBJECTPROPERTIES
7+
{
8+
COLOR OCIO_NODE_2025_COLOR {}
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
STRINGTABLE
2+
{
3+
IDS_NME_OCIO_NODE_2025 "Python SDK: Ocio Node 2025";
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
STRINGTABLE Oocionode2025
2+
{
3+
Oocionode2025 "Ocio Node 2025";
4+
OCIO_NODE_2025_COLOR "Color";
5+
}

plugins/py-rounded_tube_r13/py-rounded_tube_r13.pyp

+2-2
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class RoundedTube(c4d.plugins.ObjectData, RoundedTubeHelper):
388388
# Defines the color of the handle according of the hovered state of the object.
389389
handleColorFlag = c4d.VIEWCOLOR_HANDLES if c4d.GetC4DVersion() >= 21000 else c4d.VIEWCOLOR_ACTIVEPOINT
390390
hoverColor = c4d.VIEWCOLOR_SELECTION_PREVIEW if hitId == i else handleColorFlag
391-
bd.SetPen(c4d.GetViewColor(hoverColor))
391+
bd.SetPen(c4d.GetViewColor(hoverColor), 0)
392392

393393
# Retrieves the information of the current handle.
394394
info = c4d.HandleInfo()
@@ -398,7 +398,7 @@ class RoundedTube(c4d.plugins.ObjectData, RoundedTubeHelper):
398398
bd.DrawHandle(info.position, c4d.DRAWHANDLE_BIG, 0)
399399

400400
# Sets the color back to normal before drawing lines
401-
bd.SetPen(c4d.GetViewColor(handleColorFlag))
401+
bd.SetPen(c4d.GetViewColor(handleColorFlag), 0)
402402

403403
# Draws the lines 0, 1, 2 are draw in the same drawcall
404404
if i == 0:

plugins/py-spherify_modifier_r13/py-spherify_modifier_r13.pyp

+3-3
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ class SpherifyModifier(c4d.plugins.ObjectData):
346346
return c4d.DRAWRESULT_FAILURE
347347

348348
# Retrieves the object color
349-
bd.SetPen(bd.GetObjectColor(bh, op))
349+
bd.SetPen(bd.GetObjectColor(bh, op), c4d.SET_PEN_USE_PROFILE_COLOR)
350350
bd.SetMatrix_Matrix(None, c4d.Matrix())
351351

352352
# Defines the scale/rotation where drawing will operate by the radius of the generator
@@ -389,7 +389,7 @@ class SpherifyModifier(c4d.plugins.ObjectData):
389389
for i in range(SpherifyModifier.HANDLECOUNT):
390390
# Defines the color of the handle according of the hovered state of the object.
391391
hoverColor = c4d.VIEWCOLOR_ACTIVEPOINT if hitId != i else c4d.VIEWCOLOR_SELECTION_PREVIEW
392-
bd.SetPen(c4d.GetViewColor(hoverColor))
392+
bd.SetPen(c4d.GetViewColor(hoverColor), 0)
393393

394394
# Retrieves the information of the current handle.
395395
info = c4d.HandleInfo()
@@ -399,7 +399,7 @@ class SpherifyModifier(c4d.plugins.ObjectData):
399399
bd.DrawHandle(info.position, c4d.DRAWHANDLE_BIG, 0)
400400

401401
# Draw the line to the second Handle
402-
bd.SetPen(c4d.GetViewColor(c4d.VIEWCOLOR_ACTIVEPOINT))
402+
bd.SetPen(c4d.GetViewColor(c4d.VIEWCOLOR_ACTIVEPOINT), 0)
403403
bd.DrawLine(info.position, c4d.Vector(0), 0)
404404

405405
# If the current draw pass is not the object or handle, skip this Draw Call.
381 KB
Binary file not shown.

scripts/01_foundations/readme.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Foundations
22

3-
The classic API and MAXON API provides various fundamental concepts and classes.
3+
The Cinema API and MAXON API provides various fundamental concepts and classes.
44

55
Classic API:
6-
- **c4d.C4DAtom**: *Base class for many entities in the classic Cinema 4D API.*
6+
- **c4d.C4DAtom**: *Base class for many entities in the Cinema API.*
77
- **c4d.GeListNode**: *Based on C4DAtom, provides the functionality to organize elements in linked lists and trees.*
8-
- **c4d.BaseList2D**: *Based on C4DAtom and GeListNode. It is a base class for many entities of the classic Cinema 4D API.*
8+
- **c4d.BaseList2D**: *Based on C4DAtom and GeListNode. It is a base class for many entities of the Cinema API.*
99
- **c4d.GeListHead**: *A GeListHead object is the root of a list or tree of GeListNode elements.*
1010
- **c4d.DescID**: *Parameters of C4DAtom based elements are identified using a DescID object.*
1111

scripts/02_data_algorithms/maxon_datadictionary_2023_1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def main():
2828
dataDict[key] = value
2929

3030
# However, only the most atomic Python types as string, int, float, and bool are being
31-
# automatically converted to their maxon API equivalent. For storing a list of integer values
31+
# automatically converted to their Maxon API equivalent. For storing a list of integer values
3232
# under a key for example, one must convert that list explicitly to a BaseArray.
3333
dataDict["prime_numbers"] = maxon.BaseArray(maxon.Int32, [2, 3, 5, 7, 11, 13])
3434

scripts/02_data_algorithms/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Data & Algorithms
22

3-
Both the classic API and the MAXON API provide simple and complex data types, data structures and basic algorithms.
3+
Both the Cinema API and the MAXON API provide simple and complex data types, data structures and basic algorithms.
44

55
It is advised to always use these data types instead of basic data types or standard library structures. Using the provided data types ensures compatibility with all supported platforms.
66

scripts/03_application_development/files_media/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Files Medias
22

3-
The classic API and MAXON API provide tools and classes to handle file and media data. If possible, the classes of the MAXON API should be preferred.
3+
The Cinema API and MAXON API provide tools and classes to handle file and media data. If possible, the classes of the MAXON API should be preferred.
44

55
Classic API:
66
- **c4d.bitmaps.BaseBitmap**: *The bitmap class can be used to load, read, draw and save bitmap pictures of various formats.*

scripts/03_application_development/gui/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The Cinema 4D GUI is based on "dialog" windows based on the GeDialog class. A pl
66

77
## Content
88

9-
The classic API as well as the MAXON API provide generic application development components to handle threads, files, GUI elements etc.
9+
The Cinema API as well as the MAXON API provide generic application development components to handle threads, files, GUI elements etc.
1010

1111
* **description**: *Stores information on how parameters are to be displayed in the GUI (Attribute Manager).*
1212

scripts/03_application_development/readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
## Introduction
44

5-
The classic API as well as the MAXON API provide generic application development components to handle threads, files, GUI elements etc.
5+
The Cinema API as well as the MAXON API provide generic application development components to handle threads, files, GUI elements etc.
66

77
## Content
88

9-
* **files_media**: *The classic API and MAXON API provide tools and classes to handle file and media data. If possible, the classes of the MAXON API should be preferred.*
9+
* **files_media**: *The Cinema API and MAXON API provide tools and classes to handle file and media data. If possible, the classes of the MAXON API should be preferred.*
1010

1111
* **gui**: *The Cinema 4D GUI is based on "dialog" windows based on the GeDialog class. A plugin can create custom dialog windows for user interaction or creates new managers.*
1212

scripts/03_application_development/threading/readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
Cinema 4D is a multi-threaded application that handles different tasks in different threads. Certain operations can only be performed from within the main thread.
44
So a plugin must know its current thread context.
55

6-
Both the classic API and the MAXON API provide tools to handle threads, create custom threads to perform multi-threaded operations.
6+
Both the Cinema API and the MAXON API provide tools to handle threads, create custom threads to perform multi-threaded operations.
77

88
Classic API:
9-
- **c4d.threading.C4DThread**: *The base class for custom classic threads in Cinema 4D. Operations can be done on multiple cores or in the background.*
9+
- **c4d.threading.C4DThread**: *The base class for custom Cinema API threads. Operations can be done on multiple cores or in the background.*
1010

1111
## Examples
1212

scripts/04_3d_concepts/modeling/geometry/geometry_caches_s26.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#coding: utf-8
2-
"""Explains the geometry model of the classic API in Cinema 4D.
2+
"""Explains the geometry model of the Cinema API in Cinema 4D.
33
44
The script either evaluates the caches of the currently selected object or when there is no
55
object selection, or inserts the following object hierarchy into the active document and evaluates
@@ -10,7 +10,7 @@
1010
+- Bend Object
1111
1212
Topics:
13-
* The geometry model of the classic API
13+
* The geometry model of the Cinema API
1414
* The purpose and structure of generator and deform caches
1515
* c4d.BaseObject
1616
* c4d.PointObject
@@ -23,10 +23,10 @@
2323
* PrintCacheTree(): Prints out the cache-tree of the passed object.
2424
2525
Overview:
26-
All geometry in the Cinema 4D classic API is represented as `BaseObject` instances. `BaseObject`
26+
All geometry in the Cinema 4D Cinema API is represented as `BaseObject` instances. `BaseObject`
2727
instances can also express non-geometry entities as light objects or cameras, but they are being
2828
ignored in this context. There are two fundamental types of geometry representations in the
29-
classic API:
29+
Cinema API:
3030
3131
* Generator objects
3232
* Non-generator objects
@@ -39,7 +39,7 @@
3939
objects do not allow users to modify their underlying cache manually which also applies to
4040
programmatic access.
4141
42-
There are two types of geometry caches in the classic API. Caches for internal representations
42+
There are two types of geometry caches in the Cinema API. Caches for internal representations
4343
of generator objects, they are plainly referred to as *caches*, and *deform caches*; which can
4444
only be found on non-generator objects. The latter represents the state of a generator, as
4545
expressed by its parameters, as a (more) discrete form. In most simple cases this means

scripts/04_3d_concepts/modeling/geometry/geometry_polygonobject_s26.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#coding: utf-8
2-
"""Explains the user-editable polygon object model of the classic API.
2+
"""Explains the user-editable polygon object model of the Cinema API.
33
44
The example constructs a simple polygonal cube object.
55

scripts/04_3d_concepts/modeling/geometry/geometry_splineobject_s26.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#coding: utf-8
2-
"""Explains the user-editable spline object model of the classic API.
2+
"""Explains the user-editable spline object model of the Cinema API.
33
44
The example constructs two spline objects, one without tangents and one with tangents.
55
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Geometry
2-
Provides examples for geometry types in the classic API.
2+
Provides examples for geometry types in the Cinema API.
33

4-
All geometry in the Cinema 4D classic API is represented as `BaseObject` instances. `BaseObject` instances can also express non-geometry entities as light objects or cameras, but they are being ignored in this context. There are two fundamental types of geometry representations in the classic API:
4+
All geometry in the Cinema 4D Cinema API is represented as `BaseObject` instances. `BaseObject` instances can also express non-geometry entities as light objects or cameras, but they are being ignored in this context. There are two fundamental types of geometry representations in the Cinema API:
55

66
* Generator objects
77
* Non-generator objects
88

9-
Realized are most forms of classic API geometry by the following type hierarchy (there are some outliers as for example VolumeObject which have their own type, but these are still all `BaseObject` instances):
9+
Realized are most forms of Cinema API geometry by the following type hierarchy (there are some outliers as for example VolumeObject which have their own type, but these are still all `BaseObject` instances):
1010

1111
c4d.BaseObject
1212
+- c4d.PointObject
@@ -18,17 +18,17 @@ Generator objects are objects which generate some form of geometry over their pa
1818

1919
Non-generator objects on the other hand do not have any parameters which are exposed in the Attribute Manager which would influence their geometry. The two types which follow this model are `LineObject` and `PolygonObject`, both derived from `PointObject` . `PolygonObject` represents discrete polygonal data over vertices and polygons, and `LineObject` represents discrete curve data over points and segments. The outlier from this model is the type `SplineObject` which is representing splines. It is both a `PointObject` and a generator object. Spline generator objects in the sense of parametric objects, as for example the Circle Spline object, return directly spline caches in the form of `LineObject`. But user-editable splines, `SplineObject` instances, also have a `LineObject` cache for their current interpolation settings.
2020

21-
There are two types of geometry caches in the classic API. Caches for internal representations of generator objects, they are plainly referred to as *caches*, and *deform caches*; which can only be found on non-generator objects. The cache of a generator object represents the set of parameters the generator object had when the cache was built. In the case of simple generators, as for example the Cube generator object, the cache is a `PolygonObject`, representing the polygons of that generator. But generator object caches can be much more complex, where the cache of the generator is a hierarchy of objects, including other generator objects with their own caches.
21+
There are two types of geometry caches in the Cinema API. Caches for internal representations of generator objects, they are plainly referred to as *caches*, and *deform caches*; which can only be found on non-generator objects. The cache of a generator object represents the set of parameters the generator object had when the cache was built. In the case of simple generators, as for example the Cube generator object, the cache is a `PolygonObject`, representing the polygons of that generator. But generator object caches can be much more complex, where the cache of the generator is a hierarchy of objects, including other generator objects with their own caches.
2222

2323
Deform caches can only be found on non-generator `PointObject` objects and they are generated when a deformer, e.g., the Bend object, is applied to them. These caches then represent the deformed state of the `PolygonObject` or `LineObject` and realize the non-destructive nature of deformers in Cinema 4D. Since many objects in a scene can be generator objects, deform caches are often buried deep within the cache of a generator object.
2424

2525
## Examples
2626

2727
| File | Description |
2828
| :- | :- |
29-
| geometry_caches_xxx.py | Explains the geometry model of the classic API in Cinema 4D. |
30-
| geometry_polygonobject_xxx.py | Explains the user-editable polygon object model of the classic API. |
31-
| geometry_splineobject_xxx.py | Explains the user-editable spline object model of the classic API. |
29+
| geometry_caches_xxx.py | Explains the geometry model of the Cinema API in Cinema 4D. |
30+
| geometry_polygonobject_xxx.py | Explains the user-editable polygon object model of the Cinema API. |
31+
| geometry_splineobject_xxx.py | Explains the user-editable spline object model of the Cinema API. |
3232
| operation_extrude_polygons_xxx.py | Demonstrates how to extend polygonal geometry at the example of extruding polygons. |
3333
| operation_flatten_polygons_xxx.py | Demonstrates how to deform points of a point object at the example of 'flattening' the selected polygons in a polygon object. |
3434
| operation_transfer_axis_xxx.py | Demonstrates how to 'transfer' the axis of a point object to another object while keeping its vertices in place. |

scripts/04_3d_concepts/modeling/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Modelling
2-
Both the classic API and the maxon API provide types of geometry representations and modelling tools for them. The maxon API represents geometry with Scene Nodes, which are currently not yet documented in Python. Documented are here the classic API geometry representations and the modelling tools which exist for them, both in the classic and maxon API.
2+
Both the Cinema API and the Maxon API provide types of geometry representations and modelling tools for them. The Maxon API represents geometry with Scene Nodes, which are currently not yet documented in Python. Documented are here the Cinema API geometry representations and the modelling tools which exist for them, both in the Cinema and Maxon API.
33

44
## geometry
55
Provides examples for the fundamental geometry types `PointObject`, `SplineObject`, `PolygonObject`, `LineObject`, and `Cpolygon`, how to construct and manipulate them, as well as for the concept of caches used by them. The manipulation and construction examples provided here are of more fundamental nature. For using existing modelling tools, see the section *modelling_commands*.

scripts/04_3d_concepts/readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ The Cinema 4D API provides classes to describe complex 3D scenes and tools to ed
66

77
## Content
88

9-
* **modeling**: *The classic API provides the base classes for modeling in Cinema 4D. The MAXON API provides further, advanced modeling tools.*
9+
* **modeling**: *The Cinema API provides the base classes for modeling in Cinema 4D. The MAXON API provides further, advanced modeling tools.*
1010

11-
* **rendering**: *The classic API provides tools to render a given BaseDocument*
11+
* **rendering**: *The Cinema API provides tools to render a given BaseDocument*
1212

1313
* **scene_elements**: *Information about scene settings, take system, objects, tags, materials, shaders and animation.*
1414

scripts/04_3d_concepts/rendering/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Rendering
22

3-
The classic API provides tools to render a given BaseDocument.
3+
The Cinema API provides tools to render a given BaseDocument.
44

55
Classic API:
66
- **c4d.documents.RenderData**: *Represents a set of render settings of a BaseDocument.*

0 commit comments

Comments
 (0)