Group layer Depth Sort: Sort layers by Y-Position

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

User avatar
Lukas
Posts: 811
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: Group layer Depth Sort: Sort layers by Y-Position

Post by Lukas » Wed Feb 26, 2020 7:52 pm

Thanks for the very thorough answer. I'm afraid I've been down all those paths as well :D

The Reveal order way is pretty solid, but I still feel it's one of the many things that make Moho rigs overly complex for what they can do in the end. Having multiple layers of the same thing is usually the kind of thing that makes updating and repurposing rigs a pain, in my projects anyway. :/

Stroke-limbs are usually great, I wish their benefits (exposure, curvature, very simple rigging/animating) would be as easy to apply to other art styles. I find simple rigs gets the best out of animators and automation is definitely a dangerous rabbit hole. I find myself automating a lot of things though, but almost only to make things simpler (less layers, less bones, less keys, less tools, less clicking, less everything, okay more re-use) - in a way that does not restrict the animator or Moho - instead of adding a lot of fancy things.

I do hope using the z scale value for layer order is one of those things that simplifies projects, it might :)
User avatar
Greenlaw
Posts: 4664
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Group layer Depth Sort: Sort layers by Y-Position

Post by Greenlaw » Wed Feb 26, 2020 8:12 pm

Lukas wrote:
Wed Feb 26, 2020 7:52 pm
The Reveal order way is pretty solid, but...Having multiple layers of the same thing is usually the kind of thing that makes updating and repurposing rigs a pain, in my projects anyway. :/
I know exactly what you mean. Sometimes I'll use Reference layers and clearly mark them as such so I don't edit the wrong layer. (I wish Moho had a native Lock button in the layers window like AE has--that would help prevent this problem.) Most of the time, I wind up using Duplicates though and hoping I won't have to edit the layers later.
I find simple rigs gets the best out of animators and automation is definitely a dangerous rabbit hole. I find myself automating a lot of things though, but almost only to make things simpler (less layers, less bones, less keys, less tools, less clicking, less everything, okay more re-use) - in a way that does not restrict the animator or Moho - instead of adding a lot of fancy things.
I agree. Finding that sweet spot can be a real balancing act, and for me it varies between productions and characters.
I do hope using the z scale value for layer order is one of those things that simplifies projects, it might :)
It really should simplify it for arms in many characters and the legs in some characters. I'm looking forward to trying it out. Will let you know how it goes.

Thanks again for releasing the script!
D.R. Greenlaw
Artist/Partner - Little Green Dog | Little Green Dog Channel on Vimeo | Greenlaw's Demo Reel 2019 Edtion
Lead Digital Animator, Dreamworks Animation

Image
hayasidist
Posts: 2195
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Group layer Depth Sort: Sort layers by Y-Position

Post by hayasidist » Thu Feb 27, 2020 8:24 am

that use of the otherwise "unused" z scale is **really** neat!
User avatar
funksmaname
Posts: 3113
Joined: Tue May 29, 2007 11:31 am
Location: Nelson, New Zealand

Re: Group layer Depth Sort: Sort layers by Y-Position

Post by funksmaname » Thu Mar 12, 2020 2:40 am

Amazing Lukas!
Daxel
Posts: 100
Joined: Wed Mar 27, 2019 8:34 pm

Re: Group layer Depth Sort: Sort layers by Y-Position

Post by Daxel » Thu Apr 23, 2020 9:16 pm

This is awesome! I'm now diving into the more advanced layer sorting techniques, finding very useful every aproach explained here, and the Z scale technique, even if I still don't understand it very well, it really looks like a game changer. I would love an official implementation of something like this, that the program seems very capable of doing and the users really need to simplify their rigs.
Noob question: what's the original purpose of the Z scale parameter?

Edit: sometimes the Lua console says "LK_sortByZScale.lua:20: attempt to call method 'Layer' (a nil value)" I don't know what does that mean, I'm using Moho 12.5.


Edit2: I've been thinking about a system to have an easy to use UI to order the layers with bones and your Z-scale system:

Basically there would be one smartbone for each controled layer, every smartbone would assign to it's controled layer a Z scale value from 1 to 100 (for example).
Each bone, while pointing upwards would assign the max Z scale value (100) to it's layer and pointing downwards would be the minimum Z scale value (1).

All those smartbones would be exactly on the same spot, but they won't be animated directly, they will be hiden and they will move following one specific pin bone for each one, that will be the target bone and will show the name of the controled layer.

Then, the pin bones would be in a column, where the Y position of each bone is the layer position they have, so you should clearly see and modify the order of the layers moving the "head" pinbone, for example, above or bellow the "neck" pinbone. I only made one of these bones to test it and it works perfectly, I can move the pin bone up or down and see in realtime how the drawing goes above or behind the other drawings (that had Z scale values previously aplied, manually).

To the bed I go. Thanks for the script, Lukas.
Daxel
Posts: 100
Joined: Wed Mar 27, 2019 8:34 pm

Re: Group layer Depth Sort: Sort layers by Y-Position

Post by Daxel » Sat May 23, 2020 2:22 am

Lukas wrote:
Wed Feb 26, 2020 7:52 pm

I do hope using the z scale value for layer order is one of those things that simplifies projects, it might :)
I'm using your script and it is amazingly useful, but I keep getting this error "LK_sortByZScale.lua:20: attempt to call method 'Layer' (a nil value)" very often.
Do you get that error too? I don't know anything about scripting.

Also when I keyframe the z scale value, the sorting only takes effect on the next frame, so if I want to change it on the frame 24 I have to make the keyframe on the frame 23 and the sorting happens at frame 24. Very easy to work that way but I don't know if it is related to that console error.

If you know what am I doing wrong that would help me so much.
User avatar
Víctor Paredes
Posts: 4952
Joined: Wed Jan 26, 2005 12:18 am
Location: Ireland/Chile
Contact:

Re: Group layer Depth Sort: Sort layers by Y-Position

Post by Víctor Paredes » Mon Jun 22, 2020 7:33 pm

I'm just coming to say today I animated a crowd of around 100 characters walking on the sideway. This script made it so simple! Just duplicated the characters each time, made some small modifications on the shapes and animation and then put each character wherever I wanted without having to worry about layer ordering.
It is amazing how much time it saved me and how much control over the scene I had.
Thanks again!
Víctor Paredes
Former Moho Product Manager
Rigger and animator in Cartoon Saloon
My Youtube Channel - My webinars
User avatar
Lukas
Posts: 811
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: Group layer Depth Sort: Sort layers by Y-Position

Post by Lukas » Tue Jun 23, 2020 9:00 am

Víctor Paredes wrote:
Mon Jun 22, 2020 7:33 pm
I'm just coming to say today I animated a crowd of around 100 characters walking on the sideway. This script made it so simple! Just duplicated the characters each time, made some small modifications on the shapes and animation and then put each character wherever I wanted without having to worry about layer ordering.
It is amazing how much time it saved me and how much control over the scene I had.
Thanks again!
Awesome :)
User avatar
Lukas
Posts: 811
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: Group layer Depth Sort: Sort layers by Y-Position

Post by Lukas » Tue Jun 23, 2020 9:08 am

Daxel wrote:
Sat May 23, 2020 2:22 am
I'm using your script and it is amazingly useful, but I keep getting this error "LK_sortByZScale.lua:20: attempt to call method 'Layer' (a nil value)" very often.
Do you get that error too? I don't know anything about scripting.

Also when I keyframe the z scale value, the sorting only takes effect on the next frame, so if I want to change it on the frame 24 I have to make the keyframe on the frame 23 and the sorting happens at frame 24. Very easy to work that way but I don't know if it is related to that console error.

If you know what am I doing wrong that would help me so much.
Sorry, I don't have any time to look into it, but I'll try and remember to check it out some other time.
Post Reply