Skip to content

Instantly share code, notes, and snippets.

@p2or
p2or / blender-list-files-of-loaded-image-sequence.py
Created February 17, 2017 14:29
List Files of loaded Image Sequence #Blender #BSE
# for http://blender.stackexchange.com/q/73858/3710
import bpy
import os
def image_sequence_resolve(operator, context):
filepath = context.space_data.clip.filepath
filepath_full = bpy.path.abspath(filepath)
@p2or
p2or / blender-detect-ctrl-click-boolprop.py
Created January 19, 2017 13:11
Detect Ctrl-Click BoolProp #Blender
import bpy
class SimpleOperator(bpy.types.Operator):
"""Tooltip"""
bl_idname = "object.simple_operator"
bl_label = "Simple Object Operator"
def invoke(self, context, event):
ev = []
if event.ctrl:
@p2or
p2or / blender-io-obj-multiple-translate-by-file-name.py
Last active May 21, 2023 18:14
IO - Import obj by filename #Blender #BSE
# for http://blender.stackexchange.com/questions/71453/importing-large-number-of-objs-using-python#comment124330_71453
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@p2or
p2or / blender-create-vcolor-shader.py
Last active May 21, 2023 19:13
VColor Shader #Blender
# http://blender.stackexchange.com/questions/69671/how-to-convert-this-vertex-paint-into-a-useable-material-scripted
import bpy
# context object
obj = bpy.context.object
# create the material
mat = bpy.data.materials.new('MaterialName')
mat.diffuse_color = (0.1,0.0,0.7) # viewport color
@p2or
p2or / ae-time-code-expression.js
Created November 26, 2016 17:09
TimeCode #AfterEffects
h=0;m=00;s=0;f=0;
f+=timeToFrames();
s+=Math.floor(f*thisComp.frameDuration);
m+=Math.floor(s/60);
h+=Math.floor(m/60);
f=f%(1/thisComp.frameDuration);
s=s%60;
m=m%60;
if(f<10) {f="0"+f}
if(s<10) {s="0"+s}
import bpy
from bpy.props import IntProperty, CollectionProperty, StringProperty, EnumProperty
from bpy.types import Panel, UIList, PropertyGroup, Operator
from bpy_extras.io_utils import ImportHelper
import os
class CUSTOM_OT_actionsUIList(Operator):
bl_idname = "custom.list_action"
bl_label = "List Action"
@p2or
p2or / blender-image-3dview-img-opacity-handler.py
Last active May 21, 2023 18:38
Image Opactity Handler #Blender
# for http://blender.stackexchange.com/q/65143/3710
bl_info = {
"name": "Test",
"description": "Set Background Image Opacity in 3D View to 1 at Startup",
"author": "poor",
"version": (0, 0, 1),
"blender": (2, 70, 0),
"location": "3D View",
"warning": "", # used for warning icon and text in addons panel
@p2or
p2or / blender-sequencer-import-ascii-curve-for-hue-correct.py
Last active May 22, 2023 14:07
Import ascii data table for hue correct modifiers (sequencer) based on http://blender.stackexchange.com/a/64461 #Blender
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
import bpy
# current scene
scn = bpy.context.scene
# path to the blend
filepath = "/path/to/file.blend"
# name of object to import
obj_name = "Cube"
@p2or
p2or / blender-toggle-modifier-visibility.py
Last active May 21, 2023 18:06
Blender - Toggle Visibility of Modifier by Type using Shift+Q, for https://blender.stackexchange.com/q/46848/ #Blender #BSE
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the