Select Shape tool - See where in the order the dang shape is
Moderators: Víctor Paredes, Belgarath, slowtiger
Select Shape tool - See where in the order the dang shape is
Anigreator had asked for a "Layer" type window that would show you the shape order in a layer. Which I thought was a good idea. But wasn't quite as far as I wanted to go on a sunday morning, and probably left to LM anyway. So I decided to modify the Select Shape tool to add a box to show you what the number of the shape was in relation to its place in the shape pecking order. Should help keep track of the pesky things. I also modified the Raise and Lower Shape tools slightly so they'll keep the number updated properly.
The other thing I did was to add a bit. If you hold down <CTRL> and <ALT> and use the <UP> and <DOWN> arrow keys you can cycle up and down through the shapes, in depth order, selecting the shapes. This can give you a good idea of the stacking order pretty fast, and maybe help find those entirely hidden shapes without going nuts.
I made these as a straight replacement for the existing tool, so just back up the original ones (I don't think there's any problem with the mod, but it pays to be safe, the file names to look for are lm_select_shape.lua, lm_raise_shape.lua, and lm_lower_shape.lua), and unzip The File in you Moho>Scripts>Tool folder.
Hope that's somewhat useful. I may set it up to be a persistant window (kinda like the Bone Constraints pulldown in the Select Bone tool), but thats for another day. Also, another thing to keep in mind is that if you click on the Shapes button at the top of the Style window, it'll show you the list of shapes in the current layer, with their names and in their proper stacking order. Good for seeing the lay of the land, but I like the instant feedback. Cheers!
--Brian
The other thing I did was to add a bit. If you hold down <CTRL> and <ALT> and use the <UP> and <DOWN> arrow keys you can cycle up and down through the shapes, in depth order, selecting the shapes. This can give you a good idea of the stacking order pretty fast, and maybe help find those entirely hidden shapes without going nuts.
I made these as a straight replacement for the existing tool, so just back up the original ones (I don't think there's any problem with the mod, but it pays to be safe, the file names to look for are lm_select_shape.lua, lm_raise_shape.lua, and lm_lower_shape.lua), and unzip The File in you Moho>Scripts>Tool folder.
Hope that's somewhat useful. I may set it up to be a persistant window (kinda like the Bone Constraints pulldown in the Select Bone tool), but thats for another day. Also, another thing to keep in mind is that if you click on the Shapes button at the top of the Style window, it'll show you the list of shapes in the current layer, with their names and in their proper stacking order. Good for seeing the lay of the land, but I like the instant feedback. Cheers!
--Brian
-
- Posts: 36
- Joined: Tue Mar 22, 2005 11:47 am
-
- Posts: 246
- Joined: Thu Mar 10, 2005 7:29 pm
- Location: USA!
Would there be a way to make the tool actually raise and lower the shapes? Or maybe a seperate tool for this? I hate having to raise the shape, then go back to the menu and do that again and again. If I at least had a keyboard shortcut for that it would be great, but a tool that you could select the shape, then hit the Up and Down keys or something would be sweet.
-
- Posts: 36
- Joined: Tue Mar 22, 2005 11:47 am
Yup. Actually, that part it always did. There was no real good indication that it did do it on the screen when you are using the tool, and the arrow key shortcut info was kinda mixed in inside the help file, not really too well defined. I hadn't even realized it was there, only discovered it by peeking at the script and then went back to the help to search for it. So, the whole instructions, in a nutshell.
Click - you Select a Shape.
Hit <BACKSPACE> or <DELETE> and the currently selected shape goes away.
<ALT> click on a different shape while one is selected and the Style from the selected shape is copied to the one you click on.
<ALT><CTRL> click on a non-selected shape and its style is copied to the selected one.
Hit the Up or Down Arrow keys and the selected shape moves, well, up or down.
Hold <CTRL> while you hit the Arrow keys and you can move through any shapes that are lying under where the mouse is (or more properly where the mouse was the last time you clicked it, I think), even if some of them are completely hidden behind another shape.
Hold <SHIFT> while you work the Arrow keys, and the selected shape is moved to the top or bottom of the order.
Hold <CTRL> and <ALT> while you use the Arrow keys and you run up and down the shapes, in depth order, selecting each one in turn.
Also, keep in mind that the lower numbers that are displayed are towards the bottom, the higher towards the top. Not too hard to figure, but worth mentioning. I'll probably fold in the ability to create shapes if I get the urge. I dig those key combos. But first I want to make a usable bloody eyedropper kinda tool, which banging this out gave me a few ideas on. And a good call on moving the backups somewhere else. Forgot to mention that. Putting a subfolder in the Tools folder and putting the backups there works fine, and keeps 'em nearby in case something blows up. Later.
--Brian
Click - you Select a Shape.
Hit <BACKSPACE> or <DELETE> and the currently selected shape goes away.
<ALT> click on a different shape while one is selected and the Style from the selected shape is copied to the one you click on.
<ALT><CTRL> click on a non-selected shape and its style is copied to the selected one.
Hit the Up or Down Arrow keys and the selected shape moves, well, up or down.
Hold <CTRL> while you hit the Arrow keys and you can move through any shapes that are lying under where the mouse is (or more properly where the mouse was the last time you clicked it, I think), even if some of them are completely hidden behind another shape.
Hold <SHIFT> while you work the Arrow keys, and the selected shape is moved to the top or bottom of the order.
Hold <CTRL> and <ALT> while you use the Arrow keys and you run up and down the shapes, in depth order, selecting each one in turn.
Also, keep in mind that the lower numbers that are displayed are towards the bottom, the higher towards the top. Not too hard to figure, but worth mentioning. I'll probably fold in the ability to create shapes if I get the urge. I dig those key combos. But first I want to make a usable bloody eyedropper kinda tool, which banging this out gave me a few ideas on. And a good call on moving the backups somewhere else. Forgot to mention that. Putting a subfolder in the Tools folder and putting the backups there works fine, and keeps 'em nearby in case something blows up. Later.
--Brian
- Víctor Paredes
- Site Admin
- Posts: 5814
- Joined: Wed Jan 26, 2005 12:18 am
- Location: Barcelona/Chile
- Contact:
Yeah, I just rediscovered this tool recently and now couldn't live without it. Brian (7Feet) seems to have disappeared from these Forums so I thought I would post a little enhancement I made to it.
If you paste this message handler into Brian's modified lm_select_shape.lua tool, then you can instantly set the Shape Number of the selected shape by simply entering it in the text box and hitting enter. This has saved me having to always hold down the up or down arrow to position a shape where I want it in the stack.
Anyway, here it is, but note that this is my first attempt at hacking a lua script, so don't expect perfection.
-------------
If you paste this message handler into Brian's modified lm_select_shape.lua tool, then you can instantly set the Shape Number of the selected shape by simply entering it in the text box and hitting enter. This has saved me having to always hold down the up or down arrow to position a shape where I want it in the stack.
Anyway, here it is, but note that this is my first attempt at hacking a lua script, so don't expect perfection.
-------------
Code: Select all
function LM_SelectShape:HandleMessage(moho, view, msg)
local mesh = moho:Mesh()
if (mesh == nil) then
return
end
local NewShapeID = self.shapeNumberBox:IntValue()-1
-- Check NewShapeID against bounds
if NewShapeID < 0 then
NewShapeID = 0
elseif NewShapeID > mesh:CountShapes()-1 then
NewShapeID = mesh:CountShapes()-1
end
moho.document:PrepUndo(moho.layer)
moho.document:SetDirty()
-- Set shape to requested level
for i = 0, mesh:CountShapes() - 1 do
if (mesh:Shape(i).fSelected) then
if i > NewShapeID then
-- Need to lower selected shape
for j = 0, i - NewShapeID - 1 do
mesh:LowerShape(i-j, false)
end
elseif i < NewShapeID then
-- Need to raise selected shape
for j = 0, NewShapeID - i - 1 do
mesh:RaiseShape(i+j, false)
end
end
self.prevSelID = NewShapeID
LM_SelectShape:UpdateWidgets(moho)
break
end
end
moho:UpdateUI()
end
Thank you very much Rudiger!
I've just drop the portion of code inside the 7feet's modified LM select shape and it works fantastically good!
You want to put a shape A under/over a shape B just look the number of the shape B, then select shape A and enter that number minus/plus 1 and that's all!!!
Cool!
Thanks again.
-G
I've just drop the portion of code inside the 7feet's modified LM select shape and it works fantastically good!
You want to put a shape A under/over a shape B just look the number of the shape B, then select shape A and enter that number minus/plus 1 and that's all!!!
Cool!
Thanks again.
-G
This is FANTASTIC!!!!!!!!! YEEEEEHAAAAAA!!!!
I never would have thought of doing this!
I have incredibly complex layers in my projects with TONS of shapes. I have no problem figuring out where a shape needed to go but getting it there was a FREAKING NIGHTMARE!! I would sit there and click that dang button over and over and over and over.... and over and over... then check the order in the list... then click the button some more... until the shape was in the right spot.
It would be the same as if instead of flipping directly to page 356 in a book, you had to look at each page before getting there.
This could save literally hours of accumulated time spent working on complex vector layers. what could take me as much as 5 to ten minutes could be done in a few seconds.
Imagine a layer with bunches and bunches of repeated shapes, like a field of flowers or random objects!!!
This is an incredibly POWERFUL yet very simple addition to this tool!!!
-vern
I never would have thought of doing this!
I have incredibly complex layers in my projects with TONS of shapes. I have no problem figuring out where a shape needed to go but getting it there was a FREAKING NIGHTMARE!! I would sit there and click that dang button over and over and over and over.... and over and over... then check the order in the list... then click the button some more... until the shape was in the right spot.
It would be the same as if instead of flipping directly to page 356 in a book, you had to look at each page before getting there.
This could save literally hours of accumulated time spent working on complex vector layers. what could take me as much as 5 to ten minutes could be done in a few seconds.
Imagine a layer with bunches and bunches of repeated shapes, like a field of flowers or random objects!!!
This is an incredibly POWERFUL yet very simple addition to this tool!!!
-vern
Thanks Heyvern and Genete. Just glad to finally contribute after benefiting from the great scripts that you guys have written.
I often have characters with more than 500 shapes, and it really did get to the point where I would spend more time raising and lowering shapes than actually drawing. Now, if only I could work out to support multiple shapes at once. That would be sweet!!!!
I often have characters with more than 500 shapes, and it really did get to the point where I would spend more time raising and lowering shapes than actually drawing. Now, if only I could work out to support multiple shapes at once. That would be sweet!!!!
Hey Genete!
I just figured something out regarding shapes and names.
Apparently for some reason the shape name is a "userdata" and isn't really "readable" by the script interface. Also each time a file is opened this userdata "changes".
If you convert it to a string it is a series of numbers and letters. Each time you open the file that identification changes for each shape. However, the values remain constant through out a session in AS.
Couldn't that userdata value be used as an identifier for doing shape ordering? If you change the order that data stays the same. When the file is open the table reference could be created on frame 0 using the userdata.
The big problem is that you can't check the name or even if one exists. The name of a shape always returns the userdata value even if it is "empty".
But if you "matched up" the userdata identifier to a bone name in a table then you COULD keep track of shapes regardless of their order.
So if you moved shape "X" up six levels... you could still find "X" by using the bone name in the table and matching it to the userdata value that was converted to a string.
For instance bone "X" controls shape "X" order. When you change bone X to resort the table reference for the userdata is still stored with bone X. Later you change bone X again to change shape X's order. Bone X is still in the same spot in the table with a reference to shape X along with it. You can even store the level it is at.
You would have to make absolutely sure to go back to frame 0 to "reset" all the shapes to the original order when the file was opened. Otherwise the order would be permanently changed and the whole thing screwed up the next time the file was opened.
-vern
I just figured something out regarding shapes and names.
Apparently for some reason the shape name is a "userdata" and isn't really "readable" by the script interface. Also each time a file is opened this userdata "changes".
If you convert it to a string it is a series of numbers and letters. Each time you open the file that identification changes for each shape. However, the values remain constant through out a session in AS.
Couldn't that userdata value be used as an identifier for doing shape ordering? If you change the order that data stays the same. When the file is open the table reference could be created on frame 0 using the userdata.
The big problem is that you can't check the name or even if one exists. The name of a shape always returns the userdata value even if it is "empty".
But if you "matched up" the userdata identifier to a bone name in a table then you COULD keep track of shapes regardless of their order.
So if you moved shape "X" up six levels... you could still find "X" by using the bone name in the table and matching it to the userdata value that was converted to a string.
For instance bone "X" controls shape "X" order. When you change bone X to resort the table reference for the userdata is still stored with bone X. Later you change bone X again to change shape X's order. Bone X is still in the same spot in the table with a reference to shape X along with it. You can even store the level it is at.
You would have to make absolutely sure to go back to frame 0 to "reset" all the shapes to the original order when the file was opened. Otherwise the order would be permanently changed and the whole thing screwed up the next time the file was opened.
-vern
Well, it could be an improvement.
You can build your shapes - bones reference table everytime the embedded script is at frame 0 and not redo it when not at frame 0.
Cool.
But, ... would it allow do new things that cannot be done with sort_sahpes_by_bones embedded script?
That script works by now and I don't want to change it if no new feature is achieved. Want you?
-G
You can build your shapes - bones reference table everytime the embedded script is at frame 0 and not redo it when not at frame 0.
Cool.
But, ... would it allow do new things that cannot be done with sort_sahpes_by_bones embedded script?
That script works by now and I don't want to change it if no new feature is achieved. Want you?

-G
- funksmaname
- Posts: 3174
- Joined: Tue May 29, 2007 11:31 am
- Location: New Zealand