[osg-users] pfObject::getNamedUserDataSlot

Robert Osfield robert.osfield at gmail.com
Mon Nov 23 05:11:29 PST 2015


On 23 November 2015 at 11:38, Tony Vasile <minghia at gmail.com> wrote:

> Hi Robert,
>   Unless I am going blind I couldn't see an explicit apply for
> osg::Object in either GetValueVisitor or SetValueVisitor, hence the
> question.


This is different question to saving data, the serialization support uses
completely different mechanism.

Have a look at include/osg/ValueObject for the get/set methods for the
ValueObject/GetValueVisitor/SetValueVisitor.

Or... just use the template methods in osg::Object i.e.

 // set value
 int count;
 object->setUserValue("count", count);

  // get value
  object->getUserValue("count", count);

The later returns true of the object has a "count" value object of the same
type as the parameter passed in.  You need to take care here as:

  unsigned int value;
  object->getUserValue("count", value);

Will return false for the above setting using an int.

Robert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20151123/c632c27c/attachment-0003.htm>


More information about the osg-users mailing list