mrproxy creation

I´m trying to develop a script, that generates mrproxies from selected objects, but the script generates only the first object and then stops..

start_value = 0
end_value = 10
for i in selection do
(
mypath = "D://temp//"
myfile = mypath + i.name as string + "_.mib"
myProxy = mr_proxy()
myProxy.srcgeometry = i
-- until now the script works fine
myProxy.writeProxy i myfile replace:false animation: true zoom: true start: start_value end: end_value
-- generates exactly one mrproxy and then stops
)

I would really appreciate your help...

thanks in advance.
Andy.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
andy_alesik's picture

Thanks guys... you´re

Thanks guys... you´re really great... The script is now burning like hell.. I also found another script by google that is doing exactly the same with much more code inside and unfortunately not for animation purposes... that script is also using an array inside the for-loop... now I´m getting the idea...

My next step would be to make a small interface and upload that to scriptspot... Thank you very much for your help..

Marco Brunetta's picture

Lol, we even used the same

Lol, we even used the same variable name.... oh well, great minds think alike I guess =D

le1setreter's picture

ups, marco has been faster.

ups, marco has been faster. yes, hes right.

le1setreter's picture

looks like the selection is

looks like the selection is gone(deselected) after writing proxy, so store ypur selection into array at start:

start_value = 0
end_value = 10
-- createt array for "saving" the selection
mySelection = selection as array
--looping through selection array
for i=1 to mySelection.count do
(
mypath = "D://temp//"
myfile = mypath+mySelection[i].name as string+"_.mib"
myProxy = mr_proxy()
myProxy.srcgeometry = mySelection[i]
myProxy.writeProxy mySelection[i] myfile replace:false animation: true zoom: true start: start_value end: end_value
)
Marco Brunetta's picture

Maybe one of the steps

Maybe one of the steps alters the selection, thus screwing up the FOR loop. Try storing the selection in an array, and the loop in there.

local mySelection = selection as array
FOR i in mySelection DO
(
myPath = "D://temp//"

etc etc

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.