Python callbacks broken in custom C++ POP?

Has anyone verified that the python custom callbacks in POP custom components work in TouchDesigner?

I’m building a small POP extension to test interop between POP datastructures and torch tensors. This custom op needs to expose custom python methods & attributes to access POP buffers and call a standard “onCook” custom callback.

Working from the CHOPWithPythonClass and SimpleShapesPOP examples, I’ve been able to build a POP operator that exposes pop data via methods and properties. However, the callPythonCallback interface appears to be broken and doesn’t resolve callbacks when used with a POP_CPlusPlusBase subclass.

I’ve verified my implementation using a CHOP_CPlusPlusBase subclass and isolated the error to the return of callPythonCallback. To summarize…

When using POP_CPlusPlusBase I’ve verified that…

  • :white_check_mark:info->customOPInfo.pythonMethods exposes methods that can be called on the op.
  • :white_check_mark:info->customOPInfo.pythonCallbacksDat exposes a callbacks template and a results in a Callbacks DAT parameter on OP which successfully initializes from the template.
  • :cross_mark:OP_NodeInfo::context::callPythonCallback does not resolve or call the callback, returning Py_None for all invocations.

Has anyone attempted to build a C++ Custom POP and encountered this behavior.
Is there sample code available which exercises the python custom method/attribute/callback feature for POPs?

Thanks for reporting this, I’ll take a look soon and see what is happening.

Hey, I’m unable to reproduce this issue. Attached is my sample code. I can see a print() statement in the python callback being printed. Here is my edited .cpp file

SimpleShapesPOP.zip (8.2 KB)