[Bf-blender-cvs] [daaf6d66606] sculpt-dev: Run autopep8 on a few files
Joseph Eagar
noreply at git.blender.org
Thu Sep 30 04:44:51 CEST 2021
Commit: daaf6d666068b9fbd81dee110a436f9d377b1817
Author: Joseph Eagar
Date: Wed Sep 29 19:44:40 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBdaaf6d666068b9fbd81dee110a436f9d377b1817
Run autopep8 on a few files
===================================================================
M release/scripts/startup/bl_ui/properties_paint_common.py
M release/scripts/startup/bl_ui/space_view3d.py
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 5d554cfbc9b..29c08b9ea81 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -17,6 +17,8 @@
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
+from bpy.types import Operator
+from bpy.props import IntProperty, StringProperty
from bpy.types import Menu, Panel
classes = []
@@ -28,7 +30,7 @@ class DynamicBrushCategoryPanel(Panel):
bl_category = "Tool"
@classmethod
- def poll(self, context):
+ def poll(self, context):
ok = context.mode == "SCULPT" and context.tool_settings.sculpt and context.tool_settings.sculpt.brush
ok = ok and len(self.get_channels(context)) > 0
@@ -37,7 +39,7 @@ class DynamicBrushCategoryPanel(Panel):
@classmethod
def get_channels(self, context):
brush = context.tool_settings.sculpt.brush
-
+
idname = self.get_category(self)
channels = list(filter(lambda ch: ch.show_in_workspace and ch.category == idname, brush.channels))
@@ -48,7 +50,7 @@ class DynamicBrushCategoryPanel(Panel):
def draw(self, context):
layout = self.layout
brush = context.tool_settings.sculpt.brush
-
+
idname = self.get_category()
opt = self.get_options()
@@ -59,19 +61,20 @@ class DynamicBrushCategoryPanel(Panel):
for ch in channels:
ok = ch.show_in_workspace
ok = ok and ch.category == idname
-
+
if not ok:
continue
-
+
UnifiedPaintPanel.channel_unified(
- layout,
- context,
+ layout,
+ context,
brush,
- ch.idname,
+ ch.idname,
slider=True,
ui_editing=opt["ui_editing"],
show_reorder=opt["show_reorder"])
-
+
+
class DynamicPaintPanelGen:
class Group:
def __init__(self, idname, name, prefix, parent):
@@ -81,9 +84,9 @@ class DynamicPaintPanelGen:
self.rnaclass = None
self.parent = parent
self.options = {}
-
+
groups = {}
-
+
@staticmethod
def ensureCategory(idname, name=None, prefix="VIEW3D_PT_brush_category_", parent=None, show_reorder=False, ui_editing=False):
if name is None:
@@ -97,21 +100,21 @@ class DynamicPaintPanelGen:
group = DynamicPaintPanelGen.Group(idname, name, prefix, parent)
DynamicPaintPanelGen.groups[groupid] = group
- group.options={
- "ui_editing" : ui_editing,
- "show_reorder" : show_reorder
+ group.options = {
+ "ui_editing": ui_editing,
+ "show_reorder": show_reorder
}
-
+
def callback():
print("creating panel")
DynamicPaintPanelGen.createPanel(group)
pass
-
+
import bpy
bpy.app.timers.register(callback)
-
+
return group
-
+
@staticmethod
def get(idname, prefix):
return DynamicPaintPanelGen.groups[idname]
@@ -122,7 +125,7 @@ class DynamicPaintPanelGen:
from bpy.types import Panel
global classes
-
+
name = group.prefix + group.idname.lower()
name2 = ""
@@ -140,14 +143,14 @@ class DynamicPaintPanelGen:
name = name2
for cls in classes[:]:
- print("_", cls.bl_rna.identifier, cls.bl_rna.identifier == name) #r, dir(cls.bl_rna)) #.name)
-
+ print("_", cls.bl_rna.identifier, cls.bl_rna.identifier == name) # r, dir(cls.bl_rna)) #.name)
+
if cls.bl_rna.identifier == name:
try:
unregister_class(cls)
except:
print("failed to unregister", name)
-
+
classes.remove(cls)
if group.parent:
@@ -164,7 +167,7 @@ global classes
class CLASSNAME (DynamicBrushCategoryPanel):
bl_label = "LABEL"
PARENT
-
+
def get_category(self):
return "IDNAME"
@@ -176,23 +179,25 @@ classes.append(CLASSNAME)
""".strip().replace("CLASSNAME", name).replace("PARENT", parent).replace("LABEL", group.name).replace("OPT", opt)
code = code.replace("IDNAME", group.idname)
-
+
print("\n", code)
- exec(code)
+ exec(code)
+
channel_name_map = {
- "size" : "radius",
- "autosmooth_fset_slide":"fset_slide",
+ "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_locked_size": "radius_unit"
+}
expand_channels = {"direction", "radius_unit", "automasking"}
+
def template_curve(layout, base, propname, full_path):
layout.template_curve_mapping(base, propname, brush=True)
@@ -209,6 +214,7 @@ def template_curve(layout, base, propname, full_path):
props.shape = shape
props.path = path
+
class UnifiedPaintPanel:
# subclass must set
# bl_space_type = 'IMAGE_EDITOR'
@@ -287,7 +293,7 @@ class UnifiedPaintPanel:
return None
@staticmethod
- def get_channel(context, brush, prop_name, toolsettings_only=False, need_path=False):
+ def get_channel(context, brush, prop_name, toolsettings_only=False, need_path=False):
ch = brush.channels[prop_name] if prop_name in brush.channels else None
path = None
@@ -299,7 +305,7 @@ class UnifiedPaintPanel:
sd = context.tool_settings.sculpt
if ch:
- #ensure channel exists in tool settings channel set
+ # ensure channel exists in tool settings channel set
sd.channels.ensure(ch)
ch = sd.channels[prop_name] if prop_name in sd.channels else None
@@ -317,7 +323,7 @@ class UnifiedPaintPanel:
if ch.inherit or toolsettings_only:
sd = context.tool_settings.sculpt
- #ensure channel exists in tool settings channel set
+ # ensure channel exists in tool settings channel set
sd.channels.ensure(ch)
ch = sd.channels[prop_name]
@@ -342,7 +348,6 @@ class UnifiedPaintPanel:
""" Generalized way of adding brush options to the UI,
along with their pen pressure setting and global toggle"""
-
if ui_editing is None:
ui_editing = True
ui_editing = ui_editing and not header
@@ -361,7 +366,7 @@ class UnifiedPaintPanel:
ch = brush.channels[prop_name]
- #dynamically switch to unprojected radius if necassary
+ # dynamically switch to unprojected radius if necassary
if prop_name == "radius":
size_mode = brush.channels["radius_unit"].enum_value == "SCENE"
if size_mode:
@@ -375,7 +380,7 @@ class UnifiedPaintPanel:
l1 = layout
- #if ch.ui_expanded:
+ # if ch.ui_expanded:
# layout = layout.box().column() #.column() is a bit more compact
if ch.type == "BITMASK":
@@ -383,7 +388,6 @@ class UnifiedPaintPanel:
row = layout.row(align=True)
-
if ch.type == "FLOAT":
typeprop = "float_value" if "spacing" in ch.idname else "factor_value"
if ch.type == "INT":
@@ -399,13 +403,13 @@ class UnifiedPaintPanel:
elif ch.type == "VEC4":
typeprop = "color4_value"
- if pressure == None:
+ if pressure is None:
pressure = ch.type not in ["VEC3", "VEC4", "BITMASK", "ENUM", "BOOL"]
if text is None:
text = ch.name
- if len(text) == 0: #auto-generate from idname
+ if len(text) == 0: # auto-generate from idname
s = prop_name.lower().replace("_", " ").split(" ")
text = ''
for k in s:
@@ -419,7 +423,7 @@ class UnifiedPaintPanel:
if ch.inherit or toolsettings_only:
sd = context.tool_settings.sculpt
- #ensure channel exists in tool settings channel set
+ # ensure channel exists in tool settings channel set
sd.channels.ensure(ch)
finalch = sd.channels[prop_name]
@@ -430,7 +434,7 @@ class UnifiedPaintPanel:
path = "tool_settings.sculpt.channels[\"%s\"]" % ch.idname
else:
path = "tool_settings.sculpt.brush.channels[\"%s\"]" % ch.idname
-
+
if show_reorder:
props = row.operator("brush.change_channel_order", text="", icon="TRIA_UP")
props.channel = ch.idname
@@ -441,7 +445,7 @@ class UnifiedPaintPanel:
props.filterkey = "show_in_workspace"
props.channel = ch.idname
props.direction = 1
-
+
if ui_editing and not header:
row.prop(ch, "show_in_workspace", text="", icon="HIDE_OFF")
row.prop(ch, "show_in_context_menu", text="", icon="MENU_PANEL")
@@ -449,7 +453,7 @@ class UnifiedPaintPanel:
if ch.type == "CURVE":
row.prop(finalch.curve, "curve_preset", text=text)
- if finalch.curve.curve_preset == "CUSTOM":
+ if finalch.curve.curve_preset == "CUSTOM":
path2 = path + ".curve.curve"
template_curve(layout, finalch.curve, "curve", path2)
@@ -458,7 +462,7 @@ class UnifiedPaintPanel:
row.label(text=text)
row.prop_menu_enum(finalch, typeprop, text=text)
else:
- #why is it so hard to make bitflag checkboxes?
+ # why is it so hard to make bitflag checkboxes?
row.label(text=text)
col = layout.row(align=True)
@@ -475,7 +479,7 @@ class UnifiedP
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list