Skip to content

Instantly share code, notes, and snippets.

View Packsod's full-sized avatar

Packsod

View GitHub Profile
@Packsod
Packsod / Regex_Converter
Last active December 23, 2024 01:43
Regex_Converter
import bpy
import re
class GenerateRegexOperator(bpy.types.Operator):
bl_idname = "text.generate_regex"
bl_label = "Regex Converter"
bl_description = "Convert Words to Regex or Regex to Words"
use_clipboard: bpy.props.BoolProperty(
name="Use Clipboard",

#804040 #408080 #608040 #604080 #807040 #408050 #405080 #804070 #805840 #788040

import bpy
class InvisibleMeshHider:
def __init__(self, active_obj, selected_objs, cam, scene, limit=0.0001):
self.active_obj = active_obj
self.selected_objs = selected_objs
self.cam = cam
self.scene = scene
self.limit = limit
self.selected_mesh_objs = [obj for obj in selected_objs if obj.type == 'MESH']
import bpy
class Cam_Visibility:
@staticmethod
def has_keyframe(obj, frame):
if obj.animation_data and obj.animation_data.action:
for fcurve in obj.animation_data.action.fcurves:
if frame in [kf.co[0] for kf in fcurve.keyframe_points]:
return True
return False
import bpy
def shader_reset_CURVE_RGB_curves():
def show_popup(message):
bpy.context.window_manager.popup_menu(lambda self, context: self.layout.label(text=message), title="Error", icon='ERROR')
# Get the shader editor
shader_editor = next((space for area in bpy.context.screen.areas if area.type == 'NODE_EDITOR' for space in area.spaces if space.type == 'NODE_EDITOR' and space.tree_type == 'ShaderNodeTree'), None)
if shader_editor is None:
@Packsod
Packsod / Cam_CamP_render___script
Last active July 15, 2025 10:37
Cam_CamP_backup & restore
import bpy
class RenderSelectedCamPOperator(bpy.types.Operator):
bl_idname = "scene.render_selected_camp"
bl_label = "Render Selected CamP"
bl_options = {'REGISTER'}
render_CamP: bpy.props.IntProperty(name="Select CamP ind(1~24)", description="Specify a CamP_sub to render controlnet images", default=1, min=1, max=24)
render_video: bpy.props.BoolProperty(name="Render Video", description="Enable video rendering mode", default=False)
frame_start: bpy.props.IntProperty(name="Frame Start", description="Start frame of the video", default=1, min=1)
import bpy
import os
# Get the scene and view layer name
scene = bpy.context.scene
view_layer_name = bpy.context.view_layer.name
# Record the current area
previous_area = bpy.context.area.type
# Define AOV names
import bpy
import os
os.chdir(os.path.dirname(bpy.data.filepath))
class OverpaintCameraProjection(bpy.types.Operator):
bl_idname = "object.overpaint_camera_projection"
bl_label = "Overpaint Camera Projection"
bl_options = {'REGISTER', 'UNDO'}
camera_indexes: bpy.props.BoolVectorProperty(name="Camera Indexes", size=24)
specified_camera: bpy.props.BoolProperty(name="Specify Camera Projection", default=False)
import bpy
import os
# Start the undo block
bpy.ops.ed.undo_push(message="Start of script operation")
# Get the active object
obj = bpy.context.view_layer.objects.active
# Function to display popup menu notifications
"""run this script in shader editor, not in text editor, or it can't find nodegroups"""
import bpy
import os
os.chdir(os.path.dirname(bpy.data.filepath))
def manage_material_and_node_group():
def get_shader_editor():
return next((space for area in bpy.context.screen.areas if area.type == 'NODE_EDITOR' for space in area.spaces if space.type == 'NODE_EDITOR' and space.tree_type == 'ShaderNodeTree'), None)