Min Changes to create a new plugin from an example - SOLVED
Tried to spawn a new project in two ways -
First changed all class names and plugin descriptors and guids. This will eun along side the original (dzsceneinfo) but the local functions never get called - only the refresh() which is inherited from dzPane works.
connect( dzScene, SIGNAL(primarySelectionChanged(DzNode*)), this, SLOT(refreshSelected(DzNode*)) ); // this never gets called - or linkage fails
connect( dzScene, SIGNAL(primarySelectionChanged(DzNode*)), this, SLOT(refresh()) ); // this works fine.
All other not conected to refresh() slots also fail to get called.
So try 2 I just left all the class names the same and just changed the guids, plugin name, dll name, DZPane name, QtextBrowser name, PaneAction string name, and the QT sting names.
This plugin works as expected, but if the example plugin is there, only the example is listed in the menu, the new one is not, so they are still colliding. There is still osme identifier that belongs to the example plugin.
I would rather use the one with all new classes, which is just missing an icon, but I can not call any local functions. From what I could ding, the plugin definition macros should take care of that.
Any idea on what makes the local 'slot' functions work or fail? Or where docs for them are?
Thanks
Comments
Is the problem that primarySelectionChanged(DzNode* node) will often have node=NULL?
e.g. if the current selected is changed from one node to another primarySelectionChanged(DzNode* node) may fire multiple times.
As the current selection moves off the previously selected node it goes to NULL in the interim, primarySelectionChanged(DzNode* node) will fire and node will evaluate as NULL. It will then immediately fire again as the current selection moves on to the new selected node at which time node will evaluate to the new selected node.
Try adding some code to the beginning of your refreshSelected(DzNode* node){...} function to check for NULL==node.
The SDK docs should have been installed on you hard drive when the SDK was installed. e.g. ...\DAZStudio4.5+ SDK\docs
Bookmark the ...\DAZStudio4.5+ SDK\docs.index.html to quickly find then when you need to.
No, it never gets called at all. I added code to see which routines were getting called (by setting displayed counts) and only the refresh() funtion is ever called at all ( the one funtion inherited from DzAction).
The only info I can find about linking my class is the DAZ Macros used in pluginmain.
DZ_PLUGIN_DEFINITION( "UV Tailor" );
DZ_PLUGIN_AUTHOR( "Greenbriar Studio" );
DZ_PLUGIN_VERSION( PLUGIN_MAJOR, PLUGIN_MINOR, PLUGIN_REV, PLUGIN_BUILD );
DZ_PLUGIN_DESCRIPTION(
"Displays and prints base and SubD altered UVs over their base textues. For editing or exporint for texture creation"
);
DZ_PLUGIN_CLASS_GUID( UVTailorPane, 6E952375-D855-4B99-A3BB-9EEFD90A631A );
DZ_PLUGIN_CLASS_GUID( UVTailorPaneAction, B1972D03-FFCF-42FE-AB26-207B997078C1 );
The menu action works, my panel comes up and displays, but the private SLOT functions - none ever get called.
connect( dzScene, SIGNAL(primarySelectionChanged(DzNode*)), this, SLOT(refreshSelected(DzNode*)) ); // this one never gets called
// connect( dzScene, SIGNAL(primarySelectionChanged(DzNode*)), this, SLOT(refresh()) ); // this call will work when I click and change objects
Only if I connect a signal to refresh() will any oif them work.
UVTailorPane();
~UVTailorPane();
public slots:
/////////////////////////////
// from DzPane
virtual void refresh();
private slots:
// slots for refreshing/redrawing our data
void refreshSelected( DzNode *node );
void writeSceneStats();
// slots for blocking/unblocking our refresh functions during file load operations
void blockRefresh();
void unblockRefresh();
None of these private slots ever get called.
At this point I have only renamed everythinjg and changed names and GUIDS, so the plugin will run at the same time as the original sceneinfopane plugin without conflict.
Which it does, but I can not connect signals to my local funstions. But swap in refresh() and they work.
Haven't been able to find any reference to this in the docs so far.
David
Are your moc files getting built ?
You need the moc file to run slots and signals.
Its getting built. And the signal gets called, IF I link it to my refesh function (which is letting me get some testing work done) but if I put in any other function, even nother one with no params, it never gets called.
Not sure what I broke here.
Issue was the MOC method string table. I've used lots of guis, but I used WxWidgets for my 3D work (since it was free). This is my first encounter with Qt and its undefined arrays of setup definitions.
I broke the MOC setup. But it is now fixed and signals from dzscene are now working.
NIce. Yes it's a bit of a pain at first, I had similar problems.