Skip to content

Instantly share code, notes, and snippets.

@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 = []
@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()
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 May 19, 2024 08:28
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()
@fusepilot
fusepilot / gist:f18599d8c2489b8be1ac
Last active September 27, 2016 13:34
C4D Activate Camera on Frame Tag
import c4d
import re
"""
1. Create python tag on camera and add this code to it.
2. Duplicate tag to other cameras.
3. Rename your camera layers to match the frame you want it be be active on, e.g., cam-1, Camera01, 01.
"""
def main():
@bonsak
bonsak / c4d-select-nth-point.py
Last active September 27, 2016 13:19
C4D Python: Select every nth point in object
import c4d
from c4d import gui
def main():
doc = c4d.documents.GetActiveDocument()
op = doc.GetActiveObject()
if op is None or op.GetType() != c4d.Opolygon: return
bs = op.GetPointS()
@bekarice
bekarice / wc-free-checkout-fields.php
Last active October 31, 2021 19:10
Simplify WooCommerce checkout fields for free checkouts
<?php // only copy if needed
/**
* Removes coupon form, order notes, and several billing fields if the checkout doesn't require payment.
*
* REQUIRES PHP 5.3+
*
* Tutorial: http://skyver.ge/c
*/
function sv_free_checkout_fields() {