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>2010-12-21 02:26:29 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-21 02:26:29 +0300
commita9ba96896a627688be3359bf6a9d7e25995aa631 (patch)
treedea6a458787470ae2b046acd5247838e343323be /release/scripts/op/presets.py
parent4530b4984cc0bee1e67115c883dfaa98076832a9 (diff)
modified fix for commits r33811, 33812.
- SSS Presets were not working on pinned materials. - added ability for save-presets to define variables to stop them becoming too verbose. - remove object.active_node_material
Diffstat (limited to 'release/scripts/op/presets.py')
-rw-r--r--release/scripts/op/presets.py126
1 files changed, 74 insertions, 52 deletions
diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py
index 0ee20966fad..b0dd7de3f1c 100644
--- a/release/scripts/op/presets.py
+++ b/release/scripts/op/presets.py
@@ -69,6 +69,12 @@ class AddPresetBase():
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()
@@ -150,17 +156,21 @@ class AddPresetRender(AddPresetBase, bpy.types.Operator):
bl_label = "Add Render Preset"
preset_menu = "RENDER_MT_presets"
+ preset_defines = [
+ "scene = bpy.context.scene"
+ ]
+
preset_values = [
- "bpy.context.scene.render.field_order",
- "bpy.context.scene.render.fps",
- "bpy.context.scene.render.fps_base",
- "bpy.context.scene.render.pixel_aspect_x",
- "bpy.context.scene.render.pixel_aspect_y",
- "bpy.context.scene.render.resolution_percentage",
- "bpy.context.scene.render.resolution_x",
- "bpy.context.scene.render.resolution_y",
- "bpy.context.scene.render.use_fields",
- "bpy.context.scene.render.use_fields_still",
+ "scene.render.field_order",
+ "scene.render.fps",
+ "scene.render.fps_base",
+ "scene.render.pixel_aspect_x",
+ "scene.render.pixel_aspect_y",
+ "scene.render.resolution_percentage",
+ "scene.render.resolution_x",
+ "scene.render.resolution_y",
+ "scene.render.use_fields",
+ "scene.render.use_fields_still",
]
preset_subdir = "render"
@@ -172,20 +182,20 @@ class AddPresetSSS(AddPresetBase, bpy.types.Operator):
bl_label = "Add SSS Preset"
preset_menu = "MATERIAL_MT_sss_presets"
+ preset_defines = [
+ "material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material)"
+ ]
+
preset_values = [
- "bpy.context.material.subsurface_scattering.back",
- "bpy.context.material.subsurface_scattering.color[0]",
- "bpy.context.material.subsurface_scattering.color[1]",
- "bpy.context.material.subsurface_scattering.color[2]",
- "bpy.context.material.subsurface_scattering.color_factor",
- "bpy.context.material.subsurface_scattering.error_threshold",
- "bpy.context.material.subsurface_scattering.front",
- "bpy.context.material.subsurface_scattering.ior",
- "bpy.context.material.subsurface_scattering.radius[0]",
- "bpy.context.material.subsurface_scattering.radius[1]",
- "bpy.context.material.subsurface_scattering.radius[2]",
- "bpy.context.material.subsurface_scattering.scale",
- "bpy.context.material.subsurface_scattering.texture_factor",
+ "material.subsurface_scattering.back",
+ "material.subsurface_scattering.color",
+ "material.subsurface_scattering.color_factor",
+ "material.subsurface_scattering.error_threshold",
+ "material.subsurface_scattering.front",
+ "material.subsurface_scattering.ior",
+ "material.subsurface_scattering.radius",
+ "material.subsurface_scattering.scale",
+ "material.subsurface_scattering.texture_factor",
]
preset_subdir = "sss"
@@ -197,13 +207,17 @@ class AddPresetCloth(AddPresetBase, bpy.types.Operator):
bl_label = "Add Cloth Preset"
preset_menu = "CLOTH_MT_presets"
+ preset_defines = [
+ "cloth = bpy.context.cloth"
+ ]
+
preset_values = [
- "bpy.context.cloth.settings.air_damping",
- "bpy.context.cloth.settings.bending_stiffness",
- "bpy.context.cloth.settings.mass",
- "bpy.context.cloth.settings.quality",
- "bpy.context.cloth.settings.spring_damping",
- "bpy.context.cloth.settings.structural_stiffness",
+ "cloth.settings.air_damping",
+ "cloth.settings.bending_stiffness",
+ "cloth.settings.mass",
+ "cloth.settings.quality",
+ "cloth.settings.spring_damping",
+ "cloth.settings.structural_stiffness",
]
preset_subdir = "cloth"
@@ -215,20 +229,24 @@ class AddPresetSunSky(AddPresetBase, bpy.types.Operator):
bl_label = "Add Sunsky Preset"
preset_menu = "LAMP_MT_sunsky_presets"
+ preset_defines = [
+ "sky = bpy.context.object.data.sky"
+ ]
+
preset_values = [
- "bpy.context.object.data.sky.atmosphere_extinction",
- "bpy.context.object.data.sky.atmosphere_inscattering",
- "bpy.context.object.data.sky.atmosphere_turbidity",
- "bpy.context.object.data.sky.backscattered_light",
- "bpy.context.object.data.sky.horizon_brightness",
- "bpy.context.object.data.sky.spread",
- "bpy.context.object.data.sky.sun_brightness",
- "bpy.context.object.data.sky.sun_intensity",
- "bpy.context.object.data.sky.sun_size",
- "bpy.context.object.data.sky.use_sky_blend",
- "bpy.context.object.data.sky.use_sky_blend_type",
- "bpy.context.object.data.sky.use_sky_color_space",
- "bpy.context.object.data.sky.use_sky_exposure",
+ "sky.atmosphere_extinction",
+ "sky.atmosphere_inscattering",
+ "sky.atmosphere_turbidity",
+ "sky.backscattered_light",
+ "sky.horizon_brightness",
+ "sky.spread",
+ "sky.sun_brightness",
+ "sky.sun_intensity",
+ "sky.sun_size",
+ "sky.use_sky_blend",
+ "sky.use_sky_blend_type",
+ "sky.use_sky_color_space",
+ "sky.use_sky_exposure",
]
preset_subdir = "sunsky"
@@ -240,17 +258,21 @@ class AddPresetInteraction(AddPresetBase, bpy.types.Operator):
bl_label = "Add Interaction Preset"
preset_menu = "USERPREF_MT_interaction_presets"
+ preset_defines = [
+ "user_preferences = bpy.context.user_preferences"
+ ]
+
preset_values = [
- "bpy.context.user_preferences.edit.use_drag_immediately",
- "bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb",
- "bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom",
- "bpy.context.user_preferences.inputs.select_mouse",
- "bpy.context.user_preferences.inputs.use_emulate_numpad",
- "bpy.context.user_preferences.inputs.use_mouse_continuous",
- "bpy.context.user_preferences.inputs.use_mouse_emulate_3_button",
- "bpy.context.user_preferences.inputs.view_rotate_method",
- "bpy.context.user_preferences.inputs.view_zoom_axis",
- "bpy.context.user_preferences.inputs.view_zoom_method",
+ "user_preferences.edit.use_drag_immediately",
+ "user_preferences.edit.use_insertkey_xyz_to_rgb",
+ "user_preferences.inputs.invert_mouse_wheel_zoom",
+ "user_preferences.inputs.select_mouse",
+ "user_preferences.inputs.use_emulate_numpad",
+ "user_preferences.inputs.use_mouse_continuous",
+ "user_preferences.inputs.use_mouse_emulate_3_button",
+ "user_preferences.inputs.view_rotate_method",
+ "user_preferences.inputs.view_zoom_axis",
+ "user_preferences.inputs.view_zoom_method",
]
preset_subdir = "interaction"