Deleting inactive switch layers.

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

Deleting inactive switch layers.

Postby chucky » Sat Oct 07, 2017 7:33 am

Hi guys..
I have a dilemma.
I also think it can be fixed with a very simple delete script.

I need to delete the inactive switches from any switch not including the word SAFE... or whatever word really I don't care what that it.

That would include deleting any inactive layer inside the groups within that excluded group.
Does that make sense?

So example.
Mouth SAFE is a switch group that contains phonemes ( the phonemes would be safe... however)
Inside each 'safe' phoneme are more switch groups with inactive layers that do get deleted.


There are many , many, many switch groups and layers, with all the characters involved there are thousands of layers that will never be used. So many, that the file is blowing out and crashing like crazy.

I can't do this manually , believe me I've tried and it took hours just on a couple of characters and I have heaps of them and the files are so unstable that I have to save all the time and it take a minute for each save which corrupts half the time anyway. Plus the process needs to happen over and over.
Everything should be fine if I can clean up the files.

I don't need anything more than those layers to be deleted.

I'd like to send thanks to Hayasidist and Synthsin75 who have helped me so much ( thanks guys) , I just can't be nagging you all the time.
It's not fair on you both, so I'm putting it out into the ether, to give you a chance to ignore me :lol:
You know what I'm talking about, this thing is so on top of me now, hogging so much computer recourses that I'm getting save and render fails ans unbelievable crashes, even to black , white, even grey screens of death and messages like this....

Image

The only thing I think that can help me would be this script... any help for this urgent problem that has totally shut this project down... would safe my bacon.
mmmm bacon . :wink:
Sequential offender.
my latest animations
User avatar
chucky
 
Posts: 3300
Joined: Sun Jan 28, 2007 4:24 am
Location: Van Diemen's Land

Re: Deleting inactive switch layers.

Postby synthsin75 » Sat Oct 07, 2017 7:15 pm

chucky wrote:Hi guys..
That would include deleting any inactive layer inside the groups within that excluded group.
Does that make sense?

So example.
Mouth SAFE is a switch group that contains phonemes ( the phonemes would be safe... however)
Inside each 'safe' phoneme are more switch groups with inactive layers that do get deleted.



Just trying to understand what you need...

"Inactive layers"? Like not used in the existing animation, or something else?
Maybe there's a better criteria for deleting? Like layer name, embedded script, or even layer hierarchy?
- Wes
Image
User avatar
synthsin75
 
Posts: 5908
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma

Re: Deleting inactive switch layers.

Postby chucky » Sun Oct 08, 2017 5:12 am

I see what you Mean Wes,
I could go for a much simpler method of using three scripts.
The simplest being,
:idea: Delete all inactive layers in 'Selected' switch group(s).

:idea: :idea: Then mods to these two scripts.
https://1drv.ms/u/s!An9E1CVuSl-zgbZ_pX8BK9oLqcXYSg
Where instead of toggling visibility or active status, they delete the layers in question.

Or it's this

bone group...............>Head .....bone group, only children of switch groups WITHOUT the word SAFE get deleted

switch group...............>>SAFE mouth.....don't delete the immediate children

switch group...............>PHONEME 01 .....keep
layer........................> lips.....keep
switch group...............>TEETH.....keep but... it's a Switch group with no excluding word....so delete it's inactive children and repeat using this groups active layer as the template
layer.........................>> big teeth (inactive delete)
layer.........................>> small teeth (inactive delete)
layer.........................>>buck teeth(active layer-keep) and use the layer name as the guide for all subsequent switches groups in this group..; keep this name for all switches until the group is complete.
layer.........................>> braces teeth(inactive delete)

switch group...............>PHONEME 02 .....keep
layer........................> lips.....keep
switch group...............>TEETH.....keep but... it's a Switch group with no excluding word....so delete it's inactive children and repeat using (PHONEME 01) as the template.
layer.........................>> big teeth (inactive delete)
layer.........................>> small teeth (inactive delete)
layer.........................>>buck teeth(inactive-keep) and using the layer name as the guide from the previous group
layer.........................>> braces teeth(inactive delete)

Woah that gave me a spinny head, just trying to explain... when I thought it was simple.. huh.
Maybe just the mods would be more realistic. :)
Sequential offender.
my latest animations
User avatar
chucky
 
Posts: 3300
Joined: Sun Jan 28, 2007 4:24 am
Location: Van Diemen's Land

Re: Deleting inactive switch layers.

Postby chucky » Sun Oct 08, 2017 8:28 am

Oh here's another file size reduction script I really need.

Merge styles with same name.

I've got a lot of characters that needed styles unlinked during import( a complication due to style ID details).

Now all the styles that are 'actually' the same which have exactly the same name need to be joined again.
So I can edit them all at once and also cut the file size down ( a lot) and reduce confusion that the file seems to create in computation.
Can a script actually do that even - I know styles is not the strongest part of Moho's structure?

I think styles need a reboot - rename them Materials while at it.
Sequential offender.
my latest animations
User avatar
chucky
 
Posts: 3300
Joined: Sun Jan 28, 2007 4:24 am
Location: Van Diemen's Land

Re: Deleting inactive switch layers.

Postby hayasidist » Mon Oct 09, 2017 11:38 am

chucky wrote:... :idea: Delete all inactive layers in 'Selected' switch group(s).

:idea: :idea: Then mods to these two scripts.
https://1drv.ms/u/s!An9E1CVuSl-zgbZ_pX8BK9oLqcXYSg
Where instead of toggling visibility or active status, they delete the layers in question.



:?: inactive meaning "never made an active child"? That's something that can be done ofc, but the only way to decide if a child layer in a switch is never active is to do all the animation first ... Or "inactive" = not the active child when the tool is run .. well that's what hs_configure does -- you've already got that (as well as the two in the download you posted)?!
User avatar
hayasidist
 
Posts: 1595
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Deleting inactive switch layers.

Postby chucky » Mon Oct 09, 2017 12:28 pm

I guess it doesn't actually matter, that file is cracked. I just reduced it by 5,000 layers reducing the content to only the basics. The file size hardly changed and the performance was exactly the same. Still exploring
Sequential offender.
my latest animations
User avatar
chucky
 
Posts: 3300
Joined: Sun Jan 28, 2007 4:24 am
Location: Van Diemen's Land

Re: Deleting inactive switch layers.

Postby hayasidist » Mon Oct 09, 2017 12:55 pm

how about doing it "the other way": assembly rather than deletion? That is - rather than one big file and delete unused - how about lots of smaller files - one per "main" component - create a tailored version of the component then assemble the configured items into a "run" file?? IOW have (say) a "mouth" moho doc that has all the options in it - copy / configure and "alice" variant; same for "hair" etc etc; then build an "alice" group in the "run" file from the "alice" variants in each of the component files ...?? do you think that might cut down the layer count sufficiently in the "run" file??

(Still thinking about styles given the scripting API limitations)
User avatar
hayasidist
 
Posts: 1595
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Deleting inactive switch layers.

Postby chucky » Mon Oct 09, 2017 2:18 pm

hayasidist wrote:how about doing it "the other way": assembly rather than deletion? That is - rather than one big file and delete unused - how about lots of smaller files - one per "main" component - create a tailored version of the component then assemble the configured items into a "run" file?? IOW have (say) a "mouth" moho doc that has all the options in it - copy / configure and "alice" variant; same for "hair" etc etc; then build an "alice" group in the "run" file from the "alice" variants in each of the component files ...?? do you think that might cut down the layer count sufficiently in the "run" file??

(Still thinking about styles given the scripting API limitations)

Hey that's good thinking.
So make the decision based on one or two phonemes, press the button and all the phonemes jump in.... nice

It makes me wonder about hands, if offline projections could work as virtual puppeteers , leaving behind hard copies... This is all gone a bit SciFi now though hey.
I guess that's the beauty of analogue ,3d or stop motion for that matter , infinitely more possibilities, than switch rigs.. I used to do stop motion , switch layers are like replacement versus the old armature, that would be the smart bone version, I should have done instead of switch layers.
If morphs worked on frame zero, that would be good too. So may ways to cut the file size down, I think this time I chose the wrong path, by going with the old school moho standard of switches. The simple formula is betrayed by the exponential creep of layer counts.
Still , I'm pretty sure that the real problems I'm having are down to the style ID conflicts.
.
Sequential offender.
my latest animations
User avatar
chucky
 
Posts: 3300
Joined: Sun Jan 28, 2007 4:24 am
Location: Van Diemen's Land

Re: Deleting inactive switch layers.

Postby hayasidist » Mon Oct 09, 2017 4:58 pm

chucky wrote: If morphs worked on frame zero, that would be good too.
you mean (say) "green spiky hair" and "yellow straight / flat hair" that you can blend "at will" and capture the result? Well -- I have a "bake vector" script... define your morphs and blend them as per the book then bake the frame -- and you'll capture the point motion / colour as a "frame 0" vector.. read a bit about it here: viewtopic.php?f=9&t=28275&p=160048 and the .zip is here: http://www.mediafire.com/file/ob4vvnin58ovccz/Bake.zip
User avatar
hayasidist
 
Posts: 1595
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England


Return to Scripting

Who is online

Users browsing this forum: No registered users and 2 guests