How to store custom objects with Pdef.set?

I am writing a class, and i want it to behave like a value when used in Ndef and Pdef

With Ndef, I am able to do Nef(\sin).set( ~object ) because Ndef call ~object.asControlInput just before using it

But with Pdef, when i do Pdef(\sin).set( ~object ) it seems nothing is called on it, this result in the object not understood by the synthdef (ignored i guess), it see it in the result event instead of the value expected

( ‘instrument’: default, ‘dur’: 1, ‘amp’: 0.1, ‘freq’: a CustomClass )

My goal is to be able to retrieve the object with Pdef(\sin).get. If I convert it to a value first, I can’t access to the object anymore (I can store it elsewhere but this complicate the design a lot)

I know I can also use the object in the pattern directly, but this require to use Pbindef, if it’s another pattern this will fail. I don’t want a pattern, just a .asControlInput like