Go Back   AC3D Forums > Technical > AC3D Developers
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 10th December 2003, 08:56 PM   #1
monster
Member
Advanced member
 
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
Default Export plugin configure dialog

Hi Folks,

I've managed to write a plugin that exports from Ac3d to the OGRE mesh and material format. Which is nice.

But I'd like the user to be able to configure the exporter in a couple of ways, for example; to scale the mesh on export, to collapse all the objects into a single OGRE sub-mesh.

I imagine this can be done in tcl/tk, but I'm afraid I wouldn't know where to start with this! So, a couple of questions;
1) Do I have to supply a tcl script or can I execute the commands to build up a configuration dialog 'on-the-fly' from the exporter?
2) Is there a mechanism within exporters for writing values to (so I can save the config preferences between exports), and reading them back from, the UI widgets I create?
3) Can anyone recommend a simple guide to tcl? Bearing in mind that the dialog will probably be very basic!

Thanks for your time.
monster is offline   Reply With Quote
Old 11th December 2003, 05:53 AM   #2
monster
Member
Advanced member
 
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
Default Re: Export plugin configure dialog

I had thought I'd be able to use prefs_append_prefspec.

Would that add my settings to the standard Ac3d Settings dialog and have them managed (i.e. loaded and saved) by Ac3d?

But I get link errors using this function;

LNK2019: unresolved external symbol __imp__prefs_append_prefspec referenced in function _AC3DPluginInit
monster is offline   Reply With Quote
Old 11th December 2003, 06:54 AM   #3
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,382
Default Re: Export plugin configure dialog

Thanks - I'll investigate...
Andy is offline   Reply With Quote
Old 11th December 2003, 07:34 AM   #4
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,382
Default Re: Export plugin configure dialog

Unfortunately, this symbol was not exported as C, but C++. I'll fix this for the next release.

You should be able to refine it with:

Prototype void prefs_append_prefspec(PrefSpec *n);

in your C++ plugin.



add a pref like this:

Code:
static double grid_size = 1.0;

PrefSpec pref = 
{
    "field_grid_size", PREF_DOUBLE, (void *)&grid_size,
};


AC3D_PLUGIN_FUNC int AC3DPluginInit()
{
double ver = ac_get_version_number();

	prefs_append_prefspec(&pref);

...
This means that it will be saved and loaded from the AC3D settings file.
It won't appear in the settings dialog. If you want to access the pref from within tcl, you need to call.

Code:
Prototype void ac_tcl_link_pref(PrefSpec *p);
The var can now be accessed in tcl with pref_field_grid_size.

You can set a function to be called before the filename selection of you importer:

Prototype Boolean ac_exporter_set_settings_function(char *suffix, ac_file_settings_func func); // to be called before export

If 'func' returns TRUE, the exporter function will be called.
You'll need to make a tcl dialog which uses a tcl 'vwait' to block the eventhandler before returning.

Another way to do this would be:

ac_add_command( ogre_plugin", ogre_function );
ac_add_export_menu_item("Ogre...", "ac3d ogre_plugin");

Then in the ogre_function, you can popup a tcl dialog and do your own saving from there.

A good reference for tcl/tk is AC3D's own tcl/tk files in the tcl directory. Other than that - a google search should find some docs.

Andy
Andy is offline   Reply With Quote
Old 11th December 2003, 11:23 AM   #5
monster
Member
Advanced member
 
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
Default Re: Export plugin configure dialog

Yay! That worked a treat.
Cheers Andy!
monster is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 08:50 PM.


AC3D Forum
(C) Inivis Limited 2020