Mergeable Class Reference

#include <Mergeable.h>

Class Description

Description: This class allows referenceTargets that are not INodes to be mergeable through the File->Merge command.

The referenceTarget that you want to be mergeable must derive from Mergeable. You just then need to override GetMergeableRef, GetMergeableRefName, and PostMerge.

Code Example to make the Brightness/Contrast effect mergeable.

You would derive your class from the Mergeable

class BriteConEffect: public Effect, public Mergeable {

Then make sure you return the Mergeable Interface from GetInterface when it is asked

{
switch(id)
{
case MERGEABLE_INTERFACE : return (Mergeable *) this;
break;
default: return Effect::GetInterface(id);
break;
}
}

Next just need to implement GetMergeableRef and GetMergeableRefName which return the data needed to do the merge

ReferenceTarget* BriteConEffect::GetMergeableRef()
{
return this;
}
MSTR BriteConEffect::GetMergeableRefName()
{
return GetName();
}

Finally you just need to implement PostMerge where you do your work to hook back up your reference after the merge

void BriteConEffect::PostMerge()
{
}
+ Inheritance diagram for Mergeable:

Public Member Functions

CoreExport Mergeable ()
 
virtual CoreExport ~Mergeable ()
 
virtual CoreExport ReferenceTargetGetMergeableRef ()=0
 This needs to be implemented to return the ReferenceTarget that will be mergeable. More...
 
virtual CoreExport MSTR GetMergeableRefName ()=0
 This returns the name that you want to appear in the merge list box. More...
 
virtual CoreExport void PostMerge ()=0
 This is called after the reference has been merged. More...
 
virtual CoreExport bool SaveForMerge ()
 This is called before saving. More...
 
virtual CoreExport bool MakeMergeNameUnique ()
 The name returned from GetMergeableRefName() will be made unique in the merge list box, unless this is implemented to return false. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Constructor & Destructor Documentation

virtual CoreExport ~Mergeable ( )
virtual

Member Function Documentation

virtual CoreExport ReferenceTarget* GetMergeableRef ( )
pure virtual

This needs to be implemented to return the ReferenceTarget that will be mergeable.

This is the ReferenceTarget that is derived from Mergeable. If it does not derive from Mergeable, PostMerge will not be called on it after merging.

virtual CoreExport MSTR GetMergeableRefName ( )
pure virtual

This returns the name that you want to appear in the merge list box.

virtual CoreExport void PostMerge ( )
pure virtual

This is called after the reference has been merged.

At this point it needs to be attached to something otherwise it will be lost. For instance if this was an effect it would have to be attached to scene graphs effects list.

virtual CoreExport bool SaveForMerge ( )
inlinevirtual

This is called before saving.

If you are in a state where you don't need to be saved, then return false. Otherwise by default this returns true.

101 {return true;}
virtual CoreExport bool MakeMergeNameUnique ( )
inlinevirtual

The name returned from GetMergeableRefName() will be made unique in the merge list box, unless this is implemented to return false.

105 {return true;}