Brushstroke Tools: Initial Version #328

Merged
Simon Thommes merged 229 commits from SimonThommes/blender-studio-tools:brushstroke_tools-initial-version into main 2024-11-06 15:03:47 +01:00
2 changed files with 48 additions and 0 deletions
Showing only changes of commit 9c41820950 - Show all commits

View File

@ -625,6 +625,7 @@ class BSBST_OT_make_preset(bpy.types.Operator):
elif type(v) == bpy.types.NodeTreeInterfaceSocketMaterial: elif type(v) == bpy.types.NodeTreeInterfaceSocketMaterial:
pass # TODO: figure out material preset linking pass # TODO: figure out material preset linking
return {"FINISHED"} return {"FINISHED"}
class BSBST_OT_preset_add_mod(bpy.types.Operator): class BSBST_OT_preset_add_mod(bpy.types.Operator):
""" """
Add a modifier to the preset stack. Add a modifier to the preset stack.
@ -733,6 +734,51 @@ class BSBST_OT_brushstrokes_toggle_attribute(bpy.types.Operator):
modifier_name=self.modifier_name) modifier_name=self.modifier_name)
return {"FINISHED"} return {"FINISHED"}
class BSBST_OT_render_setup(bpy.types.Operator):
"""
Set up render settings.
"""
bl_idname = "brushstroke_tools.render_setup"
bl_label = "Render Setup"
bl_description = "Set up render settings"
bl_options = {"REGISTER", "UNDO"}
render_engine: bpy.props.EnumProperty(name='Render Engine',
items = [
('ALL', 'All', 'Set up for all available render engines', '', 0),
('CYCLES', 'Cycles', 'Set up for Cycles', '', 1),
('EEVEE', 'Eevee', 'Set up for Eevee', '', 2),
]
)
trans_pass_toggle: bpy.props.BoolProperty(default=True)
trans_pass: bpy.props.IntProperty(default=256)
prop_map = {
'CYCLES':['trans_pass',
],
'EEVEE':[
]
}
def draw(self, context):
layout = self.layout
if self.render_engine == 'ALL':
props = [*v for k, v in self.prop_map]
else:
props = self.prop_map[self.render_engine]
print(props)
layout.prop(self, 'render_engine')
def execute(self, context):
settings = context.scene.BSBST_settings
if self.render_engine in ['CYCLES', 'ALL']:
if self.trans_pass_toggle:
context.scene.cycles.transparent_max_bounces = self.trans_pass
return {"FINISHED"}
def invoke(self, context, event):
return context.window_manager.invoke_props_dialog(self)
classes = [ classes = [
BSBST_OT_new_brushstrokes, BSBST_OT_new_brushstrokes,
BSBST_OT_edit_brushstrokes, BSBST_OT_edit_brushstrokes,
@ -746,6 +792,7 @@ classes = [
BSBST_OT_preset_remove_mod, BSBST_OT_preset_remove_mod,
BSBST_OT_preset_toggle_attribute, BSBST_OT_preset_toggle_attribute,
BSBST_OT_brushstrokes_toggle_attribute, BSBST_OT_brushstrokes_toggle_attribute,
BSBST_OT_render_setup,
] ]
def register(): def register():

View File

@ -251,6 +251,7 @@ class BSBST_PT_brushstroke_tools_panel(bpy.types.Panel):
new_advanced_panel.prop(settings, 'reuse_flow') new_advanced_panel.prop(settings, 'reuse_flow')
new_advanced_panel.prop(settings, 'estimate_dimensions') new_advanced_panel.prop(settings, 'estimate_dimensions')
new_advanced_panel.prop(settings, 'style_context') new_advanced_panel.prop(settings, 'style_context')
new_advanced_panel.operator('brushstroke_tools.render_setup')
# identify style context # identify style context
style_object = context.object if settings.style_context=='BRUSHSTROKES' else settings.preset_object style_object = context.object if settings.style_context=='BRUSHSTROKES' else settings.preset_object