diff --git a/BlenderAssist/main.cpp b/BlenderAssist/main.cpp index ca9a70c..ff763b5 100644 --- a/BlenderAssist/main.cpp +++ b/BlenderAssist/main.cpp @@ -64,6 +64,7 @@ int main(int argc, const char** argv) { hkStringBuf anim_in; // original animation hkStringBuf anim_out; // pap animation out hkStringBuf check_if_bound; + hkStringBuf compress_anim; anim_idx = convert_from_wstring(nargv[2]).c_str(); bin_in = convert_from_wstring(nargv[3]).c_str(); @@ -71,8 +72,9 @@ int main(int argc, const char** argv) { anim_in = convert_from_wstring(nargv[5]).c_str(); anim_out = convert_from_wstring(nargv[6]).c_str(); check_if_bound = convert_from_wstring(nargv[7]).c_str(); + compress_anim = convert_from_wstring(nargv[8]).c_str(); - return pack_anim(anim_idx, bin_in, skl_in, anim_in, anim_out, check_if_bound); + return pack_anim(anim_idx, bin_in, skl_in, anim_in, anim_out, check_if_bound, compress_anim); } else if (operation.compare("pack_skel") == 0) { hkStringBuf bin_in; diff --git a/BlenderAssist/pack_anim.cpp b/BlenderAssist/pack_anim.cpp index b931bd8..d2bf528 100644 --- a/BlenderAssist/pack_anim.cpp +++ b/BlenderAssist/pack_anim.cpp @@ -102,9 +102,10 @@ void read(hkRefPtr anim, hkRefPtr storeAnim = new hkaInterleavedUncompressedAnimation(); - hkaSplineCompressedAnimation::TrackCompressionParams tparams; - hkaSplineCompressedAnimation::AnimationCompressionParams aparams; - //tparams.m_rotationTolerance = 0.001f; - //tparams.m_rotationQuantizationType = hkaSplineCompressedAnimation::TrackCompressionParams::THREECOMP40; - read(storeAnim, binding, skl, stream, checkIfOriginalBound); - auto final_anim = new hkaSplineCompressedAnimation( *storeAnim.val(), tparams, aparams ); - binding->m_animation = final_anim; - anim_container->m_animations[anim_idx] = final_anim; + printf("Compress animation %d\n", compress_anim); - auto anim = hkRefPtr(anim_ptr); + if (compress_anim) { + hkaSplineCompressedAnimation::TrackCompressionParams tparams; + hkaSplineCompressedAnimation::AnimationCompressionParams aparams; + //tparams.m_rotationTolerance = 0.001f; + //tparams.m_rotationQuantizationType = hkaSplineCompressedAnimation::TrackCompressionParams::THREECOMP40; + auto final_anim = new hkaSplineCompressedAnimation( *storeAnim.val(), tparams, aparams ); + binding->m_animation = final_anim; + anim_container->m_animations[anim_idx] = final_anim; + } + else { + binding->m_animation = storeAnim; + anim_container->m_animations[anim_idx] = storeAnim; + } // ======================== @@ -157,7 +163,7 @@ int packHavok(const hkStringBuf anim_idx_str, const hkStringBuf bin_in, const hk } } -int pack_anim(const hkStringBuf anim_idx_str, const hkStringBuf bin_in, const hkStringBuf skl_in_sklb, const hkStringBuf anim_in_pap, const hkStringBuf anim_out_pap, const hkStringBuf check_if_bound_str) { +int pack_anim(const hkStringBuf anim_idx_str, const hkStringBuf bin_in, const hkStringBuf skl_in_sklb, const hkStringBuf anim_in_pap, const hkStringBuf anim_out_pap, const hkStringBuf check_if_bound_str, const hkStringBuf compress_anim_str) { PapFile papFile; papFile.read(anim_in_pap); @@ -173,7 +179,7 @@ int pack_anim(const hkStringBuf anim_idx_str, const hkStringBuf bin_in, const hk sklbFile.writeHavok(original_skl_temp); auto new_anim_temp = concat(baseDir, "new_anim_temp.hkx"); - auto res = packHavok(anim_idx_str, bin_in, original_skl_temp, original_anim_temp, new_anim_temp, check_if_bound_str); + auto res = packHavok(anim_idx_str, bin_in, original_skl_temp, original_anim_temp, new_anim_temp, check_if_bound_str, compress_anim_str); papFile.replaceHavok(new_anim_temp); papFile.writePap(anim_out_pap); diff --git a/BlenderAssist/pack_anim.h b/BlenderAssist/pack_anim.h index 5882bf6..df8795a 100644 --- a/BlenderAssist/pack_anim.h +++ b/BlenderAssist/pack_anim.h @@ -4,6 +4,6 @@ #include #include -int pack_anim(const hkStringBuf anim_idx_str, const hkStringBuf bin_in, const hkStringBuf skl_in, const hkStringBuf anim_in, const hkStringBuf anim_out, const hkStringBuf check_if_bound_str); +int pack_anim(const hkStringBuf anim_idx_str, const hkStringBuf bin_in, const hkStringBuf skl_in, const hkStringBuf anim_in, const hkStringBuf anim_out, const hkStringBuf check_if_bound_str, const hkStringBuf compress_anim_str); #endif //BLENDERASSIST_PACK_ANIM_H diff --git a/BlenderAssistAddon/__init__.py b/BlenderAssistAddon/__init__.py index 63cb79b..fe27120 100644 --- a/BlenderAssistAddon/__init__.py +++ b/BlenderAssistAddon/__init__.py @@ -2,7 +2,7 @@ "name" : "BlenderAssist", "author" : "ocealot", "description" : "Export custom animations for FFXIV", - "version": (1, 3, 1), + "version": (1, 3, 2), "blender" : (2, 80, 0), "location" : "3D View > Tools (Right Side) > BlenderAssist", "warning" : "", diff --git a/BlenderAssistAddon/addon.py b/BlenderAssistAddon/addon.py index 76bc226..888f841 100644 --- a/BlenderAssistAddon/addon.py +++ b/BlenderAssistAddon/addon.py @@ -66,6 +66,10 @@ class BlenderAssistProperties(PropertyGroup): name = "Only animate same bones as original animation", default = False ) + compress_anim: BoolProperty( + name = "Compress animation data", + default = True + ) exclude_bones: CollectionProperty(type=data.ExcludeBone) editing_exclude_bones: BoolProperty(default=False) @@ -165,10 +169,15 @@ def execute(self, context): anim_in = state.input_pap skl_in = state.input_sklb anim_idx = str(state.anim_idx) + check_original_bound = "0" if state.check_original_bound: check_original_bound = "1" + compress_anim = "0" + if state.compress_anim: + compress_anim = "1" + dirname = os.path.dirname(os.path.abspath(__file__)) basename = os.path.basename(output_pap) @@ -185,7 +194,8 @@ def execute(self, context): print("Finished exporting to bin") command = dirname + '/bin/blenderassist.exe' print(command + " " + str(anim_idx) + " " + anim_bin_file + " " + skl_in + " " + anim_in + " -> " + output_pap) - subprocess.run([command, 'pack_anim', str(anim_idx), anim_bin_file, skl_in, anim_in, output_pap, check_original_bound]) + print(check_original_bound, compress_anim) + subprocess.run([command, 'pack_anim', str(anim_idx), anim_bin_file, skl_in, anim_in, output_pap, check_original_bound, compress_anim]) return {'FINISHED'} @@ -227,6 +237,8 @@ def draw(self, context): layout.prop(state, "check_original_bound") + layout.prop(state, "compress_anim") + layout.label(text="Skeleton SKLB") col = layout.column(align=True) col.prop(state, "input_sklb", text="") diff --git a/BlenderAssistAddon/bin/blenderassist.exe b/BlenderAssistAddon/bin/blenderassist.exe index c2594ef..40d80eb 100644 Binary files a/BlenderAssistAddon/bin/blenderassist.exe and b/BlenderAssistAddon/bin/blenderassist.exe differ