Bear with me - I literally started Max scripting yesterday so I'm relatively proud to have gotten as far as I have but now I'm stuck.
I'm trying to dump a bunch of values from an old Kuju material plugin (for the Railworks game) into a file to make it easier for me to migrate the materials to the latest version of Max with the game's latest plugin.
I've managed to grab some of the extended values - those that showed up when I queried the materials using getPropNames, but that's only 8 of the values out of a possible 50 or so and I'm not sure how to get the others.
I've attached my script so far - don't laugh - it's very rudimentary. But if you look at the attached screenshot, I'm trying to figure out how to find the values for things like the shader name, the UV arguments, filter mode and things like that. I've tried apropos() with some values but nothing obvious is presenting itself to my queries and now I'm stuck.
Any suggestions or help would be appreciated. The older max plugins that this game used are available as a zip file if anyone cares to help, although probing those using a non-coding brain (ie. mine) hasn't proven especially useful :)
My script so far:
fn showMaterialDetails mat indent =
(
-- The 'indent' value is either 0 or 1, allowing the output to be indented for multi/subobject materials
-- This happens by prepending the outputs with the 'indentation' string
if (indent == 1) then
(
local indentation=" "
)
else
(
local indentation=""
)
format "%Material name: %\n" indentation mat.name
-- Custom properties from Kuju materials are:#alpha,#Fog,#Specular,#Diffuse,#Ambient,#Emissive,#Specular_Power,#ZBias,#MipMap_LOD_Bias,#maps ?
-- Got these using loop:
-- for i in getPropNames mat do print i
mipLODBias = getProperty mat #MipMap_LOD_Bias
format "%Mip LOD Bias = %\n" indentation mipLODBias
zBias = getProperty mat #ZBias
format "%Z Bias = %\n" indentation zBias
alpha = getProperty mat #Alpha
format "%Alpha = %\n" indentation alpha
fog = getProperty mat #Fog
format "%Fog = %\n" indentation fog
lightmatAmb = getProperty mat #Ambient
format "%Lighting material Ambient = %\n" indentation lightmatAmb
lightmatDiff = getProperty mat #Diffuse
format "%Lighting material Diffuse = %\n" indentation lightmatDiff
lightmatEmis = getProperty mat #Emissive
format "%Lighting material Emissive = %\n" indentation lightmatEmis
lightmatSpec = getProperty mat #Specular
format "%Lighting material Specular = %\n" indentation lightmatSpec
lightmatSpecPower = getProperty mat #Specular_Power
format "%Lighting material Specular Power= %\n" indentation lightmatSpecPower
-- Start iterating through the submaps - at this point these are now the texture slots
numSubs = getNumSubTexmaps mat
for i=1 to numSubs do
(
subMat=getSubTexmap mat i
if (subMat!= undefined) then
(
if classof subMat== Bitmaptexture then
(
filename=subMat.filename
format "%Slot % name:% Bitmap %\n" indentation (i as string) (subMat.name) (filenameFromPath filename)
)
)
)
format "\n"
)
clearlistener()
for topLevelMaterial in sceneMaterials do
if (classof topLevelMaterial) == Kuju_Material then
(
showMaterialDetails topLevelMaterial 0
format "\n"
)
else if (classof topLevelMaterial) == multiMaterial then
(
format "Multi/sub-object material: %\n" topLevelMaterial.name
for i=1 to getNumSubMtls topLevelMaterial do
(
subMaterial=getSubMtl topLevelMaterial i
showMaterialDetails subMaterial 1
)
)