Notifications
Clear all
[Closed] Script fails when applied to multiple objects
Feb 22, 2013 2:20 pm
I made a script to automate some manual normal adjustments I regularly have to do to a lot of objects. It works fine with a single object selected but for some reason it fails as soon as more then one object is selected.
The script is as follows:
macroscript Flatsmoothinator category:"Arnage"
(
on execute do
(
face = #{}
normals = #{}
for i in selection where iskindof i Editable_Poly do
(
addModifier i (Edit_Normals())
for j = 1 to i.numfaces do
(
sGroups = polyop.getFaceSmoothGroup i j
if (bit.get sGroups 32) do
(
face[j] = true
i.Edit_Normals.ConvertFaceSelection face normals
i.Edit_Normals.Average selection:normals
face[j] = false
)
)
)
)
)
The problem seems to be related to the “i.Edit_Normals.ConvertFaceSelection face normals” line. When the script is executed on multiple objects both i and the face bitarray contain the correct object and face, however nothing is written into the normals bitarray. If the same thing is executed with only one object selected, exactly the same i and face input suddenly do produce a correct bitarray in normals.
Any idea what could cause this?