Message 1 of 16
Reset object and remove mesh normals?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a script that I use to reset objects, so all transforms and normals are removed from a mesh.
I've been using the code snippet below in Max 2021, which works fine. But it doesn't seem to work in 2024, the explicit normals aren't removed.
Does anyone know of a foolproof way to remove mesh normals from a mesh, that ideally doesn't require me to be in the modify panel, so I could use it even if the Max interface isn't active.
Alternatively, is there is another way to reset and object that I don't know of?
(
local myArray = getCurrentSelection()
for obj in myArray do (
convertTo obj PolyMeshObject
-- Adding a 'Mesh_Select' and disable it in rendering.
local newMeshSelect = Mesh_Select()
addModifier obj newMeshSelect
newMeshSelect.enabledInRenders = false
-- Add 2x Normal Modifiers on top.
addModifier obj (Normalmodifier())
addModifier obj (Normalmodifier())
-- The method I would like to avoid using
-- Requires the UI to be active in the Modify panel
local newEditNormals = Edit_Normals()
addModifier obj newEditNormals
select obj
local normCount = newEditNormals.EditNormalsMod.GetNumNormals()
local normArray = #{ 1..normCount }
newEditNormals.EditNormalsMod.SelLevel = #object -- Exit sub-object level
newEditNormals.EditNormalsMod.Reset selection:normArray -- Edit Normals Reset
-- ResetXForm with PreserverNormals off
-- Doesn't seem to make a difference
ResetXForm obj
obj.modifiers[1].PreserveNormals = false
convertTo obj PolyMeshObject
-- Create an empty object and attach the 'obj'
local tempSpline = line()
convertTo tempSpline PolyMeshObject
tempSpline.EditablePoly.attach obj tempSpline
convertTo tempSpline PolyMeshObject
)
)