Skip to content

Instantly share code, notes, and snippets.

@p2or
p2or / blender-merge-vertex-groups.py
Last active June 12, 2025 17:07
Merge Vertex Groups #Blender
import bpy
group_input = {"Group", "Group.001", "Group.002"}
ob = bpy.context.active_object
group_lookup = {g.index: g.name for g in ob.vertex_groups}
group_candidates = {n for n in group_lookup.values() if n in group_input}
# test whether all candidates components of group_lookup
if all(n in group_lookup.values() for n in group_candidates):
@p2or
p2or / blender-sequence-bakery.py
Last active April 20, 2025 19:57
Extended version of Animated Render Baker #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
# ##### 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
# ##### 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
@p2or
p2or / blender-merge-vertex-groups-jerryno.py
Created August 25, 2017 10:15
Merge-VertexGroups (jerryno) #Blender
import bpy
vgroup_A_name = "Group"
vgroup_B_name = "Group.001"
ob = bpy.context.active_object
if vgroup_A_name and vgroup_B_name in ob.vertex_groups:
vgroup = ob.vertex_groups.new(name=vgroup_A_name+"+"+vgroup_B_name)
@p2or
p2or / blender-anisotropic-shader.py
Last active October 19, 2024 08:20
Create Anisotropic Shader #Blender #BSE
# for http://blender.stackexchange.com/questions/32787/example-of-creating-and-setting-a-cycles-material-node-with-the-python-api
import bpy
# get the material
mat = bpy.data.materials['Material']
# get the nodes
nodes = mat.node_tree.nodes
# clear all nodes to start clean
@p2or
p2or / Blender_Basic-UI-Template.py
Last active September 23, 2024 15:48
Basic-UI-Template (Blender 3+) for https://blender.stackexchange.com/a/57332 #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
@p2or
p2or / loom_post-render-rename.py
Last active September 13, 2024 08:16
Loom Extension to remove the frame number from non-sequencial images within a given folder #BlenderAddon
# ##### 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
# 2.8+ Update for https://gist.github.com/sambler/6d1fdee82878811c75ac
import bpy
class CustomMenu(bpy.types.Menu):
"""Demo custom menu"""
# example menu from Templates->Python->ui_menu.py
bl_label = "Custom Menu"
bl_idname = "OBJECT_MT_custom_menu"
@p2or
p2or / Natron-Flicker.py
Created October 28, 2019 07:35
Flicker #Natron
# -*- coding: utf-8 -*-
# DO NOT EDIT THIS FILE
# This file was automatically generated by Natron PyPlug exporter version 10.
# Hand-written code should be added in a separate file named N_FlickerExt.py
# See http://natron.readthedocs.org/en/master/devel/groups.html#adding-hand-written-code-callbacks-etc
# Note that Viewers are never exported
import NatronEngine
import sys