On 04/02/2016 at 14:08, xxxxxxxx wrote:
Because that is how I was told to use a templated Callback.
Here is an example of using the GeDynamicArrayCallback() which works
//GeDynamicArrayCallback is declared as: typedef void GeDynamicArrayCallback(VLONG index, TYPE *value, void *data);
//First you have to define a global callback function like this
template<class TYPE> void myArrayCallback(VLONG index, TYPE *value, void *data)
{
*value *= 2; //value is the current value at index in the dynamic array
}
//Then pass that function (myArrayCallback) to the array in your method where your array is
Bool myDialog::Command(LONG id,const BaseContainer &msg) //This is where the code that does something goes
{
GeDynamicArray<LONG> myarray(3);
myarray[0] = 100;
myarray[1] = 200;
myarray[2] = 300;
myarray.DoToAll(&myArrayCallback, NULL);
return TRUE;
}
But this code doesn't help me with the ProgressHook callback.
Because I have no class member to call it with.
If the ProgressHook callback works differently then I need to know why it's different. And how to use it properly.
I've been trying to use Google to help figure this out. But MAXON writes their callbacks using void *data. And I can't find anyone posting code like that.
Every time I need to use a C4D SDK callback. I get entangled in this "How do I use This thing?" battle.
The code I find on the web and in my C++ books isn't much help understanding how MAXON is doing them.
-ScottA
*Edit-- BTW. Thanks for the hint Niklas. This works when used with my callback function:
RenderDocument(GetActiveDocument(), rdata, pr<Real>, NULL, bmp, RENDERFLAGS_EXTERNAL, NULL);
Is there anything that we can do with void *private_data?