Notifications
Clear all
[Closed] ProOptimizer.VertexCount does not work in loop
Mar 28, 2017 4:58 am
Hi,
The following scripts assume there is a default sphere in the scene, add a ProOptimizer and set VertexCount and Calculate.
I managed to make it work in the none-loop version with an extra Calculate.
However, it still does not work in the loop.
VertexCount.ms:
max modify mode
obj = $Sphere001 -- Assume there is a sphere in the scene.
select obj
optMod = ProOptimizer()
addModifier obj optMod before:(obj.modifiers.count)
modPanel.setCurrentObject obj.modifiers[obj.modifiers.count] ui:true
optMod.Calculate = true -- Needs this.
optMod.VertexCount = 200
optMod.Calculate = true
VertexCountInLoop.ms:
max modify mode
for obj in $objects do
(
select obj
optMod = ProOptimizer()
addModifier obj optMod before:(obj.modifiers.count)
modPanel.setCurrentObject obj.modifiers[obj.modifiers.count] ui:true
optMod.Calculate = true
optMod.VertexCount = 200
optMod.Calculate = true
)
Thanks!
2 Replies
Mar 28, 2017 4:58 am
Try updating the screen just after you add the modifier. Sometimes it helps updating some internal data in some modifiers. There are different ways, you can use CompleteRedraw(), RedrawViews(), Select $, etc.
(
for obj in objects do
(
select obj
optMod = ProOptimizer()
addModifier obj optMod
optMod.Calculate = true
redrawviews()
optMod.VertexCount = 200
)
)