HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_AIFEditDelta Class Referenceabstract

Base class to store recorder data. More...

#include <GA_AIFEdit.h>

Public Member Functions

 GA_AIFEditDelta ()
 
virtual ~GA_AIFEditDelta ()
 
virtual int64 getMemoryUsage (bool inclusive=false) const =0
 
virtual GA_AIFEditDeltacreateNew () const =0
 Create a new (empty) instance of the derived class. More...
 
virtual GA_AIFEditDeltaclone () const =0
 Create a copy of this delta. More...
 
virtual bool isCompatible (const GA_Attribute *attrib) const =0
 Test compatibility with a particular attribute. More...
 
virtual bool isCompatible (const GA_AIFEditDelta *delta) const =0
 
virtual GA_AIFEditSnapshotstartEdit (const GA_Attribute *attrib, GA_Offset element)=0
 
virtual GA_AIFEditSnapshotstartEdit (const GA_Attribute *attrib, const GA_Range &elements)=0
 
virtual bool endEdit (GA_AIFEditSnapshot *snapshot, const GA_AIFEditDeltaMap &map, const GA_AIFEditDeltaCoordFrames *frames=0)=0
 
virtual bool mergeEdit (const GA_AIFEditDelta *other, const GA_AIFEditDeltaCoordFrames *otherfr=0, const GA_AIFEditDeltaCoordFrames *localfr=0, bool inverse=false)=0
 
virtual bool mergeSymmetricEdit (const GA_AIFEditDelta *other, const GA_AIFEditDeltaCoordFrames *otherfr, GA_AIFEditSymmetry &symmetry, const GA_AIFEditDeltaMap &map, const GA_AIFEditDeltaCoordFrames *localfr, bool inverse=false)=0
 
virtual bool applyEdit (GA_Attribute *attrib, const GA_AIFEditDeltaMap &map, const UT_Int64Array *subset=0, const GA_AIFEditDeltaCoordFrames *frames=0, bool inverse=false) const =0
 
virtual bool applyScaledEdit (GA_Attribute *attrib, fpreal scale, const GA_AIFEditDeltaMap &map, const UT_Int64Array *subset=0, const GA_AIFEditDeltaCoordFrames *frames=0, bool inverse=false) const =0
 
virtual GA_Size getDeltaCount () const =0
 Query the number of indices that have recorded deltas. More...
 
virtual void getDeltaIndices (UT_Int64Array &indices) const =0
 
virtual bool jsonSaveDefinition (UT_JSONWriter &w) const =0
 
virtual bool jsonSave (UT_JSONWriter &w) const =0
 Save the delta object to a JSON stream. More...
 
virtual bool jsonLoad (UT_JSONParser &p)=0
 Load a delta object from a JSON stream. More...
 
virtual bool legacyLoadTuple (GA_AIFEditDeltaTupleLegacyStream &)
 Load a legacy tuple delta. Only supported by some subclasses. More...
 
virtual bool legacyLoadIndexPair (GA_AIFEditDeltaIndexPairLegacyStream &)
 Load a legacy index pair delta. Only supported by some subclasses. More...
 
virtual void zeroDeltas ()=0
 
virtual void clearDeltas ()=0
 
virtual int getObjectSetCount () const
 
virtual void setObjectSetCount (int n)
 
virtual const
GA_AIFIndexPairObjects
getObjects (int s=0) const
 
virtual GA_AIFIndexPairObjectsgetObjects (int s=0)
 

Static Public Member Functions

static bool jsonSaveDelta (UT_JSONWriter &w, const GA_AIFEditDelta *delta)
 
static bool jsonLoadDelta (UT_JSONParser &p, GA_AIFEditDelta *&delta)
 
static voidoperator new (size_t size)
 
static voidoperator new (size_t size, void *p)
 In-place construction. More...
 
static void operator delete (void *p, size_t size)
 Deletion of an allocated object. More...
 
static void getAllocationStats (int64 &used, int64 &peak)
 Get memory statistics. More...
 

Detailed Description

Base class to store recorder data.

This class is responsible for maintaining changes to an attribute. The class must be able to save/load to a JSON stream.

The deltas are used by painting, editing and other modelling operations. For example, an undo mechanism might be implemented by:

changeAttrib()
{
GA_AIFEditSnapshot *snapshot;
delta = P->getAIFEdit()->createDelta(); // TODO: NULL ptr check
snapshot = delta->startEdit(P, GA_Range(P->getIndexMap()));
letUserEditPoints(P);
delta->endEdit(snapshot, GA_AIFEditDeltaIndexMap(P->getIndexMap()));
}
doUndoRedo(GA_Attribute *P, GA_AIFEditDelta *delta, bool undo)
{
}

Definition at line 217 of file GA_AIFEdit.h.

Constructor & Destructor Documentation

GA_AIFEditDelta::GA_AIFEditDelta ( )
virtual GA_AIFEditDelta::~GA_AIFEditDelta ( )
virtual

Member Function Documentation

virtual bool GA_AIFEditDelta::applyEdit ( GA_Attribute attrib,
const GA_AIFEditDeltaMap map,
const UT_Int64Array subset = 0,
const GA_AIFEditDeltaCoordFrames frames = 0,
bool  inverse = false 
) const
pure virtual

Apply this snapshot's edit delta to the attribute, optionally restricting which delta indices get applied. The optional coordinate frames will be used to apply deltas previously mapped to local space in world space (if supported).

virtual bool GA_AIFEditDelta::applyScaledEdit ( GA_Attribute attrib,
fpreal  scale,
const GA_AIFEditDeltaMap map,
const UT_Int64Array subset = 0,
const GA_AIFEditDeltaCoordFrames frames = 0,
bool  inverse = false 
) const
pure virtual

Scale and apply this snapshot's edit delta to the attribute, optionally restricting which delta indices get applied. This operation is not supported by all attributes supporting AIF_Edit. The optional coordinate frames will be used to apply deltas previously mapped to local space in world space (if supported).

virtual void GA_AIFEditDelta::clearDeltas ( )
pure virtual

Clear currently stored deltas. The first method, zeroDeltas(), is a lighter-weight clear that will endeavour to hold onto and reuse most allocated memory.

virtual GA_AIFEditDelta* GA_AIFEditDelta::clone ( ) const
pure virtual

Create a copy of this delta.

virtual GA_AIFEditDelta* GA_AIFEditDelta::createNew ( ) const
pure virtual

Create a new (empty) instance of the derived class.

virtual bool GA_AIFEditDelta::endEdit ( GA_AIFEditSnapshot snapshot,
const GA_AIFEditDeltaMap map,
const GA_AIFEditDeltaCoordFrames frames = 0 
)
pure virtual

After editing, the endEdit() method is called. This allows the computation of the actual delta from the snapshot. Do not use the snapshot again after calling this method. The optional coordinate frames will be used to store the delta relative to the local frame if supported.

static void GA_AIFEditDelta::getAllocationStats ( int64 used,
int64 peak 
)
static

Get memory statistics.

virtual GA_Size GA_AIFEditDelta::getDeltaCount ( ) const
pure virtual

Query the number of indices that have recorded deltas.

virtual void GA_AIFEditDelta::getDeltaIndices ( UT_Int64Array indices) const
pure virtual

Query the indices that have recorded deltas. Note that these are the delta indices, not the orders of the elements in the GA_IndexMap.

virtual int64 GA_AIFEditDelta::getMemoryUsage ( bool  inclusive = false) const
pure virtual
virtual const GA_AIFIndexPairObjects* GA_AIFEditDelta::getObjects ( int  s = 0) const
virtual

Query and set information about objects referenced by index pair data. Only supported by some subclasses.

virtual GA_AIFIndexPairObjects* GA_AIFEditDelta::getObjects ( int  s = 0)
virtual

Query and set information about objects referenced by index pair data. Only supported by some subclasses.

virtual int GA_AIFEditDelta::getObjectSetCount ( ) const
virtual

Query and set information about objects referenced by index pair data. Only supported by some subclasses.

virtual bool GA_AIFEditDelta::isCompatible ( const GA_Attribute attrib) const
pure virtual

Test compatibility with a particular attribute.

virtual bool GA_AIFEditDelta::isCompatible ( const GA_AIFEditDelta delta) const
pure virtual

Test compatibility with another delta. Compatibility in this case refers to ability to merge the deltas.

virtual bool GA_AIFEditDelta::jsonLoad ( UT_JSONParser p)
pure virtual

Load a delta object from a JSON stream.

static bool GA_AIFEditDelta::jsonLoadDelta ( UT_JSONParser p,
GA_AIFEditDelta *&  delta 
)
static
virtual bool GA_AIFEditDelta::jsonSave ( UT_JSONWriter w) const
pure virtual

Save the delta object to a JSON stream.

virtual bool GA_AIFEditDelta::jsonSaveDefinition ( UT_JSONWriter w) const
pure virtual

GA_AttributeType::jsonLoadDeltaDefinition() is the counterpart to this method.

static bool GA_AIFEditDelta::jsonSaveDelta ( UT_JSONWriter w,
const GA_AIFEditDelta delta 
)
static

JSON Schema: GA_AIFEditDelta

The schema for a delta consists of an ordered map (array) with two elements. The first, "type", is an ordered pair (array) providing the information needed to allocate a subclass of GA_AIFEditDelta. The second, "data", holds. the private data for the delta, which is saved and loaded by the GA_AIFEditDelta subclass.

[
"name" : "GA_AIFEditDelta",
"description" :
"A delta is defined by an ordered map (array) with two
elements, the definition ("type") and the private data
("data").
"type" : "orderedmap",
"properties": {
"type": {
"type" : "string",
"description" : "Ordered pair (type name, args)",
},
"data": {
"type" : "string",
"description" : "Internal delta data",
},
}
]

JSON Schema: GA_AIFEditDelta-Type

The delta "type" field is an ordered pair containing the attribute type and an object holding additional type arguments needed to recreate the delta.

{
"name" : "GA_AIFEditDelta-Type",
"description" : "An ordered pair defining the attribute",
"type" : "array",
"items": [
<"Attribute Type Name">, <"Type Arguments">
],
}
See Also
GA_AttributeType
virtual bool GA_AIFEditDelta::legacyLoadIndexPair ( GA_AIFEditDeltaIndexPairLegacyStream )
virtual

Load a legacy index pair delta. Only supported by some subclasses.

virtual bool GA_AIFEditDelta::legacyLoadTuple ( GA_AIFEditDeltaTupleLegacyStream )
virtual

Load a legacy tuple delta. Only supported by some subclasses.

virtual bool GA_AIFEditDelta::mergeEdit ( const GA_AIFEditDelta other,
const GA_AIFEditDeltaCoordFrames otherfr = 0,
const GA_AIFEditDeltaCoordFrames localfr = 0,
bool  inverse = false 
)
pure virtual

Merge a separate edit into this edit, matching elements by the internal ordered index. The optional coordinate frames will be used to store the delta relative to the local frame if supported.

virtual bool GA_AIFEditDelta::mergeSymmetricEdit ( const GA_AIFEditDelta other,
const GA_AIFEditDeltaCoordFrames otherfr,
GA_AIFEditSymmetry symmetry,
const GA_AIFEditDeltaMap map,
const GA_AIFEditDeltaCoordFrames localfr,
bool  inverse = false 
)
pure virtual

Merge the edits symmetric to those in a separate edit into this edit, matching elements by internal ordered index. The optional coordinate frames will be used to store the delta relative to the local frame if supported.

static void GA_AIFEditDelta::operator delete ( void p,
size_t  size 
)
static

Deletion of an allocated object.

static void* GA_AIFEditDelta::operator new ( size_t  size)
static

The new & delete operators are overloaded to help with memory tracking. Allocate new object

static void* GA_AIFEditDelta::operator new ( size_t  size,
void p 
)
static

In-place construction.

virtual void GA_AIFEditDelta::setObjectSetCount ( int  n)
virtual

Query and set information about objects referenced by index pair data. Only supported by some subclasses.

virtual GA_AIFEditSnapshot* GA_AIFEditDelta::startEdit ( const GA_Attribute attrib,
GA_Offset  element 
)
pure virtual

The startEdit() method allows the snapshot to see the state of the attribute before any edits are made to the data.

virtual GA_AIFEditSnapshot* GA_AIFEditDelta::startEdit ( const GA_Attribute attrib,
const GA_Range elements 
)
pure virtual
virtual void GA_AIFEditDelta::zeroDeltas ( )
pure virtual

Clear currently stored deltas. The first method, zeroDeltas(), is a lighter-weight clear that will endeavour to hold onto and reuse most allocated memory.


The documentation for this class was generated from the following file: