Running scripts are slow - newbie 2005-05-23 - By Jeff McFall
Back Dabbling into some scripting stuff and I am surprised at the amount of time it seems to take to run these
Ive got a simple script that runs through about 1500 objects reading a texture location and applying a keyframe to a material, position and scale for each object.
It is taking about 7 minutes to run this which seems excessive to me. It is in VB. Would anyone have any recommendations as to how I could make this go a bit faster?
I have a dual 2.2 Ghz and 2 G ram
The script is based off of some code that I have pulled from other scripts and changed for the use I am looking for. There may be some very basic blunders in here as I am definitely a scritping novice. It does work however and Im satisfied with the results, would just like to avoid taking another coffee break each time I run it. All that coffee makes me nervous.
CreateImageClip " .... \VIDEO_ELEMENTS\Mosaic_test_mdb\Pictures\relief.pic"
SelectObj "Clips.relief_pic"
set oImageClip = Selection(0) set oImage = oImageClip.GetImage
for i = 1 to 1567
SelectObj("cube" & i)
' show where we are logmessage i
xPos = Selection(0).posX.Value yPos = Selection(0).posZ.Value
xImagepos = CInt(720 - (xPos*100)) yImagepos = CInt(540 - (yPos*100))
set oPixelColor = oImage.GetPixel (xImagepos , yImagepos) ApplyShader "Phong" SetKey obj & ".Material.Phong.Diffuse.red", 91 , oPixelColor.Red SetKey obj & ".Material.Phong.Diffuse.green", 91 , oPixelColor.Green SetKey obj & ".Material.Phong.Diffuse.blue", 91 , oPixelColor.Blue SetKey obj & ".Material.Phong.Ambient.red", 91 , oPixelColor.Blue SetKey obj & ".Material.Phong.Ambient.green", 91 , oPixelColor.Blue SetKey obj & ".Material.Phong.Ambient.blue", 91 , oPixelColor.Blue height = ((oPixelColor.Red + oPixelColor.blue + oPixelColor.green) * 1.5) size = (oPixelColor.Red + oPixelColor.blue + oPixelColor.green) SetKey obj & ".kine.local.posy", 91, height SetKey obj & ".kine.local.sclx", 91 , size SetKey obj & ".kine.local.scly", 91 , size SetKey obj & ".kine.local.sclz", 91 , size
next
Jeff McFall Video Communications & New Media 919 531 4775 jeff.mcfall@(protected)
> SAS...The Power to Know >
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|