Hi everyone,
I am new to max scripting and need help optimizing this script. Although this script works as intended I can't but help to think that there must be a better way. That is however beyond my skills to identify.
I wrote this script to check naming conventions.
1- go through everything in the scene
2- check the if the names are matching the given names i.e.(ch_*_A_*, Set_*_A_*, Prop_*_A_*, etc)
3- select everything that are not matching the giving names
4- isolate it
beforehand thank you all for helping a noob out.
/*
Version: v1.1
Purpose: Check scene for names:
CH_*_A_*
CH_*_S_*
CH_*_M_*
Set_*_A_*
Set_*_S_*
Set_*_M_*
Prop_*_A_*
Prop_*_S_*
Prop_*_M_*
Select and isolate everything that does not fall within the parameters
*/
macroScript NameChecker
category:"Custom Tools"
icon:#("enss_maintoolbar",1)
(
fn Check=
(
nameList = stringStream ""
-- putting things in arrays
local Array1 = $ch_*_a_* as array
local Array2 = $ch_*_s_* as array
local Array3 = $ch_*_m_* as array
local Array4 = $set_*_a_* as array
local Array5 = $set_*_s_* as array
local Array6 = $set_*_m_* as array
local Array7 = $prop_*_a_* as array
local Array8 = $prop_*_s_* as array
local Array9 = $prop_*_m_* as array
-- selecting arrays
select Array1
selectmore array2
selectmore array3
selectmore array4
selectmore array5
selectmore array6
selectmore array7
selectmore array8
selectmore array9
-- putting all selected into a new array
tarObj = selection as array
-- select everything in the scene, deselect everything in tarObj array and unhide selection
select $*
deselect tarObj
selection.ishidden = off
-- isolate selection
macros.run "Tools" "Isolate_Selection"
for o in selection do print (o.name as string) to:nameList
messageBox (nameList)
)
-- create GUI
rollout rollout_NameChecker "Name Checker " width:200
(
-- create button
group "Checks"
(
button squashBtn "Check Names!"
)
-- call on function check()
on squashBtn pressed do
(
check ()
)
)
createdialog rollout_NameChecker style:#(#style_titlebar,#Style_toolwindow,#style_sysmenu)
)
Anubis · 2013-01-10
miauu · 2013-01-09