ScriptSpot home

Forum topic · Scripts Wanted

script speed is not good

By dussla · 2013-05-21

Description

mysel = selection as array
for obj in selection do obj.layer.select true
$.ishidden = true
mysel.ishidden = false

in big scene , speed is very slow
is that good idea ?

Comments (7)
miauu

Use with redraw off


with redraw off
(
-- code here.
)

or use disableSceneredraw()/enbleSceneRedraw()

Reply to miauu
Branko Živković

...hide unselected nodes in the own layer

Yup. As Kostadin said "with redraw off (/*...your code...*/)"

layNames = #()
for o in selection do appendIfUnique layNames o.layer.name
with redraw off
(
for i = 1 to layNames.count do
(
(LayerManager.getLayerFromName layNames[i]).nodes &theNodes
hide (for o = 1 to theNodes.count where not theNodes[o].isSelected collect theNodes[o])
)
free layNames
)

Reply to dussla
Branko Živković

If you have problem then change 2nd line to

for o in selection where finditem layNames o.layer.name == 0 do append layNames o.layer.name

Reply to Branko Živković
Branko Živković

wow man ... max 9

I did not know anything about mxs when I used this version. Maxscript is changed a lot since max9. You will have more problems with newer code.

Hey, Branko, if I remember correctly for CheckMate tools contest(TurboSquid), one of the requirements was the tools to support max7. :)
Max 9 with AVG extension is good enough.