vrscene materials and fbx

has anybody found a clever way to export a vrscene of a model, along with an fbx, then import the fbx into max, and assign the materials from the vrscene to the fbx? so far ive found only the “manual” method, and with a model with 100+ materials, it would be nice if somebody had automated the process somehow.

I think .fbx supports User Defined Properties, so an idea is to set some properties to the objects (f.e, material = 1) to indicate which objects have which materials. Afterwards, via the following script, you can create new VRayVRMatMtls that load the .vrscene and get assigned based on the user property of the object:


for each in geometry where ((getUserProp each "material") == 1) do (
mat=VRayVRMatMtl()
mat.filename="C:\Users\al.hadzhiev\Desktop\shaders.vrscene"
mat.name = each.name
mat.matindex = 0 -- this value corresponds to the position of the shader within the VRayVRMatMtl list
SME.open()
(SME.getView SME.activeView).createNode mat [0,0]
each.material = mat
)

```​