summaryrefslogtreecommitdiff
path: root/bck_import.py
diff options
context:
space:
mode:
authorOwl <isaclien9752@gmail.com>2025-08-23 12:37:51 -0400
committerOwl <isaclien9752@gmail.com>2025-08-23 12:37:51 -0400
commit0ab9e972cb4a4128c2041f6da580a72515b3db64 (patch)
tree1a79d85db13b9714af806b54358fda15aca2ddae /bck_import.py
parenta5bdfdab2ec68ebfe99535a54b3b0cd8b95a87d6 (diff)
downloadblenxy-0ab9e972cb4a4128c2041f6da580a72515b3db64.tar.gz
blenxy-0ab9e972cb4a4128c2041f6da580a72515b3db64.zip
Some changes to the BCK exporter
Diffstat (limited to 'bck_import.py')
-rw-r--r--bck_import.py35
1 files changed, 12 insertions, 23 deletions
diff --git a/bck_import.py b/bck_import.py
index add03b1..eb1502c 100644
--- a/bck_import.py
+++ b/bck_import.py
@@ -324,18 +324,14 @@ def import_bck_func(context, filepath, import_type, angle_limit):
fcurves[8] = action.fcurves.new(data_path, 2, data_bone.name)
# for any other frame
- else:
-
+ else:
# check if the bone has more frames to animate in the 9 components
- for k in range(9):
-
+ for k in range(9):
# interpolation result
- result = 0
-
+ result = 0
# 1 keyframe animations are skipped
if (bone_anim.comp[k].kf_count == 1):
- continue
-
+ continue
# iterate over the keyframes on the component
for l in range(bone_anim.comp[k].kf_count):
# frame is exactly the last keyframe of the component
@@ -360,8 +356,7 @@ def import_bck_func(context, filepath, import_type, angle_limit):
result = None
break
- # ~ print("interpolation result: %s" % (result))
-
+ # ~ print("interpolation result: %s" % (result))
# assign to the respective component
if (result != None):
if (k == 0 or k == 3 or k == 6): # scale
@@ -420,7 +415,7 @@ def import_bck_func(context, filepath, import_type, angle_limit):
is_transl_anim = False
# remove the fcurve keyframe points that are constant (some cleanup by yours truly)
- # don't want to use blender's built-in action.clean() method cuz it resets the bezier keyframe handles
+ # don't want to use blender's built-in action.clean() method cuz it resets the bezier handles
for fcurve in action.fcurves:
if (len(fcurve.keyframe_points) == 1): # nothing to clean (are you sure about that?)
continue
@@ -446,11 +441,9 @@ def import_bck_func(context, filepath, import_type, angle_limit):
# now, if this has not been hard enough...
# find the "best" interpolator fits to be able to simplify the keyframe count
- if (import_type == "OPT_C"):
-
+ if (import_type == "OPT_C"):
# lets start
- for fcurve in action.fcurves:
-
+ for fcurve in action.fcurves:
# skip 1 frame animations
if (len(fcurve.keyframe_points) == 1):
continue
@@ -497,8 +490,7 @@ def import_bck_func(context, filepath, import_type, angle_limit):
kf_point.handle_right = right
# return to object mode
- bpy.ops.object.mode_set(mode = "OBJECT")
-
+ bpy.ops.object.mode_set(mode = "OBJECT")
# store the loop mode in a custom property of the armature object
if ("loop_mode" in armature.data):
# check if nothing touched the type of this property
@@ -508,8 +500,7 @@ def import_bck_func(context, filepath, import_type, angle_limit):
else:
armature.data["loop_mode"][file_ops.get_file_name(filepath)] = anim.loop_mode
else:
- armature.data["loop_mode"] = {file_ops.get_file_name(filepath) : anim.loop_mode}
-
+ armature.data["loop_mode"] = {file_ops.get_file_name(filepath) : anim.loop_mode}
# display some message
blender_funcs.disp_msg("Animation file \"%s\" imported." % (file_ops.get_file_name(filepath)))
# done!
@@ -532,11 +523,9 @@ class import_bck(Operator, ExportHelper):
filename_ext = ".bck"
filter_glob = StringProperty(default = "*.bck",
options = {"HIDDEN"},
- maxlen = 255)
+ maxlen = 255)
# importer options
-
- # import mode
import_type = EnumProperty(
name = "Import Mode",
description = "Way in which the animation will be imported",
@@ -570,6 +559,6 @@ bpy.utils.register_class(import_bck)
bpy.types.INFO_MT_file_import.append(menu_import_bck)
# test call
-bpy.ops.import_scene.bck('INVOKE_DEFAULT')
+bpy.ops.import_scene.bck("INVOKE_DEFAULT")