macroScript VrayColorMapTool Category:"Klaas" Buttontext:"VrayColorMapTool" ( /* VrayColorMap tool by Klaas Nienhuis Rotterdam, The Netherlands version 1.0 2008-04-03 updated 1.1 2008-06-11 now supports the tiles texturemap as far as maxscript allows added support for vrayLight material This script can be used to convert scenes from normal workflow to gamma oriented workflow replaces diffuse flat colors with VrayColor maps replaces VrayColor maps in the diffuse by plain diffuse colors is rather large for it's use */ ----------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------VARIABLES ----------------------------------------------------------------------------------------------------------------------------------------- local colorNameArr = #() --an array of propertynames flat colors taken from a textureMap local texNameArr = #() --an array of propertynames of corresponding texturemaps local enabledNameArr = #() --an array of propertynames of values corresponding to the textureMaps local LVMaxItems = #() --array containing the max-items corresponding to the listview items, either materials or objects ----------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------MATERIAL PROPERTIES ----------------------------------------------------------------------------------------------------------------------------------------- --structure contains the propertynames from different types of materials --a lot of materials are composites and hold no diffuse properties of their own, hence they're not listed here struct materialProperties ( --vray material function fn_vrayMaterialProp = ( --list the properties to be searched for colorNameArr = #("diffuse") texNameArr = #("texmap_diffuse") enabledNameArr = #("texmap_diffuse_on") ), --standard material, architectural,raytraceMaterial function fn_standardMaterialProp = ( --list the properties to be searched for colorNameArr = #("diffuse") texNameArr = #("diffuseMap") enabledNameArr = #("diffuseMapEnable") ), --InkNPaint material has three diffuse colors function fn_inkNPaintMaterialProp = ( --list the properties to be searched for colorNameArr = #("paint_color","shade_color","spec_color") texNameArr = #("paint_map","shade_color_map","Spec__Map") enabledNameArr = #("paint_map_on","shade_color_map_on","spec_map_on") ), --VrayLightmaterial function fn_VrayLightMaterialProp = ( --list the properties to be searched for colorNameArr = #("color") texNameArr = #("texmap") enabledNameArr = #("texmap_on") ) ) --determine the type of material and run the appropriate function which loads the propertynames for the diffuse channel function fn_loadMaterialPropertyNames inputMaterial = ( m = classof inputMaterial case m of ( Architectural:materialProperties.fn_standardMaterialProp() RaytraceMaterial:materialProperties.fn_standardMaterialProp() standardMaterial:materialProperties.fn_standardMaterialProp() VrayMtl:materialProperties.fn_vrayMaterialProp() InkNPaint:materialProperties.fn_inkNPaintMaterialProp() VrayLightMtl:materialProperties.fn_VrayLightMaterialProp() default:undefined ) ) ----------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------TEXTUREMAP PROPERTIES ----------------------------------------------------------------------------------------------------------------------------------------- --structure contains the propertynames from different types of maps --the bricks (or tiles) map uses the value "absent" for the enabled array. this value is a placeholder and will not throw an error struct textureMapProperties ( --cellular function fn_cellularProp = ( --list the properties to be searched for colorNameArr = #("cellColor","divColor1","divColor2") texNameArr = #("cellMap", "divMap1", "divMap2") enabledNameArr = #("map1Enabled","map2Enabled","map3Enabled") ), --checker, fallof, marble, mix, noise, RGB multiply function fn_generic2SlotProp = ( --list the properties to be searched for colorNameArr = #("color_1","color_2") texNameArr = #("map_1", "map_2") enabledNameArr = #("map_1_enable","map_2_enable") ), --gradient, particle age function fn_generic3SlotProp = ( --list the properties to be searched for colorNameArr = #("color_1","color_2","color_3") texNameArr = #("map_1", "map_2","map_3") enabledNameArr = #("map_1_enable","map_2_enable","map_3_enable") ), --perlin marble, wood,dent function fn_anotherGeneric2SlotProp = ( --list the properties to be searched for colorNameArr = #("color_1","color_2") texNameArr = #("map1", "map2") enabledNameArr = #("map1enabled","map2enabled") ), --smoke, speckle, splat, stucco, water function fn_yetAnotherGeneric2SlotProp = ( --list the properties to be searched for colorNameArr = #("color_1","color_2") texNameArr = #("map1", "map2") enabledNameArr = #("map1_on","map2_on") ), --swirl function fn_swirlProp = ( --list the properties to be searched for colorNameArr = #("base","swirl") texNameArr = #("base_map", "swirl_map") enabledNameArr = #("absent","absent")--problematic ), --tiles function fn_bricksProp = ( --list the properties to be searched for colorNameArr = #("brick_color","mortar_color") texNameArr = #("bricks", "mortar") enabledNameArr = #("absent","absent")--problematic ), /* --gradient ramp function fn_gradientRampProp inputMap= ( flagReference = inputMap.gradientRamp colorNameArr = for o = 1 to flagreference.numSubs collect (getSubAnim flagReference o).name for o = colorNameArr.count to 1 by -1 where colorNameArr[o] == "" do deleteItem colorNameArr o the texture is the 6th subanim of the flag. this subanim only exists if there actually is a texturemap. else it's undefined the name of this map is a bit fucked up there's no enabled flag. i wonder if it's possible to insert a map where there's no map inserted yet. maybe ask on scriptspot? --list the properties to be searched for texNameArr = #("map_1", "map_2") enabledNameArr = #("map_1_enable","map_2_enable") ), */ --vraycolor function fn_vraycolorProp = ( --list the properties to be searched for colorNameArr = #("color") texNameArr = #() enabledNameArr = #() ) ) --test what kind of texturemap we're dealing with and load the appropriate property-arrays function fn_loadTexturemapPropertyNames inputMap = ( m = classof inputMap case m of ( --standard max texturemaps bitmapTexture: false Camera_Map_Per_Pixel: false --this map holds no color swatches cellular: textureMapProperties.fn_cellularProp() checker: textureMapProperties.fn_generic2SlotProp() combustion: false CompositeTexturemap: false --this map holds no color swatches dent: textureMapProperties.fn_anotherGeneric2SlotProp() falloff: textureMapProperties.fn_generic2SlotProp() flat_mirror: false gradient: textureMapProperties.fn_generic3SlotProp() --gradient_Ramp:textureMapProperties.fn_gradientRampProp inputMap marble: textureMapProperties.fn_generic2SlotProp() mask: false --this map holds no color swatches mix: textureMapProperties.fn_generic2SlotProp() noise: textureMapProperties.fn_generic2SlotProp() normal_bump: false --this map holds no color swatches output: false --this map holds no color swatches particle_age: textureMapProperties.fn_generic3SlotProp() particle_mblur: false --this map holds no texturemap slots perlin_marble: textureMapProperties.fn_anotherGeneric2SlotProp() planet: false --this map holds no texturemap slots raytrace: false --this map holds no relevant color swatches reflect_refract: false --this map holds no texturemap slots RGB_multiply: textureMapProperties.fn_generic2SlotProp() RGB_tint: false --this map holds no relevant color swatches smoke: textureMapProperties.fn_yetAnotherGeneric2SlotProp() speckle: textureMapProperties.fn_yetAnotherGeneric2SlotProp() splat: textureMapProperties.fn_yetAnotherGeneric2SlotProp() stucco: textureMapProperties.fn_yetAnotherGeneric2SlotProp() --swirl:textureMapProperties.fn_swirlProp()--doesn't have clear enabled properties, maybe problematic. maxscript cannot access the texturemaps prior to manual mapcreation thin_wall_reflection: false --this map holds no relevant color swatches --widely known as tiles, but named Bricks Bricks: textureMapProperties.fn_bricksProp()--doesn't have clear enabled properties water: textureMapProperties.fn_yetAnotherGeneric2SlotProp() Wood: textureMapProperties.fn_anotherGeneric2SlotProp() --Vray texturemaps vrayBmpFilter: false --this map holds no relevant color swatches VRayColor: textureMapProperties.fn_vraycolorProp() vrayCompTex: false --this map holds no relevant color swatches VrayDirt: false --this map holds no relevant texturemap slots vrayEdgesTex: false --this map holds no texturemap slots VrayHDRI: false --this map holds no relevant color swatches vraySky: false --this map holds no color swatches default: false --return this value for every unknown texturemap ) ) ----------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------COLLECTING MATERIALS ----------------------------------------------------------------------------------------------------------------------------------------- --function creates an array with flat materials. it filters out any compositematerial (these don't have diffuse properties) --also handles undefined materials and already flat materials function fn_flattenCompositeMaterial inputMaterial = ( local flatMaterialList = #() --define the container array local subMtlList = #() --define the array containing the direct subMaterials --return an empty array if the material is undefined (this will also filter out cameras, lights and such) if inputMaterial == undefined do return #() --return the input material if there are no submaterials if getNumSubMtls inputMaterial == 0 do return #(inputMaterial) --gets the submaterials, filters out any undefined (the Composite material has these) for n = 1 to getNumSubMtls inputMaterial do ( local subMat = getSubMtl inputMaterial n if subMat != undefined do append subMtlList subMat ) --add the flat materials to the containerArray and recurse the function if there's more than one level of composites for m in subMtlList do ( if getNumSubMtls m > 0 then --if this material contains subs we don't want to append it but process its subs directly ( join flatMaterialList (fn_flattenCompositeMaterial m) )else --if the material doesn't contain any subs, it's a leaf. add it directly and don't recurse ( append flatMaterialList m ) ) flatMaterialList )--end fn ----------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------COLLECTING TEXTUREMAPS ----------------------------------------------------------------------------------------------------------------------------------------- --determine the kind of input. will run the appropriate function to deal with it. The goal is an array with texturemaps --will accept material, texturemap or geometry as input function fn_determineInput inputThingArray = ( --print inputThingArray.count --print (superclassof inputThingArray[1]) local flatMtlArr = #(undefined) local texArr = #(undefined) for o in inputThingArray do ( case superClassof o of ( material: join flatMtlArr (fn_flattenCompositeMaterial o) textureMap: append texArr o geometryClass: join flatMtlArr (fn_flattenCompositeMaterial o.material) value:()--superclass of undefined default:()--the rest ) ) #(flatMtlArr,texArr) ) --tests the class of the material. then run some actions to get the top diffuse map array from the material function fn_getRootDiffuseMapArr inputMaterial = ( local diffMapArr = #() --will contain the root diffuse maps (mostly just one, but some materials can have multiple roots like the ink'n'paint material) may also contain "undefined" if there's no root diffusemap local theTexmapArr = #() --will contain temporary maps local texmapEnabledArr = #() --contains if the map is enabled or not (true or false) if inputMaterial != undefined do ( --first check the materialType (only flat materials) and load the proper propertynames fn_loadMaterialPropertyNames inputMaterial --second run some actions to get the texmap if available and if it's enabled for o = 1 to texNameArr.count do (theTexmapArr[o] = (getProperty inputMaterial texNameArr[o]))--get the texmap for o = 1 to enabledNameArr.count do (texmapEnabledArr[o] = (getProperty inputMaterial enabledNameArr[o]))--get if it's enabled --third make an array of enabled root diffuse maps, else return undefined in the array for t = 1 to theTexmapArr.count do ( if theTexmapArr[t] == undefined then (diffMapArr[t] = undefined)else --there's no texture in the diffuse channel ( if texmapEnabledArr[t] == false then (diffMapArr[t] = undefined)else --there's a texture, but it's disabled ( diffMapArr[t] = theTexmapArr[t] --collect the diffuseMap for further processing ) ) ) ) diffMapArr --return the texturemapArray, may also contain undefined values ) --collect all the textureMaps in the diffusemap recursively except the top one. input a single texturemap, returns an array with texturemaps function fn_getChildTextureMaps texMap = ( local textureMapList = #() --define the container array if texMap == undefined do return textureMapList --exit the function if there's no texturemap at all for x = 1 to (getNumSubTexmaps texMap) do --iterate over every submap of the texturemap, also works if there are 0 submaps ( map = getSubTexmap texmap x --get the x'th submap if map != undefined do append textureMapList map --only append if it isn't undefined join textureMapList (fn_getChildTextureMaps map) --recurse and join the result ) textureMapList --return the array with texturemaps ) ----------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------FIXING TEXTUREMAPS ----------------------------------------------------------------------------------------------------------------------------------------- --insert a vraycolor using the diffusecolor. input a material --use this one when there's no texturemap in the diffuse channel function fn_insertTopVraycolor mtl idx= ( --fn_loadMaterialPropertyNames mtl --apply the vrayColorMap to the top diffuse slot and enable it local theMap = getProperty mtl texNameArr[idx] --get the map by using the indexed propertyname if theMap == undefined OR (getProperty mtl enabledNameArr[idx]) == false do --if there is no map present or if a map has been disabled ( local vc = VrayColor() --create the vraycolor map vc.gamma_correction = 1 --set the gammacorrection to "specify" vc.gamma_value = 2.2 --set the value to 2.2 vc.color = getProperty mtl colorNameArr[idx] --set the color to that of the current color slot setProperty mtl texNameArr[idx] vc --put the map in the slot setProperty mtl enabledNameArr[idx] true --enable it ) ) --remove a vraycolor by putting it's color in the top diffusecolorslot. input a material and an index --use this one when there's a single (or multiple for ink 'n paint) vrayColor in the diffuse channel. the index controls which top diffuse gets vaporized function fn_removeTopVraycolor mtl idx = ( --fn_loadMaterialPropertyNames mtl --load the correct propertynames for the material --collect the color and put it in the correponding --colorslot. finally, delete the vraycolormap local theMap = getProperty mtl texNameArr[idx] --get the map by using the indexed propertyname if classof theMap == vrayColor AND (getProperty mtl enabledNameArr[idx]) == true do --if the map actually is a vrayColor and if it's enabled ( local theColor = themap.color --reclaim the color from the vrayColor map setProperty mtl colorNameArr[idx] theColor --put the color back in the diffuse slot setProperty mtl texNameArr[idx] undefined --remove the vraycolor map ) ) --remove every vrayColor map in a single texturemap and return the flat color in its place function fn_removeChildVrayColorMaps inputMap = ( proceed = fn_loadTexturemapPropertyNames inputMap --test which texturemap is present, returns false if unknown if proceed != false do ( --iterate over all color slots. if there's vraycolor, collect its color, return it and remove the vraycolor. if there is a texturemap --but it hasn't been enabled leave it alone for o = 1 to texNameArr.count do ( theSubMap = getProperty inputMap texNameArr[o] --gets the sub-texturemap from the input texturemap if classof theSubMap == vrayColor do --if it's a vraycolormap and it's enabled ( if enabledNameArr[o] == "absent" OR getProperty inputMap enabledNameArr[o] == true do ( theColor = theSubMap.color --get the color setProperty inputMap colorNameArr[o] theColor --put the color back in the diffuse slot setProperty inputMap texNameArr[o] undefined --remove the vraycolor map ) ) ) ) ) --insert vrayColor maps for every used flat color in a single texturemap function fn_insertChildVrayColorMaps texMap = ( proceed = fn_loadTexturemapPropertyNames texMap --test which texturemap is present if proceed != false do ( --iterate over all color slots. if there's no texturemap there, put a vraycolor in there. if there is a texturemap --but it hasn't been enabled, also replace it with a vraycolor for o = 1 to texNameArr.count do ( vc = vrayColor() --create a vrayColor texturemap vc.gamma_correction = 1 --set the gammacorrection to "specify" vc.gamma_value = 2.2 --set the value to 2.2 if colorNameArr[o] != undefined do --if there's actually a color slot: get the color and store it ( texColor = getProperty texMap colorNameArr[o] --get the color taken from the swatch --this action crashes vray RC4 vc.color = texColor --put the color into the vrayColor texturemap ) if getProperty texMap texNameArr[o] == undefined OR enabledNameArr[o] == "absent" OR getProperty texMap enabledNameArr[o] == false do --if no texturemap replaces the color, or if the texturemap has been disabled ( setProperty texMap texNameArr[o] vc --put the Vray texturemap in there if enabledNameArr[o] != "absent" do setProperty texMap enabledNameArr[o] true --switch it on ) ) ) ) --insert the vraycolorMaps in materials. input is an array of flat materials function fn_insertVRayColor input2DArr = ( for i in input2DArr[1] do ( --first add the top-diffuse vraycolors local diffMapArr = fn_getRootDiffuseMapArr i for q = 1 to diffMapArr.count do fn_insertTopVraycolor i q --first add an enabled vraycolor in available top-diffuse slots --second add vraycolors in child maps local diffMapArr = fn_getRootDiffuseMapArr i --returns an array containing the top diffuse maps of the material (does contain undefined) join diffMapArr input2DArr[2] for d in diffMapArr do --iterate over the top diffuse map ( if d != undefined do --do actions on empty map-slots ( local texMapArr = fn_getChildTextureMaps d --get all texturemaps in the diffuse channel append texMapArr d --add the root diffusemaps also for o in texMapArr do fn_insertChildVrayColorMaps o --iterate over these texturemaps and insert vraycolors where needed )--end if )--end for )--end for )--en fn --remove the vraycolorMaps in materials. input is an array of flat materials function fn_removeVRayColor input2DArr = ( for i in input2DArr[1] do ( --first get rid of top-diffuse vraycolors local diffMapArr = fn_getRootDiffuseMapArr i --returns an array containing the top diffuse maps of the material (does contain undefined) for q = 1 to diffMapArr.count do fn_removeTopVraycolor i q --first remove the enabled vraycolors from the top-diffuse if present --second get rid of any child vraycolors local diffMapArr = fn_getRootDiffuseMapArr i --returns an array containing the top diffuse maps of the material (does contain undefined) join diffMapArr input2DArr[2] for d in diffMapArr do --iterate over the top diffuse map ( if d != undefined do --filter out maps which don't have a vraycolor applied ( local texMapArr = fn_getChildTextureMaps d --get all texturemaps in the diffuse channel append texMapArr d --add the root diffusemaps also for o in texMapArr do fn_removeChildVrayColorMaps o --iterate over these texturemaps and insert vraycolors where needed )--end if )--end for )--end for )--end fn ----------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------ROLLOUTFLOATER ----------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------UI FUNCTIONS ----------------------------------------------------------------------------------------------------------------------------------------- --creates the look and feel of the lisview controls. also creates a columnheader function fn_designLV lv = ( lv.gridlines = false lv.view = (dotNetClass "System.Windows.Forms.View").details --set the type of listview lv.backColor = (dotNetClass "System.Drawing.Color").FromArgb 200 200 200 lv.foreColor = (dotNetClass "System.Drawing.Color").FromArgb 0 0 100 lv.fullRowSelect = true lv.borderStyle = (dotNetClass "BorderStyle").fixedsingle --set the borderstyle lv.multiSelect = true lv.scrollable = true lv.columns.add "" 262 --when in detail view we need a column to display items lv.headerStyle = (dotNetClass "columnheaderstyle").none --although we don't display the column ) --alters the color of the listview function fn_changeColorLV lv clrR clrG clrB = ( lv.backColor = (dotNetClass "System.Drawing.Color").FromArgb clrR clrG clrB ) --populates the listviews with items function fn_populateLV lv itemArr = ( LVMaxItems = #() --reset the contents of the listView lv.Items.clear() --add the items lvItems = #() --array to hold the listviewItems for o = 1 to itemArr.count do ( li = dotNetObject "System.Windows.Forms.ListViewItem" itemArr[o].name --create a dotnetObject: listviewItem --li.name = mtlArr[o].name append lvItems li --put the item into the array append LVMaxItems itemArr[o] --also store the actual item (material, object) in another array ) lv.items.addRange lvItems --add the array with items to the listview ) ----------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------ROLLOUTS ----------------------------------------------------------------------------------------------------------------------------------------- rollout ApplyVrayColor "Add or remove vraycolor texturemaps" ( group "what do you want to do? " ( checkButton cbnAdd "ADD Vraycolor maps" height:30 width:140 across:2 checkButton cbnRemove "REMOVE Vraycolor maps" height:30 width:140 ) group "materials and objects " ( radiobuttons rbtSources labels:#("Scene mat.", "Material editor","Selected objects") enabled:false dotNetControl dotNETList "System.Windows.Forms.Listview" width:280 height:171 ) group "actions " ( button btnAddAll "add all" enabled:false width:68 across:4 button btnAddselected "add sel." enabled:false width:68 button btnRemoveAll "remove all" enabled:false width:68 button btnRemoveselected "remove sel." enabled:false width:68 ) local sourceState = 1 --stores the state of the sources radiobutton, initialize on the first state (scene materials) --------------------- --SOME MORE FUNCTIONS --------------------- --disable relevant UI elements function fn_disableUIElements = ( btnAddAll.enabled = false btnAddselected.enabled = false btnRemoveAll.enabled = false btnRemoveselected.enabled = false rbtSources.enabled = false fn_changeColorLV dotNETList 200 200 200 dotNETList.items.clear() ) ---------------------- --EVENT HANDLERS ---------------------- on applyVrayColor open do ( fn_designLV dotNETList ) on cbnRemove changed theState do ( if theState == true then ( cbnAdd.checked = false fn_disableUIElements() fn_changeColorLV dotNETList 250 120 120 btnRemoveAll.enabled = true btnRemoveselected.enabled = true rbtSources.enabled = true rbtSources.changed sourceState )else ( fn_disableUIElements() ) ) on cbnAdd changed theState do ( if theState == true then ( cbnRemove.checked = false fn_disableUIElements() fn_changeColorLV dotNETList 120 250 120 btnAddAll.enabled = true btnAddselected.enabled = true rbtSources.enabled = true rbtSources.changed sourceState )else ( fn_disableUIElements() ) ) on rbtSources changed theState do ( sourceState = theState case theState of ( 0:(print "klaas rules") 1: --scenematerials ( local matArr = for o in sceneMaterials collect o fn_populateLV dotNETList matArr ) 2: --material editor ( fn_populateLV dotNETList meditMaterials ) 3: --selected objects ( local objArr = for o in selection collect o fn_populateLV dotNETList objArr ) ) ) on btnAddSelected pressed do ( local LVIndices = dotNETList.selectedIndices local c = lvindices.count - 1 case sourceState of ( 1: --scenematerials ( local selectedItemsArr = #() for o = 0 to c do ( append selectedItemsArr LVMaxItems[(LVIndices.item[o] + 1)] ) filteredInput = fn_determineInput selectedItemsArr fn_insertVRayColor filteredInput ) 2: --material editor ( local selectedItemsArr = #() for o = 0 to c do ( append selectedItemsArr LVMaxItems[(LVIndices.item[o] + 1)] ) filteredInput = fn_determineInput selectedItemsArr fn_insertVRayColor filteredInput ) 3: --selected objects ( local selectedItemsArr = #() for o = 0 to c do ( append selectedItemsArr LVMaxItems[(LVIndices.item[o] + 1)] ) filteredInput = fn_determineInput selectedItemsArr fn_insertVRayColor filteredInput ) ) dotNETList.focus() ) on btnAddAll pressed do ( local c = dotNETList.items.count case sourceState of ( 1: --scenematerials ( local allItemsArr = #() for o = 1 to c do (append allItemsArr LVMaxItems[o] ) filteredInput = fn_determineInput allItemsArr fn_insertVRayColor filteredInput ) 2: --material editor ( local allItemsArr = #() for o = 1 to c do (append allItemsArr LVMaxItems[o] ) filteredInput = fn_determineInput allItemsArr fn_insertVRayColor filteredInput ) 3: --selected geometry-objects ( local allItemsArr = #() for o = 1 to c do (append allItemsArr LVMaxItems[o] ) filteredInput = fn_determineInput allItemsArr fn_insertVRayColor filteredInput ) ) dotNETList.focus() ) on btnRemoveAll pressed do ( local c = dotNETList.items.count case sourceState of ( 1: --scenematerials ( local allItemsArr = #() for o = 1 to c do (append allItemsArr LVMaxItems[o] ) filteredInput = fn_determineInput allItemsArr fn_removeVRayColor filteredInput ) 2: --material editor ( local allItemsArr = #() for o = 1 to c do (append allItemsArr LVMaxItems[o] ) filteredInput = fn_determineInput allItemsArr fn_removeVRayColor filteredInput ) 3: --selected objects ( local allItemsArr = #() for o = 1 to c do (append allItemsArr LVMaxItems[o] ) filteredInput = fn_determineInput allItemsArr fn_removeVRayColor filteredInput ) ) dotNETList.focus() ) on btnRemoveSelected pressed do ( local LVIndices = dotNETList.selectedIndices local c = lvindices.count - 1 case sourceState of ( 1: --scenematerials ( local selectedItemsArr = #() for o = 0 to c do ( append selectedItemsArr LVMaxItems[(LVIndices.item[o] + 1)] ) filteredInput = fn_determineInput selectedItemsArr fn_removeVRayColor filteredInput ) 2: --material editor ( local selectedItemsArr = #() for o = 0 to c do ( append selectedItemsArr LVMaxItems[(LVIndices.item[o] + 1)] ) filteredInput = fn_determineInput selectedItemsArr fn_removeVRayColor filteredInput ) 3: --selected objects ( local selectedItemsArr = #() for o = 0 to c do ( append selectedItemsArr LVMaxItems[(LVIndices.item[o] + 1)] ) filteredInput = fn_determineInput selectedItemsArr fn_removeVRayColor filteredInput ) ) dotNETList.focus() ) )--end rollout --this rollout puts up a description of the author and the script rollout aboutApplyVrayColor "about" rolledUp:true ( dotNetControl dotNETLabel "System.Windows.Forms.Label" width:280 height:180 local str --will contain some messages on aboutApplyVrayColor open do ( str = stringstream "" format "Klaas Nienhuis, april 2008, version 1.0\n\n" to:str format "Please report bugs on scriptspot\n\n" to:str format "SUPPORTED MATERIALS:\n" to:str format "Max and Vray materials\n\n" to:str format "SUPPORTED TEXTUREMAPS:\n" to:str format "Max and Vray textures except Gradient Ramp and Swirl\n\n" to:str format "\nExtra textures and materials can easily be supported by using the format in the materialProperties and textureMapProperties structs. Find them at the top of the script." to:str dotNETLabel.autoellipsis = true dotNETLabel.text = str ) )--end rollout theFloater --define the rolloutfloater globally try(closeRolloutFloater theFloater)catch() --close the rolloutfloater if opened theFloater = newRolloutFloater "Vraycolormap tool by Klaas Nienhuis" 320 390 --define the floater addRollout ApplyVrayColor theFloater--add a rollout addRollout aboutApplyVrayColor theFloater--add a rollout )