Community
Mudbox Forum
Welcome to Autodesk’s Mudbox Forums. Share your knowledge, ask questions, and explore popular Mudbox topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom Preferences Plugins

7 REPLIES 7
Reply
Message 1 of 8
Anonymous
426 Views, 7 Replies

Custom Preferences Plugins

Anonymous
Not applicable

Hi,

It looks like maybe we are getting some SDK support here now?

One of the things I really need is an example of how to create a custom preference option(a checkbox widget) so that I can load, or not load, one of my own plugins when Mudbox launches.

AFAIK, there isn't an example for this in the SDK examples.

Can someone please post a very basic example how to do this?

 

Thanks,

ScottA

0 Likes

Custom Preferences Plugins

Hi,

It looks like maybe we are getting some SDK support here now?

One of the things I really need is an example of how to create a custom preference option(a checkbox widget) so that I can load, or not load, one of my own plugins when Mudbox launches.

AFAIK, there isn't an example for this in the SDK examples.

Can someone please post a very basic example how to do this?

 

Thanks,

ScottA

7 REPLIES 7
Message 2 of 8
imre.major
in reply to: Anonymous

imre.major
Alumni
Alumni

Hi,

 

You can check the example plugin MapExtractorPlugin, in MapExtractorPlugin.cpp line 34 you can see an example of adding a bool preference:

	// Create a new boolean preference in the File section of the preferences window. This
	// preference can be used to turn this plug-in on and off. 
    s_bEnableMapExtractor = Kernel()->Preferences()->RegisterBoolVariable(NTR("Custom Map Extract Options"), NTR("Files"), 
		QObject::tr("Customize Map Extraction Options on startup"), QObject::tr("Files"), bEnable);
0 Likes

Hi,

 

You can check the example plugin MapExtractorPlugin, in MapExtractorPlugin.cpp line 34 you can see an example of adding a bool preference:

	// Create a new boolean preference in the File section of the preferences window. This
	// preference can be used to turn this plug-in on and off. 
    s_bEnableMapExtractor = Kernel()->Preferences()->RegisterBoolVariable(NTR("Custom Map Extract Options"), NTR("Files"), 
		QObject::tr("Customize Map Extraction Options on startup"), QObject::tr("Files"), bEnable);
Message 3 of 8
Anonymous
in reply to: imre.major

Anonymous
Not applicable

Thanks. But I'm still a bit confused about how this works.

I'm used to working with SDKs where there  is a separate type of plugin just for making the preferences stuff.

Do we create custom preferences in a separate plugin. Then poll for them in the plugin we want it to control?

Or

Do we add the custom preferences option right in the plugin being loaded/not loaded itself?

 

-ScottA

0 Likes

Thanks. But I'm still a bit confused about how this works.

I'm used to working with SDKs where there  is a separate type of plugin just for making the preferences stuff.

Do we create custom preferences in a separate plugin. Then poll for them in the plugin we want it to control?

Or

Do we add the custom preferences option right in the plugin being loaded/not loaded itself?

 

-ScottA

Message 4 of 8
imre.major
in reply to: Anonymous

imre.major
Alumni
Alumni

I checked this again, and indeed the plugin MapExtractorPlugin is not using that preference correctly. It is registering it in the correct way, so it shows up in the preferences, the value is saved, reloaded after you restart, but it is not used anywhere. Luckily the missing part is the easiest, just take the value, and use it anywhere. So no need to add another plugin. In you main plugins initialize function (the one you specify in the MB_PLUGIN macro, you can check how the MapExtractorPlugin example does that) you need to call Kernel()->Preferences()->RegisterBoolVariable, and your checkbox will show up in the preferences, and the value will be correctly saved/loaded on exit/startup.

0 Likes

I checked this again, and indeed the plugin MapExtractorPlugin is not using that preference correctly. It is registering it in the correct way, so it shows up in the preferences, the value is saved, reloaded after you restart, but it is not used anywhere. Luckily the missing part is the easiest, just take the value, and use it anywhere. So no need to add another plugin. In you main plugins initialize function (the one you specify in the MB_PLUGIN macro, you can check how the MapExtractorPlugin example does that) you need to call Kernel()->Preferences()->RegisterBoolVariable, and your checkbox will show up in the preferences, and the value will be correctly saved/loaded on exit/startup.

Message 5 of 8
Anonymous
in reply to: imre.major

Anonymous
Not applicable

OK. Thanks for the help.

 

I see that you're listed as an employee. Are you providing SDK help here now?

I have another plugin that I wrote that throws up a message box if I attempt to sculpt on a base mesh(Not a layer). It's very useful to me. I can't tell you how many times I've sculpted on the base mesh by accident. 😉

It works fine. But the plugin's checkbox that enables/disables it does not show up until I mouse over one of the other pre-existing menus first. And this strange behavior only happens if the plugin is created as a child of the "plugin's" menu.

There's no SDK example showing how to use the checkbox option with menu items. So I winged it. And I probably didn't do it quite right.

I stopped using the Mudbox SDK years ago because of I could not get any SDK help on basic things like this.

 

IMHO. This is something (using checkbox icons with menu items to turn them off/on) that really should be included in the example files. It's really kind of meat and potatoes stuff that everyone is going to want to do at some point. And I was surprised it wasn't there in the examples.

I can post my plugin code in a different thread if you like?

 

-ScottA

0 Likes

OK. Thanks for the help.

 

I see that you're listed as an employee. Are you providing SDK help here now?

I have another plugin that I wrote that throws up a message box if I attempt to sculpt on a base mesh(Not a layer). It's very useful to me. I can't tell you how many times I've sculpted on the base mesh by accident. 😉

It works fine. But the plugin's checkbox that enables/disables it does not show up until I mouse over one of the other pre-existing menus first. And this strange behavior only happens if the plugin is created as a child of the "plugin's" menu.

There's no SDK example showing how to use the checkbox option with menu items. So I winged it. And I probably didn't do it quite right.

I stopped using the Mudbox SDK years ago because of I could not get any SDK help on basic things like this.

 

IMHO. This is something (using checkbox icons with menu items to turn them off/on) that really should be included in the example files. It's really kind of meat and potatoes stuff that everyone is going to want to do at some point. And I was surprised it wasn't there in the examples.

I can post my plugin code in a different thread if you like?

 

-ScottA

Message 6 of 8
imre.major
in reply to: Anonymous

imre.major
Alumni
Alumni

Yes you can send the source as a private message to me, however I cannot guarantee that I can help you solve this. Based on what you wrote, I don't know what could be the problem here. But I will take a look.

0 Likes

Yes you can send the source as a private message to me, however I cannot guarantee that I can help you solve this. Based on what you wrote, I don't know what could be the problem here. But I will take a look.

Message 7 of 8
imre.major
in reply to: Anonymous

imre.major
Alumni
Alumni

The important thing about the menus is that Mudbox creates them dynamically every time when they appear, and when they disappear all the related UI objects are destroyed. The reason for this is to be able to customize the menus based on the current scenario, for example the Edit menu might contain different items if the currently selected mesh has paint layers or not.

 

Unfortunately there is no support for checkboxes for menu items in the Mudbox SDK now, so you need to get the QAction object, and set it to be checkable. But as I said above, this object doesn't exists most of the time, only created when the menu appears, and deleted after that. So what you need is to catch the menu creation event, insert the action there by calling MenuManipulator::AddMenuItem. That will give you a pointed to the related QAction object, where you can easily make it checkable or customize it even further. Unfortunately This menu creation event doesn't occur for the plugins menu, so I would suggest for you to put it in some other one, maybe the Mesh menu would be good. Does it help you with your problem? I'm not sure if this is what you had a problem with.

0 Likes

The important thing about the menus is that Mudbox creates them dynamically every time when they appear, and when they disappear all the related UI objects are destroyed. The reason for this is to be able to customize the menus based on the current scenario, for example the Edit menu might contain different items if the currently selected mesh has paint layers or not.

 

Unfortunately there is no support for checkboxes for menu items in the Mudbox SDK now, so you need to get the QAction object, and set it to be checkable. But as I said above, this object doesn't exists most of the time, only created when the menu appears, and deleted after that. So what you need is to catch the menu creation event, insert the action there by calling MenuManipulator::AddMenuItem. That will give you a pointed to the related QAction object, where you can easily make it checkable or customize it even further. Unfortunately This menu creation event doesn't occur for the plugins menu, so I would suggest for you to put it in some other one, maybe the Mesh menu would be good. Does it help you with your problem? I'm not sure if this is what you had a problem with.

Message 8 of 8
Anonymous
in reply to: imre.major

Anonymous
Not applicable

Ok. Thanks a lot for your help on this.

Even though there's no way to make it work properly. At least you've confirmed that the plugins menu doesn't support child menu plugins turning them on/off via the checkbox option(Ouch!!). And it's not something I'm doing wrong.

 

As you've pointed out.

If I put my plugin under one of the other menus. The checkbox works(updates) more as expected.

But the problem with that is if I make several plugins and use plugins from other people. Then my menus will become a mess.

The plugins menu is where most people put their 3rd party plugins in other software programs. And that's where I prefer to put them also. Keeping them all in one area of the menu rather than spread out throughout the menus.

 

Could you please pass this problem along to the developers and see if they can maybe update it?

IMHO. Turning the plugins on/off under that menu is sort of a big thing to be missing.

We really should be able to use it the same as the other menus like this:

QMenu *pluginsMenu = Kernel()->Interface()->DropDownMenu(Interface::ddmPlugins);

 

Thank you for the help,

-ScottA

0 Likes

Ok. Thanks a lot for your help on this.

Even though there's no way to make it work properly. At least you've confirmed that the plugins menu doesn't support child menu plugins turning them on/off via the checkbox option(Ouch!!). And it's not something I'm doing wrong.

 

As you've pointed out.

If I put my plugin under one of the other menus. The checkbox works(updates) more as expected.

But the problem with that is if I make several plugins and use plugins from other people. Then my menus will become a mess.

The plugins menu is where most people put their 3rd party plugins in other software programs. And that's where I prefer to put them also. Keeping them all in one area of the menu rather than spread out throughout the menus.

 

Could you please pass this problem along to the developers and see if they can maybe update it?

IMHO. Turning the plugins on/off under that menu is sort of a big thing to be missing.

We really should be able to use it the same as the other menus like this:

QMenu *pluginsMenu = Kernel()->Interface()->DropDownMenu(Interface::ddmPlugins);

 

Thank you for the help,

-ScottA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report