VDM brush baker #104580

Merged
Joseph Eagar merged 10 commits from robin.hohni/blender-addons:vdm-brush-baker into main 2023-05-12 15:42:12 +02:00
Showing only changes of commit 41b52119dd - Show all commits

View File

@ -195,8 +195,6 @@ class create_vdm_brush(bpy.types.Operator):
if len(addon_data.draft_brush_name) == 0 or is_occupied:
addon_data.draft_brush_name = brush_name
bpy.ops.object.mode_set(mode='OBJECT')
# Saving user settings
scene = context.scene
default_render_engine = scene.render.engine
@ -210,6 +208,9 @@ class create_vdm_brush(bpy.types.Operator):
default_scene_samples = scene.cycles.samples
default_plane_location = vdm_plane.location.copy()
default_plane_rotation = vdm_plane.rotation_euler.copy()
default_mode = bpy.context.object.mode
bpy.ops.object.mode_set(mode='OBJECT')
vdm_bake_material = bakematerial.get_vdm_bake_material()
try:
@ -317,7 +318,10 @@ class create_vdm_brush(bpy.types.Operator):
new_brush.strength = 1.0
new_brush.hardness = 0.9
context.tool_settings.sculpt.brush = new_brush
bpy.ops.object.mode_set(mode = default_mode)
if bpy.context.object.mode == 'SCULPT':
context.tool_settings.sculpt.brush = new_brush
return {'FINISHED'}