[Bf-blender-cvs] [7dd11f2edcf] sculpt-dev: Sculpt: fix dyntopo mode dropdown menu
Joseph Eagar
noreply at git.blender.org
Tue Oct 5 09:29:09 CEST 2021
Commit: 7dd11f2edcf32262f32c4d159edffa51d2846113
Author: Joseph Eagar
Date: Tue Oct 5 00:28:19 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB7dd11f2edcf32262f32c4d159edffa51d2846113
Sculpt: fix dyntopo mode dropdown menu
Menu is now more intelligent about handling
brushes that use the "combine with scene defaults"
inheritance mode.
===================================================================
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 0911ee2162e..87bdddfb632 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1011,17 +1011,22 @@ class SCULPT_OT_set_dyntopo_mode(Operator):
brush = context.tool_settings.sculpt.brush
ch = UnifiedPaintPanel.get_channel(context, brush, "dyntopo_mode")
+ finalch = ch
+
+ if not brush.channels["dyntopo_mode"].inherit and ch.inherit_if_unset:
+ finalch = context.tool_settings.sculpt.channels["dyntopo_mode"]
+
oldf = set()
- for f in ch.flags_value:
+ for f in finalch.flags_value:
if f not in ["SUBDIVIDE", "COLLAPSE"]:
oldf.add(f)
if self.mode == "SC":
- ch.flags_value = oldf.union({"SUBDIVIDE", "COLLAPSE"})
+ finalch.flags_value = oldf.union({"SUBDIVIDE", "COLLAPSE"})
elif self.mode == "S":
- ch.flags_value = oldf.union({"SUBDIVIDE"})
+ finalch.flags_value = oldf.union({"SUBDIVIDE"})
elif self.mode == "C":
- ch.flags_value = oldf.union({"COLLAPSE"})
+ finalch.flags_value = oldf.union({"COLLAPSE"})
return {'FINISHED'}
@@ -1031,12 +1036,16 @@ def set_dyntopo_mode_button(layout, context):
ch = brush.channels["dyntopo_mode"]
finalch = UnifiedPaintPanel.get_channel(context, brush, "dyntopo_mode")
+ val = finalch.flags_value
+
+ if finalch.inherit_if_unset:
+ val = val.union(context.tool_settings.sculpt.channels["dyntopo_mode"].flags_value)
- if "SUBDIVIDE" in finalch.flags_value and "COLLAPSE" in finalch.flags_value:
+ if "SUBDIVIDE" in val and "COLLAPSE" in val:
text = "Subdivide Collapse"
- elif "SUBDIVIDE" in finalch.flags_value:
+ elif "SUBDIVIDE" in val:
text = "Subdivide Edges"
- elif "COLLAPSE" in finalch.flags_value:
+ elif "COLLAPSE" in val:
text = "Collapse Edges"
else:
text = ""
More information about the Bf-blender-cvs
mailing list