Skip to content

Instantly share code, notes, and snippets.

View donovankeith's full-sized avatar

Donovan Keith donovankeith

View GitHub Profile
# Example of using the Cinema 4D Tree View GUI in Python.
# Originally written by Niklas Rosenstein
# Modifications by Donovan Keith
import c4d
import os
import weakref
# Be sure to use a unique ID obtained from http://www.plugincafe.com/.
PLUGIN_ID = 9912399
"""Treeview Dialog
UltraSimple Treeview Example. Displays a list of Greek letters you can select and delete.
MIT License
Copyright (c) 2016 Donovan Keith
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@donovankeith
donovankeith / ShaderBrowser.pyp
Created June 15, 2016 23:29
Example of TreeViews in Cinema 4D from Tree Views Made Easy Pt I & II
"""ShaderBrowser
Based on: https://developers.maxon.net/?p=439"""
# ====== IMPORTS ====== #
import c4d
# ====== GLOBALS ====== #
@donovankeith
donovankeith / ObjectBrowser.pyp
Created June 17, 2016 18:55
A Cinema 4D Python TreeView example that supports Shift Clicking and Up/Down Arrows.
"""ObjectBrowser
Based on: https://developers.maxon.net/?p=439"""
# ====== IMPORTS ====== #
import c4d
# ====== GLOBALS ====== #
@donovankeith
donovankeith / SelectPhongEdgesExpression.pyp
Created October 21, 2016 20:22
Code for a Cinema 4D Python Expression Tag that automatically selects edges based on the angle between adjoining faces.
"""Select Phong Edges Expression
Selects any edges w/ broken phong shading.
Last Modified: 2016-10-21
v0.0.1
By Donovan Keith for MAXON USA
Usage Instructions
@donovankeith
donovankeith / WeldCubePoints.py
Created November 9, 2016 19:36
Welds the points of a cube so that it looks like a tent.
"""Weld Cube Points
Welds cube points together.
Usage Instructions:
1. Create some cubes.
2. Make them editable
3. Run this script.
"""
import c4d
@donovankeith
donovankeith / setnewselection.py
Created January 11, 2017 01:22
CV-Set New Selection Cinema 4D Script
"""Name-US: CV-Set New Selection
Description-US: Deslects all tags and runs the Set Selection command.
Installation:
-------------
1. Save this to a file called "setnewselection.py" in your C4D Scripts Folder
2. Restart Cinema 4D
@donovankeith
donovankeith / RGBLight.cs
Created February 8, 2017 23:28
Unity Script: Changes light to Red/Green/Blue when user press `R`, `G`, or `B` keys.
// RGBLight.cs
// Changes light to Red/Green/Blue when user press `R`, `G`, or `B` keys.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RGBLight : MonoBehaviour {
Light light;
@donovankeith
donovankeith / ToggleLight.cs
Created February 8, 2017 23:31
C# Unity Script: Toggles a light on/off when user presses the `L` key.
// ToggleLight.cs
// Turns the light component of this object on/off when the user presses and releases the `L` key.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ToggleLight : MonoBehaviour {
Light light;
@donovankeith
donovankeith / MousePaint.cs
Created February 9, 2017 01:58
MousePant: A simple unity script for cloning objects as you click/drag.
// MousePaint.cs
// Paints objects when you click and drag.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MousePaint : MonoBehaviour {
public GameObject stamp;