Untitled
unknown
plain_text
a year ago
1.5 kB
3
Indexable
fn resetXFormWithChildren node = ( -- Store parent and children local parentNode = node.parent local children = for child in node.children collect child -- Unlink from parent and children node.parent = undefined for child in children do child.parent = undefined -- Reset XForm ResetXForm node -- Relink children and parent for child in children do child.parent = node node.parent = parentNode ) fn hasWeirdXForm node = ( local rot = node.rotation local scale = node.scale -- Check for non-identity rotation if (rot.x != 0 or rot.y != 0 or rot.z != 0 or rot.w != 1) then return true -- Check for non-uniform scale if (scale.x != 1 or scale.y != 1 or scale.z != 1) then return true return false ) fn processHierarchy node = ( if (hasWeirdXForm node) then ( format "Resetting XForm for: %\n" node.name resetXFormWithChildren node ) -- Process children recursively for child in node.children do ( processHierarchy child ) ) fn main = ( local selectedNodes = selection as array if selectedNodes.count == 0 then ( messageBox "Please select at least one node to process." ) else ( for node in selectedNodes do ( processHierarchy node ) messageBox "Hierarchy processing complete!" ) ) main()
Editor is loading...
Leave a Comment