Select switch layer from preview?

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

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
Greenlaw
Posts: 9259
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Select switch layer from preview?

Post by Greenlaw »

I just checked the manual and, yeah, the only ones I see mentioned are the three shortcuts I was already aware of (Alt-click, Alt+D, Alt+C,) and I knew about those because I'm geeky enough to actually read the Read Me files that come with every release. :P

Image

Guess I should report that because the additional shortcuts you posted above are too useful to be kept a 'secret'.
User avatar
synthsin75
Posts: 9970
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Select switch layer from preview?

Post by synthsin75 »

I got curious too. Alt+ctrl+right-click is on page 130. And it might be in there somewhere, but I'm not finding Shift+Alt+Right-click.
User avatar
strider2000
Posts: 506
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

Re: Select switch layer from preview?

Post by strider2000 »

synthsin75 wrote:Strider, I think this might be doable, with a few slight quirks. Give me some time, and I'll see if I can sort out what needs to be done.
Cool. Thanks. This is an interesting thread.

Like everything else with ASP, I just wish I had tons more time to do stuff :o
User avatar
synthsin75
Posts: 9970
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Select switch layer from preview?

Post by synthsin75 »

So far, it looks like you'll need to restart (close and reopen) AS to update the icons for new/edited layers. If that's a deal breaker, I'll stop right now and explain my alternative (more difficult) ideas.
User avatar
strider2000
Posts: 506
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

Re: Select switch layer from preview?

Post by strider2000 »

synthsin75 wrote:it looks like you'll need to restart (close and reopen) AS to update the icons for new/edited layers.
If you mean this: Suppose I have 5 switch layers. I don't need to close and reopen in order to have the icons pop up to select for animating. But if I add a 6th layer, or alter one of the 5 layers, then I'll need to close and reopen my file (or even ASP) in order for the "icon selection layer/panel/dialog" to be updated with the new changes.

I don't think that's a deal breaker at all. In my mind this is primarily about making it easy and fast to select the correct hand position while animating.
sillyanimate
Posts: 145
Joined: Mon Feb 15, 2016 7:28 pm

Re: Select switch layer from preview?

Post by sillyanimate »

It would be nice we have something like this,
Kinda like keyframes caddy in abode flash
Or how drawing substitution in toon boom
Don't forget! No one is perfect!
User avatar
synthsin75
Posts: 9970
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Select switch layer from preview?

Post by synthsin75 »

strider2000 wrote:
synthsin75 wrote:it looks like you'll need to restart (close and reopen) AS to update the icons for new/edited layers.
If you mean this: Suppose I have 5 switch layers. I don't need to close and reopen in order to have the icons pop up to select for animating. But if I add a 6th layer, or alter one of the 5 layers, then I'll need to close and reopen my file (or even ASP) in order for the "icon selection layer/panel/dialog" to be updated with the new changes.

I don't think that's a deal breaker at all. In my mind this is primarily about making it easy and fast to select the correct hand position while animating.
Yeah, you'd only need to restart AS after you:
- Initially generate your switch icons, and want to start using them
- Add a new layer that needs an icon generated
- Edit a layer enough that you feel you need an updated icon

So yes, it should only be necessary after asset creation and before animating, unless you find you need to add/edit something later.

And yes, it will require completely closing AS, not just the file.


If anyone wants to help out, I could use some code to center and zoom a layer (or the camera) to the bounding box of it's content. I don't remember off hand if a switch layer's bounding box includes it's visible switch or not.
User avatar
Greenlaw
Posts: 9259
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Select switch layer from preview?

Post by Greenlaw »

Hi synthsin75,

Sorry, I don't mean to derail this thread but I noticed something odd with the Ctrl+Alt+Right-Click shortcut today: With some layers, when I use this combo, there are some parts of the image that will always activate the pop-up and some parts of the image that never activate the popup. I haven't had time to investigate why this happens yet but do you know what might be going on?

Thanks in advance for any helpful answers. So far, this doesn't appear to be a critical issue, just a small annoyance. If I do figure it out, I'll be sure to follow up.

Update: I think this is only happening with bitmap (PNG) layers, not vector. It's not transparency that causes it though. I know that's not terribly helpful but it's curious.

Update 2: Now I'm wondering if something invisible is just blocking part of the drawing, preventing the shortcut from working in that area. It does appear that the shortcut isn't working for the same region for all the drawings in that Switch. Unfortunately, I don't see what that could be though.
Last edited by Greenlaw on Thu May 05, 2016 12:35 am, edited 1 time in total.
User avatar
Greenlaw
Posts: 9259
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Select switch layer from preview?

Post by Greenlaw »

Okay, figured it out. My last idea was it. The switch in question was a Mouth switch and the Eyes switch was somehow blocking the upper part of it. What's still puzzling is that the Eyes don't visually block the mouth at all, but if I disable it, the shortcut works for the entire mouth image. Still uncertain about what the actual 'blockage' is but at least I know where it's coming from now.

Just posting in case anybody else runs into this issue.

Decided to switch the layer order between the eyes and mouth switches. Problem solved...sort of. :)
Last edited by Greenlaw on Thu May 05, 2016 12:33 am, edited 1 time in total.
User avatar
synthsin75
Posts: 9970
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Select switch layer from preview?

Post by synthsin75 »

Once I finish this script, I'm sure Strider will excuse our detours.

I can't duplicate your problem. Ctrl+alt+right-click is only blocked by the visible part of a transparent image. Are you using any masking that would hide part of an image that would cover the unresponsive area? If you want to PM an example, with any transparent images needed, I can see if I can sort out the cause.
User avatar
Greenlaw
Posts: 9259
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Select switch layer from preview?

Post by Greenlaw »

Ah, mystery solved! it was the lower eyelids occluding the top of the mouth, which of course are not visible when the eyes are open because of a mask. Which is also why moving the Eyes Switch behind the Mouth Switch worked. Just something to keep in mind.

Funny, I was typing that just as you posted your tip, so you guessed it! Thanks for looking into this for me. :)
Last edited by Greenlaw on Thu May 05, 2016 12:36 am, edited 1 time in total.
User avatar
synthsin75
Posts: 9970
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Select switch layer from preview?

Post by synthsin75 »

Script update:

This is looking very good. This is what I have working so far:
  • With the tool and a switch layer selected, you can open an option dropdown to show the icons
  • You click an icon to select it and then click anywhere in the workspace to apply it
  • I've found about the largest I can make the icons is 64X64 pixels (the size of about a 3x3 square of 9 tool icons)
  • I'm probably going to give options for both 64x64 and 36x36 icons, but you'll have to regenerate the icons and restart AS to see the change
  • And I've already sorted out how to zoom the layer while generating the icons (so I don't need help there)
Immediate things to do:
Center the switch for icon generation
Test with multiple switch layers
See how this tool might work from a main bone layer, and add a switch select dropdown
User avatar
synthsin75
Posts: 9970
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Select switch layer from preview?

Post by synthsin75 »

Greenlaw wrote:Ah, mystery solved. it was the lower eyelids occluding the top of the mouth, which of course are not visible when the eyes are open because of a mask. Which is also why moving the Eyes Switch behind the Mouth Switch worked. Just something to keep in mind.

Funny, I was typing that just as you posted your tip, so you guessed it! Thanks for looking into this for me. :)
:D Glad to hear you got it sorted.
User avatar
strider2000
Posts: 506
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

Re: Select switch layer from preview?

Post by strider2000 »

synthsin75 wrote:This is looking very good.
Super cool :) ... and no I don't mind detours :) I'm always happy to help as I can with code or whatever, but it seems like you've already moved on. The biggest challenge for me is always calendar time :o My real job is nearing schedule deadline. Code freeze in one week and absolutely no room for missing the target :o I'm looking forward to the script!
User avatar
synthsin75
Posts: 9970
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Select switch layer from preview?

Post by synthsin75 »

strider2000 wrote:
synthsin75 wrote:This is looking very good.
Super cool :) ... and no I don't mind detours :) I'm always happy to help as I can with code or whatever, but it seems like you've already moved on. The biggest challenge for me is always calendar time :o My real job is nearing schedule deadline. Code freeze in one week and absolutely no room for missing the target :o I'm looking forward to the script!
Yeah, hopefully I didn't steal any of your steam on the idea. I just had an idea of how to implement it, and by the time I did a proof of concept, I had enough done to keep going.
Post Reply