UserData
ReferencesProvides a base class for custom classes of information which may be attached to geometry or attribute classes.
Finalizer
~UserData
#~UserData()
Passively reclaims unmanaged resources when the class user did not explicitly call Dispose().
Properties
If you want to save this user data in a 3dm file, override ShouldWrite and return true. If you do support serialization, you must also override the Read and Write functions.
Updated if user data is attached to a piece of geometry that is transformed and the virtual OnTransform() is not overridden. If you override OnTransform() and want Transform to be updated, then call the base class OnTransform() in your override. The default constructor sets Transform to the identity.
Methods
Expert user tool that copies user data that has a positive CopyCount from the source object to a destination object. Generally speaking you don't need to use Copy(). Simply rely on things like the copy constructors to do the right thing.
Parameters:
| source (CommonObject) | A source object for the data. |
| destination (CommonObject) | A destination object for the data. |
public void Dispose()
Actively reclaims unmanaged resources that this instance uses.
Dispose
#For derived class implementers.
This method is called with argument true when class user calls Dispose(), while with argument false when the Garbage Collector invokes the finalizer, or Finalize() method.
You must reclaim all used unmanaged resources in both cases, and can use this chance to call Dispose on disposable fields if the argument is true.
Also, you must call the base virtual method within your overriding method.
Parameters:
| disposing (bool) | true if the call comes from the Dispose() method; false if it comes from the Garbage Collector finalizer. |
Moves the user data from objectWithUserData to a temporary data storage identified by the return Guid. When MoveUserDataFrom returns, the objectWithUserData will not have any user data.
Parameters:
| objectWithUserData (CommonObject) | Object with user data attached. |
Returns: Guid identifier for storage of UserData that is held in a temporary list by this class. This function should be used in conjunction with MoveUserDataTo to transfer the user data to a different object. Returns Guid.Empty if there was no user data to transfer.
Moves the user data.
See MoveUserDataFrom(CommonObject) for more information.
Parameters:
| objectToGetUserData (CommonObject) | Object data source. |
| id (Guid) | Target. |
| append (bool) | If the data should be appended or replaced. |
OnDuplicate
#Is called when the object is being duplicated.
Parameters:
| source (UserData) | The source data. |
OnTransform
#Is called when the object associated with this data is transformed. If you override this function, make sure to call the base class if you want the stored Transform to be updated.
Parameters:
| transform (Transform) | The transform being applied. |
Read
#Reads the content of this data from a stream archive.
Parameters:
| archive (BinaryArchiveReader) | An archive. |
Returns: true if the data was successfully written. The default implementation always returns false.
Write
#Writes the content of this data to a stream archive.
Parameters:
| archive (BinaryArchiveWriter) | An archive. |
Returns: true if the data was successfully written. The default implementation always returns false.