diff options
Diffstat (limited to 'release/scripts/modules')
-rw-r--r-- | release/scripts/modules/animsys_refactor.py | 40 | ||||
-rw-r--r-- | release/scripts/modules/bpy/__init__.py | 2 | ||||
-rw-r--r-- | release/scripts/modules/rigify/__init__.py | 2 | ||||
-rw-r--r-- | release/scripts/modules/rigify/arm_biped.py | 2 | ||||
-rw-r--r-- | release/scripts/modules/rigify/eye_balls.py | 4 | ||||
-rw-r--r-- | release/scripts/modules/rigify/eye_lid.py | 40 | ||||
-rw-r--r-- | release/scripts/modules/rigify/leg_biped.py | 10 | ||||
-rw-r--r-- | release/scripts/modules/rigify/leg_quadruped.py | 2 | ||||
-rw-r--r-- | release/scripts/modules/rigify/mouth.py | 34 | ||||
-rw-r--r-- | release/scripts/modules/rigify/stretch.py | 2 | ||||
-rw-r--r-- | release/scripts/modules/rigify/stretch_twist.py | 4 | ||||
-rw-r--r-- | release/scripts/modules/rigify_utils.py | 2 |
12 files changed, 81 insertions, 63 deletions
diff --git a/release/scripts/modules/animsys_refactor.py b/release/scripts/modules/animsys_refactor.py index 3959904e0c5..8cc91873b0e 100644 --- a/release/scripts/modules/animsys_refactor.py +++ b/release/scripts/modules/animsys_refactor.py @@ -42,7 +42,7 @@ class DataPathBuilder(object): str_value = '["%s"]' % key return DataPathBuilder(self.data_path + (str_value, )) - def resolve(self, real_base): + def resolve(self, real_base, rna_update_from_map=None): """ Return (attribute, value) pairs. """ pairs = [] @@ -50,10 +50,24 @@ class DataPathBuilder(object): for item in self.data_path: if base is not Ellipsis: try: + # this only works when running with an old blender + # where the old path will resolve base = eval("base" + item) except: - print("Failed to resolve data path:", self.data_path) - base = Ellipsis + base_new = Ellipsis + # guess the new name + if item.startswith("."): + for item_new in rna_update_from_map.get(item[1:], ()): + try: + print("base." + item_new) + base_new = eval("base." + item_new) + break # found, dont keep looking + except: + pass + + if base_new is Ellipsis: + print("Failed to resolve data path:", self.data_path) + base = base_new pairs.append((item, base)) return pairs @@ -96,14 +110,14 @@ def classes_recursive(base_type, clss=None): return clss -def find_path_new(id_data, data_path, rna_update_dict): +def find_path_new(id_data, data_path, rna_update_dict, rna_update_from_map): # ignore ID props for now if data_path.startswith("["): return data_path # recursive path fixing, likely will be one in most cases. data_path_builder = eval("DataPathBuilder(tuple())." + data_path) - data_resolve = data_path_builder.resolve(id_data) + data_resolve = data_path_builder.resolve(id_data, rna_update_from_map) path_new = [pair[0] for pair in data_resolve] @@ -136,6 +150,10 @@ def update_data_paths(rna_update): rna_update_dict = {} for ren_class, ren_from, ren_to in rna_update: rna_update_dict.setdefault(ren_class, {})[ren_from] = ren_to + + rna_update_from_map = {} + for ren_class, ren_from, ren_to in rna_update: + rna_update_from_map.setdefault(ren_from, []).append(ren_to) for id_data in id_iter(): anim_data = getattr(id_data, "animation_data", None) @@ -150,7 +168,7 @@ def update_data_paths(rna_update): data_path = tar.data_path if id_data_other and data_path: - data_path_new = find_path_new(id_data_other, data_path, rna_update_dict) + data_path_new = find_path_new(id_data_other, data_path, rna_update_dict, rna_update_from_map) # print(data_path_new) if data_path_new != data_path: if not IS_TESTING: @@ -162,22 +180,22 @@ def update_data_paths(rna_update): for action in anim_data_actions(anim_data): for fcu in action.fcurves: data_path = fcu.data_path - data_path_new = find_path_new(id_data, data_path, rna_update_dict) + data_path_new = find_path_new(id_data, data_path, rna_update_dict, rna_update_from_map) # print(data_path_new) if data_path_new != data_path: if not IS_TESTING: fcu.data_path = data_path_new print("fcurve (%s): %s -> %s" % (id_data.name, data_path, data_path_new)) - + if __name__ == "__main__": # Example, should be called externally # (class, from, to) replace_ls = [ - ('AnimVizMotionPaths', 'after_current', 'frame_after'), - ('AnimVizMotionPaths', 'before_current', 'frame_before'), - ('AnimVizOnionSkinning', 'after_current', 'frame_after'), + ('AnimVizMotionPaths', 'frame_after', 'frame_after'), + ('AnimVizMotionPaths', 'frame_before', 'frame_before'), + ('AnimVizOnionSkinning', 'frame_after', 'frame_after'), ] update_data_paths(replace_ls) diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py index 3431054413e..5b7d5a76336 100644 --- a/release/scripts/modules/bpy/__init__.py +++ b/release/scripts/modules/bpy/__init__.py @@ -48,7 +48,7 @@ def _main(): import pydoc pydoc.getpager = lambda: pydoc.plainpager pydoc.Helper.getline = lambda self, prompt: None - pydoc.TextDoc.bold = lambda self, text: text + pydoc.TextDoc.use_bold = lambda self, text: text # if "-d" in sys.argv: # Enable this to measure startup speed diff --git a/release/scripts/modules/rigify/__init__.py b/release/scripts/modules/rigify/__init__.py index 2eed5bbb74e..98d9bb235a2 100644 --- a/release/scripts/modules/rigify/__init__.py +++ b/release/scripts/modules/rigify/__init__.py @@ -548,7 +548,7 @@ def generate_test_all(context, GRAPH=False): i = 0 for obj, obj_new in new_objects: - obj.data.drawtype = 'STICK' + obj.data.draw_type = 'STICK' obj.location[1] += i obj_new.location[1] += i obj_new.select = False diff --git a/release/scripts/modules/rigify/arm_biped.py b/release/scripts/modules/rigify/arm_biped.py index ec36210e61d..ac878c3c076 100644 --- a/release/scripts/modules/rigify/arm_biped.py +++ b/release/scripts/modules/rigify/arm_biped.py @@ -161,7 +161,7 @@ def ik(obj, definitions, base_names, options): con.use_stretch = True con.use_target = True con.use_rotation = False - con.chain_length = 2 + con.chain_count = 2 con.pole_angle = -pi/2 # last step setup layers diff --git a/release/scripts/modules/rigify/eye_balls.py b/release/scripts/modules/rigify/eye_balls.py index b1889d7c36f..f65d56b9f2b 100644 --- a/release/scripts/modules/rigify/eye_balls.py +++ b/release/scripts/modules/rigify/eye_balls.py @@ -328,8 +328,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'SCALE_X' con.frame_start = -20 con.frame_end = 20 - con.minimum = 0.0 - con.maximum = 2.0 + con.min = 0.0 + con.max = 2.0 con.target_space = 'LOCAL' diff --git a/release/scripts/modules/rigify/eye_lid.py b/release/scripts/modules/rigify/eye_lid.py index 2d7e3e0e61f..3f336e268c6 100644 --- a/release/scripts/modules/rigify/eye_lid.py +++ b/release/scripts/modules/rigify/eye_lid.py @@ -436,8 +436,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'LOCATION_Y' con.frame_start = -30 con.frame_end = 30 - con.minimum = -distance*2 - con.maximum = distance + con.min = -distance*2 + con.max = distance con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -455,8 +455,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'LOCATION_Y' con.frame_start = -30 con.frame_end = 30 - con.minimum = -distance*2 - con.maximum = distance + con.min = -distance*2 + con.max = distance con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -473,8 +473,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'LOCATION_Y' con.frame_start = -30 con.frame_end = 30 - con.minimum = -distance*2 - con.maximum = distance + con.min = -distance*2 + con.max = distance con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -491,8 +491,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'LOCATION_Y' con.frame_start = -30 con.frame_end = 30 - con.minimum = -distance*2 - con.maximum = distance + con.min = -distance*2 + con.max = distance con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -509,8 +509,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'LOCATION_Y' con.frame_start = -30 con.frame_end = 30 - con.minimum = -distance*2 - con.maximum = distance + con.min = -distance*2 + con.max = distance con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -528,8 +528,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'LOCATION_Y' con.frame_start = -30 con.frame_end = 30 - con.minimum = -distance - con.maximum = distance*2 + con.min = -distance + con.max = distance*2 con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -546,8 +546,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'LOCATION_Y' con.frame_start = -30 con.frame_end = 30 - con.minimum = -distance - con.maximum = distance*2 + con.min = -distance + con.max = distance*2 con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -564,8 +564,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'LOCATION_Y' con.frame_start = -30 con.frame_end = 30 - con.minimum = -distance - con.maximum = distance*2 + con.min = -distance + con.max = distance*2 con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -582,8 +582,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'LOCATION_Y' con.frame_start = -30 con.frame_end = 30 - con.minimum = -distance - con.maximum = distance*2 + con.min = -distance + con.max = distance*2 con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -600,8 +600,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'LOCATION_Y' con.frame_start = -30 con.frame_end = 30 - con.minimum = -distance - con.maximum = distance*2 + con.min = -distance + con.max = distance*2 con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver diff --git a/release/scripts/modules/rigify/leg_biped.py b/release/scripts/modules/rigify/leg_biped.py index 2ea70402d36..d2ddba9f549 100644 --- a/release/scripts/modules/rigify/leg_biped.py +++ b/release/scripts/modules/rigify/leg_biped.py @@ -225,7 +225,7 @@ def ik(obj, bone_definition, base_names, options): # IK con = ik_chain.shin_p.constraints.new('IK') - con.chain_length = 2 + con.chain_count = 2 con.iterations = 500 con.pole_angle = -pi / 2.0 con.use_tail = True @@ -256,11 +256,11 @@ def ik(obj, bone_definition, base_names, options): con.owner_space = 'LOCAL' if con_l is cons[-1][-1]: - con.minimum_x = 0.0 - con.maximum_x = 180.0 # XXX -deg + con.min_x = 0.0 + con.max_x = 180.0 # XXX -deg else: - con.minimum_x = -180.0 # XXX -deg - con.maximum_x = 0.0 + con.min_x = -180.0 # XXX -deg + con.max_x = 0.0 # last step setup layers diff --git a/release/scripts/modules/rigify/leg_quadruped.py b/release/scripts/modules/rigify/leg_quadruped.py index 640e1766ca6..739a6402c4b 100644 --- a/release/scripts/modules/rigify/leg_quadruped.py +++ b/release/scripts/modules/rigify/leg_quadruped.py @@ -268,7 +268,7 @@ def ik(obj, bone_definition, base_names, options): # IK con = ik_chain.shin_p.constraints.new('IK') - con.chain_length = 2 + con.chain_count = 2 con.iterations = 500 con.pole_angle = -90.0 # XXX - in deg! con.use_tail = True diff --git a/release/scripts/modules/rigify/mouth.py b/release/scripts/modules/rigify/mouth.py index fff58861e02..ce232b91e7b 100644 --- a/release/scripts/modules/rigify/mouth.py +++ b/release/scripts/modules/rigify/mouth.py @@ -458,7 +458,7 @@ def control(obj, definitions, base_names, options): con.target = obj con.subtarget = jaw con.head_tail = 1.0 - con.original_length = bb[jopent].length + con.rest_length = bb[jopent].length con.volume = 'NO_VOLUME' # Head lips to jaw lips @@ -545,8 +545,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'SCALE_Y' con.frame_start = 0 con.frame_end = 60 - con.minimum = 0.0 - con.maximum = 1.0 + con.min = 0.0 + con.max = 1.0 con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -563,8 +563,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'SCALE_Y' con.frame_start = 0 con.frame_end = 60 - con.minimum = 0.0 - con.maximum = 1.0 + con.min = 0.0 + con.max = 1.0 con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -581,8 +581,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'SCALE_Y' con.frame_start = 0 con.frame_end = 60 - con.minimum = 0.0 - con.maximum = 1.0 + con.min = 0.0 + con.max = 1.0 con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -599,8 +599,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'SCALE_Y' con.frame_start = 0 con.frame_end = 60 - con.minimum = 0.0 - con.maximum = 1.0 + con.min = 0.0 + con.max = 1.0 con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -617,8 +617,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'SCALE_Y' con.frame_start = 0 con.frame_end = 60 - con.minimum = 0.0 - con.maximum = 1.0 + con.min = 0.0 + con.max = 1.0 con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -635,8 +635,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'SCALE_Y' con.frame_start = 0 con.frame_end = 60 - con.minimum = 0.0 - con.maximum = 1.0 + con.min = 0.0 + con.max = 1.0 con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -653,8 +653,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'SCALE_Y' con.frame_start = 0 con.frame_end = 60 - con.minimum = 0.0 - con.maximum = 1.0 + con.min = 0.0 + con.max = 1.0 con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver @@ -671,8 +671,8 @@ def control(obj, definitions, base_names, options): con.transform_channel = 'SCALE_Y' con.frame_start = 0 con.frame_end = 60 - con.minimum = 0.0 - con.maximum = 1.0 + con.min = 0.0 + con.max = 1.0 con.target_space = 'LOCAL' fcurve = con.driver_add("influence") driver = fcurve.driver diff --git a/release/scripts/modules/rigify/stretch.py b/release/scripts/modules/rigify/stretch.py index 67ceeb39954..6a498e5aa29 100644 --- a/release/scripts/modules/rigify/stretch.py +++ b/release/scripts/modules/rigify/stretch.py @@ -100,7 +100,7 @@ def main(obj, bone_definition, base_names, options): con = pb[bone].constraints.new('STRETCH_TO') con.target = obj con.subtarget = mbone2 - con.original_length = bb[bone].length + con.rest_length = bb[bone].length if preserve_volume: con.volume = 'VOLUME_XZX' else: diff --git a/release/scripts/modules/rigify/stretch_twist.py b/release/scripts/modules/rigify/stretch_twist.py index 5250c5a9735..07ce031967f 100644 --- a/release/scripts/modules/rigify/stretch_twist.py +++ b/release/scripts/modules/rigify/stretch_twist.py @@ -128,7 +128,7 @@ def main(obj, bone_definition, base_names, options): con = pb[bone1].constraints.new('STRETCH_TO') con.target = obj con.subtarget = mid_bone - con.original_length = bb[bone1].length + con.rest_length = bb[bone1].length if preserve_volume: con.volume = 'VOLUME_XZX' else: @@ -142,7 +142,7 @@ def main(obj, bone_definition, base_names, options): con = pb[bone2].constraints.new('STRETCH_TO') con.target = obj con.subtarget = mid_bone - con.original_length = bb[bone2].length + con.rest_length = bb[bone2].length if preserve_volume: con.volume = 'VOLUME_XZX' else: diff --git a/release/scripts/modules/rigify_utils.py b/release/scripts/modules/rigify_utils.py index 39481b37f59..a270af949da 100644 --- a/release/scripts/modules/rigify_utils.py +++ b/release/scripts/modules/rigify_utils.py @@ -67,7 +67,7 @@ def add_stretch_to(obj, from_name, to_name, name): con = stretch_pbone.constraints.new('STRETCH_TO') con.target = obj con.subtarget = to_name - con.original_length = (head - tail).length + con.rest_length = (head - tail).length con.keep_axis = 'PLANE_X' con.volume = 'NO_VOLUME' |