![]() |
#1 |
Member
Advanced member
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
|
![]()
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. |
![]() |
![]() |
![]() |
#2 |
Member
Advanced member
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
|
![]()
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 |
![]() |
![]() |
![]() |
#3 |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,523
|
![]()
Thanks - I'll investigate...
|
![]() |
![]() |
![]() |
#4 |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,523
|
![]()
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); ... 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); 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 |
![]() |
![]() |
![]() |
#5 |
Member
Advanced member
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 39
|
![]()
Yay! That worked a treat.
Cheers Andy! |
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|