pluginManager.loadClass quirks?

pluginManager.loadClass quirks?

lightcube
Advisor Advisor
395 Views
1 Reply
Message 1 of 2

pluginManager.loadClass quirks?

lightcube
Advisor
Advisor
I've been building an export tool for the Source Game Engine. One of the main features is the use of third-party exporters to export files to a specific format (in this case, SMD files). The two SMD exporter developers have been very helpful in updating their plugins to accomodate the tool.

I've run into a wall, though, in preparing support for Wunderboy's newest SMD exporter (which he's provided me to test before he releases it).

A dilemma I've run into is that he has made the plugin load as a deferred plugin--which is really cool from a user's perspective since (I believe) it doesn't use up resources unless it's actually called. The problem is that the first time my script runs, there is an error... like the plugin isn't installed at all.

To load the plugin I use this syntax:

pluginManager.loadClass SMDExporter


which is the syntax he's provided (and similar to those I've seen in other examples).

But it isn't available to MAXScript until after it fails once and I reload my script.

To explain more:

1) When I load Max, the plugin is listed in the plugin manager but has a yellow icon to denote it's deferred.

2) I run my script. It includes the code above. Now in the plugin manager, the plugin is green.

3) I run the export... and it fails.

4) I re-run my script, and it works.

Any ideas about why an export plugin fails when initialized from MAXScript using pluginManager.loadClass ? Is there something that should be done in MAXScript to get this to work? The docs on pluginManager.loadClass are less than extensive. Is there a bug with this method?


Shawn Olson

Developer of Wall Worm
3ds Max plugins and Scripts

3ds Max 4/Gmax - 3ds Max 2020
Mudbox 2009-2019

Windows 10 x64
i7 8700K
64GB RAM
Geforce 1080ti
0 Likes
396 Views
1 Reply
Reply (1)
Message 2 of 2

lightcube
Advisor
Advisor
So I've found a solution... thanks to Anubis over at ScriptSpot for pointing me in the right direction.

Anubis suggested running pluginManager.loadClass twice. That didn't work inside my script (down deep in the code). But when I ran it twice at the very beginning of my script, it works.

As I've seen people with the same problem with other plugins... it almost seems like a bug in pluginManager.loadClass . That, or there needs to be a lot more documentation on pluginManager.loadClass to explain how it works!


Shawn Olson

Developer of Wall Worm
3ds Max plugins and Scripts

3ds Max 4/Gmax - 3ds Max 2020
Mudbox 2009-2019

Windows 10 x64
i7 8700K
64GB RAM
Geforce 1080ti
0 Likes