How do I get a Space Warp by Binding?

MAXScript FAQ > Working With Scene Nodes > How do I get a Space Warp by Binding?

A user asked:

I created an object and a Conform space warp. I used bindSpaceWarp to bind the object to the space warp. After doing this many times, I want to know "Which space warp was object A assigned to?"

Answer:

You can explore the dependencies of existing space warps in the scene to filter the one that is affecting your object:

EXAMPLE

fn getSpaceWarpByBinding theBinding =
(
  --Loop through all space warps in the scene
  for s in SpaceWarps do
  (
    --Loop through all dependents of the current space warp
    --If the space warp is dependent on the supplied binding, return it!
    for o in refs.dependents s where o == theBinding do returns
  )--end s loop
)--end fn
 
--Example Usage:
s = sphere()
theSW = getSpaceWarpByBinding $Sphere001.modifiers[1]

See Also