VDM brush baker #104580
@ -80,6 +80,10 @@ def get_output_path(filename):
|
|||||||
|
|
||||||
|
|
||||||
class PT_VDMBaker(bpy.types.Panel):
|
class PT_VDMBaker(bpy.types.Panel):
|
||||||
|
"""
|
||||||
|
The main panel of the add-on which contains a button to create a sculpting plane and a button to bake the vector displacement map.
|
||||||
|
It also has settings for name (image, texture and brush at once), resolution, compression and color depth.
|
||||||
|
"""
|
||||||
bl_label = 'VDM Brush Baker'
|
bl_label = 'VDM Brush Baker'
|
||||||
bl_idname = 'Editor_PT_LayoutPanel'
|
bl_idname = 'Editor_PT_LayoutPanel'
|
||||||
bl_space_type = 'VIEW_3D'
|
bl_space_type = 'VIEW_3D'
|
||||||
@ -140,6 +144,10 @@ def get_new_brush_name():
|
|||||||
|
|
||||||
|
|
||||||
class create_sculpt_plane(bpy.types.Operator):
|
class create_sculpt_plane(bpy.types.Operator):
|
||||||
|
"""
|
||||||
|
Creates a grid with 128 vertices per side plus two multires subdivisions.
|
||||||
|
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'
|
||||||
@ -160,6 +168,9 @@ class create_sculpt_plane(bpy.types.Operator):
|
|||||||
|
|
||||||
|
|
||||||
class create_vdm_brush(bpy.types.Operator):
|
class create_vdm_brush(bpy.types.Operator):
|
||||||
|
"""
|
||||||
|
This operator will bake a vector displacement map from the active object and create a texture and brush datablock.
|
||||||
|
"""
|
||||||
bl_idname = 'vdmbrush.create'
|
bl_idname = 'vdmbrush.create'
|
||||||
bl_label = 'Create vdm brush from plane'
|
bl_label = 'Create vdm brush from plane'
|
||||||
bl_description = 'Creates a vector displacement map from your sculpture and creates a brush with it'
|
bl_description = 'Creates a vector displacement map from your sculpture and creates a brush with it'
|
||||||
@ -281,7 +292,7 @@ class create_vdm_brush(bpy.types.Operator):
|
|||||||
|
|
||||||
vdm_plane.data.materials.clear()
|
vdm_plane.data.materials.clear()
|
||||||
|
|
||||||
bpy.ops.object.mode_set(mode='SCULPT')
|
bpy.ops.object.mode_set(mode='SCULPT') # Needs to be in sculpt mode to set 'AREA_PLANE' mapping on new brush.
|
||||||
|
|
||||||
# Texture
|
# Texture
|
||||||
vdm_texture: bpy.types.Texture = None
|
vdm_texture: bpy.types.Texture = None
|
||||||
|
@ -2,6 +2,11 @@ import bpy
|
|||||||
|
|
||||||
|
|
||||||
def get_vdm_bake_material():
|
def get_vdm_bake_material():
|
||||||
|
"""Creates a material that is used to bake the displacement from a plane against its UVs.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
material: Baking material
|
||||||
|
"""
|
||||||
material_name = 'VDM_baking_material'
|
material_name = 'VDM_baking_material'
|
||||||
if material_name not in bpy.data.materials:
|
if material_name not in bpy.data.materials:
|
||||||
new_material = bpy.data.materials.new(name=material_name)
|
new_material = bpy.data.materials.new(name=material_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user