Skip to content

Instantly share code, notes, and snippets.

View lupin4's full-sized avatar
⚜️
Writing

David Clabaugh lupin4

⚜️
Writing
  • The Fantatstic Planet
  • Seattle
  • 05:13 (UTC -12:00)
View GitHub Profile
@lupin4
lupin4 / RandomRotate.py
Created February 8, 2017 09:56 — forked from protofALk/RandomRotate.py
Maya Python: Randomly Rotate a bunch of Objects
#rotate a bunch of object randomly here around y but can be changed easely below
import maya.cmds as cmds
import random as rand
def getSpecificObjectsIntoArray(objectName):
return cmds.ls(objectName)
def randomRotator(objectName):
for objects in getSpecificObjectsIntoArray(objectName):
#rotate objects around Y change here if you want other axises
@lupin4
lupin4 / ClampValues.txt
Created March 31, 2018 02:26 — forked from animoplex/ClampValues.jsx
Clamp Values - After Effects Expression by Animoplex
// Clamp Values - Created by Animoplex: www.animoplex.com
// Limits a slider or keyframable value with a minimum and maximum value clamp.
// VARIATION A: Slider (1 Value)
minVal = 0;
maxVal = 100;
clamp(effect("Global Tab Size")("Slider"), minVal, maxVal)
@lupin4
lupin4 / DynamicBox.jsx
Created April 12, 2018 17:55 — forked from animoplex/DynamicBox.jsx
Dynamic Box - After Effects Expression by Animoplex
// Dynamic Box - Created by Animoplex: www.animoplex.com
// Apply this to the Size property of a shape layer to resize the box based on the source.
// Full Tutorial: https://www.youtube.com/watch?v=BOPfs49VfLE&t=803s
pad = 80; // pixel padding around box
src = thisComp.layer("Label");
box = src.sourceRectAtTime(time - src.inPoint);
[box.width + pad, box.height + pad]
import bpy
gpencil_data = bpy.data.grease_pencils.new("GPencil")
gpencil = bpy.data.objects.new(gpencil_data.name, gpencil_data)
bpy.context.collection.objects.link(gpencil)
gp_layer = gpencil_data.layers.new("lines")
gp_frame = gp_layer.frames.new(bpy.context.scene.frame_current)
@lupin4
lupin4 / vertex_colour_remap.py
Created July 3, 2022 07:35 — forked from zeffii/vertex_colour_remap.py
vertex_colors_bmesh_remapping_to_height
# vertex_color_from_z_height.py
import bpy
import random
from mathutils import Color, Vector
def remap(current, lower_old, upper_old, lower_new, upper_new):
'''
Remaps one range of values to another range of values, types must be float
@lupin4
lupin4 / print_camera.py
Created September 21, 2022 09:51 — forked from daw42/print_camera.py
Python script for retrieving the position and orientation of the active camera in Blender. Output is rotated into a y-up system.
# Simple script to output the lookAt parameters and field of view for the active camera.
# This converts the output to a y-up system, common in OpenGL.
import bpy
from mathutils import Vector
from math import degrees
# get the active camera
cam = bpy.context.scene.camera
import bpy
import warnings
bpy_context_key_types = dict([
("active_base", bpy.types.ObjectBase),
("active_bone", bpy.types.EditBone),
("active_gpencil_brush", bpy.types.GPencilBrush),
("active_gpencil_frame", [bpy.types.GPencilLayer]),
("active_gpencil_layer", [bpy.types.GPencilLayer]),
("active_gpencil_palette", [bpy.types.GPencilPalette]),
@lupin4
lupin4 / dict_example_2_start.py
Created December 1, 2022 07:23 — forked from CGArtPython/dict_example_2_start.py
Beginner Blender Python Tutorial: Python Dictionaries Example 2 scene setup code (used in tutorial: https://youtu.be/FkJ2XanNBR4)
# give Python access to Blender's functionality
import bpy
# extend Python functionality to generate random numbers
import random
# add ico spheres into the scene
object_count = 10
for _ in range(object_count):
x = random.uniform(-5, 5)
@lupin4
lupin4 / dict_example_1.py
Created December 1, 2022 07:33 — forked from CGArtPython/dict_example_1.py
Beginner Blender Python Tutorial: Python Dictionaries Example 1 (used in tutorial: https://youtu.be/FkJ2XanNBR4)
# give Python access to Blender's functionality
import bpy
# extend Python functionality to generate random numbers
import random
def create_plane_with_color(color, location):
# add a plane
bpy.ops.mesh.primitive_plane_add()
@lupin4
lupin4 / dict_example_2.py
Created December 1, 2022 07:37 — forked from CGArtPython/dict_example_2.py
Beginner Blender Python Tutorial: Python Dictionaries Example 2 (used in tutorial: https://youtu.be/FkJ2XanNBR4)
# give Python access to Blender's functionality
import bpy
cube_key = "cubes"
ico_key = "spheres"
cone_key = "cones"
# create a dict of mesh lists
mesh_objects = {
cube_key: list(),