Sculpt-dev: fix a few broken panels and a crash
This commit is contained in:
parent
bf812abfcb
commit
4d54182159
|
@ -33,6 +33,25 @@ builtin_channel_categories = ["Cloth Tool",
|
|||
"Stroke",
|
||||
"Automasking"]
|
||||
|
||||
channel_name_map = {
|
||||
"size": "radius",
|
||||
"autosmooth_fset_slide": "fset_slide",
|
||||
"auto_smooth_factor": "autosmooth",
|
||||
"auto_smooth_projection": "autosmooth_projection",
|
||||
"auto_smooth_radius_factor": "autosmooth_radius_scale",
|
||||
"boundary_smooth_factor": "boundary_smooth",
|
||||
"autosmooth_fset_slide": "fset_slide",
|
||||
"topology_rake_factor": "topology_rake",
|
||||
"use_locked_size": "radius_unit",
|
||||
"use_cloth_collision" : "cloth_use_collision",
|
||||
"use_accumulate" : "accumulate"
|
||||
}
|
||||
expand_channels = {"direction", "radius_unit", "automasking"}
|
||||
name_channel_map = {}
|
||||
|
||||
for k, v in channel_name_map.items():
|
||||
name_channel_map[v] = k
|
||||
|
||||
class DynamicBrushCategoryPanel(Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
|
@ -258,21 +277,6 @@ for cat in builtin_channel_categories:
|
|||
DynamicPaintPanelGen.ensureCategory(cat, cat, prefix="VIEW3D_PT_brush_category_edit_",
|
||||
parent="VIEW3D_PT_tools_brush_settings_channels_preview").insertEachAfter(insertAfters)
|
||||
|
||||
channel_name_map = {
|
||||
"size": "radius",
|
||||
"autosmooth_fset_slide": "fset_slide",
|
||||
"auto_smooth_factor": "autosmooth",
|
||||
"auto_smooth_projection": "autosmooth_projection",
|
||||
"auto_smooth_radius_factor": "autosmooth_radius_scale",
|
||||
"boundary_smooth_factor": "boundary_smooth",
|
||||
"autosmooth_fset_slide": "fset_slide",
|
||||
"topology_rake_factor": "topology_rake",
|
||||
"use_locked_size": "radius_unit",
|
||||
"use_cloth_collision" : "cloth_use_collision"
|
||||
}
|
||||
expand_channels = {"direction", "radius_unit", "automasking"}
|
||||
|
||||
|
||||
def template_curve(layout, base, propname, full_path, use_negative_slope=None):
|
||||
layout.template_curve_mapping(base, propname, brush=True, use_negative_slope=use_negative_slope)
|
||||
|
||||
|
@ -447,6 +451,9 @@ class UnifiedPaintPanel:
|
|||
show_mappings = True
|
||||
|
||||
if context.mode != "SCULPT":
|
||||
if prop_name in name_channel_map:
|
||||
prop_name = name_channel_map[prop_name]
|
||||
|
||||
return UnifiedPaintPanel.prop_unified(layout, context, brush, prop_name, icon=icon, text=text, slider=slider, header=header, expand=expand)
|
||||
|
||||
if prop_name == "size":
|
||||
|
@ -1252,17 +1259,17 @@ def brush_settings(layout, context, brush, popover=False):
|
|||
|
||||
mode = UnifiedPaintPanel.get_brush_mode(context)
|
||||
|
||||
layout.prop(context.tool_settings.unified_paint_settings, "brush_editor_mode")
|
||||
layout.prop(context.tool_settings.unified_paint_settings, "brush_editor_advanced")
|
||||
|
||||
advanced = context.tool_settings.unified_paint_settings.brush_editor_advanced
|
||||
editor = context.tool_settings.unified_paint_settings.brush_editor_mode
|
||||
|
||||
### Draw simple settings unique to each paint mode. ###
|
||||
brush_shared_settings(layout, context, brush, popover)
|
||||
|
||||
# Sculpt Mode #
|
||||
if mode == 'SCULPT':
|
||||
layout.prop(context.tool_settings.unified_paint_settings, "brush_editor_mode")
|
||||
layout.prop(context.tool_settings.unified_paint_settings, "brush_editor_advanced")
|
||||
|
||||
advanced = context.tool_settings.unified_paint_settings.brush_editor_advanced
|
||||
editor = context.tool_settings.unified_paint_settings.brush_editor_mode
|
||||
|
||||
capabilities = brush.sculpt_capabilities
|
||||
sculpt_tool = brush.sculpt_tool
|
||||
|
||||
|
@ -2081,13 +2088,6 @@ def brush_settings_advanced(layout, context, brush, popover=False):
|
|||
|
||||
mode = UnifiedPaintPanel.get_brush_mode(context)
|
||||
|
||||
# In the popover we want to combine advanced brush settings with
|
||||
# non-advanced brush settings.
|
||||
if popover:
|
||||
brush_settings(layout, context, brush, popover=True)
|
||||
layout.separator()
|
||||
layout.label(text="Advanced")
|
||||
|
||||
# These options are shared across many modes.
|
||||
use_accumulate = False
|
||||
use_frontface = False
|
||||
|
|
|
@ -76,7 +76,10 @@ class VIEW3D_HT_tool_header(Header):
|
|||
is_valid_context = draw_fn(context, layout, tool)
|
||||
|
||||
def draw_3d_brush_settings(layout, tool_mode):
|
||||
layout.popover("VIEW3D_PT_tools_brush_settings_channels", text="Brush")
|
||||
if tool_mode == "SCULPT":
|
||||
layout.popover("VIEW3D_PT_tools_brush_settings_channels", text="Brush")
|
||||
else:
|
||||
layout.popover("VIEW3D_PT_tools_brush_settings", text="Brush")
|
||||
|
||||
if tool_mode not in ('PAINT_WEIGHT', 'SCULPT'):
|
||||
layout.popover("VIEW3D_PT_tools_brush_texture")
|
||||
|
|
|
@ -397,7 +397,6 @@ class VIEW3D_PT_tools_brush_settings(Panel, View3DPaintBrushPanel):
|
|||
|
||||
brush_settings(layout.column(), context, brush, popover=self.is_popover)
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_brush_settings_channels(Panel, View3DPaintBrushPanel):
|
||||
bl_context = ".paint_common"
|
||||
bl_label = "Brush Settings"
|
||||
|
@ -451,14 +450,45 @@ class VIEW3D_PT_tools_brush_settings_channels_preview(Panel, View3DPaintBrushPan
|
|||
prefix="VIEW3D_PT_brush_category_edit_",
|
||||
parent="VIEW3D_PT_tools_brush_settings_channels_preview")
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_brush_settings_advanced(Panel, View3DPaintBrushPanel):
|
||||
bl_context = ".brush_editor"
|
||||
bl_parent_id = "VIEW3D_PT_tools_brush_settings"
|
||||
bl_label = "Advanced"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_ui_units_x = 14
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if context.mode == 'SCULPT':
|
||||
return False
|
||||
|
||||
return View3DPaintBrushPanel.poll(cls, context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False # No animation.
|
||||
|
||||
settings = UnifiedPaintPanel.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
brush_settings_advanced(layout.column(), context, brush, self.is_popover)
|
||||
|
||||
class VIEW3D_PT_tools_brush_settings_advanced_sculpt(Panel, View3DPaintBrushPanel):
|
||||
bl_context = ".paint_common"
|
||||
#bl_parent_id = "VIEW3D_PT_tools_brush_settings"
|
||||
bl_label = "Advanced"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_ui_units_x = 14
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if context.mode != 'SCULPT':
|
||||
return False
|
||||
|
||||
return View3DPaintBrushPanel.poll(cls, context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
@ -2745,6 +2775,7 @@ classes = (VIEW3D_MT_brush_context_menu,
|
|||
VIEW3D_PT_tools_brush_color,
|
||||
VIEW3D_PT_tools_brush_swatches,
|
||||
VIEW3D_PT_tools_brush_settings_advanced,
|
||||
VIEW3D_PT_tools_brush_settings_advanced_sculpt,
|
||||
VIEW3D_PT_tools_brush_clone,
|
||||
TEXTURE_UL_texpaintslots,
|
||||
VIEW3D_MT_tools_projectpaint_uvlayer,
|
||||
|
|
|
@ -1795,6 +1795,13 @@ static void sculpt_update_object(Depsgraph *depsgraph,
|
|||
|
||||
PBVH *pbvh = BKE_sculpt_object_pbvh_ensure(depsgraph, ob);
|
||||
|
||||
if (BKE_pbvh_type(pbvh) == PBVH_FACES) {
|
||||
ss->vert_normals = BKE_pbvh_get_vert_normals(ss->pbvh);
|
||||
}
|
||||
else {
|
||||
ss->vert_normals = NULL;
|
||||
}
|
||||
|
||||
BLI_assert(pbvh == ss->pbvh);
|
||||
UNUSED_VARS_NDEBUG(pbvh);
|
||||
|
||||
|
|
Loading…
Reference in New Issue