[Bf-blender-cvs] [430e7efd095] sculpt-dev: Sculpt: Unnest channels.channels in RNA
Joseph Eagar
noreply at git.blender.org
Sat Sep 25 03:50:06 CEST 2021
Commit: 430e7efd0952527780e4349fb6fa0e31dff10486
Author: Joseph Eagar
Date: Fri Sep 24 18:47:24 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB430e7efd0952527780e4349fb6fa0e31dff10486
Sculpt: Unnest channels.channels in RNA
* BrushChannelSet is now a pure collection. This
eliminated the annoying brush.channels.channels
paths, and also makes library overriding work.
* Now sure I've done this correctly. Struct extended
collection properties are a bit confusing.
===================================================================
M release/scripts/presets/keyconfig/keymap_data/blender_default.py
M release/scripts/startup/bl_ui/properties_paint_common.py
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/blenkernel/BKE_brush_engine.h
M source/blender/blenkernel/intern/brush.c
M source/blender/blenkernel/intern/brush_channel_define.h
M source/blender/blenkernel/intern/brush_engine.c
M source/blender/blenkernel/intern/brush_engine_presets.c
M source/blender/blenkernel/intern/lib_override.c
M source/blender/blenkernel/intern/scene.c
M source/blender/blenloader/intern/versioning_cpp.cc
M source/blender/blenloader/intern/versioning_userdef.c
M source/blender/makesrna/intern/rna_access_compare_override.c
M source/blender/makesrna/intern/rna_brush.c
M source/blender/makesrna/intern/rna_brush_engine.c
M source/blender/makesrna/intern/rna_internal.h
M source/blender/makesrna/intern/rna_rna.c
M source/blender/makesrna/intern/rna_sculpt_paint.c
===================================================================
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index cd3f78e7342..1e74f5b705d 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -4301,8 +4301,8 @@ def km_curve(params):
def radial_control_properties_channels(paint, prop, secondary_prop, secondary_rotation=False, color=False, zoom=False, type="float"):
brush_path = 'tool_settings.' + paint + '.brush'
- channels_path = brush_path + ".channels.channels"
- unified = "tool_settings." + paint + ".channels.channels"
+ channels_path = brush_path + ".channels"
+ unified = "tool_settings." + paint + ".channels"
rotation = 'mask_texture_slot_angle' if secondary_rotation else 'texture_slot_angle'
return {
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index b99e071835a..be3e115b9a8 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -127,25 +127,25 @@ class UnifiedPaintPanel:
@staticmethod
def get_channel(context, brush, prop_name, toolsettings_only=False):
- ch = brush.channels.channels[prop_name]
+ ch = brush.channels[prop_name]
if ch.inherit or toolsettings_only:
sd = context.tool_settings.sculpt
#ensure channel exists in tool settings channel set
sd.channels.ensure(ch)
- ch = sd.channels.channels[prop_name]
+ ch = sd.channels[prop_name]
return ch
@staticmethod
def get_channel_value(context, brush, prop_name, toolsettings_only=False):
- ch = brush.channels.channels[prop_name]
+ ch = brush.channels[prop_name]
if ch.inherit or toolsettings_only:
sd = context.tool_settings.sculpt
#ensure channel exists in tool settings channel set
sd.channels.ensure(ch)
- ch = sd.channels.channels[prop_name]
+ ch = sd.channels[prop_name]
if ch.type == "FLOAT":
return ch.float_value
@@ -176,14 +176,14 @@ class UnifiedPaintPanel:
elif prop_name == "use_locked_size":
prop_name = "radius_unit"
- ch = brush.channels.channels[prop_name]
+ ch = brush.channels[prop_name]
#dynamically switch to unprojected radius if necassary
if prop_name == "radius":
- size_mode = brush.channels.channels["radius_unit"].enum_value == "SCENE"
+ size_mode = brush.channels["radius_unit"].enum_value == "SCENE"
if size_mode:
prop_name = "unprojected_radius"
- ch = brush.channels.channels[prop_name]
+ ch = brush.channels[prop_name]
finalch = ch
@@ -236,14 +236,14 @@ class UnifiedPaintPanel:
#ensure channel exists in tool settings channel set
sd.channels.ensure(ch)
- finalch = sd.channels.channels[prop_name]
+ finalch = sd.channels[prop_name]
if ch.mappings["PRESSURE"].inherit:
pressurech = finalch
is_toolset = True
- path = "tool_settings.sculpt.channels.channels[\"%s\"]" % ch.idname
+ path = "tool_settings.sculpt.channels[\"%s\"]" % ch.idname
else:
- path = "tool_settings.sculpt.brush.channels.channels[\"%s\"]" % ch.idname
+ path = "tool_settings.sculpt.brush.channels[\"%s\"]" % ch.idname
if show_reorder:
props = row.operator("brush.change_channel_order", text="", icon="TRIA_UP")
@@ -388,7 +388,7 @@ class UnifiedPaintPanel:
if prop_name in channel_name_map:
prop_name = channel_name_map[prop_name]
- if prop_name in brush.channels.channels:
+ if prop_name in brush.channels:
# def channel_unified(layout, context, brush, prop_name, icon='NONE', pressure=True, text=None, slider=False, header=False):
return UnifiedPaintPanel.channel_unified(layout, context, brush, prop_name, icon=icon, text=text, slider=slider, header=header)
@@ -833,10 +833,22 @@ def brush_settings(layout, context, brush, popover=False):
sculpt_tool = brush.sculpt_tool
# normal_radius_factor
- layout.prop(brush, "normal_radius_factor", slider=True)
+ UnifiedPaintPanel.prop_unified(
+ layout,
+ context,
+ brush,
+ "normal_radius_factor",
+ slider=True,
+ )
if context.preferences.experimental.use_sculpt_tools_tilt and capabilities.has_tilt:
- layout.prop(brush, "tilt_strength_factor", slider=True)
+ UnifiedPaintPanel.prop_unified(
+ layout,
+ context,
+ brush,
+ "tilt_strength_factor",
+ slider=True,
+ )
UnifiedPaintPanel.prop_unified(
layout,
@@ -855,7 +867,7 @@ def brush_settings(layout, context, brush, popover=False):
# auto_smooth_factor and use_inverse_smooth_pressure
if capabilities.has_auto_smooth:
- box = layout.box().column() #.column() is a bit more compact
+ box = layout.column() #.column() is a bit more compact
UnifiedPaintPanel.prop_unified(
box,
@@ -925,7 +937,7 @@ def brush_settings(layout, context, brush, popover=False):
capabilities.has_topology_rake and
context.sculpt_object.use_dynamic_topology_sculpting
):
- box = layout.box().column() #.column() is a bit more compact
+ box = layout.column() #.column() is a bit more compact
#box.prop(brush, "topology_rake_factor", slider=True)
UnifiedPaintPanel.prop_unified(
@@ -938,7 +950,7 @@ def brush_settings(layout, context, brush, popover=False):
)
box.prop(brush, "use_custom_topology_rake_spacing", text="Custom Spacing")
- if brush.channels.channels["topology_rake_use_spacing"].bool_value:
+ if brush.channels["topology_rake_use_spacing"].bool_value:
UnifiedPaintPanel.prop_unified(
box,
context,
@@ -1226,7 +1238,7 @@ def brush_settings(layout, context, brush, popover=False):
#col.prop(brush, "use_weighted_smooth")
#col.prop(brush, "preserve_faceset_boundary")
- if brush.channels.channels["preserve_faceset_boundary"].bool_value:
+ if brush.channels["preserve_faceset_boundary"].bool_value:
UnifiedPaintPanel.channel_unified(
layout,
context,
@@ -1426,7 +1438,7 @@ class ReorderBrushChannel(Operator):
brush = ts.sculpt.brush
- channels = brush.channels.channels
+ channels = brush.channels
if self.channel not in channels:
print("bad channel ", self.channel)
return {'CANCELLED'}
@@ -1465,7 +1477,7 @@ class ReorderBrushChannel(Operator):
return {'FINISHED'}
def brush_settings_channels(layout, context, brush, ui_editing=False, popover=False, filterkey="show_in_workspace"):
- channels = get_ui_channels(brush.channels.channels, [filterkey])
+ channels = get_ui_channels(brush.channels, [filterkey])
for ch in channels:
UnifiedPaintPanel.channel_unified(
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 01ce12ac580..071e3d269c8 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -833,7 +833,7 @@ class VIEW3D_PT_sculpt_dyntopo_advanced(Panel, View3DPaintPanel):
brush = context.tool_settings.sculpt.brush
- ch = brush.channels.channels["dyntopo_mode"]
+ ch = brush.channels["dyntopo_mode"]
if ch.inherit:
row = layout.row()
@@ -959,7 +959,7 @@ class SCULPT_OT_set_dyntopo_mode (Operator):
def set_dyntopo_mode_button(layout, context):
brush = context.tool_settings.sculpt.brush
- ch = brush.channels.channels["dyntopo_mode"]
+ ch = brush.channels["dyntopo_mode"]
finalch = UnifiedPaintPanel.get_channel(context, brush, "dyntopo_mode")
if "SUBDIVIDE" in finalch.flags_value and "COLLAPSE" in finalch.flags_value:
diff --git a/source/blender/blenkernel/BKE_brush_engine.h b/source/blender/blenkernel/BKE_brush_engine.h
index 97b4902fd3c..f1fcbf80610 100644
--- a/source/blender/blenkernel/BKE_brush_engine.h
+++ b/source/blender/blenkernel/BKE_brush_engine.h
@@ -50,6 +50,9 @@ This should completely replace UnifiedPaintSettings.
struct BrushChannel;
struct BlendWriter;
struct BlendDataReader;
+struct BlendLibReader;
+struct ID;
+struct BlendExpander;
struct Brush;
struct Sculpt;
@@ -264,6 +267,14 @@ void BKE_builtin_commandlist_create(struct Brush *brush,
BrushMappingData *map_data); // map_data may be NULL
void BKE_brush_channelset_read(struct BlendDataReader *reader, BrushChannelSet *cset);
void BKE_brush_channelset_write(struct BlendWriter *writer, BrushChannelSet *cset);
+void BKE_brush_channelset_read_lib(struct BlendLibReader *reader,
+ struct ID *id,
+ BrushChannelSet *chset);
+void BKE_brush_channelset_expand(struct BlendExpander *expander,
+ struct ID *id,
+ BrushChannelSet *chset);
+void BKE_brush_channelset_foreach_id(struct LibraryForeachIDData *data, BrushChannelSet *chset);
+
void BKE_brush_mapping_copy_data(BrushMapping *dst, BrushMapping *src);
const char *BKE_brush_mapping_type_to_str(BrushMappingType mapping);
const char *BKE_brush_mapping_type_to_typename(BrushMappingType mapping);
diff --git a/source/blender/blenkern
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list