Im trying to create a script that turns your smoothing groups into material IDs. The problem is that when i use polyop.getFaceSmoothGroup it returns an unexpected integer that is different than the actual smoothing group making it hard to easily use that integer for my mat ID.
SG 1 returns 1.
SG 2 returns 2.
SG 3 returns 4.
SG 4 returns 8. and soo on. Anyone have a better way of using this data for mat IDs?
heres my code so far
( --Make sure it is an edit poly or edit mesh. on isEnabled return ( selection.count == 1 and classOf selection.baseobject == Editable_Poly ) on execute do ( --Switch to polygon mode. subobjectlevel = 4 --Make sure every poly has a smoothing group. If not return a pop up error screen. base_obj = $.baseobject num_faces = polyop.getNumFaces base_obj notfound = true for i in 1 to num_faces while notfound do ( face_SG = polyop.getFaceSmoothGroup base_obj i if face_SG == 0 do ( messagebox "Every face must have a smoothing group!" notfound = false ) ) --Create a subobject mat with the number of smoothing groups as the number of materials --Step through each material and assign a unique color to the diffuse slot. --Apply a matrial ID to each group of faces in the array based on what smoothing group they have. for i in 1 to num_faces do ( face_SGtoID = polyop.getFaceSmoothGroup base_obj i polyop.setFaceMatID base_obj i face_SGtoID ) ) )