iamjaideep80 Posted February 16, 2017 Share Posted February 16, 2017 Hello, I want to add an event_callback on frameChange in playbar, using HDK. In Python it works like this : hou.playbar.addEventCallback(outputPlaybarEvent) What is the HDK equivalent of this ? Thanks, Jaideep Khadilkar Quote Link to comment Share on other sites More sharing options...
MrScienceOfficer Posted February 17, 2017 Share Posted February 17, 2017 I've never seen anything. If you need to call into C++ on time change events outside of a node, it's probably best to just create a python wrapper into your plug in. Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted February 19, 2017 Share Posted February 19, 2017 (edited) If you really need to run c++ callback you can try this: #include <HOM/HOM_Module> HOM_Module &hom = HOM(); HOM_playber &playbar = hom.playbar(); playbar.addEventCallback(...); P.S. Should work in theory, haven't tested it. Edited February 19, 2017 by Stalkerx777 Quote Link to comment Share on other sites More sharing options...
iamjaideep80 Posted February 20, 2017 Author Share Posted February 20, 2017 Hello @Stalkerx777, Thanks for you suggestion. But the above code doesn't compile as "addEventCallback()" method is only available if "SWIG" is defined. Any work-around for this ? Quote Link to comment Share on other sites More sharing options...
iamjaideep80 Posted February 20, 2017 Author Share Posted February 20, 2017 On 17/02/2017 at 11:24 AM, MrScienceOfficer said: I've never seen anything. If you need to call into C++ on time change events outside of a node, it's probably best to just create a python wrapper into your plug in. Hello @MrScienceOfficer, Can you please explain in detail, how to create such wrapper ? Couldn't find similar thing in HDK Samples. Quote Link to comment Share on other sites More sharing options...
MrScienceOfficer Posted February 20, 2017 Share Posted February 20, 2017 The sample for python wrappers is in the HOM folder. ../toolkit/samples/HOM/ObjNode_setSelectable.C It's very well commented and should walk you through the process. Any type prefixed with "PY_Py" is (in most cases) a wrapper to the CPython API. So if you need to look up documentation you need to remove the "PY_" and look up the type here https://docs.python.org/2/c-api/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.