protected override JSONObject ToJSON(WXHierarchyContext context) { List <string> linkSprite = new List <string>(); JSONObject child = new JSONObject(JSONObject.Type.ARRAY); JSONObject json = new JSONObject(JSONObject.Type.OBJECT); JSONObject data = new JSONObject(JSONObject.Type.OBJECT); JSONObject layers = new JSONObject(JSONObject.Type.ARRAY); json.AddField("type", getTypeName()); json.AddField("data", data); Avatar avatar = animator.avatar; if ((UnityEngine.Object)avatar != (UnityEngine.Object)null) { AssetImporter importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(avatar.GetInstanceID())); ModelImporter mImporter = importer as ModelImporter; if (mImporter && mImporter.optimizeGameObjects) { WXAvatar converter = new WXAvatar(avatar, gameObject); string avatarPath = converter.Export(context.preset); if (avatarPath != null && avatarPath != "") { data.AddField("avatar", avatarPath); context.AddResource(avatarPath); } } } if (gameObject.GetComponent <Animator>().runtimeAnimatorController != null) { //string controllerId = SaveController(gameObject); WXResource controllerConverter = (WXResource)WXResource.getConverter( gameObject.GetComponent <Animator>().runtimeAnimatorController, gameObject ); string animatorControllerPath = controllerConverter.Export(context.preset); data.AddField("controller", animatorControllerPath); context.AddResource(animatorControllerPath); } data.AddField("cullingMode", (uint)animator.cullingMode); return(json); }
protected override JSONObject ToJSON(WXHierarchyContext context) { List <string> linkSprite = new List <string>(); JSONObject child = new JSONObject(JSONObject.Type.ARRAY); JSONObject json = new JSONObject(JSONObject.Type.OBJECT); JSONObject data = new JSONObject(JSONObject.Type.OBJECT); JSONObject layers = new JSONObject(JSONObject.Type.ARRAY); json.AddField("type", getTypeName()); json.AddField("data", data); Avatar avatar = animator.avatar; if ((UnityEngine.Object)avatar != (UnityEngine.Object)null) { WXAvatar converter = new WXAvatar(avatar, gameObject); string avatarPath = converter.Export(context.preset); if (avatarPath != null && avatarPath != "") { data.AddField("avatar", avatarPath); context.AddResource(avatarPath); } } if (gameObject.GetComponent <Animator>().runtimeAnimatorController != null) { //string controllerId = SaveController(gameObject); WXResource controllerConverter = (WXResource)WXResource.getConverter( gameObject.GetComponent <Animator>().runtimeAnimatorController, gameObject ); string animatorControllerPath = controllerConverter.Export(context.preset); data.AddField("controller", animatorControllerPath); context.AddResource(animatorControllerPath); } return(json); }