PDA

View Full Version : Material plugin interface problem


grabjacket
05-12-2009, 01:04 PM
Hi,

I'm porting a few material plugins from max 2008 to max 2010 and run into a problem I didn't have before. In general: the material plugin doens't work anymore in max 2010. To be specific: whenever I create the material I don't see any element of the scripted material plugin-interface (which can cause a few startup errors). If I then click on another material-slot and click back to the material I've just created, everything's fine.
I've added a plugin here which illustrates the problem.



Evaluate the code
Create the new material (test material 3) from the material/map browser
The interface is empty now
Click on another material slot
Click back on the new test material
The interface is visible
Could someone help me solve this problem? The issue for me isn't so much the interface but in my real plugin, some of the code depends on the interface being there. So whenever i create such a material, max throws me an error.

The test plugin:
plugin material TestInterface3
name:"Test Interface 3"
classID:#(0x3222c2bd, 0xc5394f0)
extends:Standard
replaceUI:true
(
parameters main rollout:params
(
mtlCurrent type:#material ui:mtlBtn
)

rollout params "Material test"
(
label lbl "This message is part of the scripted interface"
materialbutton mtlBtn "material button"

on params open do
(
delegate.name = "a standard material"
mtlCurrent = delegate --if you disable this line, the interface appears when you make a new material
)

)
)

ZeBoxx2
05-12-2009, 01:17 PM
Can't test right now, but if you have this scripted plugin in <max>\Plugins\, try placing it in <max\Scripts\Startup\ instead. Long shot, though.

I wonder if technically you're making some manner of illegal reference, but it works fine here in 2009 SP1 x32, at least.

grabjacket
05-12-2009, 01:47 PM
I'll be damned,

in my 32 bit max 2010 it works just fine. It's the 64 bit edition which gives me these issues.
I've tried putting the plugin in both locations you suggested, but no luck.

Does anyone else have experience with plugins not working on 64-bit max?

Klaas

grabjacket
05-13-2009, 09:08 AM
Well, I got it to work eventually.
The problem occurs on my 64-bit max 2010 only. The issue is that when I instance the plugin some parts (mainly the interface I presume) don't update correctly. In the startup procedure of the plugin some functions need the interface. This causes errors.
I initialized the plugin with the "on rollout open do" handler. To fix the errors I've moved the functions from this handler to the "on create do" handler. This handler is a handler of the plugin, not the rollout.

So here's the working example:
plugin material TestInterface3
name:"Test Interface 3"
classID:#(0x3222c2bd, 0xc5394f0)
extends:Standard
replaceUI:true
(
parameters main rollout:params
(
mtlCurrent type:#material ui:mtlBtn
)

rollout params "Material test"
(
label lbl "This message is part of the scripted interface"
materialbutton mtlBtn "material button"
)

on create do
(
delegate.name = "a standard material"
mtlCurrent = delegate --if you disable this line, the interface appears when you make a new material
)

)
Compare this plugin to the plugin in the first post. I'm a happy scripter now!

Klaas

CGTalk Moderation
05-13-2009, 09:08 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.