[Closed] Getting the reference of a custom plugin?
Hello everyone!
I’m new to both maxscript and this forum.
I’m having issues calling a function in my material from outside. In a general script I’m gathering all the geometries and would like to see if those geometries are using my custom material. If they are, then call a function defined in that material. Here’s the pseudocode.
------ myMaterial.ms ----------------
plugin material MY_MATERIAL
name:"My material"
classID:#(23452345,234523455)
extends:DirectX_9_Shader replaceUI:true version:0.1
(
fn boop =
(
print "boop"
)
)
------------------------------------------
----- otherScript -----------------------
include myMaterial.ms
fn do_things =
(
for geom in Geometry do(
geom.material.boop
)
)
-----------------------------------------
My question would be if there is any way cast the materials in the geometries to MY_MATERIAL and call the function boop if the cast is successful.
I’m also unsure if I have the right approach to this problem.
Thanks!
Casting is unnecessary in this case, maxscript is not statically typed and you can call any method of a derived class on the base class variable.
You just need to make sure the class of the material is your material.
for geom in Geometry where classof geom.material == MY_MATERIAL do(
geom.material.boop
)