Sor3nt Posted September 9, 2018 Share Posted September 9, 2018 (edited) Hi all, i am new in the 3D world but not new in development. I try since 3 days to find a simple animation importer exporter for 3dsmax or unity3d but looks like i miss something, it can not be true, that this simple thing did not exists.. What i search is a simple plugin das allows me to import animation by XML or JSON, i know the XAF format but its pain to generate and heavy overloaded. For better understanding, here what i prefer as file: [ { frame: 1, time: 0, position: { x: 0, y: 0, z: 0 }, quad: { x: 0, y: 0, z: 0, w: 0 } }, { frame: 2, time: 10, position: { x: 10, y: 0, z: 0 }, quad: { x: 10, y: 0, z: 0, w: 0 } } ] (the file is generated by a tool from me) can some one point me the right direction to solve this simple problem ? thanks Edited September 9, 2018 by Sor3nt Link to comment Share on other sites More sharing options...
K^2 Posted September 10, 2018 Share Posted September 10, 2018 You could just write your own. I've written export/import scripts for Blender, Max, and Unity, and it's not that much work. All of the above have convenient utility methods for converting transform data to whatever format you need for keyframes. Prior to filing a bug against any of my code, please consider this response to common concerns. Link to comment Share on other sites More sharing options...
Sor3nt Posted September 11, 2018 Author Share Posted September 11, 2018 you are right, but still wondering that this is not available, what ever, if someone need it , here my code sb = new StringBuilder(); sb.Append("["); AnimationClipCurveData[] cdataarray = AnimationUtility.GetAllCurves(clip, true); int l = ((AnimationClipCurveData[])cdataarray).Length; for (int x = 0; x < l; x++) { sb.Append("{"); AnimationClipCurveData cdata = cdataarray[x]; sb.AppendFormat("\"boneName\" : \"{0}\"", cdata.propertyName); sb.Append(","); sb.Append("\"frames\" : ["); Keyframe[] keys = cdata.curve.keys; for (int i = 0; i < keys.Length; i++) { Keyframe kf = keys[i]; sb.Append("{"); sb.AppendFormat("\"time\" : \"{0}\",", kf.time); sb.AppendFormat("\"value\" : \"{0}\"", kf.value); sb.Append("}"); if (i < keys.Length - 1) sb.Append(","); } sb.Append("]"); sb.Append("}"); if (x < l - 1) sb.Append(","); } sb.Append("]"); trip 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now