Skip to content

Instantly share code, notes, and snippets.

@p2or
p2or / enum_GroupsInScene.py
Last active May 21, 2023 18:10
GroupsInScene #Blender
bl_info = {
"name": "tester",
"description": "",
"author": "",
"version": (0, 0, 3),
"blender": (2, 70, 0),
"location": "3D View > Toolbox",
"warning": "", # used for warning icon and text in addons panel
"wiki_url": "",
"tracker_url": "",
@p2or
p2or / metabox-multiple.php
Created March 26, 2021 13:40 — forked from cferdinandi/metabox-multiple.php
Create a metabox with multiple fields #WP
<?php
/**
* Create a metabox with multiple fields.
* Replace `_namespace` with some namespace for your project to avoid conflicts with other items
*/
//
// Create Metabox
//
@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-deactivate-shift-MMB.py
Created June 21, 2018 13:28
Deactivate Shift-MMB #Blender #BSE
# https://blender.stackexchange.com/q/110742/3710
bl_info = {
"name": "Disable Shift+MMB in 3D Viewport",
"description": "Disable Shift+MMB in 3D Viewport",
"author": "p2or",
"version": (0, 0, 1),
"blender": (2, 79, 0),
"location": "3D View",
"category": "3D View"
@p2or
p2or / blender-open-user-prefs-and-expand-addon.py
Created February 4, 2018 19:43
Open UserPrefs and expand #Blender #BSE
import bpy
import addon_utils
# Set Addon Tab
bpy.context.user_preferences.active_section = 'ADDONS'
# Set Filter
bpy.context.window_manager.addon_search = "Addon Name"
# Get a module reference by name
@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)
import bpy
# ---------------------------------------------------
# Collection
# ---------------------------------------------------
class MyCollectionProperty(bpy.types.PropertyGroup):
id = bpy.props.IntProperty()
name = bpy.props.StringProperty(name="Test Prop", default="Unknown")
@p2or
p2or / blender-display-opengl-lights-on-custom-panel.py
Last active May 21, 2023 18:16
Display OpenGL-Lights on custom panel #Blender
# for http://blender.stackexchange.com/q/74766/3710
import bpy
def opengl_lamp_display(column, lamp):
split = column.split(percentage=0.1)
split.prop(lamp, "use", text="", icon='OUTLINER_OB_LAMP' if lamp.use else 'LAMP_DATA')
col = split.column()
col.active = lamp.use
@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:
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"