Saving host instance pointer within DGFBinding

StephenTStephenT Fabric for MotionBuilder Posts: 77

I would like to save a pointer within the DFGBinding. I can't find any method for storing an arbitrary pointer within the DFGBinding - do any exist?

When changes come through DFGUICmdHandler, I need to propagate changes back to the host app's wrapping instance. At this point, I have a handle to the binding, but no way to get a pointer to the owning host class. Max handles this by creating a unique CmdHandler for each binding (and simply stores the host pointer), while Maya handles this by storing a unique ID in the binding metadata.

I'd guess from this that no method exists. Maya's method works, but it feels a bit awkward - so this is more of a feature request than anything. Could we store a user pointer on the DFGBinding?

I wasn't sure where to post this, so here it goes :)

Tagged:

Comments

  • borjaborja Administrator, Fabric Employee Posts: 480 admin

    Hi @StephenT , I am passing this request to the dev team for discussion!

    Borja Morales
    Technical Product Manager
    Fabric Software Inc.

  • pzionpzion Moderator, Fabric Employee Posts: 117 Fabric Employee

    You can encode an arbitrary pointer as an RTVal of type Data. Use the RTVal::ConstructData() static function to do so.

    Now, you can store RTVals in a bunch of different places in a DFGBinding (arguments, port default values, variables) but none of them are probably what you want.

    That said, going back to your actual problem, is there a reason you don't simply use a DFGBinding-to-pointer hash map of some sort in your host application?

    Peter Zion
    Fabric Engine

  • StephenTStephenT Fabric for MotionBuilder Posts: 77

    I guess there is no real problem with it (it's already implemented and working fine). Performance shouldn't be a concern, there is unlikely to be more than a few hundred graphs simultaneously. Its just the level of indirection feels a bit awkward - it's not my first choice for enforcing binding between DFGBinding and host instance.

Sign In or Register to comment.