[Bf-extensions-cvs] [f360f6b8] master: Add Camera Rigs: Minor Cleanup
lijenstina
noreply at git.blender.org
Wed Jun 7 01:47:53 CEST 2017
Commit: f360f6b893366ebead07ca279b354f1e349ead64
Author: lijenstina
Date: Wed Jun 7 01:47:00 2017 +0200
Branches: master
https://developer.blender.org/rBAf360f6b893366ebead07ca279b354f1e349ead64
Add Camera Rigs: Minor Cleanup
Bumped version to 1.1.1
Pep8 cleanup
Remove some unused variables
Add the missing GPL license block
Merge the menu append functions into one
===================================================================
M camera_dolly_crane_rigs.py
===================================================================
diff --git a/camera_dolly_crane_rigs.py b/camera_dolly_crane_rigs.py
index 363cb588..8175ac3f 100644
--- a/camera_dolly_crane_rigs.py
+++ b/camera_dolly_crane_rigs.py
@@ -1,21 +1,44 @@
+# ##### 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 LICENSE BLOCK #####
+
+
bl_info = {
"name": "Add Camera Rigs",
"author": "Wayne Dixon, Kris Wittig",
- "version": (1, 1),
+ "version": (1, 1, 1),
"blender": (2, 77, 0),
"location": "View3D > Add > Camera > Dolly or Crane Rig",
"description": "Adds a Camera Rig with UI",
"warning": "Enable Auto Run Python Scripts in User Preferences > File",
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Rigging/Add_Camera_Rigs",
- "tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
+ "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/"
+ "Py/Scripts/Rigging/Add_Camera_Rigs",
"category": "Camera",
}
import bpy
-from bpy.types import Operator
+from bpy.types import (
+ Operator,
+ Panel,
+ )
from rna_prop_ui import rna_idprop_ui_prop_get
from math import radians
+
# =========================================================================
# Define the functions to build the Widgets
# =========================================================================
@@ -32,18 +55,19 @@ def create_widget(self, name):
obj = bpy.data.objects.new(obj_name, mesh)
scene.objects.link(obj)
- #this will put the Widget objects out of the way on layer 19
+ # this will put the Widget objects out of the way on layer 19
WDGT_layers = (False, False, False, False, False, False, False, False, False, True,
False, False, False, False, False, False, False, False, False, False)
obj.layers = WDGT_layers
return obj
+
def create_root_widget(self, name):
# Creates a compass-shaped widget.
obj = create_widget(self, name)
- if obj != None:
+ if obj is not None:
verts = [(0.2102552056312561, -0.0012103617191314697, 0.21025514602661133),
(0.11378927528858185, -0.001210339367389679, 0.274711549282074),
(-3.070153553608179e-08, -0.0012103626504540443, 0.29734566807746887),
@@ -99,11 +123,12 @@ def create_root_widget(self, name):
mesh.from_pydata(verts, edges, [])
mesh.update()
+
def create_camera_widget(self, name):
- # Creates a camera ctrl widget.
+ # Creates a camera ctrl widget
obj = create_widget(self, name)
- if obj != None:
+ if obj is not None:
verts = [(0.13756819069385529, 1.0706068032106941e-08, -0.13756819069385529),
(0.1797415018081665, 5.353034016053471e-09, -0.07445136457681656),
(0.19455081224441528, -6.381313819948996e-16, 8.504085435845354e-09),
@@ -160,27 +185,28 @@ def create_camera_widget(self, name):
(0.04472222924232483, -7.0564780685344886e-09, 0.10796899348497391),
(0.08263590186834335, -7.0564780685344886e-09, 0.08263590186834335),
(0.10796899348497391, -3.5282390342672443e-09, 0.04472223296761513),
- (0.11686481535434723, -4.2059886864033273e-16, 5.108323541946902e-09),
- (0.10796899348497391, 3.5282390342672443e-09, -0.04472222924232483),
- (0.08263590186834335, 7.0564780685344886e-09, -0.08263590186834335),
+ (0.11686481535434723, -4.2059886864033273e-16, 5.108323541946902e-09),
+ (0.10796899348497391, 3.5282390342672443e-09, -0.04472222924232483),
+ (0.08263590186834335, 7.0564780685344886e-09, -0.08263590186834335),
(3.725290298461914e-08, -2.1412136064213882e-08, 0.24882805347442627)]
edges = [(0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 6), (7, 8), (0, 8),
(10, 11), (9, 12), (11, 12), (10, 13), (9, 14), (13, 15), (14, 15), (16, 22),
- (17, 18), (18, 19), (19, 20), (20, 21), (21, 22), (7, 17), (6, 16), (23, 24),
+ (17, 18), (18, 19), (19, 20), (20, 21), (21, 22), (7, 17), (6, 16), (23, 24),
(23, 25), (24, 29), (25, 28), (26, 29), (27, 28), (31, 32), (30, 33), (32, 33),
- (31, 34), (30, 35), (34, 36), (35, 36), (37, 38), (37, 39), (38, 43), (39, 42),
+ (31, 34), (30, 35), (34, 36), (35, 36), (37, 38), (37, 39), (38, 43), (39, 42),
(40, 41), (40, 43), (41, 42), (50, 53), (49, 52), (44, 45), (45, 46), (46, 47),
- (47, 48), (48, 49), (44, 50), (51, 59), (51, 52), (53, 54), (54, 55), (55, 56),
+ (47, 48), (48, 49), (44, 50), (51, 59), (51, 52), (53, 54), (54, 55), (55, 56),
(56, 57), (57, 58), (58, 59), (26, 60), (27, 60), (23, 60)]
mesh = obj.data
mesh.from_pydata(verts, edges, [])
mesh.update()
+
def create_aim_widget(self, name):
""" Creates a camera aim widget."""
obj = create_widget(self, name)
- if obj != None:
+ if obj is not None:
verts = [(0.15504144132137299, 1.4901161193847656e-08, 0.15504144132137299),
(0.20257140696048737, 7.450580596923828e-09, 0.0839078277349472),
(0.21926172077655792, -8.881784197001252e-16, -9.584233851001045e-09),
@@ -215,7 +241,7 @@ def create_aim_widget(self, name):
(-0.052745334804058075, -2.9802322387695312e-08, -0.3996969759464264),
(-0.05274537205696106, -2.9802322387695312e-08, -0.49317920207977295),
(0.05274519696831703, -2.9802322387695312e-08, -0.49317920207977295),
- (-0.09776955097913742, -2.9802322387695312e-08, -0.3996969163417816),
+ (-0.09776955097913742, -2.9802322387695312e-08, -0.3996969163417816),
(0.09776940196752548, -2.9802322387695312e-08, -0.39969703555107117),
(-7.148475589247028e-08, -2.9802322387695312e-08, -0.2804329991340637),
(-0.2804330289363861, 3.552713678800501e-15, 4.234420103443881e-08),
@@ -258,6 +284,7 @@ def create_aim_widget(self, name):
mesh.from_pydata(verts, edges, [])
mesh.update()
+
# =========================================================================
# Define the fuction to make the camera active
# =========================================================================
@@ -273,10 +300,11 @@ def sceneCamera():
else:
return None
-class MakeCameraActive(bpy.types.Operator):
- '''Makes the camera parented to this rig the active scene camera'''
+
+class MakeCameraActive(Operator):
bl_idname = "scene.make_camera_active"
bl_label = "Make Camera Active"
+ bl_description = "Makes the camera parented to this rig the active scene camera"
@classmethod
def poll(cls, context):
@@ -284,14 +312,16 @@ class MakeCameraActive(bpy.types.Operator):
def execute(self, context):
sceneCamera()
+
return {'FINISHED'}
+
# =========================================================================
# Define function to add marker to timeline and bind camera
# =========================================================================
def markerBind():
ob = bpy.context.active_object # rig object
- active_cam = ob.children[0] # camera object
+ active_cam = ob.children[0] # camera object
# switch area to timeline to add marker
bpy.context.area.type = 'TIMELINE'
@@ -307,10 +337,12 @@ def markerBind():
# switch back to 3d view
bpy.context.area.type = 'VIEW_3D'
-class AddMarkerBind(bpy.types.Operator):
- """Add marker to current frame then bind rig camera to it (for camera switching)"""
+
+class AddMarkerBind(Operator):
bl_idname = "add.marker_bind"
bl_label = "Add marker and Bind Camera"
+ bl_description = ("Add marker to current frame then bind "
+ "rig camera to it (for camera switching)")
@classmethod
def poll(cls, context):
@@ -318,8 +350,10 @@ class AddMarkerBind(bpy.types.Operator):
def execute(self, context):
markerBind()
+
return {'FINISHED'}
+
# =========================================================================
# Define the function to add an Empty as DOF object
# =========================================================================
@@ -355,10 +389,11 @@ def add_DOF_Empty():
bpy.ops.object.mode_set(mode=smode, toggle=False)
-class AddDofEmpty(bpy.types.Operator):
- """Create empty and add as DOF Object"""
+
+class AddDofEmpty(Operator):
bl_idname = "add.dof_empty"
bl_label = "Add DOF Empty"
+ bl_description = "Create empty and add as DOF Object"
@classmethod
def poll(cls, context):
@@ -366,8 +401,10 @@ class AddDofEmpty(bpy.types.Operator):
def execute(self, context):
add_DOF_Empty()
+
return {'FINISHED'}
+
# =========================================================================
# Define the function to build the Dolly Rig
# =========================================================================
@@ -427,17 +464,17 @@ def build_dolly_rig(context):
# jump into pose mode and add the custom bone shapes
bpy.ops.object.mode_set(mode='POSE')
- bpy.context.object.pose.bones["Root"].custom_shape = bpy.data.objects[
- "WDGT_Camera_Root"] # add the widget as custom shape
+ bpy.context.o
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list