Skip to content

Instantly share code, notes, and snippets.

@internetimagery
internetimagery / isolate.py
Last active May 29, 2021 13:55
Isolate Selected Object in C4D
# Isolate selection
import c4d
import c4d.gui as gui
import urllib
import datetime
import platform
import traceback
import contextlib
import webbrowser
@internetimagery
internetimagery / bounds.py
Created December 23, 2015 11:04
bezier bounding box
# http://stackoverflow.com/questions/2587751/an-algorithm-to-find-bounding-box-of-closed-bezier-curves
from __future__ import division
import math
def getBoundsOfCurve(x0, y0, x1, y1, x2, y2, x3, y3):
tvalues = []
bounds = [[], []]
points = []
@NiklasRosenstein
NiklasRosenstein / c4d_copy_preset_texture.py
Last active November 14, 2017 19:06
This function can be used to copy a texture for the Cinema 4D content browser.
def copy_preset_texture(source, dest):
''' Copies a bitmap file from the Cinema 4D preset library to the
file specified by *dest*. The suffix of *source* is used to determine
the output image format.
Arguments:
source: The source texture path that begins with `preset://`
dest: The filename to save the texture to.
Raises
IOError: If *source* does not exist or could not be loaded.
@baku89
baku89 / count_keyframes_c4d.py
Created December 5, 2015 04:33
Count keyframes of active document
from c4d import gui
import shutil
num = 0
def countObjectKeyframe(obj):
global num
tracks = obj.GetCTracks()
@NiklasRosenstein
NiklasRosenstein / c4d_show_shader_list.py
Created November 16, 2015 17:07
This script opens a dialog that displays all shaders in a material, tag or object that can be specified with a link box. http://i.imgur.com/wSBWR8Z.png
# Copyright (C) 2015 Niklas Rosenstein
# All rights reserved.
#
# File: show_shaders.py
# Last Modified: 16.11.2015
# Description: This script opens a dialog that displays all
# shaders in a material, tag or object that can be specified
# with a link box.
import c4d
ABCEXPORT_CAMERAS
ABCEXPORT_FORMAT
ABCEXPORT_FORMAT_HDF5_LEGACY
ABCEXPORT_FORMAT_OGAWA
ABCEXPORT_FRAME_END
ABCEXPORT_FRAME_START
ABCEXPORT_FRAME_STEP
ABCEXPORT_GLOBAL_MATRIX
ABCEXPORT_GROUP
ABCEXPORT_HAIR
@ruimac
ruimac / Suppress similar color.py
Last active November 14, 2017 18:49
Cinema 4D python script - Suppress similar color
# Script by RuiMac - 09-2015
import c4d
from c4d import gui
#Welcome to the world of Python
def replace(obj,m1,m2):
# while there are still objects...
while obj:
# get all the tags of the object
@ruimac
ruimac / Mirror VertexMap.py
Last active November 11, 2021 10:00
Cinema 4D python script - Mirrors a VertexMap along a user defined axis.
# Script by RuiMac - 09-2015
import c4d
import sys
from c4d import gui
# IDs of the dialog elements
OPTION=1000
TH_TEXT=1009
THRESHOLD=1010
@bonsak
bonsak / c4d-reset-object-axis.py
Created September 22, 2015 20:02
c4d-reset-object-axis
import c4d
# Slightly modified version of Lennart's (tca studios) script from this thread:
# http://www.plugincafe.com/forum/forum_posts.asp?TID=6600&KW=&PID=27379#27379
def main():
if op is None: return False
oldm = op.GetMg()
points = op.GetAllPoints()
@bonsak
bonsak / c4d-select-points-visible-to-camera.py
Created September 20, 2015 21:23
c4d-select-points-visible-to-camera
import c4d
from c4d import gui, documents
def main():
# BaseDraw
bd = doc.GetActiveBaseDraw()
# The camera view
view = bd.GetSafeFrame()