This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
current_scene_name = bpy.context.scene.name | |
current_viewlayer_name = bpy.context.window.view_layer.name | |
current_world_name = bpy.context.scene.world.name | |
# ---------- SET OVERRIDE CLAY MAT ---------- | |
override_clay_mat = bpy.data.materials.get('override_clay_GI') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
class NPR_bake_helper: | |
def __init__(self, shader_name): | |
self.shader_name = shader_name | |
self.script_run_count = 0 | |
self.INPUT_SOCKETS = ['―――――― {}'.format(i) for i in range(1, 10)] | |
self.INPUT_FOR_BAKE_SOCKETS_COL = ['{}_col'.format(i) for i in self.INPUT_SOCKETS] | |
self.INPUT_FOR_BAKE_SOCKETS_A = ['{}_a'.format(i) for i in self.INPUT_SOCKETS] | |
self.NPR_NODES = ['NPR_{}'.format(i) for i in range(1, 10)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
class AtlasGenerator: | |
def __init__(self): | |
import sys | |
import bmesh | |
import os | |
self.bmesh = bmesh | |
self.atlas = None | |
self.bmeshes = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
class ColorPreset: | |
@staticmethod | |
def hex_to_rgb(hex_value): | |
hex_color = hex_value[1:] | |
r = int(hex_color[:2], base=16) / 255.0 | |
g = int(hex_color[2:4], base=16) / 255.0 | |
b = int(hex_color[4:6], base=16) / 255.0 | |
return tuple([r, g, b]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
OlderNewer