Skip to content

Instantly share code, notes, and snippets.

View NiklasRosenstein's full-sized avatar
💭
I may be slow to respond.

Niklas Rosenstein NiklasRosenstein

💭
I may be slow to respond.
View GitHub Profile

This Gist contains a bunch of Craftfiles to compile various libraries.

ident = 5159
import c4d
print "************"*4
print "Results for", ident
for key, value in vars(c4d).iteritems():
if value == ident:
print(key)
# Copyright (C) 2016 Niklas Rosenstein
# All rights reserved.
#
# Create: 2016/02/19
# Last Modified: 2016/02/19
#
# Dirty script to generate a badge with a left- and right-side text.
# The font family and size and whether a red or green badge should
# be generated can be controlled via the command-line.
#
@NiklasRosenstein
NiklasRosenstein / interpolator.cpp
Last active February 9, 2016 21:31
C++11 floating-point interpolation class with a convenient function to statically create an instance.
// Copyright (c) 2016 Niklas Rosenstein
//
// 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
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
@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.
# This script creates an image hash database and can then be used
# to copy image files to a directory, but only when they are not
# already in that directory (by the image hash).
from __future__ import print_function
from itertools import islice, izip
from six.moves import range
import argparse
import cPickle
import errno
@NiklasRosenstein
NiklasRosenstein / c4d_pluginid_exporter.py
Last active February 27, 2019 10:58
This script exports a list of all installed plugins to a text file. The first token in each line is the plugin ID where the rest of the line is the name of the plugin.
# Copyright (C) 2015 Niklas Rosenstein
# All rights reserved.
#
# File: c4d_pluginid_exporter.py
# Created: 2015-11-18
# Last Modified: 2015-11-18
# Description: This script exports a list of all installed plugins
# to a text file. The first token in each line is the plugin ID
# where the rest of the line is the name of the plugin.
@NiklasRosenstein
NiklasRosenstein / c4d_remove_rogue_shaders.py
Created November 16, 2015 17:07
Removes all rogue shaders from all materials in the scene, that is all shaders that are in the materials shader list but are not actually used in the material.
# Copyright (C) 2015 Niklas Rosenstein
# All rights reserved.
#
# File: remove_rogue_shaders.py
# Last Modified: 16.11.2015
# Version: 1.0
# Description: Removes all rogue shaders from all materials
# in the scene, that is all shaders that are in the materials
# shader list but are not actually used in the material.
@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
from __future__ import print_function
print("You've been jagged!")
print("Installing a Virus ...")