[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1955] contrib/py/scripts/addons/ paint_palette.py: deleting paint palette from contrib

Daniel Salazar zanqdo at gmail.com
Thu May 19 10:43:23 CEST 2011


Revision: 1955
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1955
Author:   zanqdo
Date:     2011-05-19 08:43:23 +0000 (Thu, 19 May 2011)
Log Message:
-----------
deleting paint palette from contrib

Removed Paths:
-------------
    contrib/py/scripts/addons/paint_palette.py

Deleted: contrib/py/scripts/addons/paint_palette.py
===================================================================
--- contrib/py/scripts/addons/paint_palette.py	2011-05-19 08:42:47 UTC (rev 1954)
+++ contrib/py/scripts/addons/paint_palette.py	2011-05-19 08:43:23 UTC (rev 1955)
@@ -1,699 +0,0 @@
-# paint_palette.py (c) 2011 Dany Lebel (Axon_D)
-#
-# ***** 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 LICENCE BLOCK *****
-
-
-bl_info = {
-    "name": "Paint Palettes",
-    "author": "Dany Lebel (Axon D)",
-    "version": (0,8,1),
-    "blender": (2, 5, 7),
-    "api": 36722,
-    "location": "Image Editor and 3D View > Any Paint mode > Color Palette or Weight Palette panel",
-    "description": "Palettes for color and weight paint modes",
-    "warning": "beta",
-    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Paint/Palettes",
-    "tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=25908",
-    "category": "Other"}
-
-"""
-This addon brings palettes to the paint modes.
-
-    * Color Palette for Image Painting, Texture Paint and Vertex Paint modes.
-    * Weight Palette for the Weight Paint mode.
-
-Set a number of colors (or weights according to the mode) and then associate it
-with the brush by using the button under the color.
-"""
-
-import bpy
-from bpy.props import *
-
-
-class AddPresetBase():
-    '''Base preset class, only for subclassing
-    subclasses must define
-     - preset_values
-     - preset_subdir '''
-    # bl_idname = "script.preset_base_add"
-    # bl_label = "Add a Python Preset"
-    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'})
-
-    @staticmethod
-    def as_filename(name):  # could reuse for other presets
-        for char in " !@#$%^&*(){}:\";'[]<>,.\\/?":
-            name = name.replace(char, '_')
-        return name.lower().strip()
-
-    def execute(self, context):
-        import os
-
-        if hasattr(self, "pre_cb"):
-            self.pre_cb(context)
-
-        preset_menu_class = getattr(bpy.types, self.preset_menu)
-
-        if not self.remove_active:
-
-            if not self.name:
-                return {'FINISHED'}
-
-            filename = self.as_filename(self.name)
-
-            target_path = bpy.utils.user_resource('SCRIPTS',
-                os.path.join("presets", self.preset_subdir), create=True)
-
-            if not target_path:
-                self.report({'WARNING'}, "Failed to create presets path")
-                return {'CANCELLED'}
-
-            filepath = os.path.join(target_path, filename) + ".py"
-
-            if hasattr(self, "add"):
-                self.add(context, filepath)
-            else:
-                file_preset = open(filepath, 'w')
-                file_preset.write("import bpy\n")
-
-                if hasattr(self, "preset_defines"):
-                    for rna_path in self.preset_defines:
-                        exec(rna_path)
-                        file_preset.write("%s\n" % rna_path)
-                    file_preset.write("\n")
-
-
-                for rna_path in self.preset_values:
-                    value = eval(rna_path)
-                    # convert thin wrapped sequences to simple lists to repr()
-                    try:
-                        value = value[:]
-                    except:
-                        pass
-
-                    file_preset.write("%s = %r\n" % (rna_path, value))
-                file_preset.write("\
-ci = bpy.context.window_manager.palette_props.current_color_index\n\
-palette_props = bpy.context.window_manager.palette_props\n\
-image_paint = bpy.context.tool_settings.image_paint\n\
-vertex_paint = bpy.context.tool_settings.vertex_paint\n\
-if ci == 0:\n\
-    image_paint.brush.color = palette_props.color_0\n\
-    vertex_paint.brush.color = palette_props.color_0\n\
-elif ci == 1:\n\
-    image_paint.brush.color = palette_props.color_1\n\
-    vertex_paint.brush.color = palette_props.color_1\n\
-elif ci == 2:\n\
-    image_paint.brush.color = palette_props.color_2\n\
-    vertex_paint.brush.color = palette_props.color_2\n\
-elif ci == 3:\n\
-    image_paint.brush.color = palette_props.color_3\n\
-    vertex_paint.brush.color = palette_props.color_3\n\
-elif ci == 4:\n\
-    image_paint.brush.color = palette_props.color_4\n\
-    vertex_paint.brush.color = palette_props.color_4\n\
-elif ci == 5:\n\
-    image_paint.brush.color = palette_props.color_5\n\
-    vertex_paint.brush.color = palette_props.color_5\n\
-elif ci == 6:\n\
-    image_paint.brush.color = palette_props.color_6\n\
-    vertex_paint.brush.color = palette_props.color_6\n\
-elif ci == 7:\n\
-    image_paint.brush.color = palette_props.color_7\n\
-    vertex_paint.brush.color = palette_props.color_7\n\
-elif ci == 8:\n\
-    image_paint.brush.color = palette_props.color_8\n\
-    vertex_paint.brush.color = palette_props.color_8")
-
-                file_preset.close()
-
-            preset_menu_class.bl_label = bpy.path.display_name(filename)
-
-        else:
-            preset_active = preset_menu_class.bl_label
-
-            # fairly sloppy but convenient.
-            filepath = bpy.utils.preset_find(preset_active, self.preset_subdir)
-
-            if not filepath:
-                filepath = bpy.utils.preset_find(preset_active,
-                    self.preset_subdir, display_name=True)
-
-            if not filepath:
-                return {'CANCELLED'}
-
-            if hasattr(self, "remove"):
-                self.remove(context, filepath)
-            else:
-                try:
-                    os.remove(filepath)
-                except:
-                    import traceback
-                    traceback.print_exc()
-
-            # XXX, stupid!
-            preset_menu_class.bl_label = "Presets"
-
-        if hasattr(self, "post_cb"):
-            self.post_cb(context)
-
-        return {'FINISHED'}
-
-    def check(self, context):
-        self.name = self.as_filename(self.name)
-
-    def invoke(self, context, event):
-        if not self.remove_active:
-            wm = context.window_manager
-            return wm.invoke_props_dialog(self)
-        else:
-            return self.execute(context)
-
-class ExecutePalettePreset(bpy.types.Operator):
-    ''' Executes a preset '''
-    bl_idname = "script.execute_preset"
-    bl_label = "Execute a Python Preset"
-
-    filepath = bpy.props.StringProperty(name="Path",
-        description="Path of the Python file to execute",
-        maxlen=512, default="")
-    menu_idname = bpy.props.StringProperty(name="Menu ID Name",
-        description="ID name of the menu this was called from", default="")
-
-    def execute(self, context):
-        from os.path import basename
-        filepath = self.filepath
-
-        # change the menu title to the most recently chosen option
-        preset_class = getattr(bpy.types, self.menu_idname)
-        preset_class.bl_label = bpy.path.display_name(basename(filepath))
-
-        # execute the preset using script.python_file_run
-        bpy.ops.script.python_file_run(filepath=filepath)
-        return {'FINISHED'}
-
-
-class PALETTE_MT_palette_presets(bpy.types.Menu):
-    bl_label = "Palette Presets"
-    preset_subdir = "palette"
-    preset_operator = "script.execute_preset"
-    draw = bpy.types.Menu.draw_preset
-
-
-class AddPresetPalette(AddPresetBase, bpy.types.Operator):
-    '''Add a Palette Preset'''
-    bl_idname = "palette.preset_add"
-    bl_label = "Add Palette Preset"
-    preset_menu = "PALETTE_MT_palette_presets"
-
-    preset_defines = [
-        "window_manager = bpy.context.window_manager"
-    ]
-
-    preset_values = [
-        "window_manager.palette_props.color_0",
-        "window_manager.palette_props.color_1",
-        "window_manager.palette_props.color_2",
-        "window_manager.palette_props.color_3",
-        "window_manager.palette_props.color_4",
-        "window_manager.palette_props.color_5",
-        "window_manager.palette_props.color_6",
-        "window_manager.palette_props.color_7",
-        "window_manager.palette_props.color_8",
-        
-    ]
-
-    preset_subdir = "palette"
-
-
-class BrushButtonsPanel():
-    bl_space_type = 'IMAGE_EDITOR'
-    bl_region_type = 'UI'
-
-    @classmethod
-    def poll(cls, context):
-        sima = context.space_data
-        toolsettings = context.tool_settings.image_paint
-        return sima.show_paint and toolsettings.brush
-
-class IMAGE_OT_select_color(bpy.types.Operator):
-    bl_label = ""
-    bl_description = "Select this color"
-    bl_idname = "paint.select_color"
-    
-    
-    color_index = IntProperty()
-    
-    def invoke(self, context, event):
-        palette_props = bpy.context.window_manager.palette_props
-        palette_props.current_color_index = self.color_index
-        
-        if self.color_index == 0:
-            color = palette_props.color_0
-        elif self.color_index == 1:
-            color = palette_props.color_1
-        elif self.color_index == 2:
-            color = palette_props.color_2
-        elif self.color_index == 3:
-            color = palette_props.color_3
-        elif self.color_index == 4:
-            color = palette_props.color_4
-        elif self.color_index == 5:
-            color = palette_props.color_5
-        elif self.color_index == 6:
-            color = palette_props.color_6
-        elif self.color_index == 7:
-            color = palette_props.color_7
-        elif self.color_index == 8:
-            color = palette_props.color_8

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list