Script idea for magnet mod: relax

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
funksmaname
Posts: 3174
Joined: Tue May 29, 2007 11:31 am
Location: New Zealand

Script idea for magnet mod: relax

Post by funksmaname »

Hey, just messing with mesh warp and thought it would be cool if there was a way to 'relax' magnet edits towards points position at a different frame (initially, frame 0 position, but maybe could be set by one of the timline markers or something?)

Similar to when you use the liquify tool in photoshop, you can 'relax' your edits so they aren't so extreme - strength could be pen pressure controlled too?

Just a passing thought, could be great for working with meshes... don't know how difficult it would be...?
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Re: Script idea for magnet mod: relax

Post by chucky »

Many uv editors for 3d use tools like relax to ease out overlaps and bunching. It would be a perfect magnet type addition to the moho toolset.
Breinmeester
Posts: 303
Joined: Thu May 13, 2010 2:01 pm

Re: Script idea for magnet mod: relax

Post by Breinmeester »

I've modifications to the magnet tool on my to-do list. I don't fully grasp the idea yet. Can you explain a little further?
User avatar
funksmaname
Posts: 3174
Joined: Tue May 29, 2007 11:31 am
Location: New Zealand

Re: Script idea for magnet mod: relax

Post by funksmaname »

w00t!

Well, say you smoosh some points about with the magnet tool, the only ways to unsmoosh them is either to continue using the magnet tool and pulling things back (often creating more of a smoosh than before), or copying their previous position from a key. What you might want to do is just 'relax' your smooshing - so by 'rubbing' an area with the magnet tool and a mod key the points slowly ease back to the position they had at the previous keyframe, you could then 'ease' different parts of your smoosh to get the effect you want with more control as you can target a small or big area to relax the movement...

hope this made more sense - please let me know if still confused and I'll try to simplify my explanation further (or record a video explanation)
User avatar
synthsin75
Posts: 9935
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Script idea for magnet mod: relax

Post by synthsin75 »

Personally, I think what we need is a value to control the magnet influence drop-off. We could then get sharper or more relaxed drop-off. Maybe that would help not get bunched points in the first place?
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Re: Script idea for magnet mod: relax

Post by chucky »

Sure Wes, agreed but it's still nice to get out of problems when they occur. I thought I'd actually requested the relax feature months ago, or at least suggested somewhere in Lenny's or Mantis.
Aah here it was
viewtopic.php?f=18&t=29378&p=166216&hilit=mesh#p166216
dkwroot
Posts: 677
Joined: Thu May 02, 2013 6:56 am
Location: USA
Contact:

Re: Script idea for magnet mod: relax

Post by dkwroot »

This sounds like it would be really useful for warp cages. I have a rough idea about how to do this.

I think you would have to find the vector positions of every point on the previous keyframe. You would then subtract the current vector position of a point by it's previous vector position to get the position change (Vec_change).

When the user brushes over a point, the pen pressure should gradually add to a value 'D'. The value D will be clamped to a range of 0 to 1.

When the user lifts the pen, the program would calculate each vector position like this:
VecPos = VecPos - Vec_change * D

where VecPos = Current Position of a Vector, Vec_Change = the difference between the vectors current position and the previous keyframe position, D = pen strength

EDIT:
I created a relax points tool. It's not the magnet tool improvement you wanted, but it gets the job done. viewtopic.php?f=12&t=30542
Post Reply