macroScript materialSelected category:"Comet Cartoons" toolTip:"materialSelected: Brings up material editor with selected objects material in swatches" Icon:#("CometCartoons",17) ( -- materialSelected - -- By Michael B. Comet - http://www.comet-cartoons.com/ - comet@comet-cartoons.com -- Version 1.00 - 02-07-2002 -- objs = getCurrentSelection(); -- what is selected? max mtledit; -- Bring up the material editor -- First clear out all materials in there for i in 1 to 24 do ( matS = standardMaterial(); -- make a standard material up. matS.name = ("defaultMat"+(i as string)); setMeditMaterial i matS; ) slotcount = 1; doneMats = #(); -- Now put each objects material into the editor. for obj in objs do ( mat = obj.material; if (mat != undefined) then ( doneIt = findItem doneMats mat; if (doneIt == 0) then -- only do materials we haven't seen before yet. ( setMeditMaterial slotcount mat; slotcount += 1; idx = doneMats.count + 1; -- store for future checking doneMats[idx] = mat; ) ) if (slotcount > 24) then ( format "Warning...all 24 material slots have been used!"; break; ) ) medit.UpdateMtlEditorBrackets(); -- we need to do this sometimes...sigh. -- such as if the selected slot doesn't have a material from the -- selected objects...it won't "refresh" unless we move something -- or call this... ) -- end of macro