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:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-02-19 16:18:02 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-02-19 16:18:02 +0400
commit5d20db1d87ac4d6c47f4930ce6856b86a7c431ce (patch)
tree986e96bf580463f7ab22a9c740c42e34d2b419e7 /release
parentdf34df50f7b95980a587ab8ec2812de84d4c73d0 (diff)
Added an option to camera preset to include/exclude focal length from the preset
Useful for cameras which have fixed focal length.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/startup/bl_operators/presets.py55
1 files changed, 39 insertions, 16 deletions
diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py
index ae6ec3946f1..f1da0ff615d 100644
--- a/release/scripts/startup/bl_operators/presets.py
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -256,14 +256,26 @@ class AddPresetCamera(AddPresetBase, Operator):
"cam = bpy.context.object.data"
]
- preset_values = [
- "cam.sensor_width",
- "cam.sensor_height",
- "cam.sensor_fit"
- ]
-
preset_subdir = "camera"
+ use_focal_length = BoolProperty(
+ name="Include Focal Length",
+ description="Include focal length into the preset",
+ options={'SKIP_SAVE'},
+ )
+
+ @property
+ def preset_values(self):
+ preset_values = [
+ "cam.sensor_width",
+ "cam.sensor_height",
+ "cam.sensor_fit"
+ ]
+ if self.use_focal_length:
+ preset_values.append("cam.lens")
+ preset_values.append("cam.lens_unit")
+ return preset_values
+
class AddPresetSSS(AddPresetBase, Operator):
"""Add or remove a Subsurface Scattering Preset"""
@@ -398,18 +410,29 @@ class AddPresetTrackingCamera(AddPresetBase, Operator):
"camera = bpy.context.edit_movieclip.tracking.camera"
]
- preset_values = [
- "camera.sensor_width",
- "camera.units",
- "camera.focal_length",
- "camera.pixel_aspect",
- "camera.k1",
- "camera.k2",
- "camera.k3"
- ]
-
preset_subdir = "tracking_camera"
+ use_focal_length = BoolProperty(
+ name="Include Focal Length",
+ description="Include focal length into the preset",
+ options={'SKIP_SAVE'},
+ default=True
+ )
+
+ @property
+ def preset_values(self):
+ preset_values = [
+ "camera.sensor_width",
+ "camera.pixel_aspect",
+ "camera.k1",
+ "camera.k2",
+ "camera.k3"
+ ]
+ if self.use_focal_length:
+ preset_values.append("camera.units")
+ preset_values.append("camera.focal_length")
+ return preset_values
+
class AddPresetTrackingTrackColor(AddPresetBase, Operator):
"""Add or remove a Clip Track Color Preset"""