I’ve been working away at this script for some time now, but I’m still very much in the process of trying to learn MaxScript so trying to build a rather complex script at the same time is just a tad challenging. :P
That being said completing this script will undoubtedly save me weeks or even months depending on the project.
The problem I’m currently having is trying to get the script to Auto Smooth editable poly objects to 45°
Here’s the code.
(I’ve also provided the entire script to give some better context as to what I’m working with)
-- This will apply the default 45° auto smooth to all selected objects
fn autosmooth45 tresh: = if selection.count == 0 then (messageBox "Select Some Objects!" title:"Warning" beep:off) else
(
local poAS = polyop.autoSmooth
local moAS = meshop.autosmooth
for o in selection where isKindOf o GeometryClass and not isKindOf o Targetobject do
(
if o.modifiers.count != 0 then (messageBox "Please collapse modifier stack!" title:"Warning" beep:off) else
(
case classof o of (
(Editable_Poly): (poAS o.autoSmoothThreshold ; update o)
(Editable_Mesh): (moAS o o.faces tresh ; update o)
)
)
)
)
For those of you who are curious I’m going to be using this script for creating content for a game called Killing Floor 2, more specifically porting maps from the first game (UE2) to the second game (UE3).
Currently I’m having to sort through thousands of objects and it’s taking me months to get the geometry into an acceptable state to be pushed into the KF2 SDK, so having this script will be a massive time saver. XD
By Steven_Oconnell · 2017-01-26
miauu · 2017-01-30