Notifications
Clear all

[Closed] spacewarp FFD box

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

18 Replies
 JHN

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

What i want is to make them animatable by maxscript, this is the thing i don’t know how to do.

weird… looks like you can’t

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.

No, I have to use the spacewarp version. It`s one of the requirements

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

It doesnt work. Ive 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???

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

thanks for all Zeboxx2, i’ll keep trying it too. If i find any solution, i’ll post it here.

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
  [color=Green]-- and so forth and so on through all 64 control points
  [/color]

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
 [color=#fffffe]	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[/color]
  	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

Page 1 / 2