Dengar Posted August 8, 2015 Author Report Share Posted August 8, 2015 Okay, so then I am assuming your spriter files are actually in a folder named "Spriter" somewhere. Otherwise the quickfix wouldn't work. :P Quote Link to comment Share on other sites More sharing options...
Solgryn Posted August 9, 2015 Report Share Posted August 9, 2015 Hi, is there any possibility to make it so that the animation events don't get overwritten? Basically I want to manually go in my animation in unity, and add events myself. But when the spriter file gets updated, these events will disappear. Would it be possible for it to read where the events were, remember them, and add them to the newly imported animation? This would be amazing c: Quote Link to comment Share on other sites More sharing options...
Dengar Posted August 9, 2015 Author Report Share Posted August 9, 2015 Hi, is there any possibility to make it so that the animation events don't get overwritten? Basically I want to manually go in my animation in unity, and add events myself. But when the spriter file gets updated, these events will disappear. Would it be possible for it to read where the events were, remember them, and add them to the newly imported animation? This would be amazing c: The DX version does nothing with events (precisely because of what you just said). Are you using the Mythgarr version? Quote Link to comment Share on other sites More sharing options...
Solgryn Posted August 9, 2015 Report Share Posted August 9, 2015 The DX version does nothing with events (precisely because of what you just said). Are you using the Mythgarr version? Huh, I'm using the DX version, I just switched from the old one. D: Am I doing something wrong? Edited the animation and updated the prefab. But whenever it reimports the events are just lost.. Quote Link to comment Share on other sites More sharing options...
Dengar Posted August 10, 2015 Author Report Share Posted August 10, 2015 Is the old version still in your project by chance? ...Also, looking at my code I suddenly realise something. See, reimporting works by basically deleting the old and then recreating it. There should be a few lines of code that basically grabs all the events from the previous version and copies them into the new version, but apparently I forgot to add that. As a "quick fix", open AnimationBuilder.cs and find the following block of code: if (OriginalClips.ContainsKey (animation.name)) { //If the clip already exists, copy this clip into the old one var oldClip = OriginalClips [animation.name]; EditorUtility.CopySerialized (clip, oldClip); clip = oldClip; ProcessingInfo.ModifiedAnims.Add (clip); Then insert a few lines if (OriginalClips.ContainsKey (animation.name)) { //If the clip already exists, copy this clip into the old one var oldClip = OriginalClips [animation.name]; var cachedEvents = oldClip.events; EditorUtility.CopySerialized (clip, oldClip); clip = oldClip; AnimationUtility.SetAnimationEvents (clip, cachedEvents); ProcessingInfo.ModifiedAnims.Add (clip); That should fix your problem. I'll also add this to the list of known issues. Quote Link to comment Share on other sites More sharing options...
Solgryn Posted August 10, 2015 Report Share Posted August 10, 2015 That should fix your problem. I'll also add this to the list of known issues. Thank you! That works perfectly c: Glad I could somehow contribute hehe Quote Link to comment Share on other sites More sharing options...
Aprowolf Posted August 10, 2015 Report Share Posted August 10, 2015 thanks for the quick fix Dengar! it works like a charm Quote Link to comment Share on other sites More sharing options...
blackant Posted August 11, 2015 Report Share Posted August 11, 2015 Nice work ! the sprites coupled with mecanim is absolutely awesome ! :-P Quote Link to comment Share on other sites More sharing options...
oatsbarley Posted August 13, 2015 Report Share Posted August 13, 2015 It's not really a solution, but for people who are suffering from the infinite loop bug, you can change a couple things in ScmlPostProcessor.cs. Add a list to cache the cache: private static IList<string> lastCachedPaths = new List<string>(); In OnPostProcessAllAssets() just before cachedPaths.Clear(): lastCachedPaths = new List<string>(cachedPaths); In ProcessFiles(), just before cachedPaths.Add(path) add: if (lastCachedPaths.Contains(path)) { Debug.LogError("Infinite loop on: " + path); continue;} and after the foreach loop, before the end of the function: lastCachedPaths.Clear(); It checks that the same file isn't being processed more than twice and, if it is, breaks out of the loop and logs an error.Obviously it doesn't fix anything, the assets don't get imported properly, but it stops your editor from locking up! Quote Link to comment Share on other sites More sharing options...
oatsbarley Posted August 13, 2015 Report Share Posted August 13, 2015 Forget my last post, I found the bug in PrefabBuilder.cs, GetSpriteAtPath(): if ((importer.textureType != TextureImporterType.Sprite || importer.spritePivot.x != file.pivot_x || importer.spritePivot.y != file.pivot_y) && !InvalidImporters.Contains (importer)) Where it says importer.spritePivot.y != file.pivot_y, it should be importer.spritePivot.y != 1-file.pivot_y. EDIT: made a pull request just to save you some time. Quote Link to comment Share on other sites More sharing options...
Dengar Posted August 13, 2015 Author Report Share Posted August 13, 2015 Updated the source folder as well as the package to v1.0.4. Contains a few minor fixes: -AnimationEvents are now preserved between reimports -SpriteSwapper renamed to TextureController to avoid confusion -Fixed a z-position issue with the SortingOrderUpdater I decided to wait with implementing the above fix until I know what it does exactly. Quote Link to comment Share on other sites More sharing options...
oatsbarley Posted August 13, 2015 Report Share Posted August 13, 2015 Maybe just ignore it, I'm not sure but I might have caused an infinite loop myself, then fixed it, hah. Quote Link to comment Share on other sites More sharing options...
BTA Posted September 2, 2015 Report Share Posted September 2, 2015 Hi, I tried for the first time the plugin and I got this error : InvalidOperationException: 'bezier' is not a valid value for Spriter2UnityDX.Importing.CurveType. Then no prefab or animationController are created. Any idea why I get this error message and what I have to do to fix that ? Thank you Quote Link to comment Share on other sites More sharing options...
Mike at BrashMonkey Posted September 2, 2015 Report Share Posted September 2, 2015 I'm no expert on Spriter2Unity, but it sounds like you used custom speed curves in one or more animation, and Spriter2Unity does not (yet at least) support anything but the standard linear easing of key-frames. Hopefully someone else can confirm this, or remove any custom curves in a back-up of your Spriter project, and try importing the one with no custom curves. cheers. Quote Link to comment Share on other sites More sharing options...
Dengar Posted September 3, 2015 Author Report Share Posted September 3, 2015 Gots a quickfix for you that will fix the error (but won't actually implement the curve type):-Open the file "ScmlSupport". -Find the "CurveType" enum. -Add the word "bezier" to the list of possible CurveTypes. Basically, the short story is, the documentation never mentioned anything about a "bezier" curve type. That said, while the enum is there in the file, it's really just a thing for future implementations. The CurveType enum doesn't actually DO anything at this point in time. Quote Link to comment Share on other sites More sharing options...
BTA Posted September 3, 2015 Report Share Posted September 3, 2015 Hi, Thanks for the quick-fix, at least I'm not longer stuck ! Quote Link to comment Share on other sites More sharing options...
poing Posted September 4, 2015 Report Share Posted September 4, 2015 This isn't working for me. Unity doesnt seem to be able to recognize the .scml file? Quote Link to comment Share on other sites More sharing options...
Dengar Posted September 5, 2015 Author Report Share Posted September 5, 2015 That can't be it, because Unity doesn't recognize .scml files in the first place. The problem has to be something else. Can you please elaborate a bit more on the steps you take? Quote Link to comment Share on other sites More sharing options...
Loki Posted September 24, 2015 Report Share Posted September 24, 2015 I'm wondering is it possbile to seperate animations from my character prefab? I have a lot of prefabs that use the same animations so I would like to use same animations for the different prefabs. So my question is, how to stop nesting of the animation? I don't know if this was answered before but I couln't find it. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Dengar Posted September 24, 2015 Author Report Share Posted September 24, 2015 The choice of whether or not to nest the animation was planned for a future version but I haven't really felt like working on it recently. A question though: If you have a lot of prefabs that use the same animation, why not use the same prefab each time as well? Quote Link to comment Share on other sites More sharing options...
Loki Posted September 24, 2015 Report Share Posted September 24, 2015 Because the player character has a lot of different skins, and every skin has a few different options for itself also, and those options differ from skin to skin. So my plan was to create seperate prefab for every skin, so it can be unique but still use same animations Quote Link to comment Share on other sites More sharing options...
Dengar Posted September 25, 2015 Author Report Share Posted September 25, 2015 Another feature planned for a future version is some implementation for CharacterMaps. That theoretically lets you store all your skin data in the prefab, or maybe a collection of ScriptableObjects, I haven't figured that part out.I understand your idea though. At the moment I'm not in a position to make one of those "Quick fixes" though, maybe this weekend I'll write up a quick fix, or someone else can write one up. Quote Link to comment Share on other sites More sharing options...
Dengar Posted September 26, 2015 Author Report Share Posted September 26, 2015 Alright, I have an update on the matter. I made a sort of intermediary build of the importer. You can now from the main menu go Edit > Project Settings > Spriter2UnityDX. There you can select whether you want your animations to be nested in the prefab, or placed in a separate folder. I won't up the version number because as of today it's really just a very fast and crude solution that may cause some unexpected behavior if you try some weird things. Also it's fairly untested. Try it and see if you like the results. Quote Link to comment Share on other sites More sharing options...
Loki Posted September 27, 2015 Report Share Posted September 27, 2015 Woah, thanks a lot man... I really didn't expect anything, I was just curious about this feature, and you went and created it.. I really really appreciate it since I was struggling with the old Malhavok Spriter2Unity. I will test it out later today for my purposes and report back. Quote Link to comment Share on other sites More sharing options...
Loki Posted September 28, 2015 Report Share Posted September 28, 2015 Okay I've tested it out and it works perfectly, thanks again. Except for the fact that pivots got to be custom and not center, but I saw that was planned for future. Because apart from my default sprites for the default prefab, other sprites have a bit bigger resolution (e.g. baggier shirt), but I played a bit with pivot X,Y, and got it working for now. So like I said, everything is perfect, you saved me Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.