#268318
Hi - I need a quick working MAXScript example, please, of how to use this method
--- maxwellMaterialImport <material:maxwell_material_node> <input:mxm_file_name>

which is listed on page 32 of the documentation file maxwell-3dsmaxv1-1.pdf

For quick short-file-path testing I copied a material shipped with the Maxwell library to C:\orangediffuseplastic.mxm

Success happens when I start a new scene,
--- hit "m" to bring up the materials UI,
--- click Standard,
--- choose MaxwellMaterial in the resulting list,
--- click OK,
--- then click Import MXM in the main "m" UI window,
--- and import C:\orangediffuseplastic.mxm to the first material slot.

The preview shows up fine, I can use the UI to assign the material to a sphere or whatever, and the following MAXScript runs successfully
--- sphereX = Sphere radius:1.75 smooth:on segs:32 chop:0 name:"TestSphere"
--- sphereX.material = meditMaterials[1]

But the goal of course is to import C:\orangediffuseplastic.mxm and then assign it to an object *without* having to use the UI

I tried
--- maxwellMaterialImport meditMaterials[1] "C:\orangediffuseplastic.mxm"

but the error
--- #Maxwell import error: A destination material is required in order to perform the import.
appears in the Listener.

I also tried
--- sphereX = Sphere radius:1.1 smooth:on segs:32 chop:0 name:"TestSphere"
--- maxwellMaterialImport sphereX.material "C:\orangediffuseplastic.mxm"
but the same error appears in the Listener. The test sphere is created and is assigned a default 3ds material.

The specific way I run thses test is:
--- Fire up new instance of 3ds,
--- start new scene,
--- open Listener and MaxScript editor,
--- copy the test code into editor
--- and do Tools\Evaluate All in the editor

The MAXScript plugin doc says to give a <material:maxwell_material_node> as the first argument. My two guesses on "What is a <material:maxwell_material_node>?" were those I tested above
1) meditMaterials[1] because some type of material thingie got picked out of there and used as an assignment source.
2) sphereX.material because some type of material thingie got assigned into there as assignment destination.

But neither of my guesses succeeded, and I'm out of guesses; so what's an example please, of a successful call to maxwellMaterialImport?

I'm new to MAXScript so I'm light on the exact semantics of stuff like what is a node of the flavor <material:maxwell_material_node>

Trying to save forum bandwidth I Googled on maxwellMaterialImport, no useful hits; and searched the forums here, no hits. Also text-searched caseys_maxwell_tools.ms, no hits.

Can anyone help, please, with one working example?

Seems like it might be as short as one line of MAXScript, but then I'm light on 3ds node semantics...

Thanks!
By Bogdan Coroi
#268322
You should have typed:

maxwellMaterialImport material:meditMaterials[1] input:"C:\\test.mxm"
"What is a <material:maxwell_material_node>?"
maxwell_material_node is an already created MaxwellMaterial entity, which you could access in MAXScript by its name like this:
Code: Select all
testMaterial = MaxwellMaterial()
maxwellMaterialImport material:testMaterial input:"C:\\test.mxm" 
$Teapot01.material = testMaterial
or by its index in the Material Editor like you have already tried.
But the goal of course is to import C:\orangediffuseplastic.mxm and then assign it to an object *without* having to use the UI
One way is to use the Material Editor as support for the newly created MaxwellMaterial:
Code: Select all
meditMaterials[1] = MaxwellMaterial()
maxwellMaterialImport material:meditMaterials[1] input:"C:\\test.mxm" 
$Teapot01.material = meditMaterials[1]
or the above temporary MaxwellMaterial approach.
By br54
#268332
One way is to use the Material Editor as support for the newly created MaxwellMaterial: ... or the above temporary MaxwellMaterial approach.
Thank you so much for the help! :D

For now, I'm doing it the temp way
Code: Select all
testMaterial = MaxwellMaterial()
maxwellMaterialImport material:testMaterial input:"C:\\test.mxm"
$Teapot01.material = testMaterial
but it's great to have the other choice in the back pocket.

Your awesome reply also prompted me to check out the Quote/Code/Etc forum buttons; sorry for the ugly formatting in my original post

Thanks again!
Help with swimming pool water

Hi Andreas " I would say the above "fake[…]

render engines and Maxwell

Other rendering engines are evolving day by day, m[…]