--- ROCKSTAR SUBSTANCE TEXTURE -- Useage : Stores substance information that is used on export to create RAGE shaders for game -- Allan Hayburn -- Oct 2012 filein (RsConfigGetWildWestDir() + "script/3dsmax/_config_files/wildwest_header.ms") filein (RsConfigGetToolsDir()+"dcc/current/max2012/scripts/pipeline/util/substanceFns.ms") plugin texturemap rsSubstance name:"R* Substance" classID:#(0x486eb8b8, 0x2ca0e68e) extends:substance replaceUI:false ----CHANGE BELOW ONCE RELEASED silentErrors:false ( --*****************-- -- Functions --*****************-- -------------------------------------------------------------------------------------------------------------------------------- -- fn getThisParentMaterial -- returns the parent material of this texturemap -------------------------------------------------------------------------------------------------------------------------------- fn getThisParentMaterial = ( if classof ( medit.GetTopMtlSlot (medit.GetActiveMtlSlot() )) != multimaterial then ( theParentMaterial = ( medit.GetTopMtlSlot (medit.GetActiveMtlSlot() )) ) else ( theMulti = ( medit.GetTopMtlSlot (medit.GetActiveMtlSlot() )) myTextureMap = this for m in theMulti where m != undefined AND hasProperty m #ambientmap AND m.ambientmap == myTextureMap do ( theParentMaterial = m ) for m in theMulti where m != undefined AND hasProperty m #diffuseMap AND m.diffuseMap == myTextureMap do ( theParentMaterial = m ) ) theParentMaterial ) -------------------------------------------------------------------------------------------------------------------------------- -- fn MakeSubstanceMat -- Creates a basic substance material setup without having to open slate editor -------------------------------------------------------------------------------------------------------------------------------- fn MakeSubstanceMat baseTexture theParentMaterial = ( local B2MFileLocation = ("C:/Users/"+sysInfo.username+"/Documents/Substances/Filters/Bitmap2Material/Bitmap2Material.sbsar") if (doesfileexist B2MFileLocation) == false then B2MFileLocation = ("C:/Users/"+sysInfo.username+"/Documents/Substances/Filters/Bitmap2Material/Bitmap2Material_2.sbsar") if (doesfileexist B2MFileLocation) == false then ( local subststFile = getOpenFileName \ caption:"Open Substance Bitmap2Material Plugin" \ filename:("C:/Users/"+sysInfo.username+"/Documents" + @"\") \ types:"Substance Archive Files (*.sbsar)|*.sbsar" \ historyCategory:"SubstancePresets" if subststFile != undefined and (doesfileexist subststFile) == true then ( B2MFileLocation = subststFile ) else ( msg = "Substance Bitmap2Material File Could not be found.\nIt is unsafe to continue." messagebox msg title:"R* Substance" return false ) ) -- Loads the Bitmap2Material Substance setting - (This may be expanded upon if we begin using substance designer) local B2MFile = B2MFileLocation -- define the materials baseMaterial = theParentMaterial substanceMaterial =this.substance substanceMaterial.SubstanceFilename = B2MFile theStandard = baseMaterial theStandard.adTextureLock = off if theStandard.diffuseMap == this then theStandard.ambientmap = this -- create the diffuse output - (This uses a composite map to multiply the AO output into the diffuse texture) theOutputDiffMap = theStandard.diffuseMap = CompositeTexturemap () theOutputDiffMap.name = "DiffMap" theOutputDiffMap.mapEnabled.count = 2 theOutputDiffMap.layername[2] = "" theOutputDiffMap.blendMode[2] = 5 theOutputDiffMap.opacity[2] = 25.0 SMEOutput = theOutputDiffMap inputA = SMEOutput.mapList[1] = MultiOutputChannelTexmapToTexmap () inputB = SMEOutput.mapList[2] = MultiOutputChannelTexmapToTexmap () InputA.sourcemap = substanceMaterial InputA.outputChannelIndex = 1 InputB.sourcemap = substanceMaterial InputB.outputChannelIndex = 7 -- creates the specular output theOutputSpecMap = theStandard.specularMap = MultiOutputChannelTexmapToTexmap () -- theStandard.specularMap = theStandard.specularLevelMap theStandard.specularLevel = 100 theOutputSpecMap.name = "SpecMap" SMEOutput = theOutputSpecMap SMEOutput.sourceMap = substanceMaterial SMEOutput.outputChannelIndex = 2 -- creates the normal output -- combines normalmap and bumpmap outputs from substance theNormalBumpMap = theStandard.bumpMap =Normal_Bump () theNormalBumpMap.name = "NormBumpMap" theNormalBumpMapProps =theNormalBumpMap theNormalBumpMapProps.bump_spin = 0.1 theOutputNormMap = theNormalBumpMapProps.normal_map = MultiOutputChannelTexmapToTexmap () theOutputNormMap.name = "NormMap" SMEOutput = theOutputNormMap SMEOutput.sourceMap = substanceMaterial SMEOutput.outputChannelIndex = 3 theOutputBumpMap = theNormalBumpMapProps.bump_map = MultiOutputChannelTexmapToTexmap () theOutputBumpMap.name = "BumpMap" SMEOutput = theOutputBumpMap SMEOutput.sourceMap = substanceMaterial SMEOutput.outputChannelIndex = 4 -- defines the base texture that drives the substance file substanceMaterial.Bitmap_Diffuse = baseTexture -- turns on the hardware shading for the material showTextureMap theStandard on theStandard.DirectX_Manager.dxStdMat = on theStandard.DirectX_Manager.enabled = on enableHardwareMaterial theStandard true --switch SMIV flyout to HW mode showHWTextureMap theStandard true --press the SMIV icon -- returns the material theStandard ) fn makeRenderTextureList presetType baseTexture = ( local thePresetArrayPresets = for theData in rsmaterialholder.thePresetArray collect (theData.preset+".sps") local selectedPreset = finditem thePresetArrayPresets presetType if selectedPreset != 0 then ( local theData = rsmaterialholder.thePresetArray[selectedPreset] local renderTextureList = #() for i in theData.mappings do ( if classof i.mapping2 == string then append renderTextureList (i.mapping2 + ":" + baseTexture) ) renderTextureList ) ) fn convertArray2String theArray = ( local theString = "" for i in 1 to theArray.count do ( append theString theArray[i] if i != theArray.count do append theString "," ) print theString theString ) fn convertString2Array theString = ( local theNewArray = filterString theString "," theNewArray ---- PUT IN TILL I FINALIZE THE SAVING STUFF #() ) parameters main rollout:params ( baseTexture type:#texturemap -- The Texture that drives the substance presetType type:#string default:"default.sps" ui:etShaderType -- The preset for the rage shader on conversion textureOutputDirectory type:#string default:(RsConfigGetProjRootDir()+"art/Textures/") ui:ettextureOutputDirectory -- where the rendered textures will output setTexture type:#boolean -- renderedTextures type:#string ui:lbRenderTextures -- on baseTexture set true do ( -- if presetType != undefined then ( -- local textList = convertArray2String (makeRenderTextureList presetType (getfilenamefile baseTexture.filename)) -- renderedTextures = textList -- ) -- -- ) -- on presetType set true do ( -- if baseTexture != undefined then ( -- local textList = convertArray2String (makeRenderTextureList presetType (getfilenamefile baseTexture.filename)) -- renderedTextures = textList -- ) -- ) ) rollout params "R* Substance" ( --*****************-- -- Functions --*****************-- -------------------------------------------------------------------------------------------------------------------------------- -- fn load_bitmap_rstar -- creates the rockstar logo -------------------------------------------------------------------------------------------------------------------------------- fn load_bitmap_rstar = ( local bitmap_rstar=bitmap 48 48 fn unpack val = for p in val collect (r=p/256^2; g=p/256-r*256; b=mod p 256; color r g b) setpixels bitmap_rstar [0,0] (unpack #(12632515, 12632515, 12632515, 12632515, 12632515, 8948884, 4671301, 3287058, 3088128, 3153664, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 2694403, 3153664, 2694403, 2694403, 3815216, 7961989, 12632515, 12632515, 12632515, 12632515, 12632515)) setpixels bitmap_rstar [0,1] (unpack #(12632515, 12632515, 12632515, 10725554, 3813670, 7621120, 13074944, 16030976, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16032256, 13995264, 8344579, 3878170, 9606813, 12632515, 12632515, 12632515)) setpixels bitmap_rstar [0,2] (unpack #(12632515, 12632515, 9409435, 4401667, 13995264, 16757504, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16757504, 15045632, 5583616, 7896194, 12632515, 12632515)) setpixels bitmap_rstar [0,3] (unpack #(12632515, 11449018, 3942403, 15571968, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 4992512, 10001830, 12632515)) setpixels bitmap_rstar [0,4] (unpack #(12632515, 4406318, 13796608, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 14716672, 4339747, 12632515)) setpixels bitmap_rstar [0,5] (unpack #(10264745, 7554816, 16757504, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16757504, 8343296, 9409435)) setpixels bitmap_rstar [0,6] (unpack #(5723732, 12680448, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 13272064, 5460045)) setpixels bitmap_rstar [0,7] (unpack #(3879196, 16030976, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16030976, 4470298)) setpixels bitmap_rstar [0,8] (unpack #(3942403, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16757504, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,9] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 11892224, 4401667, 4401667, 4401667, 4401667, 4401667, 4401667, 4401667, 4401667, 4401667, 5125382, 6373895, 9724416, 15045632, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,10] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16757504, 7621120, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 2036736, 12418304, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,11] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 5125382, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 2036736, 15571968, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,12] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16032256, 2233856, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 11496704, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,13] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 14585344, 328448, 328448, 328448, 328448, 3482368, 11496704, 11496704, 11496704, 10841600, 8344579, 2036736, 328448, 328448, 328448, 328448, 8344579, 16757504, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,14] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 11496704, 328448, 328448, 328448, 328448, 8344579, 16759040, 16755712, 16755712, 16755712, 16757504, 10841600, 328448, 328448, 328448, 328448, 7621120, 16757504, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,15] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16757504, 8344579, 328448, 328448, 328448, 328448, 10841600, 16755712, 16557056, 16557056, 16557056, 16755712, 13272064, 328448, 328448, 328448, 328448, 9133056, 16757504, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,16] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 5125382, 328448, 328448, 328448, 328448, 13796608, 16755712, 16755712, 16755712, 16755712, 16757504, 10118400, 328448, 328448, 328448, 328448, 12680448, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,17] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16032256, 2233856, 328448, 328448, 328448, 1314048, 14585344, 15571968, 15571968, 15571968, 14455296, 10381312, 2036736, 328448, 328448, 328448, 4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,18] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 14585344, 328448, 328448, 328448, 328448, 328448, 919808, 919808, 919808, 919808, 788224, 328448, 328448, 328448, 328448, 2694403, 13995264, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,19] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 11498240, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 2233856, 9133056, 15571968, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,20] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16757504, 8804352, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 328448, 919808, 9591552, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,21] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 5848320, 328448, 328448, 328448, 328448, 5848320, 5848320, 5848320, 5848320, 2694403, 328448, 328448, 328448, 328448, 788224, 15045632, 16755712, 16557056, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,22] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 2694403, 328448, 328448, 328448, 2694403, 16557056, 16755712, 16755712, 16755712, 15571968, 3482368, 328448, 328448, 328448, 328448, 12680448, 16755712, 16557056, 16557056, 16032256, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,23] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 15045632, 788224, 328448, 328448, 328448, 5583616, 16755712, 16755712, 16557056, 16557056, 16757504, 8804352, 328448, 328448, 328448, 328448, 12418304, 16755712, 16755712, 15045632, 8344579, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,24] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 12023808, 328448, 328448, 328448, 328448, 8344579, 16757504, 16557056, 16557056, 16557056, 16757504, 9724416, 328448, 328448, 328448, 328448, 12680448, 16755712, 16757504, 7621120, 2694403, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,25] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16757504, 9591552, 328448, 328448, 328448, 328448, 10841600, 16755712, 16557056, 16557056, 16557056, 16757504, 9133056, 328448, 328448, 328448, 328448, 13272064, 16757504, 14585344, 3814701, 4406318, 15571968, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,26] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 6373895, 328448, 328448, 328448, 328448, 13995264, 16755712, 16557056, 16557056, 16557056, 16757504, 8344579, 328448, 328448, 328448, 328448, 13995264, 16757504, 6307072, 10396849, 7433576, 13272064, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,27] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 2694403, 328448, 328448, 328448, 2036736, 16032256, 16755712, 16557056, 16557056, 16557056, 16757504, 7621120, 328448, 328448, 328448, 328448, 13272064, 13796608, 4407613, 16579836, 8158332, 11496704, 16757504, 16755712, 16755712, 16755712, 16755712, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,28] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16030976, 5583616, 4992512, 4992512, 4992512, 8344579, 16557056, 16557056, 16557056, 16557056, 16557056, 16757504, 9133056, 328448, 328448, 328448, 328448, 8344579, 6307072, 11844033, 16579836, 9606813, 8343296, 15638784, 15571968, 16030976, 16030976, 15571968, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,29] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 14455296, 2036736, 1250843, 3355442, 2894892, 3157804, 6908523, 16579836, 16579836, 12632515, 3288098, 4339747, 4800041, 3813670, 1576704, 7095808, 15571968, 16755712, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,30] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 12680448, 3814701, 14277600, 16579836, 16185080, 16579836, 16579836, 16579836, 16579836, 15987958, 16579836, 12962515, 3684931, 7621120, 16032256, 16755712, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,31] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16757504, 10774272, 4671301, 15987958, 16579836, 16579836, 16579836, 16579836, 16579836, 16579836, 11449018, 3682084, 10841600, 16757504, 16755712, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,32] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 8344579, 6448231, 16579836, 16579836, 16579836, 16579836, 16579836, 9212312, 4007685, 13796608, 16757504, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,33] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 11496704, 6908523, 16579836, 16579836, 16579836, 16579836, 16579836, 5723732, 13270784, 16757504, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,34] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 5125382, 12962515, 16579836, 15790837, 13290705, 16579836, 16579836, 8158332, 11496704, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,35] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 12680448, 5723732, 16579836, 12501705, 4407613, 3088907, 9606813, 16579836, 9606813, 9591552, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,36] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 7424775, 10396849, 8224650, 3943437, 12418304, 15571968, 4992512, 7961989, 10725554, 8344579, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,37] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 15045632, 1709839, 3420718, 8211968, 16030976, 16755712, 16755712, 16557056, 7621120, 2172466, 6373895, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,38] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 9133056, 4007685, 13074944, 16755712, 16755712, 16557056, 16557056, 16755712, 16755712, 9000704, 4401667, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,39] (unpack #(4007685, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 12418304, 16032256, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 13995264, 16032256, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5125382)) setpixels bitmap_rstar [0,40] (unpack #(3878170, 16030976, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16030976, 4470298)) setpixels bitmap_rstar [0,41] (unpack #(5460045, 13270784, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 13796608, 5460045)) setpixels bitmap_rstar [0,42] (unpack #(9606813, 8211968, 16757504, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16757504, 8344579, 8948884)) setpixels bitmap_rstar [0,43] (unpack #(12632515, 4339747, 14585344, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 15045632, 4470298, 12632515)) setpixels bitmap_rstar [0,44] (unpack #(12632515, 10264745, 4992512, 16557056, 16755712, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16755712, 16557056, 5583616, 10001830, 12632515)) setpixels bitmap_rstar [0,45] (unpack #(12632515, 12632515, 7961989, 5583616, 15112192, 16757504, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16755712, 16757504, 15112192, 5583616, 7369850, 12632515, 12632515)) setpixels bitmap_rstar [0,46] (unpack #(12632515, 12632515, 12632515, 9409435, 3812375, 8344579, 14585344, 16032256, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16557056, 16032256, 14585344, 9000704, 3812375, 8948884, 12632515, 12632515, 12632515)) setpixels bitmap_rstar [0,47] (unpack #(12632515, 12632515, 12632515, 12632515, 12632515, 7961989, 4407613, 3943437, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 4007685, 3943437, 4604215, 7698558, 12632515, 12632515, 12632515, 12632515, 12632515)) return bitmap_rstar ) -------------------------------------------------------------------------------------------------------------------------------- -- fn checkPathValid -- Checks that the user selected a path within the project/art/textures folder -------------------------------------------------------------------------------------------------------------------------------- fn checkPathValid thePath = ( local validPathCharacterCount = (RsConfigGetProjRootDir()+"art/Textures/").count local selectedPath = (tolower ((filterstring (substring thePath 1 validPathCharacterCount) "\/") as string)) local validPath = (tolower ((filterstring (RsConfigGetProjRootDir()+"art/Textures/") "\/") as string)) local theReturn = false if selectedPath == validPath then theReturn = true theReturn ) --*****************-- -- Locals --*****************-- local thePresets = grsSubstance.makePresetList() local theRsBmp = load_bitmap_rstar() --*****************-- -- UI --*****************-- imgTag img_RsLogo "" style:#bmp_center bitmap:theRsBmp align:#center offset:[0,10] group "Texture" ( label lbl_BaseText "Base Texture:" align:#left offset:[0,0] button btn_baseTexture "" width: 308 edittext ettextureOutputDirectory "Texture Output Directory:" text:textureOutputDirectory offset:[0,5] labelOnTop:true readonly:true width:276 align:#left across:2 button btn_SelectedOutDir "..." align:#right width:20 offset:[0,20] -- listbox lbRenderTextures "Textures that will Render:" labelOnTop:true height:5 -- edittext etRename "" across:2 align:#left width:240 offset:[-3,2] -- button btnRename "Rename" align:#right ) group "Shader" ( listbox lstPresetList "Presets:" items:thePresets width:300 selection:0 button btnChooseShader "Choose shader" align:#left offset:[0,0] across:2 width:220 button btn_refreshList "Refresh List" align:#right width:80 edittext etShaderType "Shader Preset:" labelOnTop:true width:300 offset:[0,5] label lbl_2 "" offset:[0,-10] ) button btn_EditSubstance "Edit Substance in Slate" width:300 button btn_convertRsSubstance "Convert to Rage Shader" width:300 --******************************************************************************************************************-- -- REMOVED UNTIL I CAN FIND THE ISSUE WITH DOTNET QUERY MENU CALLED FROM A COMPILED MATERIAL --********************************************************************************************************************-- -- button btn_ConvertToRage "Convert To Rage Shader" width:300 --*****************-- -- Events --*****************-- on btn_convertRsSubstance pressed do ( createdialog ConvertRsSubstance 280 60 ) on btnRename pressed do ( local theitems = #("Diffuse:","Normal:","Specular:") lbRenderTextures.items = theItems lbRenderTextures.selection = 0 ) on btn_baseTexture pressed do ( bitmapFile = getOpenFileName filename:"" if bitmapFile != undefined then ( -- make sure path is valid export path isPathValid = checkPathValid bitmapFile if isPathValid == true then ( baseTexture = bitmaptexture filename:bitmapFile btn_baseTexture.text = getfilenamefile bitmapFile this.name = getfilenamefile bitmapFile theParentMaterial = getThisParentMaterial() theParentMaterial.name = getfilenamefile baseTexture.filename MakeSubstanceMat basetexture (getThisParentMaterial()) setTexture = true format "Substance Texture Set: %\n" setTexture -- lbRenderTextures.items = (convertString2Array this.renderedTextures) -- lbRenderTextures.selection = 0 ) else messageBox "Source texture needs to be \nin the project \"Art\" directory" title:"Error" ) ) on btn_SelectedOutDir pressed do ( theSavePath = (getSavePath caption:"Output Path" initialDir:textureOutputDirectory) if theSavePath != undefined then ( append theSavePath "\\" -- make sure path is valid export path isPathValid = checkPathValid theSavePath if isPathValid == true then ( -- set the ui and the param ettextureOutputDirectory.text = theSavePath textureOutputDirectory = theSavePath ) else messageBox "Save path needs to be \nin the project \"Art\" directory" title:"Error" ) ) on btnChooseShader pressed do ( presetSelection = lstPresetList.selected presetType = presetSelection etShaderType.text = presetSelection ) on btn_refreshList pressed do ( lstPresetList.items = grsSubstance.makePresetList() findDefault = finditem lstPresetList.items "default.sps" lstPresetList.selection = findDefault presetType = "default.sps" etShaderType.text = "default.sps" ) on lstPresetList doubleclicked val do ( presetSelection = lstPresetList.items[val] presetType = presetSelection etShaderType.text = presetSelection -- lbRenderTextures.items = (convertString2Array this.renderedTextures) -- lbRenderTextures.selection = 0 ) on btn_EditSubstance pressed do ( theParentMaterial = (medit.GetTopMtlSlot (medit.GetActiveMtlSlot())) if theParentMaterial != undefined then ( MatEditor.mode = #advanced checkViews = sme.GetViewByName "Substance" if checkViews != 0 then ( sme.DeleteView checkViews false ) sme.activeView = sme.CreateView "Substance" theView = sme.GetView (sme.activeView) baseMaterial = theParentMaterial theView.CreateNode baseMaterial [100,20] actionMan.executeAction 369891408 "40070" -- SME: Zoom Extents --sme.GetMtlInParamEditor() ) ) --******************************************************************************************************************-- -- REMOVED UNTIL I CAN FIND THE ISSUE WITH DOTNET QUERY MENU CALLED FROM A COMPILED MATERIAL --********************************************************************************************************************-- -- on btn_ConvertToRage pressed do -- ( -- local msg ="Convert to Rage Shader?\n***Can not be undone***" -- local convertMaterial = queryBox msg title:"Warning" -- if convertMaterial == true then -- ( -- if baseTexture != undefined then -- ( -- local theParentMaterials = grsSubstance.findParentMaterials() -- local thePMat = theParentMaterials.pMaterial -- local theMMat = theParentMaterials.mMaterial.mat -- if theMMat != undefined then -- ( -- local thePresetArray = (grsSubstance.makeRagePresetArray()) -- local theMaps = grsSubstance.renderSubstanceMaps theMMat thePresetArray test:true -- global P4Check = #() -- for i in 1 to theMaps.count do -- ( -- append P4Check theMaps[i].map -- ) -- theP4Check = grsSubstance.checkRenderedMaps P4Check -- if theP4Check == true then -- ( -- theMaps = grsSubstance.renderSubstanceMaps theMMat thePresetArray test:false -- local theRageShader = grsSubstance.makeRageFromSubstance theMMat theMaps -- if thePMat != theMMat then -- ( -- thePMat[(findParentMaterials()).mMaterial.num] = theRageShader -- meditmaterials[medit.GetActiveMtlSlot()] = thePMat -- ) else -- ( -- grsSubstance.replaceShaderScenObjs thePMat theRageShader -- meditmaterials[medit.GetActiveMtlSlot()] = theRageShader -- ) -- ) -- ) -- ) else messagebox "No base texture selected" title:"Error" -- ) -- ) on params open do ( if baseTexture != undefined do ( btn_baseTexture.text = getfilenamefile baseTexture.filename ettextureOutputDirectory.text = textureOutputDirectory this.name = getfilenamefile baseTexture.filename ) ) ) on create do ( msg = "Rockstar Substance Shader Created" format "%\n" msg ) )