glTFMaterial() undefined in macro

jmdvella
Participant
Participant

glTFMaterial() undefined in macro

jmdvella
Participant
Participant

Previously this was working fine, now after the latest 3dsmax2024 updates I cannot assign a variable a glTFMaterial(). For example this will crash any script that uses the glTFMaterial():

 

macroScript GLBTest
    tooltip:""
    buttonText:""
(
    newMat = glTFMaterial()
    show newMat
)
 
How is this fixable? If I run the command when its not in a macro it works just fine.
0 Likes
Reply
Accepted solutions (1)
368 Views
5 Replies
Replies (5)

jmdvella
Participant
Participant

For those testing this, it works only the first time its evaluated. Put the button on the toolbar and restart 3dsmax and try again, it will fail

0 Likes

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

@jmdvella wrote:

Previously this was working fine, now after the latest 3dsmax2024 updates I cannot assign a variable a glTFMaterial(). For example this will crash any script that uses the glTFMaterial():

 

macroScript GLBTest
    tooltip:""
    buttonText:""
(
    newMat = glTFMaterial()
    show newMat
)
 
How is this fixable? If I run the command when its not in a macro it works just fine.

do 

(
    if iskindof (gltf_mat = execute "glTFMaterial") Material do
	(
		newmat = gltf_mat()
		show newmat
	)
)

 

instead.


At the time the macro was loaded, the glTFMaterial class had not yet been defined.

0 Likes

jmdvella
Participant
Participant

Thank you Denis!

 

Why does this work differently than every other current material?

 

Every other material type works like this including StandardMaterial (legacy), Physical Material, VrayMtl, CoronaMtl, etc

0 Likes

denisT.MaxDoctor
Advisor
Advisor

@jmdvella wrote:

Why does this work differently than every other current material?

 

Every other material type works like this including StandardMaterial (legacy), Physical Material, VrayMtl, CoronaMtl, etc


 

... different order of loading plugins. Some additional classes or third-party dlls may be loaded after all built-in ones.

0 Likes

jmdvella
Participant
Participant

Ah I see, very unforgiving lol...

 

Thank you! 

0 Likes