1 # paint_palette.py (c) 2011 Dany Lebel (Axon_D)
3 # ***** BEGIN GPL LICENSE BLOCK *****
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software Foundation,
18 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 # ***** END GPL LICENCE BLOCK *****
24 "name": "Paint Palettes",
25 "author": "Dany Lebel (Axon D)",
27 "blender": (2, 63, 0),
28 "location": "Image Editor and 3D View > Any Paint mode > Color Palette or Weight Palette panel",
29 "description": "Palettes for color and weight paint modes",
31 "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
32 "Scripts/Paint/Palettes",
37 This addon brings palettes to the paint modes.
39 * Color Palette for Image Painting, Texture Paint and Vertex Paint modes.
40 * Weight Palette for the Weight Paint mode.
42 Set a number of colors (or weights according to the mode) and then associate it
43 with the brush by using the button under the color.
47 from bpy
.props
import *
51 pp
= bpy
.context
.scene
.palette_props
52 current_color
= pp
.colors
[pp
.current_color_index
].color
53 pp
.color_name
= pp
.colors
[pp
.current_color_index
].name
54 brush
= current_brush()
55 brush
.color
= current_color
56 pp
.index
= pp
.current_color_index
59 pp
= bpy
.context
.scene
.palette_props
60 current_color
= pp
.colors
[pp
.current_color_index
]
61 brush
= current_brush()
62 current_color
.color
= brush
.color
67 if context
.area
.type == 'VIEW_3D' and context
.vertex_paint_object
:
68 brush
= context
.tool_settings
.vertex_paint
.brush
69 elif context
.area
.type == 'VIEW_3D' and context
.image_paint_object
:
70 brush
= context
.tool_settings
.image_paint
.brush
71 elif context
.area
.type == 'IMAGE_EDITOR' and context
.space_data
.mode
== 'PAINT':
72 brush
= context
.tool_settings
.image_paint
.brush
78 def update_weight_value():
79 pp
= bpy
.context
.scene
.palette_props
80 tt
= bpy
.context
.tool_settings
81 tt
.unified_paint_settings
.weight
= pp
.weight_value
85 class PALETTE_MT_menu(bpy
.types
.Menu
):
88 preset_operator
= "palette.load_gimp_palette"
90 def path_menu(self
, searchpaths
, operator
, props_default
={}):
92 # hard coded to set the operators 'filepath' to the filename.
97 if not searchpaths
[0]:
98 layout
.label("* Missing Paths *")
103 for directory
in searchpaths
:
104 files
.extend([(f
, os
.path
.join(directory
, f
)) for f
in os
.listdir(directory
)])
108 for f
, filepath
in files
:
110 if f
.startswith("."):
113 preset_name
= bpy
.path
.display_name(f
)
114 props
= layout
.operator(operator
, text
=preset_name
)
116 for attr
, value
in props_default
.items():
117 setattr(props
, attr
, value
)
119 props
.filepath
= filepath
120 if operator
== "palette.load_gimp_palette":
121 props
.menu_idname
= self
.bl_idname
123 def draw_preset(self
, context
):
124 """Define these on the subclass
129 self
.path_menu([bpy
.context
.scene
.palette_props
.presets_folder
], self
.preset_operator
)
134 class LoadGimpPalette(bpy
.types
.Operator
):
135 """Execute a preset"""
136 bl_idname
= "palette.load_gimp_palette"
137 bl_label
= "Load a Gimp palette"
139 filepath
= bpy
.props
.StringProperty(name
="Path",
140 description
="Path of the Python file to execute",
141 maxlen
=512, default
="")
142 menu_idname
= bpy
.props
.StringProperty(name
="Menu ID Name",
143 description
="ID name of the menu this was called from", default
="")
145 def execute(self
, context
):
146 from os
.path
import basename
147 filepath
= self
.filepath
149 palette_props
= bpy
.context
.scene
.palette_props
150 palette_props
.current_color_index
= 0
152 # change the menu title to the most recently chosen option
153 preset_class
= getattr(bpy
.types
, self
.menu_idname
)
154 preset_class
.bl_label
= bpy
.path
.display_name(basename(filepath
))
157 ts
= bpy
.context
.tool_settings
158 palette_props
.columns
= 0
159 if filepath
[-4:] == ".gpl":
160 gpl
= open(filepath
, "r")
161 lines
= gpl
.readlines()
162 palette_props
.notes
= ''
164 for index_0
, line
in enumerate(lines
):
165 if not line
or (line
[:12] == "GIMP Palette"):
167 elif line
[:5] == "Name:":
168 palette_props
.palette_name
= line
[5:]
169 elif line
[:8] == "Columns:":
170 palette_props
.columns
= int(line
[8:])
172 palette_props
.notes
+= line
179 for i
, ln
in enumerate(lines
[index_0
:]):
181 palette_props
.colors
[i
]
183 palette_props
.colors
.add()
184 color
= [float(rgb
)/255 for rgb
in [ln
[0:3], ln
[4:7], ln
[8:11]]]
186 palette_props
.colors
[i
].color
= color
188 palette_props
.colors
[i
].name
= ln
[12:-1]
191 while palette_props
.colors
.__len
__() > exceeding
:
192 palette_props
.colors
.remove(exceeding
)
199 self
.report({'INFO'}, "Not a supported palette format")
204 class WriteGimpPalette():
205 """Base preset class, only for subclassing
206 subclasses must define
209 bl_options
= {'REGISTER'} # only because invoke_props_popup requires.
213 name
= bpy
.props
.StringProperty(name
="Name",
214 description
="Name of the preset, used to make the path name",
215 maxlen
=64, default
="")
216 remove_active
= bpy
.props
.BoolProperty(default
=False, options
={'HIDDEN'})
219 def as_filename(name
): # could reuse for other presets
220 for char
in " !@#$%^&*(){}:\";'[]<>,.\\/?":
221 name
= name
.replace(char
, '_')
222 return name
.lower().strip()
224 def execute(self
, context
):
226 pp
= bpy
.context
.scene
.palette_props
228 if hasattr(self
, "pre_cb"):
231 preset_menu_class
= getattr(bpy
.types
, self
.preset_menu
)
233 if not self
.remove_active
:
238 filename
= self
.as_filename(self
.name
)
239 target_path
= pp
.presets_folder
242 self
.report({'WARNING'}, "Failed to create presets path")
245 filepath
= os
.path
.join(target_path
, filename
) + ".gpl"
246 file_preset
= open(filepath
, 'wb')
247 gpl
= "GIMP Palette\n"
248 gpl
+= "Name: %s\n" % filename
249 gpl
+= "Columns: %d\n" % pp
.columns
251 if pp
.colors
.items():
252 for i
, color
in enumerate(pp
.colors
):
253 gpl
+= "%3d%4d%4d %s" % (color
.color
.r
* 255, color
.color
.g
* 255, color
.color
.b
* 255, color
.name
+ '\n')
254 file_preset
.write(bytes(gpl
, 'UTF-8'))
258 pp
.palette_name
= filename
261 preset_active
= preset_menu_class
.bl_label
263 # fairly sloppy but convenient.
264 filepath
= bpy
.utils
.preset_find(preset_active
, self
.preset_subdir
)
267 filepath
= bpy
.utils
.preset_find(preset_active
,
268 self
.preset_subdir
, display_name
=True)
273 if hasattr(self
, "remove"):
274 self
.remove(context
, filepath
)
280 traceback
.print_exc()
283 preset_menu_class
.bl_label
= "Presets"
285 if hasattr(self
, "post_cb"):
286 self
.post_cb(context
)
290 def check(self
, context
):
291 self
.name
= self
.as_filename(self
.name
)
293 def invoke(self
, context
, event
):
294 if not self
.remove_active
:
295 wm
= context
.window_manager
296 return wm
.invoke_props_dialog(self
)
298 return self
.execute(context
)
301 class AddPresetPalette(WriteGimpPalette
, bpy
.types
.Operator
):
302 """Add a Palette Preset"""
303 bl_idname
= "palette.preset_add"
304 bl_label
= "Add Palette Preset"
305 preset_menu
= "PALETTE_MT_menu"
309 preset_subdir
= "palette"
312 class PALETTE_OT_add_color(bpy
.types
.Operator
):
314 bl_description
= "Add a Color to the Palette"
315 bl_idname
= "palette_props.add_color"
318 def execute(self
, context
):
319 pp
= bpy
.context
.scene
.palette_props
321 if pp
.colors
.items():
322 new_index
= pp
.current_color_index
+ 1
325 last
= pp
.colors
.__len
__() - 1
328 pp
.colors
.move(last
, new_index
)
329 pp
.current_color_index
= new_index
335 class PALETTE_OT_remove_color(bpy
.types
.Operator
):
337 bl_description
= "Remove Selected Color"
338 bl_idname
= "palette_props.remove_color"
341 def poll(cls
, context
):
342 pp
= bpy
.context
.scene
.palette_props
343 return bool(pp
.colors
.items())
346 def execute(self
, context
):
347 pp
= bpy
.context
.scene
.palette_props
348 i
= pp
.current_color_index
351 if pp
.current_color_index
>= pp
.colors
.__len
__():
352 pp
.index
= pp
.current_color_index
= pp
.colors
.__len
__() - 1
356 class PALETTE_OT_sample_tool_color(bpy
.types
.Operator
):
358 bl_description
= "Sample Tool Color"
359 bl_idname
= "palette_props.sample_tool_color"
361 def execute(self
, context
):
362 pp
= bpy
.context
.scene
.palette_props
363 brush
= current_brush()
364 pp
.colors
[pp
.current_color_index
].color
= brush
.color
368 class IMAGE_OT_select_color(bpy
.types
.Operator
):
370 bl_description
= "Select this color"
371 bl_idname
= "paint.select_color"
372 bl_options
= {'UNDO'}
375 color_index
= IntProperty()
377 def invoke(self
, context
, event
):
378 palette_props
= bpy
.context
.scene
.palette_props
379 palette_props
.current_color_index
= self
.color_index
385 def color_palette_draw(self
, context
):
386 palette_props
= bpy
.context
.scene
.palette_props
392 bpy
.types
.PALETTE_MT_menu
.preset_subdir
= palette_props
.presets_folder
393 row
= layout
.row(align
=True)
394 row
.menu("PALETTE_MT_menu", text
=palette_props
.palette_name
.rstrip())
395 row
.operator("palette.preset_add", text
="", icon
="ZOOMIN")
396 row
.operator("palette.preset_add", text
="", icon
="ZOOMOUT").remove_active
= True
397 col
= layout
.column(align
=True)
398 row
= col
.row(align
=True)
399 row
.operator("palette_props.add_color", icon
="ZOOMIN")
400 row
.prop(palette_props
, "index")
401 row
.operator("palette_props.remove_color", icon
="PANEL_CLOSE")
402 row
= col
.row(align
=True)
403 row
.prop(palette_props
, "columns")
404 if palette_props
.colors
.items():
406 row
= layout
.row(align
=True)
407 row
.prop(palette_props
, "color_name")
408 row
.operator("palette_props.sample_tool_color", icon
="COLOR")
410 laycol
= layout
.column(align
=False)
412 if palette_props
.columns
:
413 columns
= palette_props
.columns
416 for i
, color
in enumerate(palette_props
.colors
):
418 row1
= laycol
.row(align
=True)
420 row2
= laycol
.row(align
=True)
423 if i
== palette_props
.current_color_index
:
425 row1
.prop(palette_props
.colors
[i
], "color", event
=True, toggle
=True)
426 row2
.operator("paint.select_color", emboss
=False).color_index
= i
428 row1
.prop(palette_props
.colors
[i
], "color", event
=True, toggle
=True)
429 row2
.operator("paint.select_color").color_index
= i
433 row
.prop(palette_props
, "presets_folder", text
="")
438 class BrushButtonsPanel():
439 bl_space_type
= 'IMAGE_EDITOR'
440 bl_region_type
= 'UI'
443 def poll(cls
, context
):
444 sima
= context
.space_data
445 toolsettings
= context
.tool_settings
.image_paint
446 return sima
.show_paint
and toolsettings
.brush
450 bl_space_type
= 'VIEW_3D'
451 bl_region_type
= 'TOOLS'
452 bl_category
= 'Tools'
455 def paint_settings(context
):
456 ts
= context
.tool_settings
458 if context
.vertex_paint_object
:
459 return ts
.vertex_paint
460 elif context
.weight_paint_object
:
461 return ts
.weight_paint
462 elif context
.texture_paint_object
:
463 return ts
.image_paint
467 class IMAGE_PT_color_palette(BrushButtonsPanel
, bpy
.types
.Panel
):
468 bl_label
= "Color Palette"
469 bl_options
= {'DEFAULT_CLOSED'}
471 def draw(self
, context
):
472 color_palette_draw(self
, context
)
475 class VIEW3D_PT_color_palette(PaintPanel
, bpy
.types
.Panel
):
476 bl_label
= "Color Palette"
477 bl_options
= {'DEFAULT_CLOSED'}
480 def poll(cls
, context
):
481 return (context
.image_paint_object
or context
.vertex_paint_object
)
483 def draw(self
, context
):
484 color_palette_draw(self
, context
)
487 class VIEW3D_OT_select_weight(bpy
.types
.Operator
):
489 bl_description
= "Select this weight"
490 bl_idname
= "paint.select_weight"
491 bl_options
= {'UNDO'}
493 weight_index
= IntProperty()
495 def current_weight(self
):
496 pp
= bpy
.context
.scene
.palette_props
497 if self
.weight_index
== 0:
499 elif self
.weight_index
== 1:
501 elif self
.weight_index
== 2:
503 elif self
.weight_index
== 3:
505 elif self
.weight_index
== 4:
507 elif self
.weight_index
== 5:
509 elif self
.weight_index
== 6:
511 elif self
.weight_index
== 7:
513 elif self
.weight_index
== 8:
515 elif self
.weight_index
== 9:
517 elif self
.weight_index
== 10:
518 weight
= pp
.weight_10
521 def invoke(self
, context
, event
):
522 palette_props
= bpy
.context
.scene
.palette_props
524 palette_props
.current_weight_index
= self
.weight_index
526 if self
.weight_index
== 0:
527 weight
= palette_props
.weight_0
528 elif self
.weight_index
== 1:
529 weight
= palette_props
.weight_1
530 elif self
.weight_index
== 2:
531 weight
= palette_props
.weight_2
532 elif self
.weight_index
== 3:
533 weight
= palette_props
.weight_3
534 elif self
.weight_index
== 4:
535 weight
= palette_props
.weight_4
536 elif self
.weight_index
== 5:
537 weight
= palette_props
.weight_5
538 elif self
.weight_index
== 6:
539 weight
= palette_props
.weight_6
540 elif self
.weight_index
== 7:
541 weight
= palette_props
.weight_7
542 elif self
.weight_index
== 8:
543 weight
= palette_props
.weight_8
544 elif self
.weight_index
== 9:
545 weight
= palette_props
.weight_9
546 elif self
.weight_index
== 10:
547 weight
= palette_props
.weight_10
548 palette_props
.weight
= weight
549 #bpy.context.tool_settings.vertex_group_weight = weight
553 class VIEW3D_OT_reset_weight_palette(bpy
.types
.Operator
):
555 bl_idname
= "paint.reset_weight_palette"
558 def execute(self
, context
):
559 palette_props
= context
.scene
.palette_props
561 if palette_props
.current_weight_index
== 0:
562 palette_props
.weight
= 0.0
563 palette_props
.weight_0
= 0.0
565 palette_props
.weight_1
= 0.1
566 if palette_props
.current_weight_index
== 1:
567 palette_props
.weight
= 0.1
569 if palette_props
.current_weight_index
== 2:
570 palette_props
.weight
= 0.25
571 palette_props
.weight_2
= 0.25
573 if palette_props
.current_weight_index
== 3:
574 palette_props
.weight
= 0.3333
575 palette_props
.weight_3
= 0.3333
577 if palette_props
.current_weight_index
== 4:
578 palette_props
.weight
= 0.4
579 palette_props
.weight_4
= 0.4
581 if palette_props
.current_weight_index
== 5:
582 palette_props
.weight
= 0.5
583 palette_props
.weight_5
= 0.5
585 if palette_props
.current_weight_index
== 6:
586 palette_props
.weight
= 0.6
587 palette_props
.weight_6
= 0.6
589 if palette_props
.current_weight_index
== 7:
590 palette_props
.weight
= 0.6666
591 palette_props
.weight_7
= 0.6666
593 if palette_props
.current_weight_index
== 8:
594 palette_props
.weight
= 0.75
595 palette_props
.weight_8
= 0.75
597 if palette_props
.current_weight_index
== 9:
598 palette_props
.weight
= 0.9
599 palette_props
.weight_9
= 0.9
601 if palette_props
.current_weight_index
== 10:
602 palette_props
.weight
= 1.0
603 palette_props
.weight_10
= 1.0
606 class VIEW3D_PT_weight_palette(PaintPanel
, bpy
.types
.Panel
):
607 bl_label
= "Weight Palette"
608 bl_options
= {'DEFAULT_CLOSED'}
611 def poll(cls
, context
):
612 return context
.weight_paint_object
614 def draw(self
, context
):
615 palette_props
= bpy
.context
.scene
.palette_props
616 #vertex_group_weight = bpy.context.tool_settings.unified_paint_settings.weight
620 row
.prop(palette_props
, "weight", slider
=True)
624 if palette_props
.current_weight_index
== 0:
625 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_0
,
626 emboss
=False).weight_index
= 0
628 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_0
,
629 emboss
=True).weight_index
= 0
631 row
= box
.row(align
=True)
632 if palette_props
.current_weight_index
== 1:
633 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_1
,
634 emboss
=False).weight_index
= 1
636 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_1
,
637 emboss
=True).weight_index
= 1
639 if palette_props
.current_weight_index
== 2:
640 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_2
,
641 emboss
=False).weight_index
= 2
643 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_2
,
644 emboss
=True).weight_index
= 2
646 if palette_props
.current_weight_index
== 3:
647 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_3
,
648 emboss
=False).weight_index
= 3
650 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_3
,
651 emboss
=True).weight_index
= 3
653 row
= box
.row(align
=True)
654 if palette_props
.current_weight_index
== 4:
655 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_4
,
656 emboss
=False).weight_index
= 4
658 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_4
,
659 emboss
=True).weight_index
= 4
661 if palette_props
.current_weight_index
== 5:
662 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_5
,
663 emboss
=False).weight_index
= 5
665 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_5
,
666 emboss
=True).weight_index
= 5
668 if palette_props
.current_weight_index
== 6:
669 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_6
,
670 emboss
=False).weight_index
= 6
672 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_6
,
673 emboss
=True).weight_index
= 6
675 row
= box
.row(align
=True)
676 if palette_props
.current_weight_index
== 7:
677 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_7
,
678 emboss
=False).weight_index
= 7
680 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_7
,
681 emboss
=True).weight_index
= 7
683 if palette_props
.current_weight_index
== 8:
684 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_8
,
685 emboss
=False).weight_index
= 8
687 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_8
,
688 emboss
=True).weight_index
= 8
690 if palette_props
.current_weight_index
== 9:
691 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_9
,
692 emboss
=False).weight_index
= 9
694 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_9
,
695 emboss
=True).weight_index
= 9
697 row
= box
.row(align
=True)
698 if palette_props
.current_weight_index
== 10:
699 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_10
,
700 emboss
=False).weight_index
= 10
702 row
.operator("paint.select_weight", text
="%.2f" % palette_props
.weight_10
,
703 emboss
=True).weight_index
= 10
706 row
.operator("paint.reset_weight_palette", text
="Reset")
709 class Colors(bpy
.types
.PropertyGroup
):
710 """Class for colors CollectionProperty"""
711 color
= bpy
.props
.FloatVectorProperty(
712 name
="", description
="", default
=(0.8, 0.8, 0.8), min=0, max=1,
713 step
=1, precision
=3, subtype
='COLOR_GAMMA', size
=3)
716 class Weights(bpy
.types
.PropertyGroup
):
717 """Class for Weights Collection Property"""
719 weight
= bpy
.props
.FloatProperty(
720 default
=0.0, min=0.0, max=1.0, precision
=3)
723 class PaletteProps(bpy
.types
.PropertyGroup
):
725 def update_color_name(self
, context
):
726 pp
= bpy
.context
.scene
.palette_props
727 pp
.colors
[pp
.current_color_index
].name
= pp
.color_name
730 def move_color(self
, context
):
731 pp
= bpy
.context
.scene
.palette_props
732 if pp
.colors
.items() and pp
.current_color_index
!= pp
.index
:
733 if pp
.index
>= pp
.colors
.__len
__():
734 pp
.index
= pp
.colors
.__len
__() - 1
735 pp
.colors
.move(pp
.current_color_index
, pp
.index
)
736 pp
.current_color_index
= pp
.index
739 def update_weight(self
, context
):
740 pp
= context
.scene
.palette_props
742 if pp
.current_weight_index
== 0:
744 elif pp
.current_weight_index
== 1:
746 elif pp
.current_weight_index
== 2:
748 elif pp
.current_weight_index
== 3:
750 elif pp
.current_weight_index
== 4:
752 elif pp
.current_weight_index
== 5:
754 elif pp
.current_weight_index
== 6:
756 elif pp
.current_weight_index
== 7:
758 elif pp
.current_weight_index
== 8:
760 elif pp
.current_weight_index
== 9:
762 elif pp
.current_weight_index
== 10:
763 pp
.weight_10
= weight
764 bpy
.context
.tool_settings
.unified_paint_settings
.weight
= weight
765 #bpy.context.tool_settings.vertex_group_weight = weight
768 palette_name
= StringProperty(
769 name
="Palette Name", default
="Preset", subtype
='FILE_NAME')
771 color_name
= StringProperty(
772 name
="", description
="Color Name", default
="Untitled", update
=update_color_name
)
774 columns
= IntProperty(
776 description
="Number of Columns",
777 min=0, max=16, default
=0)
781 description
="Move Selected Color",
785 notes
= StringProperty(
786 name
="Palette Notes", default
="#\n")
788 current_color_index
= IntProperty(
789 name
="Current Color Index", description
="", default
=0, min=0)
791 current_weight_index
= IntProperty(
792 name
="Current Color Index", description
="", default
=10, min=-1)
794 presets_folder
= StringProperty(name
="",
795 description
="Palettes Folder",
798 colors
= bpy
.props
.CollectionProperty(type=Colors
)
800 weight
= bpy
.props
.FloatProperty(name
="Weight",
801 default
=0.0, min=0.0, max=1.0, precision
=3, update
=update_weight
)
803 weight_0
= bpy
.props
.FloatProperty(
804 default
=0.0, min=0.0, max=1.0, precision
=3)
805 weight_1
= bpy
.props
.FloatProperty(
806 default
=0.1, min=0.0, max=1.0, precision
=3)
807 weight_2
= bpy
.props
.FloatProperty(
808 default
=0.25, min=0.0, max=1.0, precision
=3)
809 weight_3
= bpy
.props
.FloatProperty(
810 default
=0.333, min=0.0, max=1.0, precision
=3)
811 weight_4
= bpy
.props
.FloatProperty(
812 default
=0.4, min=0.0, max=1.0, precision
=3)
813 weight_5
= bpy
.props
.FloatProperty(
814 default
=0.5, min=0.0, max=1.0, precision
=3)
815 weight_6
= bpy
.props
.FloatProperty(
816 default
=0.6, min=0.0, max=1.0, precision
=3)
817 weight_7
= bpy
.props
.FloatProperty(
818 default
=0.6666, min=0.0, max=1.0, precision
=3)
819 weight_8
= bpy
.props
.FloatProperty(
820 default
=0.75, min=0.0, max=1.0, precision
=3)
821 weight_9
= bpy
.props
.FloatProperty(
822 default
=0.9, min=0.0, max=1.0, precision
=3)
823 weight_10
= bpy
.props
.FloatProperty(
824 default
=1.0, min=0.0, max=1.0, precision
=3)
828 bpy
.utils
.register_module(__name__
)
830 bpy
.types
.Scene
.palette_props
= PointerProperty(
831 type=PaletteProps
, name
="Palette Props", description
="")
836 bpy
.utils
.unregister_module(__name__
)
838 del bpy
.types
.Scene
.palette_props
842 if __name__
== "__main__":
847 # ToDo1 Overiting the current file
848 # ToDo3 Foreground Background