diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-26 23:56:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-26 23:56:39 +0300 |
commit | a61480c27103fbf449fd14ea8061b65c29f19eae (patch) | |
tree | 8d626b465ebe17936b7551aa91cc5b9d3b192607 /release/scripts/startup/bl_operators/presets.py | |
parent | a3cd57ea8c57c10d4c65ddd51faa6cce14c98e10 (diff) | |
parent | 532c8ac58384309e77791e32ab78f448ad2a76a6 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'release/scripts/startup/bl_operators/presets.py')
-rw-r--r-- | release/scripts/startup/bl_operators/presets.py | 97 |
1 files changed, 51 insertions, 46 deletions
diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index 5c1ca0ab2ad..780183fb713 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -29,6 +29,7 @@ WindowManager.preset_name = StringProperty( default="New Preset" ) + class AddPresetBase: """Base preset class, only for subclassing subclasses must define @@ -41,26 +42,26 @@ class AddPresetBase: bl_options = {'REGISTER', 'INTERNAL'} name = StringProperty( - name="Name", - description="Name of the preset, used to make the path name", - maxlen=64, - options={'SKIP_SAVE'}, - ) + name="Name", + description="Name of the preset, used to make the path name", + maxlen=64, + options={'SKIP_SAVE'}, + ) remove_name = BoolProperty( - default=False, - options={'HIDDEN', 'SKIP_SAVE'}, - ) + default=False, + options={'HIDDEN', 'SKIP_SAVE'}, + ) remove_active = BoolProperty( - default=False, - options={'HIDDEN', 'SKIP_SAVE'}, - ) + default=False, + options={'HIDDEN', 'SKIP_SAVE'}, + ) # needed for mix-ins order = [ "name", "remove_name", "remove_active", - ] + ] @staticmethod def as_filename(name): # could reuse for other presets @@ -225,14 +226,14 @@ class ExecutePreset(Operator): bl_label = "Execute a Python Preset" filepath = StringProperty( - subtype='FILE_PATH', - options={'SKIP_SAVE'}, - ) + subtype='FILE_PATH', + options={'SKIP_SAVE'}, + ) menu_idname = StringProperty( - name="Menu ID Name", - description="ID name of the menu this was called from", - options={'SKIP_SAVE'}, - ) + name="Menu ID Name", + description="ID name of the menu this was called from", + options={'SKIP_SAVE'}, + ) def execute(self, context): from os.path import basename, splitext @@ -268,22 +269,26 @@ class PresetMenu(Panel): @classmethod def draw_panel_header(cls, layout): layout.emboss = 'NONE' - layout.popover(cls.bl_space_type, - cls.bl_region_type, - cls.__name__, - icon='PRESET', - text='') + layout.popover( + cls.bl_space_type, + cls.bl_region_type, + cls.__name__, + icon='PRESET', + text="", + ) @classmethod def draw_menu(cls, layout, text=None): - if text == None: + if text is None: text = cls.bl_label - layout.popover(cls.bl_space_type, - cls.bl_region_type, - cls.__name__, - icon='PRESET', - text=text) + layout.popover( + cls.bl_space_type, + cls.bl_region_type, + cls.__name__, + icon='PRESET', + text=text, + ) def draw(self, context): layout = self.layout @@ -329,10 +334,10 @@ class AddPresetCamera(AddPresetBase, Operator): preset_subdir = "camera" use_focal_length = BoolProperty( - name="Include Focal Length", - description="Include focal length into the preset", - options={'SKIP_SAVE'}, - ) + name="Include Focal Length", + description="Include focal length into the preset", + options={'SKIP_SAVE'}, + ) @property def preset_values(self): @@ -397,12 +402,12 @@ class AddPresetFluid(AddPresetBase, Operator): preset_defines = [ "fluid = bpy.context.fluid" - ] + ] preset_values = [ "fluid.settings.viscosity_base", "fluid.settings.viscosity_exponent", - ] + ] preset_subdir = "fluid" @@ -434,7 +439,7 @@ class AddPresetHairDynamics(AddPresetBase, Operator): "settings.density_strength", "settings.voxel_cell_size", "settings.pin_stiffness", - ] + ] class AddPresetInteraction(AddPresetBase, Operator): @@ -476,11 +481,11 @@ class AddPresetTrackingCamera(AddPresetBase, Operator): preset_subdir = "tracking_camera" use_focal_length = BoolProperty( - name="Include Focal Length", - description="Include focal length into the preset", - options={'SKIP_SAVE'}, - default=True - ) + name="Include Focal Length", + description="Include focal length into the preset", + options={'SKIP_SAVE'}, + default=True + ) @property def preset_values(self): @@ -601,10 +606,10 @@ class AddPresetOperator(AddPresetBase, Operator): preset_menu = "WM_MT_operator_presets" operator = StringProperty( - name="Operator", - maxlen=64, - options={'HIDDEN', 'SKIP_SAVE'}, - ) + name="Operator", + maxlen=64, + options={'HIDDEN', 'SKIP_SAVE'}, + ) preset_defines = [ "op = bpy.context.active_operator", |