Jump to content

Hair should go on TOP of your head.


Recommended Posts

Hello, I'm a casual, on-again-off-again modder (that's really the best description of myself I could think of) working on a character mod idea I came up with the other day to try to get myself back into the modding mood. I don't usually post on the forums, I'm more of a stalker, really, but I kind of need some help with hair placement in Spriter.

The problem I'm having right now is, the hair files (used for Wilson, Wickerbottom and maybe someone else idk) go behind the character's head when I want them to be on the top layer of the character, so the hair acts appropriately as hair, and bangs that go over the character's eyes, as so:

o8tapl.jpg

I just saved the hair there in the image, but I'm experienced enough with Spriter to know that no real change has been made (to the coding, anyway). I hacked up his .scml a little bit in a way I thought would make the hair stay on the top layer, but when I shoved this WIP in game real quick for a test drive, the hair was still behind his head. Thinking about it now, I'm not sure it would still stay above his head when he moved around and did stuff, since the different animations are still built with the default code.

 

tl;dr: I want a character's hair as the top layer in their code, not behind the head and face. Is it possible to keep it there, or should I just settle with the face clipping over the hair?

Edited by Worthington
Link to comment
Share on other sites

@Worthington, I believe it is possible, but it will probably not be easy. It may require making your own version of all the player animations (like the Extended Character Template does, although starting with Dleowolf's work should make it much easier). I know someone else was attempting another hair-related change by manually editing the z-values in various anim files, but I'm not sure they were successful.

Link to comment
Share on other sites

I believe it is possible, but it will probably not be easy. It may require making your own version of all the player animations (like the Extended Character Template does, although starting with Dleowolf's work should make it much easier). I know someone else was attempting another hair-related change by manually editing the z-values in various anim files, but I'm not sure they were successful.

Ah. That would definitely make it a little more difficult. I'll scramble around some of the z-index placements just to see if the hair stays right in the idle animation, but for now, this option will stay on the back burner. Thank you once again, Rez. :-)

 

Link to comment
Share on other sites

@rezecib,

 

With the frequency that this gets asked, I'm half tempted to recompile the animations with either an alternative z-ordering, or(more likely) with duplicated hair and torso layers with alternate z-ordering.  I already successfully managed to reorder the layers on the idle animations, so I know it's at least possible.

 

But... there's just so many animations and I'm sure I'd have to tweak a lot of them by hand... frame by frame... via text editor... :(

Link to comment
Share on other sites

@Corrosive, you could use Krane to break it down into a Spriter project, then use my animation renaming software to rename the layer names to the proper name after you've finished the conversion. It will take time, but it's a lot faster than in a text editor.

Link to comment
Share on other sites

@Kzisor,

 

I actually have a project I'm working on to manipulate .scml files and their elements using an extended implementation of LuaXML.  I'm nowhere near where I'd be comfortable releasing it, but the project is functional enough that I could just do something like:

scmlroot = scml.load("player_basic.scml")scmlroot:DuplicateTimeline("hair", "hair_front")scmlroot:DuplicateTimeline("torso", "torso_back")scmlroot:save("player_basic_new.scml")

Which would iterate through each entity, each animation of each entity, and duplicate the timeline elements matching "hair" and "torso" and rename them appropriately.

 

...But unfortunately spriter doesn't support the 2d matrix transformations that Flash does(which Klei's artists use).  In spriter, all you can do is manipulate the sprites in their rectanglieness.  You can't squish them into trapezoids or other fun rhombi. If you toggle the --check-animation-fidelity flag on Krane, you'll see a bunch of warnings because of that.

 

The only way to recompile the animations without introducing errors during conversion is either to hex edit their values(not gonna happen), or to use a tool (like BinaryConverter with the -p flag) to generate an intermediary file that's faithful to the original animations.

 

I don't know of any tools that have been developed to decompile them into a format that recognizes 2d matrix transforms, like Flash, though I did consider making one.  I would have to seriously bone up on my C++ and figure out the Flash specifications though.

 

For comparison, here's both of the (pseudo) data structures:

 

BinaryConverter intermediary element on default mode (simple_element)-- more easily hand-editable and almost equivalent to spriter's data structure for an <object> element:

 

  simple_element{
   name swap_hat
   frame 0
   layer_name HAT
   scale_x 1.000000
   scale_y 1.000000
   rot 0.000000
   tx 2.000000
   ty -120.098999
   tz -5.000000
  }

 

BinaryConverter element on precise mode, not easily hand-editable and incompatible with spriter's format:

 

element{
  name swap_hat
  frame 0
  layer_name HAT
  a 1.000000
  b 0.000000
  c 0.000000
  d 1.000000
  tx 2.000000
  ty -120.098999
  tz -5.000000
}

Edited by Corrosive
Link to comment
Share on other sites

...But unfortunately spriter doesn't support the 2d matrix transformations that Flash does(which Klei's artists use).  In spriter, all you can do is manipulate the sprites in their rectanglieness.  You can't squish them into trapezoids or other fun rhombi. If you toggle the --check-animation-fidelity flag on Krane, you'll see a bunch of warnings because of that.

 

The only way to recompile the animations without introducing errors during conversion is either to hex edit their values(not gonna happen), or to use a tool (like BinaryConverter with the -p flag) to generate an intermediary file that's faithful to the original animations.

 

I don't know of any tools that have been developed to decompile them into a format that recognizes 2d matrix transforms, like Flash, though I did consider making one.  I would have to seriously bone up on my C++ and figure out the Flash specifications though.

 

The issue lies in the fact that the auto compiler doesn't name the layers the proper name as the original animations. This leads to massive issues and could be completely negated if the auto compiler recompiled the animations correctly. A good section of Don't Starve and Don't Starve Together's code uses AnimState:Hide() and AnimState:Show() which uses the layer name, unlike the AnimState:OverrideSymbol() which uses the symbol's name.

 

What we honestly need is the ability to adjust the z-order directly in Lua with AnimState:BringSymbolForward(SymbolName) and AnimState:SendSymbolBackwards(SymbolName); however, I'm not entire sure that is feasible.

Link to comment
Share on other sites

@Kzisor,

 

That's a separate (but also important) issue.

 

But the reason for that is similarly that there is no direct equivalent in the scml format specification ( http://www.brashmonkey.com/ScmlDocs/ScmlReference.html ) for grouping by layers.  You miiiight be able to get away with it if you stored that info in tags on the timelines, but tags are a pro-only feature.

 

Another limitation of Spriter is that even if you could create layers (or even if timelines were made into layers), Spriter automatically removes empty elements.  Anything you convert from Klei native format will instantly lose blank symbols/layers upon opening in Spriter (ex. the "snow" layer on most buildings.)

 

 

Edit: might also be able to pack the layer name into the timeline name by separating by a special character... hmm

Edited by Corrosive
Link to comment
Share on other sites

@Corrosive, I think I would lump it into the same issue, as it relates to the auto compiler not functioning completely as intended. I suggested the functions above to PeterA and he said he'd put it on his list to look into in the future.

 

I'm hoping with the help of you and I we can get the official auto compiler working better as it would allow modders to create different character animations and more unique slots.

 

As a note to the limitation of 'spriter' that I believe is a limitation on Krane's part, not Spriter. Krane removes the invisible or empty images/layers before exporting to a .scml file. If you create your own .bin to .scml converter you could create empty files and spriter would pick them up properly. You can test this theory by using an empty image on frames in Spriter. If or when I get time I'll probably create my own .bin to .scml converter to create better Spriter projects, as all the information needed is located in the animation files.

Link to comment
Share on other sites

@Kzisor,

 

Well, yeah, the Krane limitation is that it doesn't create the empty layers, but the Spriter limitation is that it doesn't support layers, it removes timelines that don't contain images, and it doesn't support 2d matrix transforms.

 

The former two are workaroundable, but the latter is not even remotely.  That's what I was trying to get at initially.

 

 

Edit: I should clarify that they're workaroundable, but you'd also have to modify the autocompiler python scripts to deal with your workaround.

 

The problem with directly converting from layer name to timeline name is that multiple symbols can be on a single layer, and Spriter doesn't like multiple timelines with the same name. Which is pretty dumb, considering every timeline has a unique ID-- there's no need to keep names unique.  But Spriter goes ahead and overwrites all but one of the same-named sibling timelines. Spriter has quite a few questionable design choices like that.

Edited by Corrosive
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...