Skip to content

Instantly share code, notes, and snippets.

@sambler
sambler / timed_edit_mode.py
Created February 7, 2016 08:57
Proof of concept, needs more work to be usable. Issue comes from mouse positions in event are from previous modal call but the position during initial execute should be considered.
# made in response to
# http://blender.stackexchange.com/q/46461/935
bl_info = {
"version": (1, 0),
"blender": (2, 75, 0),
"author": "sambler",
"name": "Timed edit mode",
"description": "Use tab to go into edit mode, if tab is held and mouse is moved then show the mode pie menu." ,
# made in response to
# http://blender.stackexchange.com/q/46496/935
bl_info = {
"version": (1, 0),
"blender": (2, 75, 0),
"author": "sambler",
"name": "Demo Menus",
"description": "Demo showing use of different menus" ,
# made in response to
# http://blender.stackexchange.com/q/49552/935
bl_info = {
"version": (1, 0),
"blender": (2, 75, 0),
"author": "sambler",
"name": "testing addon",
"location": "blender",
"description": "test showing material nodes in toolshelf" ,
@sambler
sambler / __init__.py
Created June 28, 2016 13:14
Dynamically create operators that can add custom objects
# for http://blender.stackexchange.com/q/56741/935
bl_info = {
'version': (1, 0),
'blender': (2, 75, 0),
'author': 'sambler',
'name': 'Custom Object Factory',
'location': 'blender',
'description': 'Create multiple custom operators that create objects' ,
@sambler
sambler / blender_dng.diff
Created July 5, 2016 12:59
blender patch to add DNG/CR2 image support - basic change for proof of concept, could use adding clear support for DNG/CR2 files - oiio returns the image data as file_type=='JPEG'
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
index 11bf454..a68da9a 100644
--- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp
+++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
@@ -176,6 +176,8 @@ int imb_is_a_photoshop(const char *filename)
".psd",
".pdd",
".psb",
+ ".dng",
+ ".cr2",
@sambler
sambler / test_addon.py
Created July 7, 2016 07:10
Sample test addon to show using unregister() to remove changes by the addon
bl_info = {"version": (1, 0), "blender": (2, 75, 0), "author": "myname",
"name": "testing addon", "location": "blender", "description": "test a new addon" ,
"warning": "only for testing", "category": "test", }
import bpy
# add your operators, panels .....
def register() :
bpy.types.scene.my_int_storage = bpy.props.IntProperty()
bpy.utils.register_class(myOperator)
@sambler
sambler / sub_panels.py
Created August 10, 2016 10:01
Example of creating sub panels in blender
# made in response to http://blender.stackexchange.com/q/60583/935
bl_info = {
"version": (1, 0),
"blender": (2, 75, 0),
"author": "sambler",
"name": "Sample Panel with subpanels addon",
"description": """Sample addon to demonstrate displaying sub-panels within a panel""" ,
"category": "test",
}
@sambler
sambler / satellites.py
Created November 21, 2016 17:23
Create a mesh of satellites spinning around
# made in answer to http://blender.stackexchange.com/q/67612/935
# create a mesh of satellites based on http://space.stackexchange.com/q/19055
import bpy, bpy_extras, bmesh
import math, mathutils
if False: # change to True for final test - needs about 6GB free ram
# full data
# num_planes, num_sats, radius, frames
# frames is number of frames that the orbital plane takes to rotate 360
@sambler
sambler / multi_scene_setup.py
Last active June 7, 2021 07:47
Setup multi scene rendering
# made in answer to http://blender.stackexchange.com/q/74086/935
import bpy
master_render_scene_name = 'Multi_render'
base_path = '//renders/'
if master_render_scene_name not in bpy.data.scenes:
bpy.data.scenes.new(name=master_render_scene_name)
@sambler
sambler / make_bound_box.py
Last active February 27, 2017 07:36
Create a bounding box around specific objects
# for comment at http://blender.stackexchange.com/a/14188/935
import bpy
import bmesh
from bpy.props import BoolProperty, FloatVectorProperty
import mathutils
from bpy_extras import object_utils
# from blender templates
def add_box(width, height, depth):