diff options
Diffstat (limited to 'release/scripts/op')
-rw-r--r-- | release/scripts/op/add_armature_human.py | 154 | ||||
-rw-r--r-- | release/scripts/op/add_mesh_torus.py | 54 | ||||
-rw-r--r-- | release/scripts/op/animsys_update.py | 699 | ||||
-rw-r--r-- | release/scripts/op/console_python.py | 157 | ||||
-rw-r--r-- | release/scripts/op/console_shell.py | 2 | ||||
-rw-r--r-- | release/scripts/op/fcurve_euler_filter.py | 17 | ||||
-rw-r--r-- | release/scripts/op/image.py | 77 | ||||
-rw-r--r-- | release/scripts/op/mesh.py | 40 | ||||
-rw-r--r-- | release/scripts/op/nla.py | 39 | ||||
-rw-r--r-- | release/scripts/op/object.py | 168 | ||||
-rw-r--r-- | release/scripts/op/object_align.py | 45 | ||||
-rw-r--r-- | release/scripts/op/object_randomize_transform.py | 6 | ||||
-rw-r--r-- | release/scripts/op/presets.py | 120 | ||||
-rw-r--r-- | release/scripts/op/screen_play_rendered_anim.py | 8 | ||||
-rw-r--r-- | release/scripts/op/sequencer.py | 72 | ||||
-rw-r--r-- | release/scripts/op/uv.py | 46 | ||||
-rw-r--r-- | release/scripts/op/uvcalc_follow_active.py | 37 | ||||
-rw-r--r-- | release/scripts/op/uvcalc_smart_project.py | 62 | ||||
-rw-r--r-- | release/scripts/op/vertexpaint_dirt.py | 39 | ||||
-rw-r--r-- | release/scripts/op/wm.py | 325 |
20 files changed, 1594 insertions, 573 deletions
diff --git a/release/scripts/op/add_armature_human.py b/release/scripts/op/add_armature_human.py index b00b735d16d..e0558e84315 100644 --- a/release/scripts/op/add_armature_human.py +++ b/release/scripts/op/add_armature_human.py @@ -18,7 +18,7 @@ # <pep8-80 compliant> import bpy -import Mathutils +import mathutils from math import cos, sin, pi # could this be stored elsewhere? @@ -33,426 +33,426 @@ def metarig_template(): bone.head[:] = -0.0000, -0.0145, 1.1263 bone.tail[:] = -0.0000, -0.0145, 0.9563 bone.roll = 3.1416 - bone.connected = False + bone.use_connect = False bone = arm.edit_bones.new('torso') bone.head[:] = -0.0000, -0.0145, 1.1263 bone.tail[:] = -0.0000, -0.0145, 1.2863 bone.roll = 3.1416 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['pelvis'] bone = arm.edit_bones.new('spine.01') bone.head[:] = 0.0000, 0.0394, 0.9688 bone.tail[:] = -0.0000, -0.0145, 1.1263 bone.roll = 0.0000 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['torso'] bone = arm.edit_bones.new('spine.02') bone.head[:] = -0.0000, -0.0145, 1.1263 bone.tail[:] = -0.0000, -0.0213, 1.2884 bone.roll = -0.0000 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['spine.01'] bone = arm.edit_bones.new('thigh.L') bone.head[:] = 0.0933, -0.0421, 1.0434 bone.tail[:] = 0.0933, -0.0516, 0.5848 bone.roll = 0.0000 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['spine.01'] bone = arm.edit_bones.new('thigh.R') bone.head[:] = -0.0933, -0.0421, 1.0434 bone.tail[:] = -0.0933, -0.0516, 0.5848 bone.roll = -0.0000 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['spine.01'] bone = arm.edit_bones.new('spine.03') bone.head[:] = -0.0000, -0.0213, 1.2884 bone.tail[:] = -0.0000, 0.0160, 1.3705 bone.roll = -0.0000 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['spine.02'] bone = arm.edit_bones.new('shin.L') bone.head[:] = 0.0933, -0.0516, 0.5848 bone.tail[:] = 0.0915, 0.0100, 0.1374 bone.roll = 0.0034 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['thigh.L'] bone = arm.edit_bones.new('shin.R') bone.head[:] = -0.0933, -0.0516, 0.5848 bone.tail[:] = -0.0915, 0.0100, 0.1374 bone.roll = -0.0034 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['thigh.R'] bone = arm.edit_bones.new('spine.04') bone.head[:] = -0.0000, 0.0160, 1.3705 bone.tail[:] = -0.0000, 0.0590, 1.4497 bone.roll = -0.0000 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['spine.03'] bone = arm.edit_bones.new('foot.L') bone.head[:] = 0.0915, 0.0100, 0.1374 bone.tail[:] = 0.1033, -0.0968, 0.0510 bone.roll = 2.8964 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['shin.L'] bone = arm.edit_bones.new('foot.R') bone.head[:] = -0.0915, 0.0100, 0.1374 bone.tail[:] = -0.1033, -0.0968, 0.0510 bone.roll = -2.8793 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['shin.R'] bone = arm.edit_bones.new('neck_base') bone.head[:] = -0.0000, 0.0590, 1.4497 bone.tail[:] = -0.0000, 0.0401, 1.5389 bone.roll = -0.0000 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['spine.04'] bone = arm.edit_bones.new('toe.L') bone.head[:] = 0.1033, -0.0968, 0.0510 bone.tail[:] = 0.1136, -0.1848, 0.0510 bone.roll = 0.0001 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['foot.L'] bone = arm.edit_bones.new('heel.L') bone.head[:] = 0.0809, 0.0969, -0.0000 bone.tail[:] = 0.1020, -0.0846, -0.0000 bone.roll = -0.0001 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['foot.L'] bone = arm.edit_bones.new('toe.R') bone.head[:] = -0.1033, -0.0968, 0.0510 bone.tail[:] = -0.1136, -0.1848, 0.0510 bone.roll = -0.0002 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['foot.R'] bone = arm.edit_bones.new('heel.R') bone.head[:] = -0.0809, 0.0969, -0.0000 bone.tail[:] = -0.1020, -0.0846, -0.0000 bone.roll = -0.0000 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['foot.R'] bone = arm.edit_bones.new('head') bone.head[:] = -0.0000, 0.0401, 1.5389 bone.tail[:] = -0.0000, 0.0401, 1.5979 bone.roll = 3.1416 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['neck_base'] bone = arm.edit_bones.new('DLT-shoulder.L') bone.head[:] = 0.0141, -0.0346, 1.4991 bone.tail[:] = 0.1226, 0.0054, 1.4991 bone.roll = 0.0005 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['neck_base'] bone = arm.edit_bones.new('DLT-shoulder.R') bone.head[:] = -0.0141, -0.0346, 1.4991 bone.tail[:] = -0.1226, 0.0054, 1.4991 bone.roll = -0.0005 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['neck_base'] bone = arm.edit_bones.new('neck.01') bone.head[:] = -0.0000, 0.0401, 1.5389 bone.tail[:] = -0.0000, 0.0176, 1.5916 bone.roll = 0.0000 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['head'] bone = arm.edit_bones.new('shoulder.L') bone.head[:] = 0.0141, -0.0346, 1.4991 bone.tail[:] = 0.1226, 0.0216, 1.5270 bone.roll = -0.1225 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['DLT-shoulder.L'] bone = arm.edit_bones.new('shoulder.R') bone.head[:] = -0.0141, -0.0346, 1.4991 bone.tail[:] = -0.1226, 0.0216, 1.5270 bone.roll = 0.0849 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['DLT-shoulder.R'] bone = arm.edit_bones.new('neck.02') bone.head[:] = -0.0000, 0.0176, 1.5916 bone.tail[:] = -0.0000, 0.0001, 1.6499 bone.roll = 0.0000 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['neck.01'] bone = arm.edit_bones.new('DLT-upper_arm.L') bone.head[:] = 0.1482, 0.0483, 1.4943 bone.tail[:] = 0.2586, 0.1057, 1.5124 bone.roll = 1.4969 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['shoulder.L'] bone = arm.edit_bones.new('DLT-upper_arm.R') bone.head[:] = -0.1482, 0.0483, 1.4943 bone.tail[:] = -0.2586, 0.1057, 1.5124 bone.roll = -1.4482 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['shoulder.R'] bone = arm.edit_bones.new('neck.03') bone.head[:] = -0.0000, 0.0001, 1.6499 bone.tail[:] = -0.0000, 0.0001, 1.8522 bone.roll = 0.0000 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['neck.02'] bone = arm.edit_bones.new('upper_arm.L') bone.head[:] = 0.1482, 0.0483, 1.4943 bone.tail[:] = 0.3929, 0.0522, 1.4801 bone.roll = 1.6281 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['DLT-upper_arm.L'] bone = arm.edit_bones.new('upper_arm.R') bone.head[:] = -0.1482, 0.0483, 1.4943 bone.tail[:] = -0.3929, 0.0522, 1.4801 bone.roll = -1.6281 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['DLT-upper_arm.R'] bone = arm.edit_bones.new('forearm.L') bone.head[:] = 0.3929, 0.0522, 1.4801 bone.tail[:] = 0.6198, 0.0364, 1.4906 bone.roll = 1.5240 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['upper_arm.L'] bone = arm.edit_bones.new('forearm.R') bone.head[:] = -0.3929, 0.0522, 1.4801 bone.tail[:] = -0.6198, 0.0364, 1.4906 bone.roll = -1.5219 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['upper_arm.R'] bone = arm.edit_bones.new('hand.L') bone.head[:] = 0.6198, 0.0364, 1.4906 bone.tail[:] = 0.6592, 0.0364, 1.4853 bone.roll = -3.0065 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['forearm.L'] bone = arm.edit_bones.new('hand.R') bone.head[:] = -0.6198, 0.0364, 1.4906 bone.tail[:] = -0.6592, 0.0364, 1.4853 bone.roll = 3.0065 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['forearm.R'] bone = arm.edit_bones.new('palm.04.L') bone.head[:] = 0.6514, 0.0658, 1.4906 bone.tail[:] = 0.7287, 0.0810, 1.4747 bone.roll = -3.0715 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['hand.L'] bone = arm.edit_bones.new('palm.03.L') bone.head[:] = 0.6533, 0.0481, 1.4943 bone.tail[:] = 0.7386, 0.0553, 1.4781 bone.roll = -3.0290 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['hand.L'] bone = arm.edit_bones.new('palm.02.L') bone.head[:] = 0.6539, 0.0305, 1.4967 bone.tail[:] = 0.7420, 0.0250, 1.4835 bone.roll = -3.0669 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['hand.L'] bone = arm.edit_bones.new('palm.01.L') bone.head[:] = 0.6514, 0.0116, 1.4961 bone.tail[:] = 0.7361, -0.0074, 1.4823 bone.roll = -2.9422 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['hand.L'] bone = arm.edit_bones.new('thumb.01.L') bone.head[:] = 0.6380, -0.0005, 1.4848 bone.tail[:] = 0.6757, -0.0408, 1.4538 bone.roll = -0.7041 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['hand.L'] bone = arm.edit_bones.new('palm.04.R') bone.head[:] = -0.6514, 0.0658, 1.4906 bone.tail[:] = -0.7287, 0.0810, 1.4747 bone.roll = 3.0715 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['hand.R'] bone = arm.edit_bones.new('palm.03.R') bone.head[:] = -0.6533, 0.0481, 1.4943 bone.tail[:] = -0.7386, 0.0553, 1.4781 bone.roll = 3.0290 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['hand.R'] bone = arm.edit_bones.new('palm.02.R') bone.head[:] = -0.6539, 0.0305, 1.4967 bone.tail[:] = -0.7420, 0.0250, 1.4835 bone.roll = 3.0669 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['hand.R'] bone = arm.edit_bones.new('thumb.01.R') bone.head[:] = -0.6380, -0.0005, 1.4848 bone.tail[:] = -0.6757, -0.0408, 1.4538 bone.roll = 0.7041 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['hand.R'] bone = arm.edit_bones.new('palm.01.R') bone.head[:] = -0.6514, 0.0116, 1.4961 bone.tail[:] = -0.7361, -0.0074, 1.4823 bone.roll = 2.9332 - bone.connected = False + bone.use_connect = False bone.parent = arm.edit_bones['hand.R'] bone = arm.edit_bones.new('finger_pinky.01.L') bone.head[:] = 0.7287, 0.0810, 1.4747 bone.tail[:] = 0.7698, 0.0947, 1.4635 bone.roll = -3.0949 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['palm.04.L'] bone = arm.edit_bones.new('finger_ring.01.L') bone.head[:] = 0.7386, 0.0553, 1.4781 bone.tail[:] = 0.7890, 0.0615, 1.4667 bone.roll = -3.0081 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['palm.03.L'] bone = arm.edit_bones.new('finger_middle.01.L') bone.head[:] = 0.7420, 0.0250, 1.4835 bone.tail[:] = 0.7975, 0.0221, 1.4712 bone.roll = -2.9982 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['palm.02.L'] bone = arm.edit_bones.new('finger_index.01.L') bone.head[:] = 0.7361, -0.0074, 1.4823 bone.tail[:] = 0.7843, -0.0204, 1.4718 bone.roll = -3.0021 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['palm.01.L'] bone = arm.edit_bones.new('thumb.02.L') bone.head[:] = 0.6757, -0.0408, 1.4538 bone.tail[:] = 0.6958, -0.0568, 1.4376 bone.roll = -0.6963 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['thumb.01.L'] bone = arm.edit_bones.new('finger_pinky.01.R') bone.head[:] = -0.7287, 0.0810, 1.4747 bone.tail[:] = -0.7698, 0.0947, 1.4635 bone.roll = 3.0949 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['palm.04.R'] bone = arm.edit_bones.new('finger_ring.01.R') bone.head[:] = -0.7386, 0.0553, 1.4781 bone.tail[:] = -0.7890, 0.0615, 1.4667 bone.roll = 2.9892 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['palm.03.R'] bone = arm.edit_bones.new('finger_middle.01.R') bone.head[:] = -0.7420, 0.0250, 1.4835 bone.tail[:] = -0.7975, 0.0221, 1.4712 bone.roll = 2.9816 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['palm.02.R'] bone = arm.edit_bones.new('thumb.02.R') bone.head[:] = -0.6757, -0.0408, 1.4538 bone.tail[:] = -0.6958, -0.0568, 1.4376 bone.roll = 0.6963 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['thumb.01.R'] bone = arm.edit_bones.new('finger_index.01.R') bone.head[:] = -0.7361, -0.0074, 1.4823 bone.tail[:] = -0.7843, -0.0204, 1.4718 bone.roll = 2.9498 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['palm.01.R'] bone = arm.edit_bones.new('finger_pinky.02.L') bone.head[:] = 0.7698, 0.0947, 1.4635 bone.tail[:] = 0.7910, 0.1018, 1.4577 bone.roll = -3.0949 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_pinky.01.L'] bone = arm.edit_bones.new('finger_ring.02.L') bone.head[:] = 0.7890, 0.0615, 1.4667 bone.tail[:] = 0.8177, 0.0650, 1.4600 bone.roll = -3.0006 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_ring.01.L'] bone = arm.edit_bones.new('finger_middle.02.L') bone.head[:] = 0.7975, 0.0221, 1.4712 bone.tail[:] = 0.8289, 0.0206, 1.4643 bone.roll = -2.9995 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_middle.01.L'] bone = arm.edit_bones.new('finger_index.02.L') bone.head[:] = 0.7843, -0.0204, 1.4718 bone.tail[:] = 0.8117, -0.0275, 1.4660 bone.roll = -3.0064 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_index.01.L'] bone = arm.edit_bones.new('thumb.03.L') bone.head[:] = 0.6958, -0.0568, 1.4376 bone.tail[:] = 0.7196, -0.0671, 1.4210 bone.roll = -0.8072 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['thumb.02.L'] bone = arm.edit_bones.new('finger_pinky.02.R') bone.head[:] = -0.7698, 0.0947, 1.4635 bone.tail[:] = -0.7910, 0.1018, 1.4577 bone.roll = 3.0949 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_pinky.01.R'] bone = arm.edit_bones.new('finger_ring.02.R') bone.head[:] = -0.7890, 0.0615, 1.4667 bone.tail[:] = -0.8177, 0.0650, 1.4600 bone.roll = 3.0341 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_ring.01.R'] bone = arm.edit_bones.new('finger_middle.02.R') bone.head[:] = -0.7975, 0.0221, 1.4712 bone.tail[:] = -0.8289, 0.0206, 1.4643 bone.roll = 3.0291 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_middle.01.R'] bone = arm.edit_bones.new('thumb.03.R') bone.head[:] = -0.6958, -0.0568, 1.4376 bone.tail[:] = -0.7196, -0.0671, 1.4210 bone.roll = 0.8072 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['thumb.02.R'] bone = arm.edit_bones.new('finger_index.02.R') bone.head[:] = -0.7843, -0.0204, 1.4718 bone.tail[:] = -0.8117, -0.0275, 1.4660 bone.roll = 3.0705 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_index.01.R'] bone = arm.edit_bones.new('finger_pinky.03.L') bone.head[:] = 0.7910, 0.1018, 1.4577 bone.tail[:] = 0.8109, 0.1085, 1.4523 bone.roll = -3.0949 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_pinky.02.L'] bone = arm.edit_bones.new('finger_ring.03.L') bone.head[:] = 0.8177, 0.0650, 1.4600 bone.tail[:] = 0.8396, 0.0677, 1.4544 bone.roll = -2.9819 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_ring.02.L'] bone = arm.edit_bones.new('finger_middle.03.L') bone.head[:] = 0.8289, 0.0206, 1.4643 bone.tail[:] = 0.8534, 0.0193, 1.4589 bone.roll = -3.0004 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_middle.02.L'] bone = arm.edit_bones.new('finger_index.03.L') bone.head[:] = 0.8117, -0.0275, 1.4660 bone.tail[:] = 0.8331, -0.0333, 1.4615 bone.roll = -3.0103 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_index.02.L'] bone = arm.edit_bones.new('finger_pinky.03.R') bone.head[:] = -0.7910, 0.1018, 1.4577 bone.tail[:] = -0.8109, 0.1085, 1.4523 bone.roll = 3.0949 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_pinky.02.R'] bone = arm.edit_bones.new('finger_ring.03.R') bone.head[:] = -0.8177, 0.0650, 1.4600 bone.tail[:] = -0.8396, 0.0677, 1.4544 bone.roll = 2.9819 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_ring.02.R'] bone = arm.edit_bones.new('finger_middle.03.R') bone.head[:] = -0.8289, 0.0206, 1.4643 bone.tail[:] = -0.8534, 0.0193, 1.4589 bone.roll = 3.0004 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_middle.02.R'] bone = arm.edit_bones.new('finger_index.03.R') bone.head[:] = -0.8117, -0.0275, 1.4660 bone.tail[:] = -0.8331, -0.0333, 1.4615 bone.roll = 2.9917 - bone.connected = True + bone.use_connect = True bone.parent = arm.edit_bones['finger_index.02.R'] bpy.ops.object.mode_set(mode='OBJECT') @@ -487,11 +487,11 @@ def metarig_template(): pbone = obj.pose.bones['shoulder.L'] pbone['type'] = 'copy' pbone = obj.pose.bones['shoulder.L'] - pbone['copy.layer'] = 1 + pbone['copy.layers'] = 1 pbone = obj.pose.bones['shoulder.R'] pbone['type'] = 'copy' pbone = obj.pose.bones['shoulder.R'] - pbone['copy.layer'] = 1 + pbone['copy.layers'] = 1 pbone = obj.pose.bones['DLT-upper_arm.L'] pbone['type'] = 'delta' pbone = obj.pose.bones['DLT-upper_arm.R'] @@ -515,7 +515,7 @@ def metarig_template(): pbone = obj.pose.bones['palm.01.L'] pbone['type'] = 'palm_curl' pbone = obj.pose.bones['palm.01.L'] - pbone['palm_curl.layer'] = 5 + pbone['palm_curl.layers'] = 5 pbone = obj.pose.bones['thumb.01.L'] pbone['type'] = 'finger_curl' pbone = obj.pose.bones['thumb.01.L'] @@ -531,7 +531,7 @@ def metarig_template(): pbone = obj.pose.bones['palm.01.R'] pbone['type'] = 'palm_curl' pbone = obj.pose.bones['palm.01.R'] - pbone['palm_curl.layer'] = 5 + pbone['palm_curl.layers'] = 5 pbone = obj.pose.bones['finger_pinky.01.L'] pbone['type'] = 'finger_curl' pbone = obj.pose.bones['finger_pinky.01.L'] @@ -606,12 +606,10 @@ menu_func = (lambda self, context: self.layout.operator(AddHuman.bl_idname, def register(): - bpy.types.register(AddHuman) bpy.types.INFO_MT_armature_add.append(menu_func) def unregister(): - bpy.types.unregister(AddHuman) bpy.types.INFO_MT_armature_add.remove(menu_func) if __name__ == "__main__": diff --git a/release/scripts/op/add_mesh_torus.py b/release/scripts/op/add_mesh_torus.py index 601cc712dda..217aa8fae83 100644 --- a/release/scripts/op/add_mesh_torus.py +++ b/release/scripts/op/add_mesh_torus.py @@ -18,13 +18,13 @@ # <pep8 compliant> import bpy -import Mathutils +import mathutils from math import cos, sin, pi def add_torus(major_rad, minor_rad, major_seg, minor_seg): - Vector = Mathutils.Vector - Quaternion = Mathutils.Quaternion + Vector = mathutils.Vector + Quaternion = mathutils.Quaternion PI_2 = pi * 2 z_axis = (0, 0, 1) @@ -39,10 +39,10 @@ def add_torus(major_rad, minor_rad, major_seg, minor_seg): for minor_index in range(minor_seg): angle = 2 * pi * minor_index / minor_seg - vec = Vector(major_rad + (cos(angle) * minor_rad), 0.0, - (sin(angle) * minor_rad)) * quat + vec = Vector((major_rad + (cos(angle) * minor_rad), 0.0, + (sin(angle) * minor_rad))) * quat - verts.extend([vec.x, vec.y, vec.z]) + verts.extend(vec[:]) if minor_index + 1 == minor_seg: i2 = (major_index) * minor_seg @@ -102,6 +102,10 @@ class AddTorus(bpy.types.Operator): description="Total Interior Radius of the torus", default=0.5, min=0.01, max=100.0) + # generic transform props + location = FloatVectorProperty(name="Location") + rotation = FloatVectorProperty(name="Rotation") + def execute(self, context): props = self.properties @@ -117,39 +121,15 @@ class AddTorus(bpy.types.Operator): mesh = bpy.data.meshes.new("Torus") - mesh.add_geometry(int(len(verts_loc) / 3), 0, int(len(faces) / 4)) - mesh.verts.foreach_set("co", verts_loc) - mesh.faces.foreach_set("verts_raw", faces) - - scene = context.scene - - # ugh - for ob in scene.objects: - ob.selected = False + mesh.vertices.add(len(verts_loc) // 3) + mesh.faces.add(len(faces) // 4) + mesh.vertices.foreach_set("co", verts_loc) + mesh.faces.foreach_set("vertices_raw", faces) mesh.update() - ob_new = bpy.data.objects.new("Torus", mesh) - scene.objects.link(ob_new) - ob_new.selected = True - - ob_new.location = scene.cursor_location - - obj_act = scene.objects.active - - if obj_act and obj_act.mode == 'EDIT': - bpy.ops.object.mode_set(mode='OBJECT') - - obj_act.selected = True - scene.update() # apply location - #scene.objects.active = ob_new - - bpy.ops.object.join() # join into the active. - bpy.ops.object.mode_set(mode='EDIT') - else: - scene.objects.active = ob_new - if context.user_preferences.edit.enter_edit_mode: - bpy.ops.object.mode_set(mode='EDIT') + import add_object_utils + add_object_utils.add_object_data(context, mesh, operator=self) return {'FINISHED'} @@ -159,12 +139,10 @@ def menu_func(self, context): def register(): - bpy.types.register(AddTorus) bpy.types.INFO_MT_mesh_add.append(menu_func) def unregister(): - bpy.types.unregister(AddTorus) bpy.types.INFO_MT_mesh_add.remove(menu_func) if __name__ == "__main__": diff --git a/release/scripts/op/animsys_update.py b/release/scripts/op/animsys_update.py new file mode 100644 index 00000000000..0fe03a0cc4d --- /dev/null +++ b/release/scripts/op/animsys_update.py @@ -0,0 +1,699 @@ +# ##### 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 ##### + +# <pep8 compliant> + +data_path_update = [ + ("ClothCollisionSettings", "min_distance", "distance_min"), + ("ClothCollisionSettings", "self_min_distance", "self_distance_min"), + ("ClothCollisionSettings", "enable_collision", "use_collision"), + ("ClothCollisionSettings", "enable_self_collision", "use_self_collision"), + ("ClothSettings", "pin_cloth", "use_pin_cloth"), + ("ClothSettings", "stiffness_scaling", "use_stiffness_scale"), + ("CollisionSettings", "random_damping", "damping_random"), + ("CollisionSettings", "random_friction", "friction_random"), + ("CollisionSettings", "inner_thickness", "thickness_inner"), + ("CollisionSettings", "outer_thickness", "thickness_outer"), + ("CollisionSettings", "kill_particles", "use_particle_kill"), + ("Constraint", "proxy_local", "is_proxy_local"), + ("ActionConstraint", "maximum", "max"), + ("ActionConstraint", "minimum", "min"), + ("FollowPathConstraint", "use_fixed_position", "use_fixed_location"), + ("KinematicConstraint", "chain_length", "chain_count"), + ("KinematicConstraint", "pos_lock_x", "lock_location_x"), + ("KinematicConstraint", "pos_lock_y", "lock_location_y"), + ("KinematicConstraint", "pos_lock_z", "lock_location_z"), + ("KinematicConstraint", "rot_lock_x", "lock_rotation_x"), + ("KinematicConstraint", "rot_lock_y", "lock_rotation_y"), + ("KinematicConstraint", "rot_lock_z", "lock_rotation_z"), + ("KinematicConstraint", "axis_reference", "reference_axis"), + ("KinematicConstraint", "use_position", "use_location"), + ("LimitLocationConstraint", "maximum_x", "max_x"), + ("LimitLocationConstraint", "maximum_y", "max_y"), + ("LimitLocationConstraint", "maximum_z", "max_z"), + ("LimitLocationConstraint", "minimum_x", "min_x"), + ("LimitLocationConstraint", "minimum_y", "min_y"), + ("LimitLocationConstraint", "minimum_z", "min_z"), + ("LimitLocationConstraint", "use_maximum_x", "use_max_x"), + ("LimitLocationConstraint", "use_maximum_y", "use_max_y"), + ("LimitLocationConstraint", "use_maximum_z", "use_max_z"), + ("LimitLocationConstraint", "use_minimum_x", "use_min_x"), + ("LimitLocationConstraint", "use_minimum_y", "use_min_y"), + ("LimitLocationConstraint", "use_minimum_z", "use_min_z"), + ("LimitLocationConstraint", "limit_transform", "use_transform_limit"), + ("LimitRotationConstraint", "maximum_x", "max_x"), + ("LimitRotationConstraint", "maximum_y", "max_y"), + ("LimitRotationConstraint", "maximum_z", "max_z"), + ("LimitRotationConstraint", "minimum_x", "min_x"), + ("LimitRotationConstraint", "minimum_y", "min_y"), + ("LimitRotationConstraint", "minimum_z", "min_z"), + ("LimitRotationConstraint", "limit_transform", "use_transform_limit"), + ("LimitScaleConstraint", "maximum_x", "max_x"), + ("LimitScaleConstraint", "maximum_y", "max_y"), + ("LimitScaleConstraint", "maximum_z", "max_z"), + ("LimitScaleConstraint", "minimum_x", "min_x"), + ("LimitScaleConstraint", "minimum_y", "min_y"), + ("LimitScaleConstraint", "minimum_z", "min_z"), + ("LimitScaleConstraint", "use_maximum_x", "use_max_x"), + ("LimitScaleConstraint", "use_maximum_y", "use_max_y"), + ("LimitScaleConstraint", "use_maximum_z", "use_max_z"), + ("LimitScaleConstraint", "use_minimum_x", "use_min_x"), + ("LimitScaleConstraint", "use_minimum_y", "use_min_y"), + ("LimitScaleConstraint", "use_minimum_z", "use_min_z"), + ("LimitScaleConstraint", "limit_transform", "use_transform_limit"), + ("PivotConstraint", "enabled_rotation_range", "rotation_range"), + ("PivotConstraint", "use_relative_position", "use_relative_location"), + ("PythonConstraint", "number_of_targets", "target_count"), + ("SplineIKConstraint", "chain_length", "chain_count"), + ("SplineIKConstraint", "chain_offset", "use_chain_offset"), + ("SplineIKConstraint", "even_divisions", "use_even_divisions"), + ("SplineIKConstraint", "y_stretch", "use_y_stretch"), + ("SplineIKConstraint", "xz_scaling_mode", "xz_scale_mode"), + ("StretchToConstraint", "original_length", "rest_length"), + ("TrackToConstraint", "target_z", "use_target_z"), + ("TransformConstraint", "extrapolate_motion", "use_motion_extrapolate"), + ("FieldSettings", "do_location", "apply_to_location"), + ("FieldSettings", "do_rotation", "apply_to_rotation"), + ("FieldSettings", "maximum_distance", "distance_max"), + ("FieldSettings", "minimum_distance", "distance_min"), + ("FieldSettings", "radial_maximum", "radial_max"), + ("FieldSettings", "radial_minimum", "radial_min"), + ("FieldSettings", "force_2d", "use_2d_force"), + ("FieldSettings", "do_absorption", "use_absorption"), + ("FieldSettings", "global_coordinates", "use_global_coords"), + ("FieldSettings", "guide_path_add", "use_guide_path_add"), + ("FieldSettings", "multiple_springs", "use_multiple_springs"), + ("FieldSettings", "use_coordinates", "use_object_coords"), + ("FieldSettings", "root_coordinates", "use_root_coords"), + ("ControlFluidSettings", "reverse_frames", "use_reverse_frames"), + ("DomainFluidSettings", "real_world_size", "simulation_scale"), + ("DomainFluidSettings", "surface_smoothing", "surface_smooth"), + ("DomainFluidSettings", "reverse_frames", "use_reverse_frames"), + ("DomainFluidSettings", "generate_speed_vectors", "use_speed_vectors"), + ("DomainFluidSettings", "override_time", "use_time_override"), + ("FluidFluidSettings", "export_animated_mesh", "use_animated_mesh"), + ("InflowFluidSettings", "export_animated_mesh", "use_animated_mesh"), + ("InflowFluidSettings", "local_coordinates", "use_local_coords"), + ("ObstacleFluidSettings", "export_animated_mesh", "use_animated_mesh"), + ("OutflowFluidSettings", "export_animated_mesh", "use_animated_mesh"), + ("ParticleFluidSettings", "drops", "use_drops"), + ("ParticleFluidSettings", "floats", "use_floats"), + ("Armature", "drawtype", "draw_type"), + ("Armature", "layer_protection", "layers_protected"), + ("Armature", "auto_ik", "use_auto_ik"), + ("Armature", "delay_deform", "use_deform_delay"), + ("Armature", "deform_envelope", "use_deform_envelopes"), + ("Armature", "deform_quaternion", "use_deform_preserve_volume"), + ("Armature", "deform_vertexgroups", "use_deform_vertex_groups"), + ("Armature", "x_axis_mirror", "use_mirror_x"), + ("Curve", "width", "offset"), + ("Image", "animation_speed", "fps"), + ("Image", "animation_end", "frame_end"), + ("Image", "animation_start", "frame_start"), + ("Image", "animated", "use_animation"), + ("Image", "clamp_x", "use_clamp_x"), + ("Image", "clamp_y", "use_clamp_y"), + ("Image", "premultiply", "use_premultiply"), + ("AreaLamp", "shadow_ray_sampling_method", "shadow_ray_sample_method"), + ("AreaLamp", "only_shadow", "use_only_shadow"), + ("AreaLamp", "shadow_layer", "use_shadow_layer"), + ("AreaLamp", "umbra", "use_umbra"), + ("PointLamp", "shadow_ray_sampling_method", "shadow_ray_sample_method"), + ("PointLamp", "only_shadow", "use_only_shadow"), + ("PointLamp", "shadow_layer", "use_shadow_layer"), + ("PointLamp", "sphere", "use_sphere"), + ("SpotLamp", "shadow_ray_sampling_method", "shadow_ray_sample_method"), + ("SpotLamp", "auto_clip_end", "use_auto_clip_end"), + ("SpotLamp", "auto_clip_start", "use_auto_clip_start"), + ("SpotLamp", "only_shadow", "use_only_shadow"), + ("SpotLamp", "shadow_layer", "use_shadow_layer"), + ("SpotLamp", "sphere", "use_sphere"), + ("SunLamp", "only_shadow", "use_only_shadow"), + ("SunLamp", "shadow_layer", "use_shadow_layer"), + ("Material", "z_offset", "offset_z"), + ("Material", "shadow_casting_alpha", "shadow_cast_alpha"), + ("Material", "cast_approximate", "use_cast_approximate"), + ("Material", "cast_buffer_shadows", "use_cast_buffer_shadows"), + ("Material", "cast_shadows_only", "use_cast_shadows_only"), + ("Material", "face_texture", "use_face_texture"), + ("Material", "face_texture_alpha", "use_face_texture_alpha"), + ("Material", "full_oversampling", "use_full_oversampling"), + ("Material", "light_group_exclusive", "use_light_group_exclusive"), + ("Material", "object_color", "use_object_color"), + ("Material", "only_shadow", "use_only_shadow"), + ("Material", "ray_shadow_bias", "use_ray_shadow_bias"), + ("Material", "traceable", "use_raytrace"), + ("Material", "shadeless", "use_shadeless"), + ("Material", "tangent_shading", "use_tangent_shading"), + ("Material", "transparency", "use_transparency"), + ("Material", "receive_transparent_shadows", "use_transparent_shadows"), + ("Material", "vertex_color_light", "use_vertex_color_light"), + ("Material", "vertex_color_paint", "use_vertex_color_paint"), + ("Mesh", "autosmooth_angle", "auto_smooth_angle"), + ("Mesh", "autosmooth", "use_auto_smooth"), + ("Object", "max_draw_type", "draw_type"), + ("Object", "use_dupli_verts_rotation", "use_dupli_vertices_rotation"), + ("Object", "shape_key_edit_mode", "use_shape_key_edit_mode"), + ("Object", "slow_parent", "use_slow_parent"), + ("Object", "time_offset_add_parent", "use_time_offset_add_parent"), + ("Object", "time_offset_edit", "use_time_offset_edit"), + ("Object", "time_offset_parent", "use_time_offset_parent"), + ("Object", "time_offset_particle", "use_time_offset_particle"), + ("ParticleSettings", "adaptive_pix", "adaptive_pixel"), + ("ParticleSettings", "child_effector", "apply_effector_to_children"), + ("ParticleSettings", "child_guide", "apply_guide_to_children"), + ("ParticleSettings", "billboard_split_offset", "billboard_offset_split"), + ("ParticleSettings", "billboard_random_tilt", "billboard_tilt_random"), + ("ParticleSettings", "child_length_thres", "child_length_threshold"), + ("ParticleSettings", "child_random_size", "child_size_random"), + ("ParticleSettings", "clumppow", "clump_shape"), + ("ParticleSettings", "damp_factor", "damping"), + ("ParticleSettings", "draw_as", "draw_method"), + ("ParticleSettings", "random_factor", "factor_random"), + ("ParticleSettings", "grid_invert", "invert_grid"), + ("ParticleSettings", "random_length", "length_random"), + ("ParticleSettings", "random_lifetime", "lifetime_random"), + ("ParticleSettings", "billboard_lock", "lock_billboard"), + ("ParticleSettings", "boids_2d", "lock_boids_to_surface"), + ("ParticleSettings", "object_aligned_factor", "object_align_factor"), + ("ParticleSettings", "random_phase_factor", "phase_factor_random"), + ("ParticleSettings", "ren_as", "render_type"), + ("ParticleSettings", "rendered_child_nbr", "rendered_child_count"), + ("ParticleSettings", "random_rotation_factor", "rotation_factor_random"), + ("ParticleSettings", "rough1", "roughness_1"), + ("ParticleSettings", "rough1_size", "roughness_1_size"), + ("ParticleSettings", "rough2", "roughness_2"), + ("ParticleSettings", "rough2_size", "roughness_2_size"), + ("ParticleSettings", "rough2_thres", "roughness_2_threshold"), + ("ParticleSettings", "rough_end_shape", "roughness_end_shape"), + ("ParticleSettings", "rough_endpoint", "roughness_endpoint"), + ("ParticleSettings", "random_size", "size_random"), + ("ParticleSettings", "abs_path_time", "use_absolute_path_time"), + ("ParticleSettings", "animate_branching", "use_animate_branching"), + ("ParticleSettings", "branching", "use_branching"), + ("ParticleSettings", "died", "use_dead"), + ("ParticleSettings", "die_on_collision", "use_die_on_collision"), + ("ParticleSettings", "rotation_dynamic", "use_dynamic_rotation"), + ("ParticleSettings", "even_distribution", "use_even_distribution"), + ("ParticleSettings", "rand_group", "use_group_pick_random"), + ("ParticleSettings", "hair_bspline", "use_hair_bspline"), + ("ParticleSettings", "sizemass", "use_multiply_size_mass"), + ("ParticleSettings", "react_multiple", "use_react_multiple"), + ("ParticleSettings", "react_start_end", "use_react_start_end"), + ("ParticleSettings", "render_adaptive", "use_render_adaptive"), + ("ParticleSettings", "self_effect", "use_self_effect"), + ("ParticleSettings", "enable_simplify", "use_simplify"), + ("ParticleSettings", "size_deflect", "use_size_deflect"), + ("ParticleSettings", "render_strand", "use_strand_primitive"), + ("ParticleSettings", "symmetric_branching", "use_symmetric_branching"), + ("ParticleSettings", "velocity_length", "use_velocity_length"), + ("ParticleSettings", "whole_group", "use_whole_group"), + ("CloudsTexture", "noise_size", "noise_scale"), + ("DistortedNoiseTexture", "noise_size", "noise_scale"), + ("EnvironmentMapTexture", "filter_size_minimum", "use_filter_size_min"), + ("EnvironmentMapTexture", "mipmap_gauss", "use_mipmap_gauss"), + ("ImageTexture", "calculate_alpha", "use_calculate_alpha"), + ("ImageTexture", "checker_even", "use_checker_even"), + ("ImageTexture", "checker_odd", "use_checker_odd"), + ("ImageTexture", "filter_size_minimum", "use_filter_size_min"), + ("ImageTexture", "flip_axis", "use_flip_axis"), + ("ImageTexture", "mipmap_gauss", "use_mipmap_gauss"), + ("ImageTexture", "mirror_x", "use_mirror_x"), + ("ImageTexture", "mirror_y", "use_mirror_y"), + ("ImageTexture", "normal_map", "use_normal_map"), + ("MarbleTexture", "noise_size", "noise_scale"), + ("MarbleTexture", "noisebasis2", "noisebasis_2"), + ("MusgraveTexture", "highest_dimension", "dimension_max"), + ("MusgraveTexture", "noise_size", "noise_scale"), + ("StucciTexture", "noise_size", "noise_scale"), + ("VoronoiTexture", "coloring", "color_mode"), + ("VoronoiTexture", "noise_size", "noise_scale"), + ("WoodTexture", "noise_size", "noise_scale"), + ("WoodTexture", "noisebasis2", "noisebasis_2"), + ("World", "blend_sky", "use_sky_blend"), + ("World", "paper_sky", "use_sky_paper"), + ("World", "real_sky", "use_sky_real"), + ("ImageUser", "auto_refresh", "use_auto_refresh"), + ("MaterialHalo", "flares_sub", "flare_subflare_count"), + ("MaterialHalo", "flare_subsize", "flare_subflare_size"), + ("MaterialHalo", "line_number", "line_count"), + ("MaterialHalo", "rings", "ring_count"), + ("MaterialHalo", "star_tips", "star_tip_count"), + ("MaterialHalo", "xalpha", "use_extreme_alpha"), + ("MaterialHalo", "flare_mode", "use_flare_mode"), + ("MaterialHalo", "vertex_normal", "use_vertex_normal"), + ("MaterialPhysics", "align_to_normal", "use_normal_align"), + ("MaterialStrand", "min_size", "size_min"), + ("MaterialStrand", "blender_units", "use_blender_units"), + ("MaterialStrand", "surface_diffuse", "use_surface_diffuse"), + ("MaterialStrand", "tangent_shading", "use_tangent_shading"), + ("MaterialSubsurfaceScattering", "error_tolerance", "error_threshold"), + ("MaterialVolume", "depth_cutoff", "depth_threshold"), + ("MaterialVolume", "lighting_mode", "light_method"), + ("MaterialVolume", "step_calculation", "step_method"), + ("MaterialVolume", "external_shadows", "use_external_shadows"), + ("MaterialVolume", "light_cache", "use_light_cache"), + ("ArmatureModifier", "multi_modifier", "use_multi_modifier"), + ("ArrayModifier", "constant_offset_displacement", "constant_offset_displace"), + ("ArrayModifier", "merge_distance", "merge_threshold"), + ("ArrayModifier", "relative_offset_displacement", "relative_offset_displace"), + ("ArrayModifier", "constant_offset", "use_constant_offset"), + ("ArrayModifier", "merge_adjacent_vertices", "use_merge_vertices"), + ("ArrayModifier", "merge_end_vertices", "use_merge_vertices_cap"), + ("ArrayModifier", "add_offset_object", "use_object_offset"), + ("ArrayModifier", "relative_offset", "use_relative_offset"), + ("BevelModifier", "only_vertices", "use_only_vertices"), + ("CastModifier", "from_radius", "use_radius_as_size"), + ("DisplaceModifier", "midlevel", "mid_level"), + ("DisplaceModifier", "texture_coordinates", "texture_coords"), + ("EdgeSplitModifier", "use_sharp", "use_edge_sharp"), + ("ExplodeModifier", "split_edges", "use_edge_split"), + ("MirrorModifier", "merge_limit", "merge_threshold"), + ("MirrorModifier", "mirror_u", "use_mirror_u"), + ("MirrorModifier", "mirror_v", "use_mirror_v"), + ("MirrorModifier", "mirror_vertex_groups", "use_mirror_vertex_groups"), + ("ParticleInstanceModifier", "particle_system_number", "particle_system_index"), + ("ParticleInstanceModifier", "keep_shape", "use_preserve_shape"), + ("ShrinkwrapModifier", "cull_back_faces", "use_cull_back_faces"), + ("ShrinkwrapModifier", "cull_front_faces", "use_cull_front_faces"), + ("ShrinkwrapModifier", "keep_above_surface", "use_keep_above_surface"), + ("SimpleDeformModifier", "lock_x_axis", "lock_x"), + ("SimpleDeformModifier", "lock_y_axis", "lock_y"), + ("SmokeModifier", "smoke_type", "type"), + ("SubsurfModifier", "subsurf_uv", "use_subsurf_uv"), + ("UVProjectModifier", "num_projectors", "projector_count"), + ("UVProjectModifier", "override_image", "use_image_override"), + ("WaveModifier", "texture_coordinates", "texture_coords"), + ("WaveModifier", "x_normal", "use_normal_x"), + ("WaveModifier", "y_normal", "use_normal_y"), + ("WaveModifier", "z_normal", "use_normal_z"), + ("NlaStrip", "blending", "blend_type"), + ("NlaStrip", "animated_influence", "use_animated_influence"), + ("NlaStrip", "animated_time", "use_animated_time"), + ("NlaStrip", "animated_time_cyclic", "use_animated_time_cyclic"), + ("NlaStrip", "auto_blending", "use_auto_blend"), + ("CompositorNodeAlphaOver", "convert_premul", "use_premultiply"), + ("CompositorNodeBlur", "sizex", "size_x"), + ("CompositorNodeBlur", "sizey", "size_y"), + ("CompositorNodeChannelMatte", "algorithm", "limit_method"), + ("CompositorNodeChromaMatte", "acceptance", "tolerance"), + ("CompositorNodeColorBalance", "correction_formula", "correction_method"), + ("CompositorNodeColorSpill", "algorithm", "limit_method"), + ("CompositorNodeColorSpill", "unspill", "use_unspill"), + ("CompositorNodeCrop", "x2", "max_x"), + ("CompositorNodeCrop", "y2", "max_y"), + ("CompositorNodeCrop", "x1", "min_x"), + ("CompositorNodeCrop", "y1", "min_y"), + ("CompositorNodeCrop", "crop_size", "use_crop_size"), + ("CompositorNodeDefocus", "max_blur", "blur_max"), + ("CompositorNodeDefocus", "gamma_correction", "use_gamma_correction"), + ("CompositorNodeGlare", "rotate_45", "use_rotate_45"), + ("CompositorNodeImage", "auto_refresh", "use_auto_refresh"), + ("CompositorNodeLensdist", "projector", "use_projector"), + ("CompositorNodeVecBlur", "max_speed", "speed_max"), + ("CompositorNodeVecBlur", "min_speed", "speed_min"), + ("ShaderNodeMapping", "maximum", "max"), + ("ShaderNodeMapping", "minimum", "min"), + ("ShaderNodeMapping", "clamp_maximum", "use_max"), + ("ShaderNodeMapping", "clamp_minimum", "use_min"), + ("VertexPaint", "all_faces", "use_all_faces"), + ("VertexPaint", "spray", "use_spray"), + ("ParticleEdit", "add_keys", "default_key_count"), + ("ParticleEdit", "selection_mode", "select_mode"), + ("ParticleEdit", "auto_velocity", "use_auto_velocity"), + ("ParticleEdit", "add_interpolate", "use_default_interpolate"), + ("ParticleEdit", "emitter_deflect", "use_emitter_deflect"), + ("ParticleEdit", "fade_time", "use_fade_time"), + ("ParticleEdit", "keep_lengths", "use_preserve_length"), + ("ParticleEdit", "keep_root", "use_preserve_root"), + ("ParticleSystem", "vertex_group_clump_negate", "invert_vertex_group_clump"), + ("ParticleSystem", "vertex_group_density_negate", "invert_vertex_group_density"), + ("ParticleSystem", "vertex_group_field_negate", "invert_vertex_group_field"), + ("ParticleSystem", "vertex_group_kink_negate", "invert_vertex_group_kink"), + ("ParticleSystem", "vertex_group_length_negate", "invert_vertex_group_length"), + ("ParticleSystem", "vertex_group_rotation_negate", "invert_vertex_group_rotation"), + ("ParticleSystem", "vertex_group_roughness1_negate", "invert_vertex_group_roughness_1"), + ("ParticleSystem", "vertex_group_roughness2_negate", "invert_vertex_group_roughness_2"), + ("ParticleSystem", "vertex_group_roughness_end_negate", "invert_vertex_group_roughness_end"), + ("ParticleSystem", "vertex_group_size_negate", "invert_vertex_group_size"), + ("ParticleSystem", "vertex_group_tangent_negate", "invert_vertex_group_tangent"), + ("ParticleSystem", "vertex_group_velocity_negate", "invert_vertex_group_velocity"), + ("ParticleSystem", "hair_dynamics", "use_hair_dynamics"), + ("ParticleSystem", "keyed_timing", "use_keyed_timing"), + ("PointDensity", "falloff_softness", "falloff_soft"), + ("PointDensity", "particle_cache", "particle_cache_space"), + ("PointDensity", "turbulence_size", "turbulence_scale"), + ("PointDensity", "turbulence", "use_turbulence"), + ("PointDensity", "vertices_cache", "vertex_cache_space"), + ("PoseBone", "ik_lin_weight", "ik_linear_weight"), + ("PoseBone", "ik_rot_weight", "ik_rotation_weight"), + ("PoseBone", "ik_limit_x", "use_ik_limit_x"), + ("PoseBone", "ik_limit_y", "use_ik_limit_y"), + ("PoseBone", "ik_limit_z", "use_ik_limit_z"), + ("PoseBone", "ik_lin_control", "use_ik_linear_control"), + ("PoseBone", "ik_rot_control", "use_ik_rotation_control"), + ("SPHFluidSettings", "spring_k", "spring_force"), + ("SPHFluidSettings", "stiffness_k", "stiffness"), + ("SPHFluidSettings", "stiffness_knear", "stiffness_near"), + ("SceneGameData", "framing_color", "frame_color"), + ("SceneGameData", "framing_type", "frame_type"), + ("SceneGameData", "eye_separation", "stereo_eye_separation"), + ("SceneGameData", "activity_culling", "use_activity_culling"), + ("SceneGameData", "auto_start", "use_auto_start"), + ("SceneGameData", "glsl_extra_textures", "use_glsl_extra_textures"), + ("SceneGameData", "glsl_lights", "use_glsl_lights"), + ("SceneGameData", "glsl_nodes", "use_glsl_nodes"), + ("SceneGameData", "glsl_ramps", "use_glsl_ramps"), + ("SceneGameData", "glsl_shaders", "use_glsl_shaders"), + ("SceneGameData", "glsl_shadows", "use_glsl_shadows"), + ("Sequence", "blend_opacity", "blend_alpha"), + ("Sequence", "blend_mode", "blend_type"), + ("Sequence", "frame_final_length", "frame_final_duration"), + ("Sequence", "use_effect_default_fade", "use_default_fade"), + ("SequenceColorBalance", "inverse_gain", "invert_gain"), + ("SequenceColorBalance", "inverse_gamma", "invert_gamma"), + ("SequenceColorBalance", "inverse_lift", "invert_lift"), + ("EffectSequence", "multiply_colors", "color_multiply"), + ("EffectSequence", "de_interlace", "use_deinterlace"), + ("EffectSequence", "flip_x", "use_flip_x"), + ("EffectSequence", "flip_y", "use_flip_y"), + ("EffectSequence", "convert_float", "use_float"), + ("EffectSequence", "premultiply", "use_premultiply"), + ("EffectSequence", "proxy_custom_directory", "use_proxy_custom_directory"), + ("EffectSequence", "proxy_custom_file", "use_proxy_custom_file"), + ("EffectSequence", "reverse_frames", "use_reverse_frames"), + ("GlowSequence", "blur_distance", "blur_radius"), + ("GlowSequence", "only_boost", "use_only_boost"), + ("SpeedControlSequence", "curve_compress_y", "use_curve_compress_y"), + ("SpeedControlSequence", "curve_velocity", "use_curve_velocity"), + ("SpeedControlSequence", "frame_blending", "use_frame_blend"), + ("TransformSequence", "uniform_scale", "use_uniform_scale"), + ("ImageSequence", "animation_end_offset", "animation_offset_end"), + ("ImageSequence", "animation_start_offset", "animation_offset_start"), + ("ImageSequence", "multiply_colors", "color_multiply"), + ("ImageSequence", "de_interlace", "use_deinterlace"), + ("ImageSequence", "flip_x", "use_flip_x"), + ("ImageSequence", "flip_y", "use_flip_y"), + ("ImageSequence", "convert_float", "use_float"), + ("ImageSequence", "premultiply", "use_premultiply"), + ("ImageSequence", "proxy_custom_directory", "use_proxy_custom_directory"), + ("ImageSequence", "proxy_custom_file", "use_proxy_custom_file"), + ("ImageSequence", "reverse_frames", "use_reverse_frames"), + ("MetaSequence", "animation_end_offset", "animation_offset_end"), + ("MetaSequence", "animation_start_offset", "animation_offset_start"), + ("MetaSequence", "multiply_colors", "color_multiply"), + ("MetaSequence", "de_interlace", "use_deinterlace"), + ("MetaSequence", "flip_x", "use_flip_x"), + ("MetaSequence", "flip_y", "use_flip_y"), + ("MetaSequence", "convert_float", "use_float"), + ("MetaSequence", "premultiply", "use_premultiply"), + ("MetaSequence", "proxy_custom_directory", "use_proxy_custom_directory"), + ("MetaSequence", "proxy_custom_file", "use_proxy_custom_file"), + ("MetaSequence", "reverse_frames", "use_reverse_frames"), + ("MovieSequence", "animation_end_offset", "animation_offset_end"), + ("MovieSequence", "animation_start_offset", "animation_offset_start"), + ("MovieSequence", "multiply_colors", "color_multiply"), + ("MovieSequence", "de_interlace", "use_deinterlace"), + ("MovieSequence", "flip_x", "use_flip_x"), + ("MovieSequence", "flip_y", "use_flip_y"), + ("MovieSequence", "convert_float", "use_float"), + ("MovieSequence", "premultiply", "use_premultiply"), + ("MovieSequence", "proxy_custom_directory", "use_proxy_custom_directory"), + ("MovieSequence", "proxy_custom_file", "use_proxy_custom_file"), + ("MovieSequence", "reverse_frames", "use_reverse_frames"), + ("MulticamSequence", "animation_end_offset", "animation_offset_end"), + ("MulticamSequence", "animation_start_offset", "animation_offset_start"), + ("MulticamSequence", "multiply_colors", "color_multiply"), + ("MulticamSequence", "de_interlace", "use_deinterlace"), + ("MulticamSequence", "flip_x", "use_flip_x"), + ("MulticamSequence", "flip_y", "use_flip_y"), + ("MulticamSequence", "convert_float", "use_float"), + ("MulticamSequence", "premultiply", "use_premultiply"), + ("MulticamSequence", "proxy_custom_directory", "use_proxy_custom_directory"), + ("MulticamSequence", "proxy_custom_file", "use_proxy_custom_file"), + ("MulticamSequence", "reverse_frames", "use_reverse_frames"), + ("SceneSequence", "animation_end_offset", "animation_offset_end"), + ("SceneSequence", "animation_start_offset", "animation_offset_start"), + ("SceneSequence", "multiply_colors", "color_multiply"), + ("SceneSequence", "de_interlace", "use_deinterlace"), + ("SceneSequence", "flip_x", "use_flip_x"), + ("SceneSequence", "flip_y", "use_flip_y"), + ("SceneSequence", "convert_float", "use_float"), + ("SceneSequence", "premultiply", "use_premultiply"), + ("SceneSequence", "proxy_custom_directory", "use_proxy_custom_directory"), + ("SceneSequence", "proxy_custom_file", "use_proxy_custom_file"), + ("SceneSequence", "reverse_frames", "use_reverse_frames"), + ("SoundSequence", "animation_end_offset", "animation_offset_end"), + ("SoundSequence", "animation_start_offset", "animation_offset_start"), + ("SmokeDomainSettings", "smoke_domain_colli", "collision_extents"), + ("SmokeDomainSettings", "smoke_cache_high_comp", "point_cache_compress_high_type"), + ("SmokeDomainSettings", "smoke_cache_comp", "point_cache_compress_type"), + ("SmokeDomainSettings", "maxres", "resolution_max"), + ("SmokeDomainSettings", "smoothemitter", "smooth_emitter"), + ("SmokeDomainSettings", "dissolve_smoke", "use_dissolve_smoke"), + ("SmokeDomainSettings", "dissolve_smoke_log", "use_dissolve_smoke_log"), + ("SmokeDomainSettings", "highres", "use_high_resolution"), + ("SoftBodySettings", "bending", "bend"), + ("SoftBodySettings", "error_limit", "error_threshold"), + ("SoftBodySettings", "lcom", "location_mass_center"), + ("SoftBodySettings", "lrot", "rotation_estimate"), + ("SoftBodySettings", "lscale", "scale_estimate"), + ("SoftBodySettings", "maxstep", "step_max"), + ("SoftBodySettings", "minstep", "step_min"), + ("SoftBodySettings", "diagnose", "use_diagnose"), + ("SoftBodySettings", "edge_collision", "use_edge_collision"), + ("SoftBodySettings", "estimate_matrix", "use_estimate_matrix"), + ("SoftBodySettings", "face_collision", "use_face_collision"), + ("SoftBodySettings", "self_collision", "use_self_collision"), + ("SoftBodySettings", "stiff_quads", "use_stiff_quads"), + ("TexMapping", "maximum", "max"), + ("TexMapping", "minimum", "min"), + ("TexMapping", "has_maximum", "use_max"), + ("TexMapping", "has_minimum", "use_min"), + ("TextCharacterFormat", "bold", "use_bold"), + ("TextCharacterFormat", "italic", "use_italic"), + ("TextCharacterFormat", "underline", "use_underline"), + ("TextureSlot", "rgb_to_intensity", "use_rgb_to_intensity"), + ("TextureSlot", "stencil", "use_stencil"), + ("LampTextureSlot", "texture_coordinates", "texture_coords"), + ("LampTextureSlot", "map_color", "use_map_color"), + ("LampTextureSlot", "map_shadow", "use_map_shadow"), + ("MaterialTextureSlot", "coloremission_factor", "color_emission_factor"), + ("MaterialTextureSlot", "colordiff_factor", "diffuse_color_factor"), + ("MaterialTextureSlot", "x_mapping", "mapping_x"), + ("MaterialTextureSlot", "y_mapping", "mapping_y"), + ("MaterialTextureSlot", "z_mapping", "mapping_z"), + ("MaterialTextureSlot", "colorreflection_factor", "reflection_color_factor"), + ("MaterialTextureSlot", "colorspec_factor", "specular_color_factor"), + ("MaterialTextureSlot", "texture_coordinates", "texture_coords"), + ("MaterialTextureSlot", "colortransmission_factor", "transmission_color_factor"), + ("MaterialTextureSlot", "from_dupli", "use_from_dupli"), + ("MaterialTextureSlot", "from_original", "use_from_original"), + ("MaterialTextureSlot", "map_alpha", "use_map_alpha"), + ("MaterialTextureSlot", "map_ambient", "use_map_ambient"), + ("MaterialTextureSlot", "map_colordiff", "use_map_color_diff"), + ("MaterialTextureSlot", "map_coloremission", "use_map_color_emission"), + ("MaterialTextureSlot", "map_colorreflection", "use_map_color_reflection"), + ("MaterialTextureSlot", "map_colorspec", "use_map_color_spec"), + ("MaterialTextureSlot", "map_colortransmission", "use_map_color_transmission"), + ("MaterialTextureSlot", "map_density", "use_map_density"), + ("MaterialTextureSlot", "map_diffuse", "use_map_diffuse"), + ("MaterialTextureSlot", "map_displacement", "use_map_displacement"), + ("MaterialTextureSlot", "map_emission", "use_map_emission"), + ("MaterialTextureSlot", "map_emit", "use_map_emit"), + ("MaterialTextureSlot", "map_hardness", "use_map_hardness"), + ("MaterialTextureSlot", "map_mirror", "use_map_mirror"), + ("MaterialTextureSlot", "map_normal", "use_map_normal"), + ("MaterialTextureSlot", "map_raymir", "use_map_raymir"), + ("MaterialTextureSlot", "map_reflection", "use_map_reflect"), + ("MaterialTextureSlot", "map_scattering", "use_map_scatter"), + ("MaterialTextureSlot", "map_specular", "use_map_specular"), + ("MaterialTextureSlot", "map_translucency", "use_map_translucency"), + ("MaterialTextureSlot", "map_warp", "use_map_warp"), + ("WorldTextureSlot", "texture_coordinates", "texture_coords"), + ("WorldTextureSlot", "map_blend", "use_map_blend"), + ("WorldTextureSlot", "map_horizon", "use_map_horizon"), + ("WorldTextureSlot", "map_zenith_down", "use_map_zenith_down"), + ("WorldTextureSlot", "map_zenith_up", "use_map_zenith_up"), + ("VoxelData", "still_frame_number", "still_frame"), + ("WorldLighting", "ao_blend_mode", "ao_blend_type"), + ("WorldLighting", "error_tolerance", "error_threshold"), + ("WorldLighting", "use_ambient_occlusion", "use_ambient_occlusian"), + ("WorldLighting", "pixel_cache", "use_cache"), + ("WorldLighting", "use_environment_lighting", "use_environment_light"), + ("WorldLighting", "use_indirect_lighting", "use_indirect_light"), + ("WorldStarsSettings", "color_randomization", "color_random"), + ("WorldStarsSettings", "min_distance", "distance_min"), + ("WorldLighting", "falloff", "use_falloff"), + ("Constraint", "disabled", "is_valid"), + ("ClampToConstraint", "cyclic", "use_cyclic"), + ("ImageTexture", "filter", "filter_type"), + ("ImageTexture", "interpolation", "use_interpolation"), + ("ImageTexture", "mipmap", "use_mipmap"), + ("ImageUser", "frames", "frame_duration"), + ("ImageUser", "offset", "frame_offset"), + ("ImageUser", "cyclic", "use_cyclic"), + ("ArmatureModifier", "invert", "invert_vertex_group"), + ("ArmatureModifier", "quaternion", "use_deform_preserve_volume"), + ("ArrayModifier", "length", "fit_length"), + ("BevelModifier", "angle", "angle_limit"), + ("BuildModifier", "length", "frame_duration"), + ("BuildModifier", "randomize", "use_random_order"), + ("CastModifier", "x", "use_x"), + ("CastModifier", "y", "use_y"), + ("CastModifier", "z", "use_z"), + ("ExplodeModifier", "size", "use_size"), + ("MaskModifier", "invert", "invert_vertex_group"), + ("MeshDeformModifier", "invert", "invert_vertex_group"), + ("MeshDeformModifier", "dynamic", "use_dynamic_bind"), + ("MirrorModifier", "clip", "use_clip"), + ("MirrorModifier", "x", "use_x"), + ("MirrorModifier", "y", "use_y"), + ("MirrorModifier", "z", "use_z"), + ("ParticleInstanceModifier", "children", "use_children"), + ("ParticleInstanceModifier", "normal", "use_normal"), + ("ParticleInstanceModifier", "size", "use_size"), + ("ShrinkwrapModifier", "negative", "use_negative_direction"), + ("ShrinkwrapModifier", "positive", "use_positive_direction"), + ("ShrinkwrapModifier", "x", "use_project_x"), + ("ShrinkwrapModifier", "y", "use_project_y"), + ("ShrinkwrapModifier", "z", "use_project_z"), + ("ShrinkwrapModifier", "mode", "wrap_method"), + ("SimpleDeformModifier", "mode", "deform_method"), + ("SimpleDeformModifier", "relative", "use_relative"), + ("SmoothModifier", "repeat", "iterations"), + ("SmoothModifier", "x", "use_x"), + ("SmoothModifier", "y", "use_y"), + ("SmoothModifier", "z", "use_z"), + ("SolidifyModifier", "invert", "invert_vertex_group"), + ("WaveModifier", "cyclic", "use_cyclic"), + ("WaveModifier", "normals", "use_normal"), + ("WaveModifier", "x", "use_x"), + ("WaveModifier", "y", "use_y"), + ("DampedTrackConstraint", "track", "track_axis"), + ("FloorConstraint", "sticky", "use_sticky"), + ("FollowPathConstraint", "forward", "forward_axis"), + ("FollowPathConstraint", "up", "up_axis"), + ("LockedTrackConstraint", "lock", "lock_axis"), + ("LockedTrackConstraint", "track", "track_axis"), + ("MaintainVolumeConstraint", "axis", "free_axis"), + ("TrackToConstraint", "track", "track_axis"), + ("TrackToConstraint", "up", "up_axis"), + ("GameProperty", "debug", "show_debug"), + ("Image", "tiles", "use_tiles"), + ("Lamp", "diffuse", "use_diffuse"), + ("Lamp", "negative", "use_negative"), + ("Lamp", "layer", "use_own_layer"), + ("Lamp", "specular", "use_specular"), + ("AreaLamp", "dither", "use_dither"), + ("AreaLamp", "jitter", "use_jitter"), + ("SpotLamp", "square", "use_square"), + ("Material", "cubic", "use_cubic"), + ("Material", "shadows", "use_shadows"), + ("ParticleSettings", "amount", "count"), + ("ParticleSettings", "display", "draw_percentage"), + ("ParticleSettings", "velocity", "show_velocity"), + ("ParticleSettings", "trand", "use_emit_random"), + ("ParticleSettings", "parent", "use_parent_particles"), + ("ParticleSettings", "emitter", "use_render_emitter"), + ("ParticleSettings", "viewport", "use_simplify_viewport"), + ("Texture", "brightness", "intensity"), + ("CloudsTexture", "stype", "cloud_type"), + ("EnvironmentMapTexture", "filter", "filter_type"), + ("EnvironmentMapTexture", "mipmap", "use_mipmap"), + ("MarbleTexture", "stype", "marble_type"), + ("StucciTexture", "stype", "stucci_type"), + ("WoodTexture", "stype", "wood_type"), + ("World", "range", "color_range"), + ("World", "lighting", "light_settings"), + ("World", "mist", "mist_settings"), + ("World", "stars", "star_settings"), + ("MaterialHalo", "lines", "use_lines"), + ("MaterialHalo", "ring", "use_ring"), + ("MaterialHalo", "soft", "use_soft"), + ("MaterialHalo", "star", "use_star"), + ("MaterialHalo", "texture", "use_texture"), + ("MaterialPhysics", "damp", "damping"), + ("MaterialRaytraceTransparency", "limit", "depth_max"), + ("NlaStrip", "reversed", "use_reverse"), + ("CompositorNodeBlur", "bokeh", "use_bokeh"), + ("CompositorNodeBlur", "gamma", "use_gamma_correction"), + ("CompositorNodeBlur", "relative", "use_relative"), + ("CompositorNodeChannelMatte", "high", "limit_max"), + ("CompositorNodeChannelMatte", "low", "limit_min"), + ("CompositorNodeChannelMatte", "channel", "matte_channel"), + ("CompositorNodeChromaMatte", "cutoff", "threshold"), + ("CompositorNodeColorMatte", "h", "color_hue"), + ("CompositorNodeColorMatte", "s", "color_saturation"), + ("CompositorNodeColorMatte", "v", "color_value"), + ("CompositorNodeDBlur", "wrap", "use_wrap"), + ("CompositorNodeDefocus", "preview", "use_preview"), + ("CompositorNodeHueSat", "hue", "color_hue"), + ("CompositorNodeHueSat", "sat", "color_saturation"), + ("CompositorNodeHueSat", "val", "color_value"), + ("CompositorNodeImage", "frames", "frame_duration"), + ("CompositorNodeImage", "offset", "frame_offset"), + ("CompositorNodeImage", "start", "frame_start"), + ("CompositorNodeImage", "cyclic", "use_cyclic"), + ("CompositorNodeInvert", "alpha", "invert_alpha"), + ("CompositorNodeInvert", "rgb", "invert_rgb"), + ("CompositorNodeLensdist", "fit", "use_fit"), + ("CompositorNodeLensdist", "jitter", "use_jitter"), + ("CompositorNodeMixRGB", "alpha", "use_alpha"), + ("CompositorNodeRotate", "filter", "filter_type"), + ("CompositorNodeTime", "end", "frame_end"), + ("CompositorNodeTime", "start", "frame_start"), + ("CompositorNodeVecBlur", "curved", "use_curved"), + ("ShaderNodeExtendedMaterial", "diffuse", "use_diffuse"), + ("ShaderNodeExtendedMaterial", "specular", "use_specular"), + ("ShaderNodeMaterial", "diffuse", "use_diffuse"), + ("ShaderNodeMaterial", "specular", "use_specular"), + ("ShaderNodeMixRGB", "alpha", "use_alpha"), + ("TextureNodeCurveTime", "end", "frame_end"), + ("TextureNodeCurveTime", "start", "frame_start"), + ("TextureNodeMixRGB", "alpha", "use_alpha"), + ("TextureSlot", "negate", "invert"), + ("TextureSlot", "size", "scale"), + ("SoftBodySettings", "damp", "damping"), + ("SequenceCrop", "right", "max_x"), + ("SequenceCrop", "top", "max_y"), + ("SequenceCrop", "bottom", "min_x"), + ("SequenceCrop", "left", "min_y"), + ] + + +import bpy + + +class UpdateAnimData(bpy.types.Operator): + '''''' + bl_idname = "anim.update_data_paths" + bl_label = "Update Animation Data" + + def execute(self, context): + import animsys_refactor + reload(animsys_refactor) + animsys_refactor.update_data_paths(data_path_update) + return {'FINISHED'} + + +if __name__ == "__main__": + bpy.ops.anim.update_data_paths() + +def register(): + pass
\ No newline at end of file diff --git a/release/scripts/op/console_python.py b/release/scripts/op/console_python.py index a9fa90ee6fa..918c31cff04 100644 --- a/release/scripts/op/console_python.py +++ b/release/scripts/op/console_python.py @@ -22,6 +22,9 @@ import bpy language_id = 'python' +# store our own __main__ module, not 100% needed +# but python expects this in some places +_BPY_MAIN_OWN = True def add_scrollback(text, text_type): for l in text.split('\n'): @@ -33,31 +36,56 @@ def get_console(console_id): ''' helper function for console operators currently each text datablock gets its own - console - bpython_code.InteractiveConsole() + console - code.InteractiveConsole() ...which is stored in this function. console_id can be any hashable type ''' from code import InteractiveConsole - try: - consoles = get_console.consoles - except: + consoles = getattr(get_console, "consoles", None) + hash_next = hash(bpy.context.manager) + + if consoles is None: consoles = get_console.consoles = {} + get_console.consoles_namespace_hash = hash_next + else: + # check if clearning the namespace is needed to avoid a memory leak. + # the window manager is normally loaded with new blend files + # so this is a reasonable way to deal with namespace clearing. + # bpy.data hashing is reset by undo so cant be used. + hash_prev = getattr(get_console, "consoles_namespace_hash", 0) - # clear all dead consoles, use text names as IDs - # TODO, find a way to clear IDs - ''' - for console_id in list(consoles.keys()): - if console_id not in bpy.data.texts: - del consoles[id] - ''' + if hash_prev != hash_next: + get_console.consoles_namespace_hash = hash_next + consoles.clear() - try: - console, stdout, stderr = consoles[console_id] - except: - namespace = {'__builtins__': __builtins__, 'bpy': bpy} - console = InteractiveConsole(namespace) + console_data = consoles.get(console_id) + + if console_data: + console, stdout, stderr = console_data + + # XXX, bug in python 3.1.2 ? (worked in 3.1.1) + # seems there is no way to clear StringIO objects for writing, have to make new ones each time. + import io + stdout = io.StringIO() + stderr = io.StringIO() + else: + if _BPY_MAIN_OWN: + import types + bpy_main_mod = types.ModuleType("__main__") + namespace = bpy_main_mod.__dict__ + else: + namespace = {} + + namespace["__builtins__"] = sys.modules["builtins"] + namespace["bpy"] = bpy + namespace["C"] = bpy.context + + console = InteractiveConsole(locals=namespace, filename="<blender_console>") + + if _BPY_MAIN_OWN: + console._bpy_main_mod = bpy_main_mod import io stdout = io.StringIO() @@ -77,7 +105,7 @@ def execute(context): sc = context.space_data try: - line = sc.history[-1].line + line_object = sc.history[-1] except: return {'CANCELLED'} @@ -86,21 +114,36 @@ def execute(context): console, stdout, stderr = get_console(hash(context.region)) - # Hack, useful but must add some other way to access - #if "C" not in console.locals: - console.locals["C"] = context - # redirect output sys.stdout = stdout sys.stderr = stderr - # run the console - if not line.strip(): - line_exec = '\n' # executes a multiline statement - else: - line_exec = line + # dont allow the stdin to be used, can lock blender. + stdin_backup = sys.stdin + sys.stdin = None - is_multiline = console.push(line_exec) + if _BPY_MAIN_OWN: + main_mod_back = sys.modules["__main__"] + sys.modules["__main__"] = console._bpy_main_mod + + # incase exception happens + line = "" # incase of encodingf error + is_multiline = False + + try: + line = line_object.body + + # run the console, "\n" executes a multiline statement + line_exec = line if line.strip() else "\n" + + is_multiline = console.push(line_exec) + except: + # unlikely, but this can happen with unicode errors for example. + import traceback + stderr.write(traceback.format_exc()) + + if _BPY_MAIN_OWN: + sys.modules["__main__"] = main_mod_back stdout.seek(0) stderr.seek(0) @@ -136,6 +179,9 @@ def execute(context): if output_err: add_scrollback(output_err, 'ERROR') + # restore the stdin + sys.stdin = stdin_backup + return {'FINISHED'} @@ -146,27 +192,48 @@ def autocomplete(context): console = get_console(hash(context.region))[0] - current_line = sc.history[-1] - line = current_line.line - if not console: return {'CANCELLED'} if sc.console_type != 'PYTHON': return {'CANCELLED'} - # This function isnt aware of the text editor or being an operator - # just does the autocomp then copy its results back - current_line.line, current_line.current_character, scrollback = \ - intellisense.expand( - line=current_line.line, - cursor=current_line.current_character, - namespace=console.locals, - private=bpy.app.debug) + # dont allow the stdin to be used, can lock blender. + # note: unlikely stdin would be used for autocomp. but its possible. + stdin_backup = sys.stdin + sys.stdin = None + + scrollback = "" + scrollback_error = "" + + if _BPY_MAIN_OWN: + main_mod_back = sys.modules["__main__"] + sys.modules["__main__"] = console._bpy_main_mod + + try: + current_line = sc.history[-1] + line = current_line.body + + # This function isnt aware of the text editor or being an operator + # just does the autocomp then copy its results back + current_line.body, current_line.current_character, scrollback = \ + intellisense.expand( + line=current_line.body, + cursor=current_line.current_character, + namespace=console.locals, + private=bpy.app.debug) + except: + # unlikely, but this can happen with unicode errors for example. + # or if the api attribute access its self causes an error. + import traceback + scrollback_error = traceback.format_exc() + + if _BPY_MAIN_OWN: + sys.modules["__main__"] = main_mod_back # Separate automplete output by command prompts if scrollback != '': - bpy.ops.console.scrollback_append(text=sc.prompt + current_line.line, type='INPUT') + bpy.ops.console.scrollback_append(text=sc.prompt + current_line.body, type='INPUT') # Now we need to copy back the line from blender back into the # text editor. This will change when we dont use the text editor @@ -174,6 +241,12 @@ def autocomplete(context): if scrollback: add_scrollback(scrollback, 'INFO') + if scrollback_error: + add_scrollback(scrollback_error, 'ERROR') + + # restore the stdin + sys.stdin = stdin_backup + context.area.tag_redraw() return {'FINISHED'} @@ -190,16 +263,12 @@ def banner(context): add_scrollback("Execute: Enter", 'OUTPUT') add_scrollback("Autocomplete: Ctrl+Space", 'OUTPUT') add_scrollback("Ctrl +/- Wheel: Zoom", 'OUTPUT') - add_scrollback("Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bgl, blf, Mathutils, Geometry", 'OUTPUT') + add_scrollback("Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bgl, blf, mathutils, geometry", 'OUTPUT') add_scrollback("", 'OUTPUT') add_scrollback(" WARNING!!! Blender 2.5 API is subject to change, see API reference for more info.", 'ERROR') add_scrollback("", 'OUTPUT') sc.prompt = PROMPT - # Add context into the namespace for quick access - console = get_console(hash(context.region))[0] - console.locals["C"] = bpy.context - return {'FINISHED'} diff --git a/release/scripts/op/console_shell.py b/release/scripts/op/console_shell.py index e269cc0bb2f..2c5b48acd34 100644 --- a/release/scripts/op/console_shell.py +++ b/release/scripts/op/console_shell.py @@ -47,7 +47,7 @@ def execute(context): sc = context.space_data try: - line = sc.history[-1].line + line = sc.history[-1].body except: return {'CANCELLED'} diff --git a/release/scripts/op/fcurve_euler_filter.py b/release/scripts/op/fcurve_euler_filter.py index 1c9e9a73312..a2730e16843 100644 --- a/release/scripts/op/fcurve_euler_filter.py +++ b/release/scripts/op/fcurve_euler_filter.py @@ -1,13 +1,13 @@ from math import * import bpy -from Mathutils import * +from mathutils import * def main(context): def cleanupEulCurve(fcv): keys = [] for k in fcv.keyframe_points: - keys.append([k.handle1.copy(), k.co.copy(), k.handle2.copy()]) + keys.append([k.handle_left.copy(), k.co.copy(), k.handle_right.copy()]) print(keys) for i in range(len(keys)): @@ -34,13 +34,13 @@ def main(context): for i in range(len(keys)): for x in range(2): - fcv.keyframe_points[i].handle1[x] = keys[i][0][x] + fcv.keyframe_points[i].handle_left[x] = keys[i][0][x] fcv.keyframe_points[i].co[x] = keys[i][1][x] - fcv.keyframe_points[i].handle2[x] = keys[i][2][x] + fcv.keyframe_points[i].handle_right[x] = keys[i][2][x] flist = bpy.context.active_object.animation_data.action.fcurves for f in flist: - if f.selected and f.data_path.endswith("rotation_euler"): + if f.select and f.data_path.endswith("rotation_euler"): cleanupEulCurve(f) class DiscontFilterOp(bpy.types.Operator): @@ -48,7 +48,8 @@ class DiscontFilterOp(bpy.types.Operator): bl_idname = "graph.euler_filter" bl_label = "Filter out discontinuities in the active fcurves" - def poll(self, context): + @classmethod + def poll(cls, context): return context.active_object != None def execute(self, context): @@ -56,10 +57,10 @@ class DiscontFilterOp(bpy.types.Operator): return {'FINISHED'} def register(): - bpy.types.register(DiscontFilterOp) + pass def unregister(): - bpy.types.unregister(DiscontFilterOp) + pass if __name__ == "__main__": register() diff --git a/release/scripts/op/image.py b/release/scripts/op/image.py index f362f55d37e..c8160ded9a4 100644 --- a/release/scripts/op/image.py +++ b/release/scripts/op/image.py @@ -28,7 +28,7 @@ class EditExternally(bpy.types.Operator): bl_label = "Image Edit Externally" bl_options = {'REGISTER'} - path = StringProperty(name="File Path", description="Path to an image file", maxlen= 1024, default= "") + filepath = StringProperty(name="File Path", description="Path to an image file", maxlen=1024, default="") def _editor_guess(self, context): import platform @@ -50,17 +50,21 @@ class EditExternally(bpy.types.Operator): # and will include a trailing backslash, so we strip it. image_editor.rstrip('\\') image_editor = ["open", "-a", image_editor] + else: + image_editor = [image_editor] return image_editor def execute(self, context): + import os import subprocess - path = self.properties.path - image_editor = self._editor_guess(context) + filepath = bpy.path.abspath(self.properties.filepath) + + if not os.path.exists(filepath): + self.report('ERROR', "Image path '%s' not found." % filepath) + return {'CANCELLED'} - cmd = [] - cmd.extend(image_editor) - cmd.append(bpy.utils.expandpath(path)) + cmd = self._editor_guess(context) + [filepath] subprocess.Popen(cmd) @@ -68,12 +72,12 @@ class EditExternally(bpy.types.Operator): def invoke(self, context, event): try: - path = context.space_data.image.filename + filepath = context.space_data.image.filepath except: self.report({'ERROR'}, "Image not found on disk") return {'CANCELLED'} - self.properties.path = path + self.properties.filepath = filepath self.execute(context) return {'FINISHED'} @@ -88,14 +92,14 @@ class SaveDirty(bpy.types.Operator): def execute(self, context): unique_paths = set() for image in bpy.data.images: - if image.dirty: - path = bpy.utils.expandpath(image.filename) - if "\\" not in path and "/" not in path: - self.report({'WARNING'}, "Invalid path: " + path) - elif path in unique_paths: - self.report({'WARNING'}, "Path used by more then one image: " + path) + if image.is_dirty: + filepath = bpy.path.abspath(image.filepath) + if "\\" not in filepath and "/" not in filepath: + self.report({'WARNING'}, "Invalid path: " + filepath) + elif filepath in unique_paths: + self.report({'WARNING'}, "Path used by more then one image: " + filepath) else: - unique_paths.add(path) + unique_paths.add(filepath) image.save() return {'FINISHED'} @@ -129,35 +133,37 @@ class ProjectEdit(bpy.types.Operator): self.report({'ERROR'}, "Could not make new image") return {'CANCELLED'} - filename = os.path.basename(bpy.data.filename) - filename = os.path.splitext(filename)[0] - # filename = bpy.utils.clean_name(filename) # fixes <memory> rubbish, needs checking + filepath = os.path.basename(bpy.data.filepath) + filepath = os.path.splitext(filepath)[0] + # filepath = bpy.path.clean_name(filepath) # fixes <memory> rubbish, needs checking - if filename.startswith("."): # TODO, have a way to check if the file is saved, assuem .B25.blend - filename = os.path.join(os.path.dirname(bpy.data.filename), filename) + if filepath.startswith(".") or filepath == "": + # TODO, have a way to check if the file is saved, assume .B25.blend + tmpdir = context.user_preferences.filepaths.temporary_directory + filepath = os.path.join(tmpdir, "project_edit") else: - filename = "//" + filename + filepath = "//" + filepath obj = context.object if obj: - filename += "_" + bpy.utils.clean_name(obj.name) + filepath += "_" + bpy.path.clean_name(obj.name) - filename_final = filename + "." + EXT + filepath_final = filepath + "." + EXT i = 0 - while os.path.exists(bpy.utils.expandpath(filename_final)): - filename_final = filename + ("%.3d.%s" % (i, EXT)) + while os.path.exists(bpy.path.abspath(filepath_final)): + filepath_final = filepath + ("%.3d.%s" % (i, EXT)) i += 1 - image_new.name = os.path.basename(filename_final) + image_new.name = os.path.basename(filepath_final) ProjectEdit._proj_hack[0] = image_new.name - image_new.filename_raw = filename_final # TODO, filename raw is crummy + image_new.filepath_raw = filepath_final # TODO, filepath raw is crummy image_new.file_format = 'PNG' image_new.save() - bpy.ops.image.external_edit(path=filename_final) + bpy.ops.image.external_edit(filepath=filepath_final) return {'FINISHED'} @@ -182,23 +188,12 @@ class ProjectApply(bpy.types.Operator): return {'FINISHED'} -classes = [ - EditExternally, - SaveDirty, - ProjectEdit, - ProjectApply] - def register(): - register = bpy.types.register - for cls in classes: - register(cls) - + pass def unregister(): - unregister = bpy.types.unregister - for cls in classes: - unregister(cls) + pass if __name__ == "__main__": register() diff --git a/release/scripts/op/mesh.py b/release/scripts/op/mesh.py index 3989e51b6ca..9e684cea9c2 100644 --- a/release/scripts/op/mesh.py +++ b/release/scripts/op/mesh.py @@ -28,7 +28,8 @@ class MeshSelectInteriorFaces(bpy.types.Operator): bl_label = "Select Interior Faces" bl_options = {'REGISTER', 'UNDO'} - def poll(self, context): + @classmethod + def poll(cls, context): ob = context.active_object return (ob and ob.type == 'MESH') @@ -54,9 +55,9 @@ class MeshSelectInteriorFaces(bpy.types.Operator): for index, face in enumerate(face_list): if(test_interior(index)): - face.selected = True + face.select = True else: - face.selected = False + face.select = False if is_editmode: bpy.ops.object.mode_set(mode='EDIT', toggle=False) @@ -69,14 +70,15 @@ class MeshMirrorUV(bpy.types.Operator): bl_label = "Copy Mirrored UV coords" bl_options = {'REGISTER', 'UNDO'} - def poll(self, context): + @classmethod + def poll(cls, context): ob = context.active_object return (ob and ob.type == 'MESH') def execute(self, context): DIR = 1 # TODO, make an option - from Mathutils import Vector + from mathutils import Vector ob = context.active_object is_editmode = (ob.mode == 'EDIT') @@ -89,7 +91,7 @@ class MeshMirrorUV(bpy.types.Operator): mirror_gt = {} mirror_lt = {} - vcos = [v.co.to_tuple(5) for v in mesh.verts] + vcos = [v.co.to_tuple(5) for v in mesh.vertices] for i, co in enumerate(vcos): if co[0] > 0.0: @@ -100,7 +102,7 @@ class MeshMirrorUV(bpy.types.Operator): mirror_gt[co] = i mirror_lt[co] = i - #for i, v in enumerate(mesh.verts): + #for i, v in enumerate(mesh.vertices): vmap = {} for mirror_a, mirror_b in (mirror_gt, mirror_lt), (mirror_lt, mirror_gt): for co, i in mirror_a.items(): @@ -122,20 +124,20 @@ class MeshMirrorUV(bpy.types.Operator): # as a list faces = mesh.faces[:] - fuvsel = [(False not in uv.uv_selected) for uv in active_uv_layer] + fuvsel = [(False not in uv.select_uv) for uv in active_uv_layer] fcents = [f.center for f in faces] # find mirror faces mirror_fm = {} for i, f in enumerate(faces): - verts = f.verts[:] + verts = f.vertices[:] verts.sort() verts = tuple(verts) mirror_fm[verts] = i fmap = {} for i, f in enumerate(faces): - verts = [vmap.get(j) for j in f.verts] + verts = [vmap.get(j) for j in f.vertices] if None not in verts: verts.sort() j = mirror_fm.get(tuple(verts)) @@ -157,8 +159,8 @@ class MeshMirrorUV(bpy.types.Operator): uv2 = fuvs_cpy[j] # get the correct rotation - v1 = faces[j].verts[:] - v2 = [vmap[k] for k in faces[i].verts[:]] + v1 = faces[j].vertices[:] + v2 = [vmap[k] for k in faces[i].vertices[:]] for k in range(len(uv1)): @@ -172,22 +174,12 @@ class MeshMirrorUV(bpy.types.Operator): return {'FINISHED'} -# Register the operator -classes = [ - MeshSelectInteriorFaces, - MeshMirrorUV] - - def register(): - register = bpy.types.register - for cls in classes: - register(cls) + pass def unregister(): - unregister = bpy.types.unregister - for cls in classes: - unregister(cls) + pass if __name__ == "__main__": register() diff --git a/release/scripts/op/nla.py b/release/scripts/op/nla.py index db8c0be053a..44bd5d91e32 100644 --- a/release/scripts/op/nla.py +++ b/release/scripts/op/nla.py @@ -22,7 +22,7 @@ import bpy def pose_info(): - from Mathutils import Matrix + from mathutils import Matrix info = {} @@ -100,7 +100,7 @@ def bake(frame_start, frame_end, step=1, only_selected=False): pose_items = pose.bones.items() for name, pbone in pose_items: - if only_selected and not pbone.selected: + if only_selected and not pbone.select: continue for f in frame_range: @@ -109,34 +109,19 @@ def bake(frame_start, frame_end, step=1, only_selected=False): #pbone.location = matrix.translation_part() #pbone.rotation_quaternion = matrix.to_quat() pbone.matrix_local = [f for v in matrix for f in v] - - pbone.keyframe_insert("location", -1, f) + + pbone.keyframe_insert("location", -1, f, name) rotation_mode = pbone.rotation_mode if rotation_mode == 'QUATERNION': - pbone.keyframe_insert("rotation_quaternion", -1, f) + pbone.keyframe_insert("rotation_quaternion", -1, f, name) elif rotation_mode == 'AXIS_ANGLE': - pbone.keyframe_insert("rotation_axis_angle", -1, f) + pbone.keyframe_insert("rotation_axis_angle", -1, f, name) else: # euler, XYZ, ZXY etc - pbone.keyframe_insert("rotation_euler", -1, f) - - pbone.keyframe_insert("scale", -1, f) - - # assign groups, could become a more generic function - agrp_loc = action.groups.add("Location") - agrp_rot = action.groups.add("Rotation") - agrp_sca = action.groups.add("Scale") - - for fcu in action.fcurves: - path = fcu.data_path.rsplit(".", 1)[-1] + pbone.keyframe_insert("rotation_euler", -1, f, name) - if path.startswith("loc"): - fcu.group = agrp_loc - if path.startswith("rot"): - fcu.group = agrp_rot - if path.startswith("sca"): - fcu.group = agrp_sca + pbone.keyframe_insert("scale", -1, f, name) return action @@ -145,7 +130,7 @@ from bpy.props import * class BakeAction(bpy.types.Operator): - '''Add a torus mesh''' + '''Bake animation to an Action''' bl_idname = "nla.bake" bl_label = "Bake Action" bl_options = {'REGISTER', 'UNDO'} @@ -165,7 +150,7 @@ class BakeAction(bpy.types.Operator): def execute(self, context): props = self.properties - action = bake(props.frame_start, props.frame_end, props.step, props.only_selected) + action = bake(props.frame_start, props.frame_end, props.step, props.show_only_selected) # basic cleanup, could move elsewhere for fcu in action.fcurves: @@ -193,12 +178,12 @@ class BakeAction(bpy.types.Operator): def register(): - bpy.types.register(BakeAction) + pass # bpy.types.INFO_MT_mesh_add.append(menu_func) def unregister(): - bpy.types.unregister(BakeAction) + pass # bpy.types.INFO_MT_mesh_add.remove(menu_func) if __name__ == "__main__": diff --git a/release/scripts/op/object.py b/release/scripts/op/object.py index 026d4409272..cb97fb736b9 100644 --- a/release/scripts/op/object.py +++ b/release/scripts/op/object.py @@ -52,9 +52,9 @@ class SelectPattern(bpy.types.Operator): # Can be pose bones or objects for item in items: if pattern_match(item.name, self.properties.pattern): - item.selected = True + item.select = True elif not self.properties.extend: - item.selected = False + item.select = False return {'FINISHED'} @@ -80,7 +80,8 @@ class SelectCamera(bpy.types.Operator): bl_label = "Select Camera" bl_options = {'REGISTER', 'UNDO'} - def poll(self, context): + @classmethod + def poll(cls, context): return context.scene.camera is not None def execute(self, context): @@ -90,7 +91,7 @@ class SelectCamera(bpy.types.Operator): self.report({'WARNING'}, "Active camera is not in this scene") context.scene.objects.active = camera - camera.selected = True + camera.select = True return {'FINISHED'} @@ -109,30 +110,51 @@ class SelectHierarchy(bpy.types.Operator): extend = BoolProperty(name="Extend", description="Extend the existing selection", default=False) - def poll(self, context): + @classmethod + def poll(cls, context): return context.object def execute(self, context): - obj = context.object + select_new = [] + act_new = None + + + selected_objects = context.selected_objects + obj_act = context.object + + if context.object not in selected_objects: + selected_objects.append(context.object) + if self.properties.direction == 'PARENT': - parent = obj.parent - if not parent: - return {'CANCELLED'} - obj_act = parent + for obj in selected_objects: + parent = obj.parent + + if parent: + if obj_act == obj: + act_new = parent + + select_new.append(parent) + else: - children = obj.children - if len(children) != 1: - return {'CANCELLED'} - obj_act = children[0] + for obj in selected_objects: + select_new.extend(obj.children) - if not self.properties.extend: - # obj.selected = False - bpy.ops.object.select_all(action='DESELECT') + if select_new: + select_new.sort(key=lambda obj_iter: obj_iter.name) + act_new = select_new[0] - obj_act.selected = True - context.scene.objects.active = obj_act + # dont edit any object settings above this + if select_new: + if not self.properties.extend: + bpy.ops.object.select_all(action='DESELECT') - return {'FINISHED'} + for obj in select_new: + obj.select = True + + context.scene.objects.active = act_new + return {'FINISHED'} + + return {'CANCELLED'} class SubdivisionSet(bpy.types.Operator): @@ -147,7 +169,8 @@ class SubdivisionSet(bpy.types.Operator): relative = BoolProperty(name="Relative", description="Apply the subsurf level as an offset relative to the current level", default=False) - def poll(self, context): + @classmethod + def poll(cls, context): obs = context.selected_editable_objects return (obs is not None) @@ -233,10 +256,10 @@ class ShapeTransfer(bpy.types.Operator): key = ob.add_shape_key(from_mix=False) # we need a rest key.name = name ob.active_shape_key_index = len(me.shape_keys.keys) - 1 - ob.shape_key_lock = True + ob.show_shape_key = True - from Geometry import BarycentricTransform - from Mathutils import Vector + from geometry import BarycentricTransform + from mathutils import Vector if use_clamp and mode == 'OFFSET': use_clamp = False @@ -246,28 +269,28 @@ class ShapeTransfer(bpy.types.Operator): orig_shape_coords = me_cos(ob_act.active_shape_key.data) - orig_normals = me_nos(me.verts) - # orig_coords = me_cos(me.verts) # the actual mverts location isnt as relyable as the base shape :S + orig_normals = me_nos(me.vertices) + # orig_coords = me_cos(me.vertices) # the actual mverts location isnt as relyable as the base shape :S orig_coords = me_cos(me.shape_keys.keys[0].data) for ob_other in objects: me_other = ob_other.data - if len(me_other.verts) != len(me.verts): + if len(me_other.vertices) != len(me.vertices): self.report({'WARNING'}, "Skipping '%s', vertex count differs" % ob_other.name) continue - target_normals = me_nos(me_other.verts) + target_normals = me_nos(me_other.vertices) if me_other.shape_keys: target_coords = me_cos(me_other.shape_keys.keys[0].data) else: - target_coords = me_cos(me_other.verts) + target_coords = me_cos(me_other.vertices) ob_add_shape(ob_other, orig_key_name) # editing the final coords, only list that stores wrapped coords target_shape_coords = [v.co for v in ob_other.active_shape_key.data] - median_coords = [[] for i in range(len(me.verts))] + median_coords = [[] for i in range(len(me.vertices))] # Method 1, edge if mode == 'OFFSET': @@ -276,7 +299,7 @@ class ShapeTransfer(bpy.types.Operator): elif mode == 'RELATIVE_FACE': for face in me.faces: - i1, i2, i3, i4 = face.verts_raw + i1, i2, i3, i4 = face.vertices_raw if i4 != 0: pt = BarycentricTransform(orig_shape_coords[i1], orig_coords[i4], orig_coords[i1], orig_coords[i2], @@ -316,7 +339,7 @@ class ShapeTransfer(bpy.types.Operator): elif mode == 'RELATIVE_EDGE': for ed in me.edges: - i1, i2 = ed.verts + i1, i2 = ed.vertices v1, v2 = orig_coords[i1], orig_coords[i2] edge_length = (v1 - v2).length n1loc = v1 + orig_normals[i1] * edge_length @@ -359,7 +382,8 @@ class ShapeTransfer(bpy.types.Operator): return {'FINISHED'} - def poll(self, context): + @classmethod + def poll(cls, context): obj = context.active_object return (obj and obj.mode != 'EDIT') @@ -389,7 +413,8 @@ class JoinUVs(bpy.types.Operator): bl_idname = "object.join_uvs" bl_label = "Join as UVs" - def poll(self, context): + @classmethod + def poll(cls, context): obj = context.active_object return (obj and obj.type == 'MESH') @@ -402,13 +427,13 @@ class JoinUVs(bpy.types.Operator): if is_editmode: bpy.ops.object.mode_set(mode='OBJECT', toggle=False) - if not mesh.active_uv_texture: + if not mesh.uv_textures: self.report({'WARNING'}, "Object: %s, Mesh: '%s' has no UVs\n" % (obj.name, mesh.name)) else: len_faces = len(mesh.faces) uv_array = array.array('f', [0.0] * 8) * len_faces # seems to be the fastest way to create an array - mesh.active_uv_texture.data.foreach_get("uv_raw", uv_array) + mesh.uv_textures.active.data.foreach_get("uv_raw", uv_array) objects = context.selected_editable_objects[:] @@ -426,10 +451,9 @@ class JoinUVs(bpy.types.Operator): if len(mesh_other.faces) != len_faces: self.report({'WARNING'}, "Object: %s, Mesh: '%s' has %d faces, expected %d\n" % (obj_other.name, mesh_other.name, len(mesh_other.faces), len_faces)) else: - uv_other = mesh_other.active_uv_texture + uv_other = mesh_other.uv_textures.active if not uv_other: - mesh_other.add_uv_texture() # should return the texture it adds - uv_other = mesh_other.active_uv_texture + uv_other = mesh_other.uv_textures.new() # should return the texture it adds # finally do the copy uv_other.data.foreach_set("uv_raw", uv_array) @@ -447,17 +471,18 @@ class MakeDupliFace(bpy.types.Operator): bl_idname = "object.make_dupli_face" bl_label = "Make DupliFace" - def poll(self, context): + @classmethod + def poll(cls, context): obj = context.active_object return (obj and obj.type == 'MESH') def _main(self, context): - from Mathutils import Vector + from mathutils import Vector from math import sqrt SCALE_FAC = 0.01 offset = 0.5 * SCALE_FAC - base_tri = Vector(-offset, -offset, 0.0), Vector(offset, -offset, 0.0), Vector(offset, offset, 0.0), Vector(-offset, offset, 0.0) + base_tri = Vector((-offset, -offset, 0.0)), Vector((offset, -offset, 0.0)), Vector((offset, offset, 0.0)), Vector((-offset, offset, 0.0)) def matrix_to_quat(matrix): # scale = matrix.median_scale @@ -473,14 +498,16 @@ class MakeDupliFace(bpy.types.Operator): linked.setdefault(data, []).append(obj) for data, objects in linked.items(): - face_verts = [axis for obj in objects for v in matrix_to_quat(obj.matrix) for axis in v] - faces = list(range(int(len(face_verts) / 3))) + face_verts = [axis for obj in objects for v in matrix_to_quat(obj.matrix_world) for axis in v] + faces = list(range(len(face_verts) // 3)) mesh = bpy.data.meshes.new(data.name + "_dupli") - mesh.add_geometry(int(len(face_verts) / 3), 0, int(len(face_verts) / (4 * 3))) - mesh.verts.foreach_set("co", face_verts) - mesh.faces.foreach_set("verts_raw", faces) + mesh.vertices.add(len(face_verts) // 3) + mesh.faces.add(len(face_verts) // 12) + + mesh.vertices.foreach_set("co", face_verts) + mesh.faces.foreach_set("vertices_raw", faces) mesh.update() # generates edge data # pick an object to use @@ -507,26 +534,43 @@ class MakeDupliFace(bpy.types.Operator): return {'FINISHED'} -classes = [ - SelectPattern, - SelectCamera, - SelectHierarchy, - SubdivisionSet, - ShapeTransfer, - JoinUVs, - MakeDupliFace] +class IsolateTypeRender(bpy.types.Operator): + '''Hide unselected render objects of same type as active by setting the hide render flag''' + bl_idname = "object.isolate_type_render" + bl_label = "Restrict Render Unselected" + bl_options = {'REGISTER', 'UNDO'} + + def execute(self, context): + act_type = context.object.type + + for obj in context.visible_objects: + + if obj.select: + obj.hide_render = False + else: + if obj.type == act_type: + obj.hide_render = True + + return {'FINISHED'} + +class ClearAllRestrictRender(bpy.types.Operator): + '''Reveal all render objects by setting the hide render flag''' + bl_idname = "object.hide_render_clear_all" + bl_label = "Clear All Restrict Render" + bl_options = {'REGISTER', 'UNDO'} + + def execute(self, context): + for obj in context.scene.objects: + obj.hide_render = False + return {'FINISHED'} def register(): - register = bpy.types.register - for cls in classes: - register(cls) + pass def unregister(): - unregister = bpy.types.unregister - for cls in classes: - unregister(cls) + pass if __name__ == "__main__": - register() + register()
\ No newline at end of file diff --git a/release/scripts/op/object_align.py b/release/scripts/op/object_align.py index c5fcc3d2a32..dc9b7c34523 100644 --- a/release/scripts/op/object_align.py +++ b/release/scripts/op/object_align.py @@ -19,22 +19,22 @@ # <pep8 compliant> import bpy -from Mathutils import Vector +from mathutils import Vector def align_objects(align_x, align_y, align_z, align_mode, relative_to): cursor = bpy.context.scene.cursor_location - Left_Up_Front_SEL = [[],[],[]] - Right_Down_Back_SEL = [[],[],[]] + Left_Up_Front_SEL = [[], [], []] + Right_Down_Back_SEL = [[], [], []] flag_first = True for obj in bpy.context.selected_objects: if obj.type == 'MESH': - bb_world = [obj.matrix * Vector(v[:]) for v in obj.bound_box] + bb_world = [obj.matrix_world * Vector(v[:]) for v in obj.bound_box] Left_Up_Front = bb_world[1] Right_Down_Back = bb_world[7] @@ -43,13 +43,13 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to): if obj == bpy.context.active_object: - center_active_x = ( Left_Up_Front[0] + Right_Down_Back[0] ) / 2 - center_active_y = ( Left_Up_Front[1] + Right_Down_Back[1] ) / 2 - center_active_z = ( Left_Up_Front[2] + Right_Down_Back[2] ) / 2 + center_active_x = (Left_Up_Front[0] + Right_Down_Back[0]) / 2 + center_active_y = (Left_Up_Front[1] + Right_Down_Back[1]) / 2 + center_active_z = (Left_Up_Front[2] + Right_Down_Back[2]) / 2 - size_active_x = ( Right_Down_Back[0] - Left_Up_Front[0] ) / 2 - size_active_y = ( Right_Down_Back[1] - Left_Up_Front[1] ) / 2 - size_active_z = ( Left_Up_Front[2] - Right_Down_Back[2] ) / 2 + size_active_x = (Right_Down_Back[0] - Left_Up_Front[0]) / 2 + size_active_y = (Right_Down_Back[1] - Left_Up_Front[1]) / 2 + size_active_z = (Left_Up_Front[2] - Right_Down_Back[2]) / 2 # Selection Center @@ -85,9 +85,9 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to): if Right_Down_Back[2] < Right_Down_Back_SEL[2]: Right_Down_Back_SEL[2] = Right_Down_Back[2] - center_sel_x = ( Left_Up_Front_SEL[0] + Right_Down_Back_SEL[0] ) / 2 - center_sel_y = ( Left_Up_Front_SEL[1] + Right_Down_Back_SEL[1] ) / 2 - center_sel_z = ( Left_Up_Front_SEL[2] + Right_Down_Back_SEL[2] ) / 2 + center_sel_x = (Left_Up_Front_SEL[0] + Right_Down_Back_SEL[0]) / 2 + center_sel_y = (Left_Up_Front_SEL[1] + Right_Down_Back_SEL[1]) / 2 + center_sel_z = (Left_Up_Front_SEL[2] + Right_Down_Back_SEL[2]) / 2 # Main Loop @@ -95,14 +95,14 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to): if obj.type == 'MESH': loc_world = obj.location - bb_world = [obj.matrix * Vector(v[:]) for v in obj.bound_box] + bb_world = [obj.matrix_world * Vector(v[:]) for v in obj.bound_box] Left_Up_Front = bb_world[1] Right_Down_Back = bb_world[7] - center_x = ( Left_Up_Front[0] + Right_Down_Back[0] ) / 2 - center_y = ( Left_Up_Front[1] + Right_Down_Back[1] ) / 2 - center_z = ( Left_Up_Front[2] + Right_Down_Back[2] ) / 2 + center_x = (Left_Up_Front[0] + Right_Down_Back[0]) / 2 + center_y = (Left_Up_Front[1] + Right_Down_Back[1]) / 2 + center_z = (Left_Up_Front[2] + Right_Down_Back[2]) / 2 positive_x = Right_Down_Back[0] positive_y = Right_Down_Back[1] @@ -240,8 +240,7 @@ class AlignObjects(bpy.types.Operator): align_mode = bpy.props.EnumProperty(items=( ('OPT_1', "Negative Sides", ""), ('OPT_2', "Centers", ""), - ('OPT_3', "Positive Sides", "") - ), + ('OPT_3', "Positive Sides", "")), name="Align Mode:", description="", default='OPT_2') @@ -250,8 +249,7 @@ class AlignObjects(bpy.types.Operator): ('OPT_1', "Scene Origin", ""), ('OPT_2', "3D Cursor", ""), ('OPT_3', "Selection", ""), - ('OPT_4', "Active", "") - ), + ('OPT_4', "Active", "")), name="Relative To:", description="", default='OPT_4') @@ -265,7 +263,8 @@ class AlignObjects(bpy.types.Operator): align_z = BoolProperty(name="Align Z", description="Align in the Z axis", default=False) - def poll(self, context): + @classmethod + def poll(cls, context): return context.mode == 'OBJECT' def execute(self, context): @@ -288,12 +287,10 @@ def menu_func(self, context): def register(): - bpy.types.register(AlignObjects) bpy.types.VIEW3D_MT_transform.append(menu_func) def unregister(): - bpy.types.unregister(AlignObjects) bpy.types.VIEW3D_MT_transform.remove(menu_func) if __name__ == "__main__": diff --git a/release/scripts/op/object_randomize_transform.py b/release/scripts/op/object_randomize_transform.py index 3d3feb66424..8c3f4eb6dfd 100644 --- a/release/scripts/op/object_randomize_transform.py +++ b/release/scripts/op/object_randomize_transform.py @@ -25,12 +25,12 @@ def randomize_selected(seed, loc, rot, scale, scale_even, scale_min): import random from random import uniform - from Mathutils import Vector + from mathutils import Vector random.seed(seed) def rand_vec(vec_range): - return Vector([uniform(- val, val) for val in vec_range]) + return Vector([uniform(-val, val) for val in vec_range]) for obj in bpy.context.selected_objects: @@ -140,12 +140,10 @@ def menu_func(self, context): def register(): - bpy.types.register(RandomizeLocRotSize) bpy.types.VIEW3D_MT_transform.append(menu_func) def unregister(): - bpy.types.unregister(RandomizeLocRotSize) bpy.types.VIEW3D_MT_transform.remove(menu_func) if __name__ == "__main__": diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py index 1a8e57f7c32..4d15d94f408 100644 --- a/release/scripts/op/presets.py +++ b/release/scripts/op/presets.py @@ -22,13 +22,13 @@ import bpy import os -class AddPresetBase(bpy.types.Operator): +class AddPresetBase(): '''Base preset class, only for subclassing subclasses must define - preset_values - preset_subdir ''' - bl_idname = "render.preset_add" - bl_label = "Add Render Preset" + # bl_idname = "script.preset_base_add" + # bl_label = "Add a Python Preset" name = bpy.props.StringProperty(name="Name", description="Name of the preset, used to make the path name", maxlen=64, default="") @@ -46,14 +46,18 @@ class AddPresetBase(bpy.types.Operator): target_path = bpy.utils.preset_paths(self.preset_subdir)[0] # we need some way to tell the user and system preset path - file_preset = open(os.path.join(target_path, filename), 'w') + filepath = os.path.join(target_path, filename) + if getattr(self, "save_keyconfig", False): + bpy.ops.wm.keyconfig_export(filepath=filepath, kc_name=self.properties.name) + file_preset = open(filepath, 'a') + file_preset.write("wm.keyconfigs.active = kc\n\n") + else: + file_preset = open(filepath, 'w') + file_preset.write("import bpy\n") for rna_path in self.preset_values: value = eval(rna_path) - if type(value) == str: - value = "'%s'" % value - - file_preset.write("%s = %s\n" % (rna_path, value)) + file_preset.write("%s = %s\n" % (rna_path, repr(value))) file_preset.close() @@ -68,29 +72,48 @@ class AddPresetBase(bpy.types.Operator): return {'RUNNING_MODAL'} -class AddPresetRender(AddPresetBase): +class ExecutePreset(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="") + preset_name = bpy.props.StringProperty(name="Preset Name", description="Name of the Preset being executed", 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): + # change the menu title to the most recently chosen option + preset_class = getattr(bpy.types, self.properties.menu_idname) + preset_class.bl_label = self.properties.preset_name + + # execute the preset using script.python_file_run + bpy.ops.script.python_file_run(filepath=self.properties.filepath) + return {'FINISHED'} + + +class AddPresetRender(AddPresetBase, bpy.types.Operator): '''Add a Render Preset''' bl_idname = "render.preset_add" bl_label = "Add Render Preset" name = AddPresetBase.name preset_values = [ - "bpy.context.scene.render.resolution_x", - "bpy.context.scene.render.resolution_y", - "bpy.context.scene.render.pixel_aspect_x", - "bpy.context.scene.render.pixel_aspect_y", + "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.fields", - "bpy.context.scene.render.field_order", - "bpy.context.scene.render.fields_still", + "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", ] preset_subdir = "render" -class AddPresetSSS(AddPresetBase): +class AddPresetSSS(AddPresetBase, bpy.types.Operator): '''Add a Subsurface Scattering Preset''' bl_idname = "material.sss_preset_add" bl_label = "Add SSS Preset" @@ -102,7 +125,7 @@ class AddPresetSSS(AddPresetBase): "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_tolerance", + "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]", @@ -115,66 +138,77 @@ class AddPresetSSS(AddPresetBase): preset_subdir = "sss" -class AddPresetCloth(AddPresetBase): +class AddPresetCloth(AddPresetBase, bpy.types.Operator): '''Add a Cloth Preset''' bl_idname = "cloth.preset_add" bl_label = "Add Cloth Preset" name = AddPresetBase.name preset_values = [ - "bpy.context.cloth.settings.quality", - "bpy.context.cloth.settings.mass", - "bpy.context.cloth.settings.structural_stiffness", + "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.air_damping", + "bpy.context.cloth.settings.structural_stiffness", ] preset_subdir = "cloth" -class AddPresetSunSky(AddPresetBase): +class AddPresetSunSky(AddPresetBase, bpy.types.Operator): '''Add a Sky & Atmosphere Preset''' bl_idname = "lamp.sunsky_preset_add" bl_label = "Add Sunsky Preset" name = AddPresetBase.name 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.sky_blend_type", - "bpy.context.object.data.sky.sky_blend", + "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.sky_color_space", - "bpy.context.object.data.sky.sky_exposure", "bpy.context.object.data.sky.sun_brightness", - "bpy.context.object.data.sky.sun_size", - "bpy.context.object.data.sky.backscattered_light", "bpy.context.object.data.sky.sun_intensity", - "bpy.context.object.data.sky.atmosphere_inscattering", - "bpy.context.object.data.sky.atmosphere_extinction", + "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", ] preset_subdir = "sunsky" -classes = [ - AddPresetRender, - AddPresetSSS, - AddPresetCloth, - AddPresetSunSky] +class AddPresetInteraction(AddPresetBase, bpy.types.Operator): + '''Add an Application Interaction Preset''' + bl_idname = "wm.interaction_preset_add" + bl_label = "Add Interaction Preset" + name = AddPresetBase.name + save_keyconfig = True + + 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", + ] + preset_subdir = "interaction" def register(): - register = bpy.types.register - for cls in classes: - register(cls) + pass def unregister(): - unregister = bpy.types.unregister - for cls in classes: - unregister(cls) + pass if __name__ == "__main__": register() diff --git a/release/scripts/op/screen_play_rendered_anim.py b/release/scripts/op/screen_play_rendered_anim.py index 2ecd445df1d..80260755714 100644 --- a/release/scripts/op/screen_play_rendered_anim.py +++ b/release/scripts/op/screen_play_rendered_anim.py @@ -79,7 +79,7 @@ class PlayRenderedAnim(bpy.types.Operator): preset = prefs.filepaths.animation_player_preset player_path = prefs.filepaths.animation_player - file_path = bpy.utils.expandpath(rd.output_path) + file_path = bpy.path.abspath(rd.filepath) is_movie = rd.is_movie_format # try and guess a command line if it doesn't exist @@ -105,7 +105,7 @@ class PlayRenderedAnim(bpy.types.Operator): # works for movies and images file = rd.frame_path(frame=scene.frame_start) - file = bpy.utils.expandpath(file) # expand '//' + file = bpy.path.abspath(file) # expand '//' cmd = [player_path] # extra options, fps controls etc. @@ -144,11 +144,11 @@ class PlayRenderedAnim(bpy.types.Operator): def register(): - bpy.types.register(PlayRenderedAnim) + pass def unregister(): - bpy.types.unregister(PlayRenderedAnim) + pass if __name__ == "__main__": register() diff --git a/release/scripts/op/sequencer.py b/release/scripts/op/sequencer.py index b3b674cb97e..feedb5cb4a8 100644 --- a/release/scripts/op/sequencer.py +++ b/release/scripts/op/sequencer.py @@ -20,6 +20,8 @@ import bpy +from bpy.props import * + class SequencerCrossfadeSounds(bpy.types.Operator): '''Do crossfading volume animation of two selected sound strips.''' @@ -28,7 +30,8 @@ class SequencerCrossfadeSounds(bpy.types.Operator): bl_label = "Crossfade sounds" bl_options = {'REGISTER', 'UNDO'} - def poll(self, context): + @classmethod + def poll(cls, context): if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip: return context.scene.sequence_editor.active_strip.type == 'SOUND' else: @@ -38,7 +41,7 @@ class SequencerCrossfadeSounds(bpy.types.Operator): seq1 = None seq2 = None for s in context.scene.sequence_editor.sequences: - if s.selected and s.type == 'SOUND': + if s.select and s.type == 'SOUND': if seq1 == None: seq1 = s elif seq2 == None: @@ -71,12 +74,73 @@ class SequencerCrossfadeSounds(bpy.types.Operator): return {'CANCELLED'} +class SequencerCutMulticam(bpy.types.Operator): + '''Cut multicam strip and select camera.''' + + bl_idname = "sequencer.cut_multicam" + bl_label = "Cut multicam" + bl_options = {'REGISTER', 'UNDO'} + + camera = IntProperty(name="Camera", + default=1, min=1, max=32, soft_min=1, soft_max=32) + + @classmethod + def poll(cls, context): + if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip: + return context.scene.sequence_editor.active_strip.type == 'MULTICAM' + else: + return False + + def execute(self, context): + camera = self.properties.camera + + s = context.scene.sequence_editor.active_strip + + if s.multicam_source == camera or camera >= s.channel: + return {'FINISHED'} + + if not s.select: + s.select = True + + cfra = context.scene.frame_current + bpy.ops.sequencer.cut(frame=cfra, type='SOFT', side='RIGHT') + for s in context.scene.sequence_editor.sequences_all: + if s.select and s.type == 'MULTICAM' and s.frame_final_start <= cfra and cfra < s.frame_final_end: + context.scene.sequence_editor.active_strip = s + + context.scene.sequence_editor.active_strip.multicam_source = camera + return {'FINISHED'} + + +class SequencerDeinterlaceSelectedMovies(bpy.types.Operator): + '''Deinterlace all selected movie sources.''' + + bl_idname = "sequencer.deinterlace_selected_movies" + bl_label = "Deinterlace Movies" + bl_options = {'REGISTER', 'UNDO'} + + @classmethod + def poll(cls, context): + if context.scene and context.scene.sequence_editor: + return True + else: + return False + + def execute(self, context): + for s in context.scene.sequence_editor.sequences_all: + if s.select and s.type == 'MOVIE': + s.use_deinterlace = True + + return {'FINISHED'} + + def register(): - bpy.types.register(SequencerCrossfadeSounds) + pass def unregister(): - bpy.types.unregister(SequencerCrossfadeSounds) + pass + if __name__ == "__main__": register() diff --git a/release/scripts/op/uv.py b/release/scripts/op/uv.py index f22db9d87a8..238c11d6e06 100644 --- a/release/scripts/op/uv.py +++ b/release/scripts/op/uv.py @@ -29,7 +29,7 @@ class ExportUVLayout(bpy.types.Operator): bl_label = "Export UV Layout" bl_options = {'REGISTER', 'UNDO'} - path = StringProperty(name="File Path", description="File path used for exporting the SVG file", maxlen=1024, default="") + filepath = StringProperty(name="File Path", description="File path used for exporting the SVG file", maxlen=1024, default="") check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'}) export_all = BoolProperty(name="All UV's", description="Export all UVs in this mesh (not just the visible ones)", default=False) mode = EnumProperty(items=( @@ -39,7 +39,8 @@ class ExportUVLayout(bpy.types.Operator): description="File format to export the UV layout to", default='SVG') - def poll(self, context): + @classmethod + def poll(cls, context): obj = context.active_object return (obj and obj.type == 'MESH') @@ -68,14 +69,14 @@ class ExportUVLayout(bpy.types.Operator): def _face_uv_iter(self, context): obj = context.active_object mesh = obj.data - uv_layer = mesh.active_uv_texture.data + uv_layer = mesh.uv_textures.active.data uv_layer_len = len(uv_layer) if not self.properties.export_all: local_image = Ellipsis - if context.tool_settings.uv_local_view: + if context.tool_settings.show_uv_local_view: space_data = self._space_image(context) if space_data: local_image = space_data.image @@ -85,9 +86,9 @@ class ExportUVLayout(bpy.types.Operator): for i in range(uv_layer_len): uv_elem = uv_layer[i] # context checks - if faces[i].selected and (local_image is Ellipsis or local_image == uv_elem.image): + if faces[i].select and (local_image is Ellipsis or local_image == uv_elem.image): #~ uv = uv_elem.uv - #~ if False not in uv_elem.uv_selected[:len(uv)]: + #~ if False not in uv_elem.select_uv[:len(uv)]: #~ yield (i, uv) # just write what we see. @@ -113,7 +114,9 @@ class ExportUVLayout(bpy.types.Operator): mode = self.properties.mode - file = open(self.properties.path, "w") + filepath = self.properties.filepath + filepath = bpy.path.ensure_ext(filepath, "." + mode.lower()) + file = open(filepath, "w") fw = file.write if mode == 'SVG': @@ -123,7 +126,7 @@ class ExportUVLayout(bpy.types.Operator): fw(' "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n') fw('<svg width="%dpx" height="%dpx" viewBox="0px 0px %dpx %dpx"\n' % (image_width, image_height, image_width, image_height)) fw(' xmlns="http://www.w3.org/2000/svg" version="1.1">\n') - desc = "%s, %s, %s (Blender %s)" % (basename(bpy.data.filename), obj.name, mesh.name, bpy.app.version_string) + desc = "%s, %s, %s (Blender %s)" % (basename(bpy.data.filepath), obj.name, mesh.name, bpy.app.version_string) fw('<desc>%s</desc>\n' % escape(desc)) # svg colors @@ -167,18 +170,34 @@ class ExportUVLayout(bpy.types.Operator): fw('1 setlinewidth\n') fw('1 setlinejoin\n') fw('1 setlinecap\n') + fw('/DRAW {') + # can remove from here to next comment to disable filling, aparently alpha is not supported + fw('gsave\n') + fw('0.7 setgray\n') + fw('fill\n') + fw('grestore\n') + fw('0 setgray\n') + # remove to here + fw('stroke\n') + fw('} def\n') fw('newpath\n') + firstline = True for i, uvs in self._face_uv_iter(context): for j, uv in enumerate(uvs): x, y = uv[0], uv[1] if j == 0: + if not firstline: + fw('closepath\n') + fw('DRAW\n') + fw('newpath\n') + firstline = False fw('%.5f %.5f moveto\n' % (x * image_width, y * image_height)) else: fw('%.5f %.5f lineto\n' % (x * image_width, y * image_height)) fw('closepath\n') - fw('stroke\n') + fw('DRAW\n') fw('showpage\n') fw('%%EOF\n') @@ -194,17 +213,16 @@ class ExportUVLayout(bpy.types.Operator): def menu_func(self, context): - default_path = bpy.data.filename.replace(".blend", ".svg") - self.layout.operator(ExportUVLayout.bl_idname).path = default_path + import os + default_path = os.path.splitext(bpy.data.filepath)[0] + ".svg" + self.layout.operator(ExportUVLayout.bl_idname).filepath = default_path def register(): - bpy.types.register(ExportUVLayout) bpy.types.IMAGE_MT_uvs.append(menu_func) -def unreguster(): - bpy.types.unregister(ExportUVLayout) +def unregister(): bpy.types.IMAGE_MT_uvs.remove(menu_func) if __name__ == "__main__": diff --git a/release/scripts/op/uvcalc_follow_active.py b/release/scripts/op/uvcalc_follow_active.py index c8a13441048..9f809dd39f8 100644 --- a/release/scripts/op/uvcalc_follow_active.py +++ b/release/scripts/op/uvcalc_follow_active.py @@ -26,10 +26,10 @@ import bpy def extend(obj, operator, EXTEND_MODE): me = obj.data - me_verts = me.verts + me_verts = me.vertices # script will fail without UVs - if not me.active_uv_texture: - me.add_uv_texture() + if not me.uv_textures: + me.uv_textures.new() # Toggle Edit mode @@ -54,20 +54,20 @@ def extend(obj, operator, EXTEND_MODE): # assume a quad return [(vi[0], vi[1]), (vi[1], vi[2]), (vi[2], vi[3]), (vi[3], vi[0])] - vidx_source = face_source.verts - vidx_target = face_target.verts + vidx_source = face_source.vertices + vidx_target = face_target.vertices - faceUVsource = me.active_uv_texture.data[face_source.index] + faceUVsource = me.uv_textures.active.data[face_source.index] uvs_source = [faceUVsource.uv1, faceUVsource.uv2, faceUVsource.uv3, faceUVsource.uv4] - faceUVtarget = me.active_uv_texture.data[face_target.index] + faceUVtarget = me.uv_textures.active.data[face_target.index] uvs_target = [faceUVtarget.uv1, faceUVtarget.uv2, faceUVtarget.uv3, faceUVtarget.uv4] # vertex index is the key, uv is the value - uvs_vhash_source = dict([(vindex, uvs_source[i]) for i, vindex in enumerate(vidx_source)]) + uvs_vhash_source = {vindex: uvs_source[i] for i, vindex in enumerate(vidx_source)} - uvs_vhash_target = dict([(vindex, uvs_target[i]) for i, vindex in enumerate(vidx_target)]) + uvs_vhash_target = {vindex: uvs_target[i] for i, vindex in enumerate(vidx_target)} edge_idxs_source = face_edge_vs(vidx_source) edge_idxs_target = face_edge_vs(vidx_target) @@ -138,15 +138,15 @@ def extend(obj, operator, EXTEND_MODE): uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] + (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]]) - if me.active_uv_texture == None: - me.add_uv_texture + if not me.uv_textures: + me.uv_textures.new() face_act = me.faces.active if face_act == -1: operator.report({'ERROR'}, "No active face.") return - face_sel = [f for f in me.faces if len(f.verts) == 4 and f.selected] + face_sel = [f for f in me.faces if len(f.vertices) == 4 and f.select] face_act_local_index = -1 for i, f in enumerate(face_sel): @@ -177,11 +177,9 @@ def extend(obj, operator, EXTEND_MODE): except: edge_faces[edkey] = [i] - #SEAM = me.edges.seam - if EXTEND_MODE == 'LENGTH': - edge_loops = me.edge_loops(face_sel, [ed.key for ed in me.edges if ed.seam]) - me_verts = me.verts + edge_loops = me.edge_loops_from_faces(face_sel, [ed.key for ed in me.edges if ed.use_seam]) + me_verts = me.vertices for loop in edge_loops: looplen = [0.0] for ed in loop: @@ -192,7 +190,7 @@ def extend(obj, operator, EXTEND_MODE): # remove seams, so we dont map accross seams. for ed in me.edges: - if ed.seam: + if ed.use_seam: # remove the edge pair if we can try: del edge_faces[ed.key] @@ -249,7 +247,8 @@ class FollowActiveQuads(bpy.types.Operator): description="Method to space UV edge loops", default="LENGTH") - def poll(self, context): + @classmethod + def poll(cls, context): obj = context.active_object return (obj is not None and obj.type == 'MESH') @@ -263,12 +262,10 @@ menu_func = (lambda self, context: self.layout.operator(FollowActiveQuads.bl_idn def register(): - bpy.types.register(FollowActiveQuads) bpy.types.VIEW3D_MT_uv_map.append(menu_func) def unregister(): - bpy.types.unregister(FollowActiveQuads) bpy.types.VIEW3D_MT_uv_map.remove(menu_func) if __name__ == "__main__": diff --git a/release/scripts/op/uvcalc_smart_project.py b/release/scripts/op/uvcalc_smart_project.py index c88faae2818..c4e19afc810 100644 --- a/release/scripts/op/uvcalc_smart_project.py +++ b/release/scripts/op/uvcalc_smart_project.py @@ -22,10 +22,9 @@ # <pep8 compliant> -#from Blender import Object, Draw, Window, sys, Mesh, Geometry -from Mathutils import Matrix, Vector, RotationMatrix +from mathutils import Matrix, Vector import time -import Geometry +import geometry import bpy from math import cos, radians @@ -200,7 +199,7 @@ def pointInEdges(pt, edges): """ def pointInIsland(pt, island): - vec1 = Vector(); vec2 = Vector(); vec3 = Vector() + vec1, vec2, vec3 = Vector(), Vector(), Vector() for f in island: vec1.x, vec1.y = f.uv[0] vec2.x, vec2.y = f.uv[1] @@ -227,7 +226,7 @@ def islandIntersectUvIsland(source, target, SourceOffset): # Edge intersect test for ed in edgeLoopsSource: for seg in edgeLoopsTarget: - i = Geometry.LineIntersect2D(\ + i = geometry.LineIntersect2D(\ seg[0], seg[1], SourceOffset+ed[0], SourceOffset+ed[1]) if i: return 1 # LINE INTERSECTION @@ -276,15 +275,15 @@ def testNewVecLs2DRotIsBetter(vecs, mat=-1, bestAreaSoFar = -1): # Takes a list of faces that make up a UV island and rotate # until they optimally fit inside a square. -ROTMAT_2D_POS_90D = RotationMatrix( radians(90.0), 2) -ROTMAT_2D_POS_45D = RotationMatrix( radians(45.0), 2) +ROTMAT_2D_POS_90D = Matrix.Rotation( radians(90.0), 2) +ROTMAT_2D_POS_45D = Matrix.Rotation( radians(45.0), 2) RotMatStepRotation = [] rot_angle = 22.5 #45.0/2 while rot_angle > 0.1: RotMatStepRotation.append([\ - RotationMatrix( radians(rot_angle), 2),\ - RotationMatrix( radians(-rot_angle), 2)]) + Matrix.Rotation( radians(rot_angle), 2),\ + Matrix.Rotation( radians(-rot_angle), 2)]) rot_angle = rot_angle/2.0 @@ -390,7 +389,7 @@ def mergeUvIslands(islandList): w, h = maxx-minx, maxy-miny totFaceArea = 0 - offset= Vector(minx, miny) + offset= Vector((minx, miny)) for f in islandList[islandIdx]: for uv in f.uv: uv -= offset @@ -514,7 +513,7 @@ def mergeUvIslands(islandList): ##testcount+=1 #print 'Testing intersect' - Intersect = islandIntersectUvIsland(sourceIsland, targetIsland, Vector(boxLeft, boxBottom)) + Intersect = islandIntersectUvIsland(sourceIsland, targetIsland, Vector((boxLeft, boxBottom))) #print 'Done', Intersect if Intersect == 1: # Line intersect, dont bother with this any more pass @@ -525,7 +524,7 @@ def mergeUvIslands(islandList): then move us 1 whole width accross, Its possible this is a bad idea since 2 skinny Angular faces could join without 1 whole move, but its a lot more optimal to speed this up - since we have alredy tested for it. + since we have already tested for it. It gives about 10% speedup with minimal errors. ''' @@ -540,7 +539,7 @@ def mergeUvIslands(islandList): # Move faces into new island and offset targetIsland[0].extend(sourceIsland[0]) - offset= Vector(boxLeft, boxBottom) + offset= Vector((boxLeft, boxBottom)) for f in sourceIsland[0]: for uv in f.uv: @@ -565,7 +564,7 @@ def mergeUvIslands(islandList): targetIsland[7].extend(sourceIsland[7]) - offset= Vector(boxLeft, boxBottom, 0) + offset= Vector((boxLeft, boxBottom, 0.0)) for p in sourceIsland[7]: p+= offset @@ -605,7 +604,7 @@ def getUvIslands(faceGroups, me): # Get seams so we dont cross over seams edge_seams = {} # shoudl be a set for ed in me.edges: - if ed.seam: + if ed.use_seam: edge_seams[ed.key] = None # dummy var- use sets! # Done finding seams @@ -741,7 +740,7 @@ def packIslands(islandList): #XXX Window.DrawProgressBar(0.7, 'Packing %i UV Islands...' % len(packBoxes) ) time1 = time.time() - packWidth, packHeight = Geometry.BoxPack2D(packBoxes) + packWidth, packHeight = geometry.BoxPack2D(packBoxes) # print 'Box Packing Time:', time.time() - time1 @@ -781,9 +780,9 @@ def packIslands(islandList): def VectoMat(vec): a3 = vec.__copy__().normalize() - up = Vector(0,0,1) + up = Vector((0.0, 0.0, 1.0)) if abs(a3.dot(up)) == 1.0: - up = Vector(0,1,0) + up = Vector((0.0, 1.0, 0.0)) a1 = a3.cross(up).normalize() a2 = a3.cross(a1) @@ -793,7 +792,7 @@ def VectoMat(vec): class thickface(object): __slost__= 'v', 'uv', 'no', 'area', 'edge_keys' def __init__(self, face, uvface, mesh_verts): - self.v = [mesh_verts[i] for i in face.verts] + self.v = [mesh_verts[i] for i in face.vertices] if len(self.v)==4: self.uv = uvface.uv1, uvface.uv2, uvface.uv3, uvface.uv4 else: @@ -822,7 +821,7 @@ def main(context, island_margin, projection_limit): #XXX ob = objects.active ob= objects[0] - if ob and ob.selected == 0 and ob.type == 'MESH': + if ob and (not ob.select) and ob.type == 'MESH': # Add to the list obList =[ob] del objects @@ -893,14 +892,14 @@ def main(context, island_margin, projection_limit): # Tag as used me.tag = True - if len(me.uv_textures)==0: # Mesh has no UV Coords, dont bother. - me.add_uv_texture() + if not me.uv_textures: # Mesh has no UV Coords, dont bother. + me.uv_textures.new() - uv_layer = me.active_uv_texture.data - me_verts = list(me.verts) + uv_layer = me.uv_textures.active.data + me_verts = list(me.vertices) if USER_ONLY_SELECTED_FACES: - meshFaces = [thickface(f, uv_layer[i], me_verts) for i, f in enumerate(me.faces) if f.selected] + meshFaces = [thickface(f, uv_layer[i], me_verts) for i, f in enumerate(me.faces) if f.select] #else: # meshFaces = map(thickface, me.faces) @@ -936,7 +935,7 @@ def main(context, island_margin, projection_limit): # Initialize projectVecs if USER_VIEW_INIT: # Generate Projection - projectVecs = [Vector(Window.GetViewVector()) * ob.matrixWorld.copy().invert().rotation_part()] # We add to this allong the way + projectVecs = [Vector(Window.GetViewVector()) * ob.matrix_world.copy().invert().rotation_part()] # We add to this allong the way else: projectVecs = [] @@ -964,7 +963,7 @@ def main(context, island_margin, projection_limit): newProjectMeshFaces.append(tempMeshFaces.pop(fIdx)) # Add the average of all these faces normals as a projectionVec - averageVec = Vector(0,0,0) + averageVec = Vector((0.0, 0.0, 0.0)) if USER_AREA_WEIGHT: for fprop in newProjectMeshFaces: averageVec += (fprop.no * fprop.area) @@ -1028,7 +1027,7 @@ def main(context, island_margin, projection_limit): bestAng = fvec.dot(projectVecs[0]) bestAngIdx = 0 - # Cycle through the remaining, first alredy done + # Cycle through the remaining, first already done while i-1: i-=1 @@ -1056,7 +1055,7 @@ def main(context, island_margin, projection_limit): for f in faceProjectionGroupList[i]: f_uv = f.uv for j, v in enumerate(f.v): - # XXX - note, between Mathutils in 2.4 and 2.5 the order changed. + # XXX - note, between mathutils in 2.4 and 2.5 the order changed. f_uv[j][:] = (v.co * MatProj)[:2] @@ -1125,7 +1124,8 @@ class SmartProject(bpy.types.Operator): description="Margin to reduce bleed from adjacent islands.", default=0.0, min=0.0, max=1.0) - def poll(self, context): + @classmethod + def poll(cls, context): return context.active_object != None def execute(self, context): @@ -1139,12 +1139,10 @@ menu_func = (lambda self, context: self.layout.operator(SmartProject.bl_idname, def register(): - bpy.types.register(SmartProject) bpy.types.VIEW3D_MT_uv_map.append(menu_func) def unregister(): - bpy.types.unregister(SmartProject) bpy.types.VIEW3D_MT_uv_map.remove(menu_func) if __name__ == "__main__": diff --git a/release/scripts/op/vertexpaint_dirt.py b/release/scripts/op/vertexpaint_dirt.py index f2c2d5bd864..72317cf8c11 100644 --- a/release/scripts/op/vertexpaint_dirt.py +++ b/release/scripts/op/vertexpaint_dirt.py @@ -34,7 +34,7 @@ import bpy import math import time -from Mathutils import Vector +from mathutils import Vector from bpy.props import * @@ -43,7 +43,7 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean, #BPyMesh.meshCalcNormals(me) - vert_tone = [0.0] * len(me.verts) + vert_tone = [0.0] * len(me.vertices) min_tone = 180.0 max_tone = 0.0 @@ -51,24 +51,29 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean, # create lookup table for each vertex's connected vertices (via edges) con = [] - con = [[] for i in range(len(me.verts))] + con = [[] for i in range(len(me.vertices))] # add connected verts for e in me.edges: - con[e.verts[0]].append(e.verts[1]) - con[e.verts[1]].append(e.verts[0]) + con[e.vertices[0]].append(e.vertices[1]) + con[e.vertices[1]].append(e.vertices[0]) - for v in me.verts: + for i, v in enumerate(me.vertices): vec = Vector() no = v.normal co = v.co # get the direction of the vectors between the vertex and it's connected vertices - for c in con[v.index]: - vec += Vector(me.verts[c].co - co).normalize() + for c in con[i]: + vec += (me.vertices[c].co - co).normalize() # normalize the vector by dividing by the number of connected verts - vec /= len(con[v.index]) + tot_con = len(con[i]) + + if tot_con == 0: + continue + + vec /= tot_con # angle is the acos of the dot product between vert and connected verts normals ang = math.acos(no.dot(vec)) @@ -79,7 +84,7 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean, if not dirt_only: ang = min(clamp_clean, ang) - vert_tone[v.index] = ang + vert_tone[i] = ang # blur tones for i in range(blur_iterations): @@ -122,15 +127,15 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean, return('CANCELLED', ) for i, f in enumerate(me.faces): - if not me.use_paint_mask or f.selected: + if not me.use_paint_mask or f.select: f_col = active_col_layer[i] f_col = [f_col.color1, f_col.color2, f_col.color3, f_col.color4] - for j, v in enumerate(f.verts): + for j, v in enumerate(f.vertices): col = f_col[j] - tone = vert_tone[me.verts[v].index] + tone = vert_tone[me.vertices[v].index] tone = (tone - min_tone) / tone_range if dirt_only: @@ -146,7 +151,7 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean, class VertexPaintDirt(bpy.types.Operator): - bl_idname = "mesh.vertex_paint_dirt" + bl_idname = "paint.vertex_color_dirt" bl_label = "Dirty Vertex Colors" bl_options = {'REGISTER', 'UNDO'} @@ -171,15 +176,15 @@ class VertexPaintDirt(bpy.types.Operator): print('Dirt calculated in %.6f' % (time.time() - t)) - return('FINISHED',) + return {'FINISHED'} def register(): - bpy.types.register(VertexPaintDirt) + pass def unregister(): - bpy.types.unregister(VertexPaintDirt) + pass if __name__ == "__main__": register() diff --git a/release/scripts/op/wm.py b/release/scripts/op/wm.py index 5893a9cf472..cc35a0ab3dd 100644 --- a/release/scripts/op/wm.py +++ b/release/scripts/op/wm.py @@ -16,16 +16,15 @@ # # ##### END GPL LICENSE BLOCK ##### -# <pep8-80 compliant> +# <pep8 compliant> import bpy from bpy.props import * - +from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear class MESH_OT_delete_edgeloop(bpy.types.Operator): - '''Export a single object as a stanford PLY with normals, - colours and texture coordinates.''' + '''Delete an edge loop by merging the faces on each side to a single face loop''' bl_idname = "mesh.delete_edgeloop" bl_label = "Delete Edge Loop" @@ -47,10 +46,10 @@ rna_relative_prop = BoolProperty(name="Relative", default=False) -def context_path_validate(context, path): +def context_path_validate(context, data_path): import sys try: - value = eval("context.%s" % path) + value = eval("context.%s" % data_path) except AttributeError: if "'NoneType'" in str(sys.exc_info()[1]): # One of the items in the rna path is None, just ignore this @@ -63,13 +62,13 @@ def context_path_validate(context, path): def execute_context_assign(self, context): - if context_path_validate(context, self.properties.path) is Ellipsis: + if context_path_validate(context, self.properties.data_path) is Ellipsis: return {'PASS_THROUGH'} if getattr(self.properties, "relative", False): - exec("context.%s+=self.properties.value" % self.properties.path) + exec("context.%s+=self.properties.value" % self.properties.data_path) else: - exec("context.%s=self.properties.value" % self.properties.path) + exec("context.%s=self.properties.value" % self.properties.data_path) return {'FINISHED'} @@ -80,7 +79,7 @@ class WM_OT_context_set_boolean(bpy.types.Operator): bl_label = "Context Set Boolean" bl_options = {'UNDO'} - path = rna_path_prop + data_path = rna_path_prop value = BoolProperty(name="Value", description="Assignment value", default=True) @@ -93,7 +92,7 @@ class WM_OT_context_set_int(bpy.types.Operator): # same as enum bl_label = "Context Set" bl_options = {'UNDO'} - path = rna_path_prop + data_path = rna_path_prop value = IntProperty(name="Value", description="Assign value", default=0) relative = rna_relative_prop @@ -106,18 +105,18 @@ class WM_OT_context_scale_int(bpy.types.Operator): # same as enum bl_label = "Context Set" bl_options = {'UNDO'} - path = rna_path_prop + data_path = rna_path_prop value = FloatProperty(name="Value", description="Assign value", default=1.0) always_step = BoolProperty(name="Always Step", description="Always adjust the value by a minimum of 1 when 'value' is not 1.0.", default=True) def execute(self, context): - if context_path_validate(context, self.properties.path) is Ellipsis: + if context_path_validate(context, self.properties.data_path) is Ellipsis: return {'PASS_THROUGH'} value = self.properties.value - path = self.properties.path + data_path = self.properties.data_path if value == 1.0: # nothing to do return {'CANCELLED'} @@ -129,9 +128,9 @@ class WM_OT_context_scale_int(bpy.types.Operator): # same as enum else: add = "-1" func = "min" - exec("context.%s = %s(round(context.%s * value), context.%s + %s)" % (path, func, path, path, add)) + exec("context.%s = %s(round(context.%s * value), context.%s + %s)" % (data_path, func, data_path, data_path, add)) else: - exec("context.%s *= value" % self.properties.path) + exec("context.%s *= value" % self.properties.data_path) return {'FINISHED'} @@ -142,7 +141,7 @@ class WM_OT_context_set_float(bpy.types.Operator): # same as enum bl_label = "Context Set Float" bl_options = {'UNDO'} - path = rna_path_prop + data_path = rna_path_prop value = FloatProperty(name="Value", description="Assignment value", default=0.0) relative = rna_relative_prop @@ -156,7 +155,7 @@ class WM_OT_context_set_string(bpy.types.Operator): # same as enum bl_label = "Context Set String" bl_options = {'UNDO'} - path = rna_path_prop + data_path = rna_path_prop value = StringProperty(name="Value", description="Assign value", maxlen=1024, default="") @@ -169,7 +168,7 @@ class WM_OT_context_set_enum(bpy.types.Operator): bl_label = "Context Set Enum" bl_options = {'UNDO'} - path = rna_path_prop + data_path = rna_path_prop value = StringProperty(name="Value", description="Assignment value (as a string)", maxlen=1024, default="") @@ -183,15 +182,15 @@ class WM_OT_context_set_value(bpy.types.Operator): bl_label = "Context Set Value" bl_options = {'UNDO'} - path = rna_path_prop + data_path = rna_path_prop value = StringProperty(name="Value", description="Assignment value (as a string)", maxlen=1024, default="") def execute(self, context): - if context_path_validate(context, self.properties.path) is Ellipsis: + if context_path_validate(context, self.properties.data_path) is Ellipsis: return {'PASS_THROUGH'} - exec("context.%s=%s" % (self.properties.path, self.properties.value)) + exec("context.%s=%s" % (self.properties.data_path, self.properties.value)) return {'FINISHED'} @@ -201,15 +200,15 @@ class WM_OT_context_toggle(bpy.types.Operator): bl_label = "Context Toggle" bl_options = {'UNDO'} - path = rna_path_prop + data_path = rna_path_prop def execute(self, context): - if context_path_validate(context, self.properties.path) is Ellipsis: + if context_path_validate(context, self.properties.data_path) is Ellipsis: return {'PASS_THROUGH'} exec("context.%s=not (context.%s)" % - (self.properties.path, self.properties.path)) + (self.properties.data_path, self.properties.data_path)) return {'FINISHED'} @@ -220,7 +219,7 @@ class WM_OT_context_toggle_enum(bpy.types.Operator): bl_label = "Context Toggle Values" bl_options = {'UNDO'} - path = rna_path_prop + data_path = rna_path_prop value_1 = StringProperty(name="Value", \ description="Toggle enum", maxlen=1024, default="") @@ -229,12 +228,12 @@ class WM_OT_context_toggle_enum(bpy.types.Operator): def execute(self, context): - if context_path_validate(context, self.properties.path) is Ellipsis: + if context_path_validate(context, self.properties.data_path) is Ellipsis: return {'PASS_THROUGH'} exec("context.%s = ['%s', '%s'][context.%s!='%s']" % \ - (self.properties.path, self.properties.value_1,\ - self.properties.value_2, self.properties.path, + (self.properties.data_path, self.properties.value_1,\ + self.properties.value_2, self.properties.data_path, self.properties.value_2)) return {'FINISHED'} @@ -247,12 +246,12 @@ class WM_OT_context_cycle_int(bpy.types.Operator): bl_label = "Context Int Cycle" bl_options = {'UNDO'} - path = rna_path_prop + data_path = rna_path_prop reverse = rna_reverse_prop def execute(self, context): - path = self.properties.path - value = context_path_validate(context, path) + data_path = self.properties.data_path + value = context_path_validate(context, data_path) if value is Ellipsis: return {'PASS_THROUGH'} @@ -261,16 +260,16 @@ class WM_OT_context_cycle_int(bpy.types.Operator): else: value += 1 - exec("context.%s=value" % path) + exec("context.%s=value" % data_path) - if value != eval("context.%s" % path): + if value != eval("context.%s" % data_path): # relies on rna clamping int's out of the range if self.properties.reverse: value = (1 << 32) else: value = - (1 << 32) - exec("context.%s=value" % path) + exec("context.%s=value" % data_path) return {'FINISHED'} @@ -281,19 +280,19 @@ class WM_OT_context_cycle_enum(bpy.types.Operator): bl_label = "Context Enum Cycle" bl_options = {'UNDO'} - path = rna_path_prop + data_path = rna_path_prop reverse = rna_reverse_prop def execute(self, context): - value = context_path_validate(context, self.properties.path) + value = context_path_validate(context, self.properties.data_path) if value is Ellipsis: return {'PASS_THROUGH'} orig_value = value # Have to get rna enum values - rna_struct_str, rna_prop_str = self.properties.path.rsplit('.', 1) + rna_struct_str, rna_prop_str = self.properties.data_path.rsplit('.', 1) i = rna_prop_str.find('[') # just incse we get "context.foo.bar[0]" @@ -323,9 +322,45 @@ class WM_OT_context_cycle_enum(bpy.types.Operator): advance_enum = enums[orig_index + 1] # set the new value - exec("context.%s=advance_enum" % self.properties.path) + exec("context.%s=advance_enum" % self.properties.data_path) + return {'FINISHED'} + + +class WM_OT_context_set_id(bpy.types.Operator): + '''Toggle a context value.''' + bl_idname = "wm.context_set_id" + bl_label = "Set Library ID" + bl_options = {'UNDO'} + + data_path = rna_path_prop + value = StringProperty(name="Value", + description="Assign value", maxlen=1024, default="") + + def execute(self, context): + value = self.properties.value + data_path = self.properties.data_path + + # match the pointer type from the target property to bpy.data.* + # so we lookup the correct list. + data_path_base, data_path_prop = data_path.rsplit(".", 1) + data_prop_rna = eval("context.%s" % data_path_base).rna_type.properties[data_path_prop] + data_prop_rna_type = data_prop_rna.fixed_type + + id_iter = None + + for prop in bpy.data.rna_type.properties: + if prop.rna_type.identifier == "CollectionProperty": + if prop.fixed_type == data_prop_rna_type: + id_iter = prop.identifier + break + + if id_iter: + value_id = getattr(bpy.data, id_iter).get(value) + exec("context.%s=value_id" % data_path) + return {'FINISHED'} + doc_id = StringProperty(name="Doc ID", description="", maxlen=1024, default="", options={'HIDDEN'}) @@ -338,27 +373,27 @@ class WM_OT_context_modal_mouse(bpy.types.Operator): bl_idname = "wm.context_modal_mouse" bl_label = "Context Modal Mouse" - path_iter = StringProperty(description="The path relative to the context, must point to an iterable.") - path_item = StringProperty(description="The path from each iterable to the value (int or float)") + data_path_iter = StringProperty(description="The data path relative to the context, must point to an iterable.") + data_path_item = StringProperty(description="The data path from each iterable to the value (int or float)") input_scale = FloatProperty(default=0.01, description="Scale the mouse movement by this value before applying the delta") invert = BoolProperty(default=False, description="Invert the mouse input") initial_x = IntProperty(options={'HIDDEN'}) def _values_store(self, context): - path_iter = self.properties.path_iter - path_item = self.properties.path_item + data_path_iter = self.properties.data_path_iter + data_path_item = self.properties.data_path_item self._values = values = {} - for item in getattr(context, path_iter): + for item in getattr(context, data_path_iter): try: - value_orig = eval("item." + path_item) + value_orig = eval("item." + data_path_item) except: continue # check this can be set, maybe this is library data. try: - exec("item.%s = %s" % (path_item, value_orig)) + exec("item.%s = %s" % (data_path_item, value_orig)) except: continue @@ -369,17 +404,17 @@ class WM_OT_context_modal_mouse(bpy.types.Operator): if self.properties.invert: delta = - delta - path_item = self.properties.path_item + data_path_item = self.properties.data_path_item for item, value_orig in self._values.items(): if type(value_orig) == int: - exec("item.%s = int(%d)" % (path_item, round(value_orig + delta))) + exec("item.%s = int(%d)" % (data_path_item, round(value_orig + delta))) else: - exec("item.%s = %f" % (path_item, value_orig + delta)) + exec("item.%s = %f" % (data_path_item, value_orig + delta)) def _values_restore(self): - path_item = self.properties.path_item + data_path_item = self.properties.data_path_item for item, value_orig in self._values.items(): - exec("item.%s = %s" % (path_item, value_orig)) + exec("item.%s = %s" % (data_path_item, value_orig)) self._values.clear() @@ -408,7 +443,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator): if not self._values: self.report({'WARNING'}, "Nothing to operate on: %s[ ].%s" % - (self.properties.path_iter, self.properties.path_item)) + (self.properties.data_path_iter, self.properties.data_path_item)) return {'CANCELLED'} else: @@ -419,7 +454,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator): class WM_OT_url_open(bpy.types.Operator): - "Open the Blender Wiki in the Webbrowser" + "Open a website in the Webbrowser" bl_idname = "wm.url_open" bl_label = "" @@ -431,6 +466,39 @@ class WM_OT_url_open(bpy.types.Operator): return {'FINISHED'} +class WM_OT_path_open(bpy.types.Operator): + "Open a path in a file browser" + bl_idname = "wm.path_open" + bl_label = "" + + filepath = StringProperty(name="File Path", maxlen=1024) + + def execute(self, context): + import sys + import os + import subprocess + + filepath = bpy.path.abspath(self.properties.filepath) + filepath = os.path.normpath(filepath) + + if not os.path.exists(filepath): + self.report({'ERROR'}, "File '%s' not found" % filepath) + return {'CANCELLED'} + + if sys.platform == 'win32': + subprocess.Popen(['start', filepath], shell=True) + elif sys.platform == 'darwin': + subprocess.Popen(['open', filepath]) + else: + try: + subprocess.Popen(['xdg-open', filepath]) + except OSError: + # xdg-open *should* be supported by recent Gnome, KDE, Xfce + pass + + return {'FINISHED'} + + class WM_OT_doc_view(bpy.types.Operator): '''Load online reference docs''' bl_idname = "wm.doc_view" @@ -544,58 +612,139 @@ class WM_OT_doc_edit(bpy.types.Operator): return wm.invoke_props_dialog(self, width=600) -class WM_OT_reload_scripts(bpy.types.Operator): - '''Load online reference docs''' - bl_idname = "wm.reload_scripts" - bl_label = "Reload Scripts" +from bpy.props import * + + +rna_path = StringProperty(name="Property Edit", + description="Property data_path edit", maxlen=1024, default="", options={'HIDDEN'}) + +rna_value = StringProperty(name="Property Value", + description="Property value edit", maxlen=1024, default="") + +rna_property = StringProperty(name="Property Name", + description="Property name edit", maxlen=1024, default="") + +rna_min = FloatProperty(name="Min", default=0.0, precision=3) +rna_max = FloatProperty(name="Max", default=1.0, precision=3) + + +class WM_OT_properties_edit(bpy.types.Operator): + '''Internal use (edit a property data_path)''' + bl_idname = "wm.properties_edit" + bl_label = "Edit Property" + + data_path = rna_path + property = rna_property + value = rna_value + min = rna_min + max = rna_max + description = StringProperty(name="Tip", default="") def execute(self, context): - MOD = type(bpy) - bpy.utils.load_scripts(True) + data_path = self.properties.data_path + value = self.properties.value + prop = self.properties.property + prop_old = self._last_prop[0] + + try: + value_eval = eval(value) + except: + value_eval = value + + # First remove + item = eval("context.%s" % data_path) + + rna_idprop_ui_prop_clear(item, prop_old) + exec_str = "del item['%s']" % prop_old + # print(exec_str) + exec(exec_str) + + + # Reassign + exec_str = "item['%s'] = %s" % (prop, repr(value_eval)) + # print(exec_str) + exec(exec_str) + self._last_prop[:] = [prop] + + prop_type = type(item[prop]) + + prop_ui = rna_idprop_ui_prop_get(item, prop) + + if prop_type in (float, int): + + prop_ui['soft_min'] = prop_ui['min'] = prop_type(self.properties.min) + prop_ui['soft_max'] = prop_ui['max'] = prop_type(self.properties.max) + + prop_ui['description'] = self.properties.description + return {'FINISHED'} + def invoke(self, context, event): -import rna_prop_ui + self._last_prop = [self.properties.property] -classes = [ - MESH_OT_delete_edgeloop, + item = eval("context.%s" % self.properties.data_path) - WM_OT_context_set_boolean, - WM_OT_context_set_int, - WM_OT_context_scale_int, - WM_OT_context_set_float, - WM_OT_context_set_string, - WM_OT_context_set_enum, - WM_OT_context_set_value, - WM_OT_context_toggle, - WM_OT_context_toggle_enum, - WM_OT_context_cycle_enum, - WM_OT_context_cycle_int, - WM_OT_context_modal_mouse, + # setup defaults + prop_ui = rna_idprop_ui_prop_get(item, self.properties.property, False) # dont create + if prop_ui: + self.properties.min = prop_ui.get("min", -1000000000) + self.properties.max = prop_ui.get("max", 1000000000) + self.properties.description = prop_ui.get("description", "") - WM_OT_url_open, + wm = context.manager + # This crashes, TODO - fix + #return wm.invoke_props_popup(self, event) + + wm.invoke_props_popup(self, event) + return {'RUNNING_MODAL'} - WM_OT_doc_view, - WM_OT_doc_edit, - WM_OT_reload_scripts, +class WM_OT_properties_add(bpy.types.Operator): + '''Internal use (edit a property data_path)''' + bl_idname = "wm.properties_add" + bl_label = "Add Property" + + data_path = rna_path + + def execute(self, context): + item = eval("context.%s" % self.properties.data_path) + + def unique_name(names): + prop = 'prop' + prop_new = prop + i = 1 + while prop_new in names: + prop_new = prop + str(i) + i += 1 - # experemental! - rna_prop_ui.WM_OT_properties_edit, - rna_prop_ui.WM_OT_properties_add, - rna_prop_ui.WM_OT_properties_remove] + return prop_new + property = unique_name(item.keys()) + + item[property] = 1.0 + return {'FINISHED'} + + +class WM_OT_properties_remove(bpy.types.Operator): + '''Internal use (edit a property data_path)''' + bl_idname = "wm.properties_remove" + bl_label = "Remove Property" + + data_path = rna_path + property = rna_property + + def execute(self, context): + item = eval("context.%s" % self.properties.data_path) + del item[self.properties.property] + return {'FINISHED'} def register(): - register = bpy.types.register - for cls in classes: - register(cls) + pass def unregister(): - unregister = bpy.types.unregister - for cls in classes: - unregister(cls) + pass if __name__ == "__main__": register() |