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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlijenstina <lijenstina@gmail.com>2017-04-15 04:25:47 +0300
committerlijenstina <lijenstina@gmail.com>2017-04-15 04:25:47 +0300
commit5f883054ce5904d4d1fb34216530b6df9cb04a81 (patch)
tree47347e37c844733b81f44dbe2dea53a6b27172ee /paint_palette.py
parentb7b4e2fbe72a69a7f24b1d7dcb4baf0975606f8a (diff)
Paint Palletes: Cleanup, refactor some code
Bumped version to 0.9.2 Pep8 cleanup Remove star imports Imports as tuples Consistent props definitions Refactor the VIEW3D_OT_reset_weight_palette operator and VIEW3D_PT_weight_palette panel removing if else walls Fix crash with trying to save a preset into a non existing path Small UI fixes (introduce the active icon in the palette menu) Update some tooltips Update links
Diffstat (limited to 'paint_palette.py')
-rw-r--r--paint_palette.py534
1 files changed, 263 insertions, 271 deletions
diff --git a/paint_palette.py b/paint_palette.py
index c343978b..2a221cc4 100644
--- a/paint_palette.py
+++ b/paint_palette.py
@@ -1,34 +1,33 @@
# paint_palette.py (c) 2011 Dany Lebel (Axon_D)
+
+# ##### BEGIN GPL LICENSE BLOCK #####
#
-# ***** 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 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.
+# 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.
+# 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 LICENCE BLOCK *****
+# ##### END GPL LICENSE BLOCK #####
bl_info = {
"name": "Paint Palettes",
"author": "Dany Lebel (Axon D)",
- "version": (0, 9, 1),
+ "version": (0, 9, 2),
"blender": (2, 63, 0),
"location": "Image Editor and 3D View > Any Paint mode > Color Palette or Weight Palette panel",
"description": "Palettes for color and weight paint modes",
"warning": "",
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
+ "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
"Scripts/Paint/Palettes",
"category": "Paint",
}
@@ -44,7 +43,21 @@ with the brush by using the button under the color.
"""
import bpy
-from bpy.props import *
+from bpy.types import (
+ Operator,
+ Menu,
+ Panel,
+ PropertyGroup,
+ )
+from bpy.props import (
+ BoolProperty,
+ FloatProperty,
+ FloatVectorProperty,
+ IntProperty,
+ StringProperty,
+ PointerProperty,
+ CollectionProperty,
+ )
def update_panels():
@@ -55,6 +68,7 @@ def update_panels():
brush.color = current_color
pp.index = pp.current_color_index
+
def sample():
pp = bpy.context.scene.palette_props
current_color = pp.colors[pp.current_color_index]
@@ -62,15 +76,16 @@ def sample():
current_color.color = brush.color
return None
+
def current_brush():
context = bpy.context
if context.area.type == 'VIEW_3D' and context.vertex_paint_object:
brush = context.tool_settings.vertex_paint.brush
elif context.area.type == 'VIEW_3D' and context.image_paint_object:
brush = context.tool_settings.image_paint.brush
- elif context.area.type == 'IMAGE_EDITOR' and context.space_data.mode == 'PAINT':
+ elif context.area.type == 'IMAGE_EDITOR' and context.space_data.mode == 'PAINT':
brush = context.tool_settings.image_paint.brush
- else :
+ else:
brush = None
return brush
@@ -82,7 +97,7 @@ def update_weight_value():
return None
-class PALETTE_MT_menu(bpy.types.Menu):
+class PALETTE_MT_menu(Menu):
bl_label = "Presets"
preset_subdir = ""
preset_operator = "palette.load_gimp_palette"
@@ -98,7 +113,7 @@ class PALETTE_MT_menu(bpy.types.Menu):
layout.label("* Missing Paths *")
# collect paths
- else :
+ else:
files = []
for directory in searchpaths:
files.extend([(f, os.path.join(directory, f)) for f in os.listdir(directory)])
@@ -153,8 +168,6 @@ class LoadGimpPalette(bpy.types.Operator):
preset_class = getattr(bpy.types, self.menu_idname)
preset_class.bl_label = bpy.path.display_name(basename(filepath))
-
- ts = bpy.context.tool_settings
palette_props.columns = 0
if filepath[-4:] == ".gpl":
gpl = open(filepath, "r")
@@ -170,9 +183,9 @@ class LoadGimpPalette(bpy.types.Operator):
palette_props.columns = int(line[8:])
elif line[0] == "#":
palette_props.notes += line
- else :
+ else:
has_color = True
- #index_0 = i
+ # index_0 = i
break
i = -1
if has_color:
@@ -181,7 +194,7 @@ class LoadGimpPalette(bpy.types.Operator):
palette_props.colors[i]
except IndexError:
palette_props.colors.add()
- color = [float(rgb)/255 for rgb in [ln[0:3], ln[4:7], ln[8:11]]]
+ color = [float(rgb) / 255 for rgb in [ln[0: 3], ln[4: 7], ln[8: 11]]]
palette_props.colors[i].color = color
@@ -195,7 +208,7 @@ class LoadGimpPalette(bpy.types.Operator):
update_panels()
gpl.close()
pass
- else :
+ else:
self.report({'INFO'}, "Not a supported palette format")
return {'FINISHED'}
@@ -206,14 +219,17 @@ class WriteGimpPalette():
subclasses must define
- preset_values
- preset_subdir """
- bl_options = {'REGISTER'} # only because invoke_props_popup requires.
-
-
-
- name = bpy.props.StringProperty(name="Name",
- description="Name of the preset, used to make the path name",
- maxlen=64, default="")
- remove_active = bpy.props.BoolProperty(default=False, options={'HIDDEN'})
+ bl_options = {'REGISTER'} # only because invoke_props_popup requires
+
+ name = StringProperty(
+ name="Name",
+ description="Name of the preset, used to make the path name",
+ maxlen=64, default=""
+ )
+ remove_active = BoolProperty(
+ default=False,
+ options={'HIDDEN'}
+ )
@staticmethod
def as_filename(name): # could reuse for other presets
@@ -242,7 +258,13 @@ class WriteGimpPalette():
self.report({'WARNING'}, "Failed to create presets path")
return {'CANCELLED'}
+ if not os.path.exists(target_path):
+ self.report({'WARNING'},
+ "Failure to open the saved Palletes Folder. Check if the path exists")
+ return {'CANCELLED'}
+
filepath = os.path.join(target_path, filename) + ".gpl"
+
file_preset = open(filepath, 'wb')
gpl = "GIMP Palette\n"
gpl += "Name: %s\n" % filename
@@ -250,7 +272,8 @@ class WriteGimpPalette():
gpl += pp.notes
if pp.colors.items():
for i, color in enumerate(pp.colors):
- gpl += "%3d%4d%4d %s" % (color.color.r * 255, color.color.g * 255, color.color.b * 255, color.name + '\n')
+ gpl += "%3d%4d%4d %s" % (color.color.r * 255, color.color.g * 255,
+ color.color.b * 255, color.name + '\n')
file_preset.write(bytes(gpl, 'UTF-8'))
file_preset.close()
@@ -298,22 +321,21 @@ class WriteGimpPalette():
return self.execute(context)
-class AddPresetPalette(WriteGimpPalette, bpy.types.Operator):
- """Add a Palette Preset"""
+class AddPresetPalette(WriteGimpPalette, Operator):
bl_idname = "palette.preset_add"
bl_label = "Add Palette Preset"
preset_menu = "PALETTE_MT_menu"
+ bl_description = "Add a Palette Preset"
preset_defines = []
preset_values = []
preset_subdir = "palette"
-class PALETTE_OT_add_color(bpy.types.Operator):
+class PALETTE_OT_add_color(Operator):
+ bl_idname = "palette_props.add_color"
bl_label = ""
bl_description = "Add a Color to the Palette"
- bl_idname = "palette_props.add_color"
-
def execute(self, context):
pp = bpy.context.scene.palette_props
@@ -324,81 +346,82 @@ class PALETTE_OT_add_color(bpy.types.Operator):
last = pp.colors.__len__() - 1
-
pp.colors.move(last, new_index)
pp.current_color_index = new_index
sample()
update_panels()
+
return {'FINISHED'}
-class PALETTE_OT_remove_color(bpy.types.Operator):
+class PALETTE_OT_remove_color(Operator):
+ bl_idname = "palette_props.remove_color"
bl_label = ""
bl_description = "Remove Selected Color"
- bl_idname = "palette_props.remove_color"
@classmethod
def poll(cls, context):
pp = bpy.context.scene.palette_props
return bool(pp.colors.items())
-
def execute(self, context):
- pp = bpy.context.scene.palette_props
+ pp = context.scene.palette_props
i = pp.current_color_index
pp.colors.remove(i)
if pp.current_color_index >= pp.colors.__len__():
pp.index = pp.current_color_index = pp.colors.__len__() - 1
+
return {'FINISHED'}
-class PALETTE_OT_sample_tool_color(bpy.types.Operator):
+class PALETTE_OT_sample_tool_color(Operator):
+ bl_idname = "palette_props.sample_tool_color"
bl_label = ""
bl_description = "Sample Tool Color"
- bl_idname = "palette_props.sample_tool_color"
def execute(self, context):
- pp = bpy.context.scene.palette_props
+ pp = context.scene.palette_props
brush = current_brush()
pp.colors[pp.current_color_index].color = brush.color
+
return {'FINISHED'}
-class IMAGE_OT_select_color(bpy.types.Operator):
+class IMAGE_OT_select_color(Operator):
+ bl_idname = "paint.select_color"
bl_label = ""
bl_description = "Select this color"
- bl_idname = "paint.select_color"
bl_options = {'UNDO'}
-
color_index = IntProperty()
def invoke(self, context, event):
- palette_props = bpy.context.scene.palette_props
+ palette_props = context.scene.palette_props
palette_props.current_color_index = self.color_index
update_panels()
+
return {'FINISHED'}
def color_palette_draw(self, context):
palette_props = bpy.context.scene.palette_props
-
layout = self.layout
-
-
bpy.types.PALETTE_MT_menu.preset_subdir = palette_props.presets_folder
+
row = layout.row(align=True)
row.menu("PALETTE_MT_menu", text=palette_props.palette_name.rstrip())
row.operator("palette.preset_add", text="", icon="ZOOMIN")
row.operator("palette.preset_add", text="", icon="ZOOMOUT").remove_active = True
+
col = layout.column(align=True)
row = col.row(align=True)
row.operator("palette_props.add_color", icon="ZOOMIN")
row.prop(palette_props, "index")
row.operator("palette_props.remove_color", icon="PANEL_CLOSE")
+
row = col.row(align=True)
row.prop(palette_props, "columns")
if palette_props.colors.items():
@@ -411,22 +434,21 @@ def color_palette_draw(self, context):
if palette_props.columns:
columns = palette_props.columns
- else :
+ else:
columns = 16
+
for i, color in enumerate(palette_props.colors):
if not i % columns:
row1 = laycol.row(align=True)
row1.scale_y = 0.8
row2 = laycol.row(align=True)
- row2.scale_y = 0.5
-
- if i == palette_props.current_color_index:
+ row2.scale_y = 0.8
- row1.prop(palette_props.colors[i], "color", event=True, toggle=True)
- row2.operator("paint.select_color", emboss=False).color_index = i
- else :
- row1.prop(palette_props.colors[i], "color", event=True, toggle=True)
- row2.operator("paint.select_color").color_index = i
+ active = True if i == palette_props.current_color_index else False
+ icons = "LAYER_ACTIVE" if active else "LAYER_USED"
+ row1.prop(palette_props.colors[i], "color", event=True, toggle=True)
+ row2.operator("paint.select_color", text=" ",
+ emboss=active, icon=icons).color_index = i
layout = self.layout
row = layout.row()
@@ -464,7 +486,7 @@ class PaintPanel():
return None
-class IMAGE_PT_color_palette(BrushButtonsPanel, bpy.types.Panel):
+class IMAGE_PT_color_palette(BrushButtonsPanel, Panel):
bl_label = "Color Palette"
bl_options = {'DEFAULT_CLOSED'}
@@ -472,7 +494,7 @@ class IMAGE_PT_color_palette(BrushButtonsPanel, bpy.types.Panel):
color_palette_draw(self, context)
-class VIEW3D_PT_color_palette(PaintPanel, bpy.types.Panel):
+class VIEW3D_PT_color_palette(PaintPanel, Panel):
bl_label = "Color Palette"
bl_options = {'DEFAULT_CLOSED'}
@@ -484,10 +506,10 @@ class VIEW3D_PT_color_palette(PaintPanel, bpy.types.Panel):
color_palette_draw(self, context)
-class VIEW3D_OT_select_weight(bpy.types.Operator):
- bl_label = ""
- bl_description = "Select this weight"
+class VIEW3D_OT_select_weight(Operator):
bl_idname = "paint.select_weight"
+ bl_label = ""
+ bl_description = "Select this weight value slot"
bl_options = {'UNDO'}
weight_index = IntProperty()
@@ -519,8 +541,7 @@ class VIEW3D_OT_select_weight(bpy.types.Operator):
return weight
def invoke(self, context, event):
- palette_props = bpy.context.scene.palette_props
-
+ palette_props = context.scene.palette_props
palette_props.current_weight_index = self.weight_index
if self.weight_index == 0:
@@ -546,64 +567,42 @@ class VIEW3D_OT_select_weight(bpy.types.Operator):
elif self.weight_index == 10:
weight = palette_props.weight_10
palette_props.weight = weight
- #bpy.context.tool_settings.vertex_group_weight = weight
+
return {'FINISHED'}
-class VIEW3D_OT_reset_weight_palette(bpy.types.Operator):
- bl_label = ""
+class VIEW3D_OT_reset_weight_palette(Operator):
bl_idname = "paint.reset_weight_palette"
-
+ bl_label = ""
+ bl_description = "Reset the active Weight slot to it's default value"
def execute(self, context):
- palette_props = context.scene.palette_props
-
- if palette_props.current_weight_index == 0:
- palette_props.weight = 0.0
- palette_props.weight_0 = 0.0
-
- palette_props.weight_1 = 0.1
- if palette_props.current_weight_index == 1:
- palette_props.weight = 0.1
+ try:
+ palette_props = context.scene.palette_props
+ dict_defs = {0: 0.0, 1: 0.1, 2: 0.25,
+ 3: 0.333, 4: 0.4, 5: 0.5,
+ 6: 0.6, 7: 0.6666, 8: 0.75,
+ 9: 0.9, 10: 1.0
+ }
+ current_idx = palette_props.current_weight_index
+ palette_props.weight = dict_defs[current_idx]
- if palette_props.current_weight_index == 2:
- palette_props.weight = 0.25
- palette_props.weight_2 = 0.25
+ var_name = "weight_" + str(current_idx)
+ var_to_change = getattr(palette_props, var_name, None)
+ if var_to_change:
+ var_to_change = dict_defs[current_idx]
- if palette_props.current_weight_index == 3:
- palette_props.weight = 0.3333
- palette_props.weight_3 = 0.3333
+ return {'FINISHED'}
- if palette_props.current_weight_index == 4:
- palette_props.weight = 0.4
- palette_props.weight_4 = 0.4
+ except Exception as e:
+ self.report({'WARNING'},
+ "Reset Weight pallete could not be completed (See Console for more info)")
+ print("\n[Paint Palette]\nOperator: paint.reset_weight_palette\nError: %s\n" % e)
- if palette_props.current_weight_index == 5:
- palette_props.weight = 0.5
- palette_props.weight_5 = 0.5
+ return {'CANCELLED'}
- if palette_props.current_weight_index == 6:
- palette_props.weight = 0.6
- palette_props.weight_6 = 0.6
-
- if palette_props.current_weight_index == 7:
- palette_props.weight = 0.6666
- palette_props.weight_7 = 0.6666
-
- if palette_props.current_weight_index == 8:
- palette_props.weight = 0.75
- palette_props.weight_8 = 0.75
-
- if palette_props.current_weight_index == 9:
- palette_props.weight = 0.9
- palette_props.weight_9 = 0.9
-
- if palette_props.current_weight_index == 10:
- palette_props.weight = 1.0
- palette_props.weight_10 = 1.0
- return {'FINISHED'}
-class VIEW3D_PT_weight_palette(PaintPanel, bpy.types.Panel):
+class VIEW3D_PT_weight_palette(PaintPanel, Panel):
bl_label = "Weight Palette"
bl_options = {'DEFAULT_CLOSED'}
@@ -612,115 +611,59 @@ class VIEW3D_PT_weight_palette(PaintPanel, bpy.types.Panel):
return context.weight_paint_object
def draw(self, context):
- palette_props = bpy.context.scene.palette_props
- #vertex_group_weight = bpy.context.tool_settings.unified_paint_settings.weight
+ palette_props = context.scene.palette_props
layout = self.layout
row = layout.row()
row.prop(palette_props, "weight", slider=True)
box = layout.box()
- row = box.row()
- if palette_props.current_weight_index == 0:
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_0,
- emboss=False).weight_index = 0
- else :
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_0,
- emboss=True).weight_index = 0
-
- row = box.row(align=True)
- if palette_props.current_weight_index == 1:
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_1,
- emboss=False).weight_index = 1
- else :
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_1,
- emboss=True).weight_index = 1
-
- if palette_props.current_weight_index == 2:
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_2,
- emboss=False).weight_index = 2
- else :
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_2,
- emboss=True).weight_index = 2
-
- if palette_props.current_weight_index == 3:
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_3,
- emboss=False).weight_index = 3
- else :
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_3,
- emboss=True).weight_index = 3
-
- row = box.row(align=True)
- if palette_props.current_weight_index == 4:
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_4,
- emboss=False).weight_index = 4
- else :
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_4,
- emboss=True).weight_index = 4
-
- if palette_props.current_weight_index == 5:
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_5,
- emboss=False).weight_index = 5
- else :
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_5,
- emboss=True).weight_index = 5
-
- if palette_props.current_weight_index == 6:
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_6,
- emboss=False).weight_index = 6
- else :
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_6,
- emboss=True).weight_index = 6
-
- row = box.row(align=True)
- if palette_props.current_weight_index == 7:
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_7,
- emboss=False).weight_index = 7
- else :
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_7,
- emboss=True).weight_index = 7
-
- if palette_props.current_weight_index == 8:
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_8,
- emboss=False).weight_index = 8
- else :
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_8,
- emboss=True).weight_index = 8
-
- if palette_props.current_weight_index == 9:
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_9,
- emboss=False).weight_index = 9
- else :
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_9,
- emboss=True).weight_index = 9
-
- row = box.row(align=True)
- if palette_props.current_weight_index == 10:
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_10,
- emboss=False).weight_index = 10
- else :
- row.operator("paint.select_weight", text="%.2f" % palette_props.weight_10,
- emboss=True).weight_index = 10
+ selected_weight = palette_props.current_weight_index
+ for props in range(0, 11):
+ embossed = False if props == selected_weight else True
+ prop_name = "weight_" + str(props)
+ prop_value = getattr(palette_props, prop_name, "")
+ if props in (0, 10):
+ row = box.row(align=True)
+ elif (props + 2) % 3 == 0:
+ col = box.column(align=True)
+ row = col.row(align=True)
+ else:
+ if props == 1:
+ row = box.row(align=True)
+ row = row.row(align=True)
+
+ row.operator("paint.select_weight", text="%.2f" % prop_value,
+ emboss=embossed).weight_index = props
row = layout.row()
row.operator("paint.reset_weight_palette", text="Reset")
-class Colors(bpy.types.PropertyGroup):
+class Colors(PropertyGroup):
"""Class for colors CollectionProperty"""
- color = bpy.props.FloatVectorProperty(
- name="", description="", default=(0.8, 0.8, 0.8), min=0, max=1,
- step=1, precision=3, subtype='COLOR_GAMMA', size=3)
-
-
-class Weights(bpy.types.PropertyGroup):
+ color = FloatVectorProperty(
+ name="",
+ description="",
+ default=(0.8, 0.8, 0.8),
+ min=0, max=1,
+ step=1, precision=3,
+ subtype='COLOR_GAMMA',
+ size=3
+ )
+
+
+class Weights(PropertyGroup):
"""Class for Weights Collection Property"""
-
- weight = bpy.props.FloatProperty(
- default=0.0, min=0.0, max=1.0, precision=3)
+ weight = FloatProperty(
+ default=0.0,
+ min=0.0,
+ max=1.0,
+ precision=3
+ )
-class PaletteProps(bpy.types.PropertyGroup):
+class PaletteProps(PropertyGroup):
def update_color_name(self, context):
pp = bpy.context.scene.palette_props
@@ -732,6 +675,7 @@ class PaletteProps(bpy.types.PropertyGroup):
if pp.colors.items() and pp.current_color_index != pp.index:
if pp.index >= pp.colors.__len__():
pp.index = pp.colors.__len__() - 1
+
pp.colors.move(pp.current_color_index, pp.index)
pp.current_color_index = pp.index
return None
@@ -762,73 +706,128 @@ class PaletteProps(bpy.types.PropertyGroup):
elif pp.current_weight_index == 10:
pp.weight_10 = weight
bpy.context.tool_settings.unified_paint_settings.weight = weight
- #bpy.context.tool_settings.vertex_group_weight = weight
return None
palette_name = StringProperty(
- name="Palette Name", default="Preset", subtype='FILE_NAME')
-
+ name="Palette Name",
+ default="Preset",
+ subtype='FILE_NAME'
+ )
color_name = StringProperty(
- name="", description="Color Name", default="Untitled", update=update_color_name)
-
+ name="",
+ description="Color Name",
+ default="Untitled",
+ update=update_color_name
+ )
columns = IntProperty(
- name="Columns",
- description="Number of Columns",
- min=0, max=16, default=0)
-
+ name="Columns",
+ description="Number of Columns",
+ min=0, max=16,
+ default=0
+ )
index = IntProperty(
- name="Index",
- description="Move Selected Color",
- min=0,
- update=move_color)
-
+ name="Index",
+ description="Move Selected Color",
+ min=0,
+ update=move_color
+ )
notes = StringProperty(
- name="Palette Notes", default="#\n")
-
+ name="Palette Notes",
+ default="#\n"
+ )
current_color_index = IntProperty(
- name="Current Color Index", description="", default=0, min=0)
-
+ name="Current Color Index",
+ description="",
+ default=0,
+ min=0
+ )
current_weight_index = IntProperty(
- name="Current Color Index", description="", default=10, min=-1)
-
+ name="Current Color Index",
+ description="",
+ default=10,
+ min=-1
+ )
presets_folder = StringProperty(name="",
- description="Palettes Folder",
- subtype="DIR_PATH")
-
- colors = bpy.props.CollectionProperty(type=Colors)
-
- weight = bpy.props.FloatProperty(name="Weight",
- default=0.0, min=0.0, max=1.0, precision=3, update=update_weight)
-
- weight_0 = bpy.props.FloatProperty(
- default=0.0, min=0.0, max=1.0, precision=3)
- weight_1 = bpy.props.FloatProperty(
- default=0.1, min=0.0, max=1.0, precision=3)
- weight_2 = bpy.props.FloatProperty(
- default=0.25, min=0.0, max=1.0, precision=3)
- weight_3 = bpy.props.FloatProperty(
- default=0.333, min=0.0, max=1.0, precision=3)
- weight_4 = bpy.props.FloatProperty(
- default=0.4, min=0.0, max=1.0, precision=3)
- weight_5 = bpy.props.FloatProperty(
- default=0.5, min=0.0, max=1.0, precision=3)
- weight_6 = bpy.props.FloatProperty(
- default=0.6, min=0.0, max=1.0, precision=3)
- weight_7 = bpy.props.FloatProperty(
- default=0.6666, min=0.0, max=1.0, precision=3)
- weight_8 = bpy.props.FloatProperty(
- default=0.75, min=0.0, max=1.0, precision=3)
- weight_9 = bpy.props.FloatProperty(
- default=0.9, min=0.0, max=1.0, precision=3)
- weight_10 = bpy.props.FloatProperty(
- default=1.0, min=0.0, max=1.0, precision=3)
+ description="Palettes Folder",
+ subtype="DIR_PATH"
+ )
+ colors = CollectionProperty(
+ type=Colors
+ )
+ weight = FloatProperty(
+ name="Weight",
+ description="Modify the active Weight preset slot value",
+ default=0.0,
+ min=0.0, max=1.0,
+ precision=3,
+ update=update_weight
+ )
+ weight_0 = FloatProperty(
+ default=0.0,
+ min=0.0, max=1.0,
+ precision=3
+ )
+ weight_1 = FloatProperty(
+ default=0.1,
+ min=0.0, max=1.0,
+ precision=3
+ )
+ weight_2 = FloatProperty(
+ default=0.25,
+ min=0.0, max=1.0,
+ precision=3
+ )
+ weight_3 = FloatProperty(
+ default=0.333,
+ min=0.0, max=1.0,
+ precision=3
+ )
+ weight_4 = FloatProperty(
+ default=0.4,
+ min=0.0, max=1.0,
+ precision=3
+ )
+ weight_5 = FloatProperty(
+ default=0.5,
+ min=0.0, max=1.0,
+ precision=3
+ )
+ weight_6 = FloatProperty(
+ default=0.6,
+ min=0.0, max=1.0,
+ precision=3
+ )
+ weight_7 = FloatProperty(
+ default=0.6666,
+ min=0.0, max=1.0,
+ precision=3
+ )
+ weight_8 = FloatProperty(
+ default=0.75,
+ min=0.0, max=1.0,
+ precision=3
+ )
+ weight_9 = FloatProperty(
+ default=0.9,
+ min=0.0, max=1.0,
+ precision=3
+ )
+ weight_10 = FloatProperty(
+ default=1.0,
+ min=0.0, max=1.0,
+ precision=3
+ )
pass
+
def register():
bpy.utils.register_module(__name__)
bpy.types.Scene.palette_props = PointerProperty(
- type=PaletteProps, name="Palette Props", description="")
+ type=PaletteProps,
+ name="Palette Props",
+ description=""
+ )
pass
@@ -841,10 +840,3 @@ def unregister():
if __name__ == "__main__":
register()
-
-
-# To Do List
-# ToDo1 Overiting the current file
-# ToDo3 Foreground Background
-
-