Skip to content

Instantly share code, notes, and snippets.

View enzyme69's full-sized avatar
🎯
Blender and AR~!

Jimmy Gunawan enzyme69

🎯
Blender and AR~!
View GitHub Profile
@enzyme69
enzyme69 / bs_listNameSelectedObjects.py
Created March 24, 2013 00:20
BLENDER / LIST THE NAMES OF SELECTED OBJECTS
# NORMAL STYLE
import bpy
selected_objects = bpy.context.selected_objects
obNameList = []
for item in selected_objects:
obNameList.append(item.name) #append each name into list
print(obNameList)
@enzyme69
enzyme69 / jgbpy_pixelArtImportVertexColor.py
Last active December 15, 2015 08:19
Blender Sushi script that imports small size Pixel Art (under 128 x 128 pixel size) and convert it into a grid of 3D cubes with Vertex Color applied based on the pixel color.
##### PIXEL ART IMPORT #####
'''
Import Pixel Art image and turn it into pixel 3D cubes, each colored based on the pixel sample grid
'''
import bpy
D = bpy.data
@enzyme69
enzyme69 / jgbpy_giveRandomColorToSelectedMeshesVertexColor.py
Created March 24, 2013 01:42
Blender Sushi script that gives random Vertex Color Layer set to selected meshes.
import bpy
import random
# Get selected objects
selected_meshes = bpy.context.selected_objects
# Add Materials that respects the Vertex Color for
# each selected and active objects
for mesh in selected_meshes:
@enzyme69
enzyme69 / jgbpy_shuffleMeshPosition.py
Created March 24, 2013 01:47
Blender Sushi Script to shuffle the transform position of selected meshes.
# Based on Example Script "Python In Maya" by Shaun Friedberg.
# http://www.pyrokinesis.co.nz
import bpy
import random
def completeShuffle(listToShuffle):
'''
'''
@enzyme69
enzyme69 / jgbpy_randomizeScaleSelectedObject.py
Created March 24, 2013 01:55
Blender Sushi Script to randomize the Scale Transform of user selected mesh. It randomize the Scale in 3 different axes separately.
import bpy
import random
# Define a function to randomize scale
def randomizeScale (minScale, maxScale):
selected_objects = bpy.context.selected_objects
@enzyme69
enzyme69 / jgbpy_selectMeshBasedOnDistance.py
Created March 24, 2013 01:57
Blender Sushi Script to select some meshes within specific distance to an Empty in 3D scene. User can adjust the Distance value.
import bpy
def selectMeshBasedOnDistance(distance, empty):
"""
A simple script to calculate the distance of all
mesh in the scene relative to the selected camera
"""
# Firstly, deselect all objects in the scene
bpy.ops.object.select_all(action='DESELECT')
@enzyme69
enzyme69 / jgbpy_arrange_2d_grid
Created March 25, 2013 06:10
Simple script to arrange selected objects into 2D grid with specified width and height
import bpy
'''
Arrange selected objects in specified grid space
'''
def arrangeIn2DGrid(width=10, height=10, spread=2):
# Get List of Selected Objects
myObjects = bpy.context.selected_objects
@enzyme69
enzyme69 / jgbpy_randomColorFacesForQuadMesh.py
Created March 25, 2013 22:33
Blender Sushi Script to give random Vertex Color Faces for Quad Mesh
'''
NOTE: The Script only works on surface with Quads Faces ONLY
'''
import bpy
from random import *
# Get selected objects
selected_objects = bpy.context.selected_objects
@enzyme69
enzyme69 / sv_place_object_on_ground_zero.json
Created October 21, 2016 05:39
Sverchok JSON Place Objects On Ground at World Zero
{
"export_version": "0.062",
"framed_nodes": {
"List Item": "To Get The Height",
"List Item.001": "To Get The Height"
},
"groups": {},
"nodes": {
"Bounding box": {
"bl_idname": "SvBBoxNode",
@enzyme69
enzyme69 / sv_stack_objects_at_zero_world.json
Created October 21, 2016 05:40
SV Stacking objects at World Zero Position
{
"export_version": "0.062",
"framed_nodes": {
"List Item": "To Get The Height",
"List Item.001": "To Get The Height"
},
"groups": {},
"nodes": {
"Bounding box": {
"bl_idname": "SvBBoxNode",