Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography



Maxunderground news unavailable

-- Unknown property: "controller" in undefined <<
show user profile  FX
Does anyone know why I might be getting this error ?

Tried in 2010, 2014, and 2016 all throw up an undefined error.

Create 2 splines and an animated box, the box is supposed to pull the two splines together, I found it here:


http://forums.cgsociety.org/showthread.php?f=98&t=255514&page=2&pp=15




There's a link to the final script but it's a 404, so I have to go by the comments in the thread talking about a similar error, one suggests the formatting is getting broken by copying and pasting.

I modified the script with the new tread1[#object__line][#master][track].controller, but it still errors out.

2016 gives me "-- No ""get"" function for undefined <<"

2014 gives me "-- No ""put"" function for undefined <<"



I'm clueless how to fix it, can anyone suggest what's wrong ?

tia


--"Spline Zipper" created by Tyson Ibele, 2005.

global startTime = bezier_float()
global endTime = bezier_float()
global zip1
global tread1
global tread2

rollout zipper "Spline Zipper"
(
pickbutton spline1 "Select Spline Tread 1" width:150
pickbutton spline2 "Select Spline Tread 2" width:150
pickbutton zipper1 "Select Zipper" width:150
spinner in1 "Start Time: " type:#integer range:[-100000,100000,0] controller:startTime width:100
spinner out1 "End Time: " type:#integer range:[-100000,100000,100] controller:endTime width:100
checkbox help1 "Create Helpers" pos:[50,124]
button zip "Zip it up!" width:70 height:30

on spline1 picked obj do --get user to pick first spline
(
if canconvertto obj SplineShape then --only splines allowed
(
tread1 = obj
convertto tread1 SplineShape
spline1.text = tread1.name
)
else messagebox "Must be a shape object"
)
on spline2 picked obj do --get user to pick second spline
(
if canconvertto obj SplineShape then
(
convertto obj SplineShape
tread2 = obj
spline2.text = tread2.name
)
else messagebox "Must be a shape object"
)
on zipper1 picked obj do --get user to pick zipper object
(
zip1 = obj
zipper1.text = obj.name
if numkeys zip1.pos.controller == 0 then
(
messagebox "Note: You've selected an object with no positional keyframes, therefore no actual zipping will occur"
)
)
on zip pressed do
(
if (tread1 != undefined and tread2 != undefined and zip1 != undefined) and ((isdeleted tread1) != true and (isdeleted tread2) != true and (isdeleted zip1) != true) then
--the above statement checks to see if all necessary objects have been selected, and are available
(
if help1.checked == true then --if the helper checkbox is checked, make helpers
(
delete $*zip_* --delete previous helpers first
for k in 1 to (numknots tread1 1) do
(
ht1[k] = point name:("zip_l_point"+(k as string))
ht1[k].wireColor = blue
)
for k in 1 to (numknots tread2 1) do
(
ht2[k] = point name:("zip_r_point"+(k as string))
ht2[k].wireColor = green
)
)
count1 = 1 --reset counters
count2 = 1
zipStep = #() --reset zipper position cache
zipStep2 = #()
dumStep = #() --reset helper position cache
dumStep2 = #()

animateVertex tread1 #all --enable both spline's vertices to be animated
animateVertex tread2 #all
sliderTime = startTime.value --reset time slider

deleteKeys tread1 --delete all previous spline keyes, to avoid weird errors due to key overlaps
deleteKeys tread2

div1 = floor ((endTime.value-startTime.value)/(numknots tread1 1)) --calculate keying distance between separate spline vertices
div2 = floor ((endTime.value-startTime.value)/(numknots tread2 1))

for j in startTime.value to endTime.value by div1 do --key vertices of first spline
(
sliderTime = j
in coordsys tread1 (zipStep[count1] = zip1.pos) --cache position of box (using the spline's coordinate system), over time
in coordsys world (dumStep[count1] = zip1.pos)

setknottype tread1 1 count1 #smooth --convert current spline vertice to "smooth"
track = 3*(count1-1)+2 --get necessary controller track *thanks to Bobo for posting how to do this!*
key = addNewKey tread1[4][4][track].controller (j-(div1*2)) --set inital key for vertice
key = addNewKey tread1[4][4][track].controller (j) --set destination key for vertice
key.value = zipStep[count1] --set destination position for vertice (ie...its zipped position)

if help1.checked == true then --if the user wants helpers to be created, create them!
(
at time (j-(div1*2)) (ht1[count1].pos = (in coordsys world (getknotpoint tread1 1 count1)))
addNewKey ht1[count1].pos.controller (j-(div1*2))
with animate on
(
at time j (ht1[count1].pos = dumStep[count1])
)
)
count1 += 1 --increase counter (this counter is used to cycle through vertices, as well as to cycle through the zipper's position cache)
updateshape tread1
if count1 > (numknots tread1 1) then exit --exit when we've cycled through all available vertices
)

for j in startTime.value to endTime.value by div2 do --key vertices of second spline (same as above)
(
sliderTime = j
in coordsys tread2 (zipStep2[count2] = zip1.pos)
in coordsys world (dumStep2[count2] = zip1.pos)

setknottype tread2 1 count2 #smooth
track = 3*(count2-1)+2
key = addNewKey tread2[4][4][track].controller (j-(div2*2))
key = addNewKey tread2[4][4][track].controller (j)
key.value = zipStep2[count2]

if help1.checked == true then
(
at time (j-(div2*2)) (ht2[count2].pos = (in coordsys world (getknotpoint tread2 1 count2)))
addNewKey ht2[count2].pos.controller (j-(div2*2))
with animate on
(
at time j (ht2[count2].pos = dumStep2[count2])
)
)
count2 += 1
updateshape tread2
if count2 > (numknots tread2 1) then exit
)
sliderTime = startTime.value
)
else --the following statements check to see why the above script did not execute
(
if tread1 != undefined and tread2 != undefined and zip1 != undefined then
(
messagebox "One or more of your zipper objects has been deleted. Script cannot continue."
case of
(
(isdeleted tread1 == true): spline1.text = "Select Spline Tread 1"
(isdeleted tread2 == true): spline2.text = "Select Spline Tread 2"
(isdeleted zip1 == true): zipper1.text = "Select Zipper"
)
)
else
(
messagebox "You must select three zipper objects first!"
)
)
)
)
zipit=newrolloutfloater "Spline Zipper" 200 215 650 300
addrollout zipper zipit
endTime.value = 100
tread1 = undefined --clear out all three object variables, each time the script is run
tread2 = undefined
zip1 = undefined
ht1 = #()
ht2 = #()
read 72 times
8/10/2017 1:06:01 PM (last edit: 8/10/2017 1:07:18 PM)
#Maxforums IRC
Open chat window


Support Maxforums.org