magnet tool - radius preview ????

Wondering how to accomplish a certain animation task? Ask here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
AngryMonster
Posts: 95
Joined: Sun Apr 22, 2007 1:42 am
Location: Australia
Contact:

magnet tool - radius preview ????

Post by AngryMonster »

Hi

I love the magnet tool ... especially Fazek's one

But I wish I could see a preview of the magnet radius area before I click with the mouse....if you know what I mean? ... Like Photoshop and others - you can see a preview of your brush size as you hover around.

Does anyone know if this exists ... or if anyone as scripted something like this? (hint, hint :wink:)

Thanks
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

This is not a script solution but it would help you:

You know that fazek's magnet tool only works with selected points. You can apply the magnet over not selected points to see the magnet radius. Then when happy apply the points to the selected ones. Select only one point to see the result.

Alternatively you can use my embedded script "Freeze points". It would allow apply any tool over them without modifying the points. You can unfreeze the points easily with the same tool. Watch my signature.

Don't miss the "Set mirror" options in magnet tool. They're incredible!

-G
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

I've been working on a mirror bone translation tool and used Fazeks mirrored points/magnet tool as my "inspiration"... Translation: I stole a bunch of his code. ;) (this mirror bones tool script is almost done. I should be posting it soon in my scripts thread).

I was using the big circle thingie from Fazek's magnet script in my mirror bones tool just so I could see the spot on the "other side" it was hitting for testing purposes. Very handy but unnecessary for the tool itself.

I have learned a ton of stuff about that whole "drawing" on the screen thing with tool scripts. It's great but also limited. Sad to say I can't draw to the screen with a layer script like I had hoped... dagnabbit that is frustrating. ;)

For the magnet tool radius I think a type of "preview" could be done but the problem is that if you don't actually click the mouse on the screen there is no location for the preview to show up. There is no way to track the mouse without clicking on the screen. The scripting only allows for click tracking (mousedown) it doesn't track "hovering".

Another option would be to show the preview at the "center" of the selected points (if any).

Not a perfect solution but at least it won't lead to moving the whole darn mesh in one go by mistake (Yes! I do know EXACTLY what you mean! ;) ). I set the radius really really really small before even using the tool and I still have to "undo" at least once because I can't see it.

My thought would be to add a feint transparent circle outline of the brush (instead of filled) at the center of the view before clicking. Then when you click it would fill in... or actually I could just leave the brush area an outline only so it wouldn't hide the mesh area so much.

I will see how to incorporate this on my own since Fazek hasn't posted in a very long time. Fazek if you read this and want to do it your own let me know. I will only add just a teeny tiny bit of code so my version will barely be a big change. I would just add change the version number and maybe add my name as a modification. I don't really care that much about the credit. I've learned so much just from looking at that script.

-vern
User avatar
AngryMonster
Posts: 95
Joined: Sun Apr 22, 2007 1:42 am
Location: Australia
Contact:

Post by AngryMonster »

Good ideas Genete! ..thanks ...great tuts aswell


Heyvern ... hmm i see the problem ...no hover tracking

Please excuse this next question, I am by no means a techo!...

Is there away to change the actual mouse pointer icon .. like it changes with various tools ... and maybe update its icon when ever you change the magnet radius .... :shock: ?
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

No, unfortunately you can't change the cursor icon via scripting. It is "static". That would be an interesting idea.

The radius preview I solution I suggested above would update as the radius is changed though if that helps. Remember you can't track mouse movements but you can track any other changes to settings as they happen.

-vern
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Here's my new version of Fazek's magnet tool with radius preview:

http://www.lowrestv.com/moho_stuff/scri ... magnet.lua

The best I could come up with was to have the preview show up as a black outline in the center of the point selection group. If no points are selected it just shows up in the center of the layer.

I deleted a... chunk of code that... er... seemed important (Fazek put it in... he must have thought it was important) but apparently wasn't needed since it was an "if then" kind of thing that was redundant. I tested it and it seems to work okay... you may want to give it a good workout though.

Let me know if you want to change the color, thickness or transparency of the circle... it might be hard to see on really dark backgrounds. I haven't figured out a way to make these drawn things "reverse" out of the back ground "dynamically" the way cursors do in other programs. I think there is a way to do it but I'm too lazy at the moment to peck around for it. ;)

-vern
User avatar
AngryMonster
Posts: 95
Joined: Sun Apr 22, 2007 1:42 am
Location: Australia
Contact:

Post by AngryMonster »

holly s!@#...'speedy gonzalez'

that was quick Heyvern ... and awesome!

This is truly great!... This tool is going to be so much cooler to use... no more mucking around.

Thanks Heyvern

and yeah ... thin red line might work nice? ... might be clearer in light and dark scenes


:D :D :D :D :D :D
User avatar
jahnocli
Posts: 3471
Joined: Fri Oct 29, 2004 2:13 pm
Location: UK

Post by jahnocli »

I haven't figured out a way to make these drawn things "reverse" out of the back ground "dynamically" the way cursors do in other programs...
I don't know if this helps (you might know this already) but this "reversing out" is an example of XOR'ing the foreground with the background...
You can't have everything. Where would you put it?
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

I think I have a way to "reverse" the preview. AS doesn't have any way to reverse the drawn shape colors based on the pixels on the screen. There is now way to really check what RGB value is present on the screen. You can check for either "all white" or "Not all white" and that's it.

What I could do is make the preview stroke really thin (1 pixel) and red with a thicker white stroke behind it (3 pixels). The preview will show on dark or light colored backgrounds this way. This is how the cursor png files were created, with a white stroke around the black of the cursor art on a transparent background.

I was testing with a file that had a red fill and the stupid preview and lines kept vanishing that is why I used black for the preview. I know this wouldn't be a "standard" situation but I felt it would be a shame to punish people using red. ;)

-vern
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

I updated the link above to the tool script. You can just replace it.

Here is a screen grab of the preview circle color:

Image

It consists of two strokes with antialiasing. The outer stroke is white at 50% transparency. The inner stroke is black at 50% transparency.

I think this should cover nearly any combination of colors under it so it will always be visible.

-vern
Post Reply