3ds Max C++ API Reference
ITranslationManager Class Referenceabstract

Manages the translation graph for a scene. More...

#include <ITranslationManager.h>

+ Inheritance diagram for ITranslationManager:

Public Member Functions

virtual ~ITranslationManager ()
 
template<typename TranslatorType >
TranslatorType * TranslateScene (const TranslatorKey &key, const TimeValue t, TranslationResult &result)
 Acquires the root translator for a scene. More...
 
virtual TranslationResult UpdateScene (Translator &rootTranslator, const TimeValue t)=0
 Updates the translation graph anchored at the given root. More...
 
virtual bool DoesSceneNeedUpdate (const Translator &rootTranslator, const TimeValue t)=0
 Checks whether any part of the translation graph is invalid at the given time. More...
 
virtual void ReleaseSceneTranslator (const Translator &rootTranslator)=0
 Releases a reference to a root translator. More...
 

Protected Member Functions

virtual TranslatorTranslateSceneInternal (const TranslatorKey &key, const TimeValue t, TranslationResult &result)=0
 

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...
 

Detailed Description

Manages the translation graph for a scene.

The translation manager is responsible for maintaining the translation graph for a scene. It should be created by the render session that wishes to use the translation component of the Rendering API. Once created, this interface enables the creation of the root of the translation graph - the scene translator, which then serves as the anchor point for the translation of the whole scene.

Remarks
This interface is implemented by the system. An instance of the interface can be obtained from IRenderSessionContext::GetTranslationManager().

Constructor & Destructor Documentation

◆ ~ITranslationManager()

virtual ~ITranslationManager ( )
inlinevirtual
49 {}

Member Function Documentation

◆ TranslateScene()

TranslatorType * TranslateScene ( const TranslatorKey key,
const TimeValue  t,
TranslationResult result 
)

Acquires the root translator for a scene.

This method acquires the root of the translation graph for the scene. This root is responsible for acquiring other translators, a recursive process which results in the scene's complete translation graph. The root translator is typically responsible for acquiring child translators for the camera, scene nodes, and environment.

Parameters
keyThe key that uniquely identifies the root translator. Given that a scene root is unique, this key need not store any data (as the root translator's input would typically dependent exclusively on the contents of the IRenderSessionContext), but should uniquely identify the type/class of the root translator.
tThe time at which the root translator is to be initially translated.
[out]resultStores whether the translation was successful.
Returns
A pointer to the root translator, dynamically cast to the templated type. Null if and only if translation wasn't successful.
Remarks
The root translator, returned by this method, is reference counted and must be released by calling ReleaseSceneTranslator().
Multiple root translators can be created, if needed. The translation manager would, in that case, manage multiple scene translation graphs. These graphs, though anchored using separate roots, would be able to share translators within the graph. The only potential issue, with such a scheme, is that every node in the graph can only be translated for a single time value, meaning that the scenes could not be translated at different time values.
19 {
20  Translator* translator = TranslateSceneInternal(key, t, result);
21  TranslatorType* cast_translator = dynamic_cast<TranslatorType*>(translator);
22  if(DbgVerify(translator == cast_translator))
23  {
24  return cast_translator;
25  }
26  else
27  {
29  return nullptr;
30  }
31 }
virtual Translator * TranslateSceneInternal(const TranslatorKey &key, const TimeValue t, TranslationResult &result)=0
@ Failure
Translation failed (for any reason)
Definition: TranslationResult.h:41
#define DbgVerify(expr)
Definition: assert1.h:83

◆ UpdateScene()

virtual TranslationResult UpdateScene ( Translator rootTranslator,
const TimeValue  t 
)
pure virtual

Updates the translation graph anchored at the given root.

This method traverses the translation graph, starting at the given root, and updates (re-translates) every node which is not valid at the given time value.

Remarks
This method may be called from any thread. Internally, the work will be performed from the main thread.
Parameters
rootTranslatorThe root translator node at which to start the traversal. This has to be a root translator, as returned by TranslateScene().
tThe time at which to update the scene translation graph.
Returns
The result (success or failure) of the update.

◆ DoesSceneNeedUpdate()

virtual bool DoesSceneNeedUpdate ( const Translator rootTranslator,
const TimeValue  t 
)
pure virtual

Checks whether any part of the translation graph is invalid at the given time.

Parameters
rootTranslatorThe root of the translation graph to be checked.
tThe time value at which to check for validity.
Returns
True if any node, in the translation graph, is invalid at the given time. False otherwise.
Remarks
This method performs no acccess to the 3ds Max scene; it merely traverses the translation graph and checks for its validity. Consequently, it's safe to call it from any thread. But there is no locking in place, so the translation manager should not be accessed in parallel by another thread.

◆ ReleaseSceneTranslator()

virtual void ReleaseSceneTranslator ( const Translator rootTranslator)
pure virtual

Releases a reference to a root translator.

Root translators are reference counted. Acquiring one through TranslateScene() increments its reference count, which must then be decremented using this method.

Remarks
The released root translator should no longer be accessed following this call.
This call may result in the deletion (garbage collection) of parts or all of the translation graph, depending on whether the reference count of the root node goes to 0.
Parameters
rootTranslatorThe root translator to be released.

◆ TranslateSceneInternal()

virtual Translator* TranslateSceneInternal ( const TranslatorKey key,
const TimeValue  t,
TranslationResult result 
)
protectedpure virtual