VDM brush baker #104580
@ -48,20 +48,20 @@ class vdm_brush_baker_addon_data(bpy.types.PropertyGroup):
|
|||||||
('1024', '1024 px', 'Render with 1024 x 1024 pixels', 4),
|
('1024', '1024 px', 'Render with 1024 x 1024 pixels', 4),
|
||||||
('2048', '2048 px', 'Render with 2048 x 2048 pixels', 5),
|
('2048', '2048 px', 'Render with 2048 x 2048 pixels', 5),
|
||||||
},
|
},
|
||||||
default='512', name='')
|
default='512', name='Map Resolution')
|
||||||
compression: bpy.props.EnumProperty(items={
|
compression: bpy.props.EnumProperty(items={
|
||||||
('none', 'None', '', 1),
|
('none', 'None', '', 1),
|
||||||
('zip', 'ZIP (lossless)', '', 2),
|
('zip', 'ZIP (lossless)', '', 2),
|
||||||
},
|
},
|
||||||
default='zip', name='')
|
default='zip', name='Compression')
|
||||||
color_depth: bpy.props.EnumProperty(items={
|
color_depth: bpy.props.EnumProperty(items={
|
||||||
('16', '16', '', 1),
|
('16', '16', '', 1),
|
||||||
('32', '32', '', 2),
|
('32', '32', '', 2),
|
||||||
},
|
},
|
||||||
default='16',
|
default='16',
|
||||||
name='Color depth',
|
name='Color Depth',
|
||||||
description='A color depth of 32 can give better results but leads to far bigger file sizes. 16 should be good if the sculpt doesn\'t extend "too far" from the original plane')
|
description='A color depth of 32 can give better results but leads to far bigger file sizes. 16 should be good if the sculpt doesn\'t extend "too far" from the original plane')
|
||||||
render_samples: bpy.props.IntProperty(name='Render samples',
|
render_samples: bpy.props.IntProperty(name='Render Samples',
|
||||||
default=64,
|
default=64,
|
||||||
min=2,
|
min=2,
|
||||||
max=4096)
|
max=4096)
|
||||||
@ -98,43 +98,44 @@ class PT_VDMBaker(bpy.types.Panel):
|
|||||||
layout = self.layout
|
layout = self.layout
|
||||||
addon_data = get_addon_data()
|
addon_data = get_addon_data()
|
||||||
|
|
||||||
layout.operator(create_sculpt_plane.bl_idname)
|
layout.use_property_split = True
|
||||||
|
layout.use_property_decorate = False
|
||||||
|
|
||||||
|
layout.operator(create_sculpt_plane.bl_idname, icon='ADD')
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
is_occupied, brush_name = get_new_brush_name()
|
is_occupied, brush_name = get_new_brush_name()
|
||||||
button_text = 'Render and create brush'
|
button_text = 'Overwrite VDM Brush' if is_occupied else 'Render and Create VDM Brush'
|
||||||
|
|
||||||
createvdmlayout = layout.row()
|
createvdmlayout = layout.row()
|
||||||
createvdmlayout.enabled = context.active_object is not None and context.active_object.type == 'MESH'
|
createvdmlayout.enabled = context.active_object is not None and context.active_object.type == 'MESH'
|
||||||
createvdmlayout.operator(
|
createvdmlayout.operator(
|
||||||
create_vdm_brush.bl_idname, text=button_text, icon='META_DATA')
|
create_vdm_brush.bl_idname, text=button_text, icon='BRUSH_DATA')
|
||||||
|
|
||||||
if is_occupied:
|
if is_occupied:
|
||||||
layout.label(
|
layout.label(
|
||||||
text='Name taken: overrides Brush.', icon='INFO')
|
text='Name Taken: Brush will be overwritten.', icon='INFO')
|
||||||
button_text = 'Overwrite vdm brush'
|
|
||||||
|
|
||||||
layout.prop(addon_data, 'draft_brush_name')
|
col = layout.column()
|
||||||
|
col.alert = is_occupied
|
||||||
|
col.prop(addon_data, 'draft_brush_name')
|
||||||
|
|
||||||
settings_layout = layout.column(align=True)
|
settings_layout = layout.column(align=True)
|
||||||
settings_layout.label(text='Settings')
|
settings_layout.label(text='Settings')
|
||||||
layout_box = settings_layout.box()
|
layout_box = settings_layout.box()
|
||||||
resolution_layout = layout_box.row(align=True)
|
|
||||||
resolution_layout.label(text='Map resolution: ')
|
|
||||||
resolution_layout.prop(addon_data, 'render_resolution')
|
|
||||||
|
|
||||||
compression_layout = layout_box.row(align=True)
|
col = layout_box.column()
|
||||||
compression_layout.label(text='Compression: ')
|
col.prop(addon_data, 'render_resolution')
|
||||||
compression_layout.prop(addon_data, 'compression')
|
|
||||||
|
|
||||||
colordepth_layout = layout_box.row(align=True)
|
col = layout_box.column()
|
||||||
colordepth_layout.label(text='Color depth: ')
|
col.prop(addon_data, 'compression')
|
||||||
colordepth_layout.prop(addon_data, 'color_depth', text='')
|
|
||||||
|
|
||||||
samples_layout = layout_box.row(align=True)
|
col = layout_box.column()
|
||||||
samples_layout.label(text='Samples:')
|
col.prop(addon_data, 'color_depth')
|
||||||
samples_layout.prop(addon_data, 'render_samples', text='')
|
|
||||||
|
col = layout_box.column()
|
||||||
|
col.prop(addon_data, 'render_samples')
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
@ -162,7 +163,7 @@ class create_sculpt_plane(bpy.types.Operator):
|
|||||||
It uses 'Preserve corners' so further subdivisions can be made while the corners of the grid stay pointy.
|
It uses 'Preserve corners' so further subdivisions can be made while the corners of the grid stay pointy.
|
||||||
"""
|
"""
|
||||||
bl_idname = 'sculptplane.create'
|
bl_idname = 'sculptplane.create'
|
||||||
bl_label = 'Create sculpting plane'
|
bl_label = 'Create Sculpting Plane'
|
||||||
bl_description = 'Creates a plane with a multires modifier to sculpt on'
|
bl_description = 'Creates a plane with a multires modifier to sculpt on'
|
||||||
bl_options = {'REGISTER', 'UNDO'}
|
bl_options = {'REGISTER', 'UNDO'}
|
||||||
|
|
||||||
@ -292,7 +293,8 @@ class create_vdm_brush(bpy.types.Operator):
|
|||||||
|
|
||||||
vdm_plane.data.materials.clear()
|
vdm_plane.data.materials.clear()
|
||||||
|
|
||||||
bpy.ops.object.mode_set(mode='SCULPT') # Needs to be in sculpt mode to set 'AREA_PLANE' mapping on new brush.
|
# Needs to be in sculpt mode to set 'AREA_PLANE' mapping on new brush.
|
||||||
|
bpy.ops.object.mode_set(mode='SCULPT')
|
||||||
|
|
||||||
# Texture
|
# Texture
|
||||||
vdm_texture: bpy.types.Texture = None
|
vdm_texture: bpy.types.Texture = None
|
||||||
@ -313,7 +315,8 @@ class create_vdm_brush(bpy.types.Operator):
|
|||||||
else:
|
else:
|
||||||
new_brush = bpy.data.brushes.new(
|
new_brush = bpy.data.brushes.new(
|
||||||
name=new_brush_name, mode='SCULPT')
|
name=new_brush_name, mode='SCULPT')
|
||||||
self.report({'INFO'}, f'Created new draw brush \'{new_brush.name}\'')
|
self.report(
|
||||||
|
{'INFO'}, f'Created new draw brush \'{new_brush.name}\'')
|
||||||
|
|
||||||
new_brush.texture = vdm_texture
|
new_brush.texture = vdm_texture
|
||||||
new_brush.texture_slot.map_mode = 'AREA_PLANE'
|
new_brush.texture_slot.map_mode = 'AREA_PLANE'
|
||||||
|
Loading…
Reference in New Issue
Block a user