Still in C++CHOP Callback Troubles :)

Hi. im still not able to access the callback data inside the clusplusCHOP_with_Python_class from the Samples Folder. sorry - i’m to dumb for that …

what i have now is: ive set up a Base with callbackExtension. Inside that i have the cpluplusCHOP. (there should the Speed value be as an callback example inside). then ive a Text DAT via which i wanna access that Speed-value.

print(op(‘cplusplus1’).par.callbacksDat …???)

i don’t know, if i have to setup the callback Extension to the base or not - or if i can access that Speed-value from a single script too …

maybe please someone can give me a starting hint :slight_smile:

EDIT:
as i understand this, there should be a par.callbacksDat …
but there is none


Are you setting that the pythonCallbacksDAT member to something other than nullptr? It needs to be filled in with the code you want to be in the ‘default callbacks’ DAT when that node is created. That will enable that feature.

hi. thx for reply. i thought, there is allready a little example code in that CHOP_with_Python_class.
i took that …

is that not enought for generating the callbacksDat?


Screenshot 2022-10-06 205239

Ah right, this callbacks DAT only works when you are using the node as a Custom OP, not as a C++ CHOP. So you’ll need to copy your .dll to Documents/Derivative/Plugins and load it as that. Then you get get a callback DAT that your C++ code can call to query Python for data, or execute stuff in Python during the cook.

1 Like

I’ll mention the callbacks arn’t really meant to get ‘get’ data out of the CHOP via a Text DAT. If you want to do that you should be using the getSets example such as ‘executeCount’, or ‘speedMod’.
The callbacks are more for information or work that should be handled during the cook.

1 Like

the get/Set also works only in Custom OP mode?

if technically possible - maybe you think about a cplusplusCHOP-version too - for easier debug :slight_smile:

EDIT:
Have it.

Haha .
op(“Customsignalpython1”).executeCount

thank you

NOW I’M HAPPY

:slight_smile:

could you please make one exception and give me this one line of python code to show me how i can access the getSets vals for the given pyGetExecuteCount

static PyObject* pyGetExecuteCount(PyObject* self, void*)

static PyGetSetDef getSets[] =
{
// This one doesn’t define a ‘setter’, so it’s a read-only value.
{“executeCount”, pyGetExecuteCount, nullptr, “Get execute count.”, nullptr},
{0}
};

please. that would help me a lot

getSet works in both forms, it’s just the callback DAT that is limited.
I’m not sure I understand your question though, can you elaborate?

ah - sorry - forgot to delete the question from before the EDIT. (wasn’t able to call the function in correct way … but finally found out.)

so - in the cusom OP all works fine.

in the cplusplusCHOP it doesn’t. there the getSet couldnt be found… made a network, with the same dll. as custom op and inside the cplusplus. (see pic). the custom OP works fine. the c++CHOP not. maybe ive to call different …

Im so sorry hp3007. Python does indeed only work with the Custom Operator workflow, not as C++. This is due to how the Python classes are loaded into our namespace. I think it’d be quite difficult to make it work with the C++ nodes themselves, since they need to be unloaded/loaded.

hi, no problem. knowing that now is ok. its a little bit “unhandy” to develop and debug - but, no problem to change my workflow.

thx for helping - cu next time :slight_smile:

and a nice weekend.