Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-01-18 09:54:19 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-18 09:54:19 +0400
commit259b68f5c7455f57c67d6db50e727d0f02330c0c (patch)
treeb9d2381f6f673f17d81af73993e04ac1caa48fcc /release/scripts/startup/bl_ui/properties_paint_common.py
parent6a218612be7be727a9cad6b85b2f368d78c5c422 (diff)
de-duplicate paint parent class, added new py module for common paint UI classes/funcs --- since we'll likely have more of these.
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_paint_common.py')
-rw-r--r--release/scripts/startup/bl_ui/properties_paint_common.py61
1 files changed, 61 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
new file mode 100644
index 00000000000..25ea85a9a6a
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -0,0 +1,61 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+
+class UnifiedPaintPanel():
+ # subclass must set
+ # bl_space_type = 'IMAGE_EDITOR'
+ # bl_region_type = 'UI'
+
+ @staticmethod
+ def paint_settings(context):
+ toolsettings = context.tool_settings
+
+ if context.sculpt_object:
+ return toolsettings.sculpt
+ elif context.vertex_paint_object:
+ return toolsettings.vertex_paint
+ elif context.weight_paint_object:
+ return toolsettings.weight_paint
+ elif context.image_paint_object:
+ return toolsettings.image_paint
+ elif context.particle_edit_object:
+ return toolsettings.particle_edit
+
+ return None
+
+ @staticmethod
+ def unified_paint_settings(parent, context):
+ ups = context.tool_settings.unified_paint_settings
+ parent.label(text="Unified Settings:")
+ parent.prop(ups, "use_unified_size", text="Size")
+ parent.prop(ups, "use_unified_strength", text="Strength")
+
+ @staticmethod
+ def prop_unified_size(parent, context, brush, prop_name, icon='NONE', text="", slider=False):
+ ups = context.tool_settings.unified_paint_settings
+ ptr = ups if ups.use_unified_size else brush
+ parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)
+
+ @staticmethod
+ def prop_unified_strength(parent, context, brush, prop_name, icon='NONE', text="", slider=False):
+ ups = context.tool_settings.unified_paint_settings
+ ptr = ups if ups.use_unified_strength else brush
+ parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)