PDA

View Full Version : spacewarp FFD box


nasersolona
01-19-2009, 04:31 PM
I need to acces the position of an SPACEWARP FFD BOX, i know that firs of all i have to set animatable this points, but i don't know how to do it by script.

once done i can access it by: $FFD01[4][8][1].controller.value, but i need to know how to asign $FFD01[4][8][1] a controller

anyone knows???

thanks

JHN
01-19-2009, 05:53 PM
For example m(when they are all animateable offcourse):

$FFD01[4][8][1].controller = (point3_script())


You can directly assign a controller to a points controller property. Be aware the point don't move in world space, but in obj space with value from 0 to 1 some additional math is needed when you want to connect them too world space dummies for example... if that's what you want offcourse...

-Johan

nasersolona
01-19-2009, 09:38 PM
What i want is to make them animatable by maxscript, this is the thing i don't know how to do.

ZeBoxx2
01-19-2009, 09:50 PM
weird.. looks like you can't


The number of control points in a SpaceFFDBox created by MAXScript is always 4x4x4.

There is no method for assigning controllers to the FFD control points, nor is there a method for assigning the number or accessing the number of Length, Width, and Height points using MAXScript in 3ds Max.


and indeed - 'animateVertex <node/modifier> <index>' and animateAll <node/modifier> do zilch.

can you use the modifier version instead of the spacewarp?

Edit: .. the only other workaround I can think of is for you to create a few FFD cages you'd typically use, animate those manually, save them to a sort of 'animated FFD cages' file, and merge the one you need from that file in your script.

nasersolona
01-19-2009, 09:55 PM
No, I have to use the spacewarp version. It`s one of the requirements

ZeBoxx2
01-19-2009, 09:57 PM
actually, I guess you could mimic a manual animate...


-- THE BELOW CODE DOES NOT WORK, leaving for posterity to ponder "why not?"
-- select your FFD cage spacewarp here
subObjectLevel = 1
max select all
with animate on at time (sliderTime+1) ( move $ [0,0,0] )
-- clean up the keys here
-- THE ABOVE CODE DOES NOT WORK


Edit: scratch that. *shakes fist*

nasersolona
01-19-2009, 10:08 PM
It doesn`t work. I`ve tryed to execute it and this code generates two keys, one in frame 0 ando other in frame 1, but it doesn't make the points animatable. Any idea of why????

ZeBoxx2
01-19-2009, 10:53 PM
it doesn't make the points animatable. Any idea of why????
yes - it ends up moving the node, not the control points.. *sigh*

anyway - think I've got something, but it's the usual scarycode. 'll post once I've got it in a function

nasersolona
01-19-2009, 10:57 PM
thanks for all Zeboxx2, i'll keep trying it too. If i find any solution, i'll post it here.

ZeBoxx2
01-19-2009, 11:16 PM
dang there's gotta be easier ways to do this...

maybe making 'move' work on whatever the actual active selection is... or making animateVertex work with the spacewarps...or..

anyway.

sample usage:

myObj = SpaceFFDBox()
$FFD_box__4x4x4:FFD01 @ [0.000000,0.000000,0.000000]
showProperties myObj
.dispLattice (Lattice) : boolean
.dispSource (Source_Volume) : boolean
.deformType : integer
.falloff : float
.tension : float
.continuity : float
.length : worldUnits
.width : worldUnits
.height : worldUnits
false
animateFFDSpaceWarp myObj
-- some flickering later
OK
showProperties myObj
.dispLattice (Lattice) : boolean
.dispSource (Source_Volume) : boolean
.deformType : integer
.falloff : float
.tension : float
.continuity : float
.length : worldUnits
.width : worldUnits
.height : worldUnits
.Control_Point_1 : point3
.Control_Point_2 : point3
.Control_Point_3 : point3
-- and so forth and so on through all 64 control points


Function animateFFDSpaceWarp:

fn animateFFDSpaceWarp o = (
-- defines
-- user interaction windows message
local WM_USER = 1024
-- changing a spinner message
local CC_SPINNER_CHANGE = WM_USER + 600

-- select the spacewarp
select o

-- change the command panel to modify mode
max modify mode

-- go to the control points sub-object level
subObjectLevel = 1

-- select all the control points
max select all

-- go into move transform mode
max move

-- open the 'transform type-in' dialog
max tti

-- find the tti dialog
local desktopHWND = windows.getDesktopHWND()
local desktopChildren = windows.getChildrenHWND desktopHWND
local tti
for child in desktopChildren do (
if (child[5] == "Move Transform Type-In") then (
tti = child
exit
)
)
if (tti == undefined) then ( return false )

-- get the tti's handle
local ttiHWND = tti[1]

-- now find a spinner therein (don't care much which)
local ttiChildren = windows.getChildrenHWND ttiHWND
local anySpinner
for child in ttiChildren do (
if (child[4] == "SpinnerControl") then ( anySpinner = child; exit )
)
if (anySpinner == undefined) then ( return false )

-- get the spinner's handle
local anySpinnerHWND = anySpinner[1]
-- get the spinner's dialog id
local anySpinnerDlgID = uiaccessor.GetWindowResourceID anySpinnerHWND
-- get the spinner's parent dialog
local anySpinnerParent = uiaccessor.getparentwindow anySpinnerHWND

-- go into animation (auto-key) mode
animButtonState = true

-- make sure we're not on frame zero
-- store the old frame first
local oldSliderTime = sliderTime
-- now change it
sliderTime = 1

-- now let's make max think we changed the spinner's value.
-- The SDK says there's an option to indicate that we're dragging the spinner
-- we're not, so ignore any of that (bit.shift 1 16) stuff we'd otherwise have to add
windows.sendmessage anySpinnerParent CC_SPINNER_CHANGE anySpinnerDlgID anySpinnerHWND

-- with any luck, the points are now animated

-- restore the frame we're on
sliderTime = oldSliderTime

-- go out of animation (auto-key) mode
animButtonState = false

-- close that tti dialog
UIAccessor.CloseDialog ttiHWND

-- done
OK
)


Edit: slidertime fixes

nasersolona
01-20-2009, 12:02 AM
does it works to you??? i still have the points unanimatable after executing your code. Maybe i'm doing something wrong. thanks anyway for your time. thanks.

ZeBoxx2
01-20-2009, 12:58 AM
try again, the function's code has been updated.

I must have been on a non-zero frame when I tested it.. fresh maxstart did fail it, took me a moment to realize it was because I was on frame zero. *mutter* :)
A quick poking at sliderTime fixes things

nasersolona
01-20-2009, 08:06 AM
hey! it works perfectly now. Thank you so much ZeBoxx2, you've helped me a lot in my job.

I hope this help more people here too.

thanks again.

nasersolona
01-20-2009, 08:09 AM
MAXSCRIPT HELP SAYS:

The number of control points in a SpaceFFDBox created by MAXScript is always 4x4x4.

There is no method for assigning controllers to the FFD control points, nor is there a method for assigning the number or accessing the number of Length, Width, and Height points using MAXScript in 3ds Max.


How can i create a SpaceFFDBox of 2x2x2 by maxscript?. this is starting to exasperate me.

ZeBoxx2
01-20-2009, 10:25 AM
hehe.. figured you might ask that next.

'fraid the news isn't good on that one - there's no UI mongering that you can do from within 3ds Max to change the number of points, as far as I could ever figure out; the basic problem being that you can't set the value of the spinner in any way.

So, you're back to...
A. save a library of FFD spacewarps with the number of segments you'd use, animate those, and merge the appropriate one from that library when needed
B. use the modifier (you already mentioned it's not an option, though)
C. get somebody to add the appropriate maxscript access to the FFDmod source and compile that for you (anybody else that would need to work with your scripts would need to have that plugin as well)
D. use an external UI-mongering tool to set the spinner values.

I'm listing A first because that's still the way I'd go about it.

nasersolona
01-20-2009, 10:38 AM
thanks, you are right, i think i'm going to save a library to merge FFDs each time i need one. In fact we cant use the modifier beacuse an internal point cache tool problem.

thanks again for your help.

IkerCLoN
01-21-2009, 03:54 PM
I thought I answered in this thread... weird... :)

There is no method for assigning controllers to the FFD control points, nor is there a method for assigning the number or accessing the number of Length, Width, and Height points using MAXScript in 3ds Max.

I was working with this kind of things last week, making some rolling balls to deform via FFD Space Warp. I was using math for converting from FFD CP local space to world space, so I could use some controllers to drive the points...

... until a coleague at the company asked me 'why don't you use Skin modifier for that?'. And, wow, it worked: skin the controls (i had spheres in the corners) to the FFD, and done. Fast, reliable, and it's a lot easier to animate 'outside' the FFD Space Warp than inside.

nasersolona
01-21-2009, 10:04 PM
thanks Iker for the idea, i'll try this if in the future i've got to animate an FFD, but now it's not the case. I needed to set controllers to the control points because i wanted to access the position of each one of them by maxscript.

I've bee doing a tool with some functions to copy one FFD form to another, invert the control points, save a FFD control points positions to a file and then load them into a new one....

This was because here in the studio we are creating the tecnology to our productions, and we'v decided to use FFD with the character eyes and with the head, and it's very useful to have a tool to save the information in a file to rebuild this part of the rig if something fails.

I've been watching your autorig script and it looks very good and useful, i'm making one autorig too.

Congratulations for ‘The missing Lynx’, i've seen it and think is a great film, but you were at Ilion animation studios before, weren't you?

IkerCLoN
01-23-2009, 02:35 PM
What you're trying to achieve sounds nice :-) Hope you make it work soon!

Yep, I worked at Ilion for almost two years. After that, worked a little on the 'Lynx' movie and then I started to develop a new animation system from scratch. That's what we're using in the short-film we're working on, and on our next movie as well.

Since you are working on an autorig too, maybe we can be in touch and exchange some ideas or impressions. Not a lot of MAX riggers to chat with... ;)

Thanks for your kind compliment ;-)

CGTalk Moderation
01-23-2009, 02:35 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.