Ocaf and UAttribute

Hi all, I've a question about using UAttribute in Ocaf document. If I need to define an UAttribute that contain for instance a reference (as C++ pointer) to my C++ Object, How do I do to define this attribute? I don't understend if I need to define a new class that inherit from UAttribute. Is there somebody that provide me an example?

Thanks Fabrizio.

Sergey RUIN's picture

Hi Fabrizio,

UAttribute isn't supposed for storing any reference. The only purpose of UAttribute is to store arbitary GUID. For example if there is a need to assign to the TDF_Label a semantic.

To have attribute that stores a reference to some C++ object you need to create your own attribute that inherits from TDF_Attribute, redefine its virtual methods (only Paste, Restore, NewEmpty and ID have to be mandatory redefined) then add methods to Set/Get your reference and a field to store it in the attribute.

That's enough to have a Transient version of the attribute.

Best Regards

Sergey