Interface14 Class Reference
 
 
 
Interface14 Class Reference

This reference page is linked to from the following overview topics: Accessing Core 3ds Max Functionality.


#include <maxapi.h>

Inheritance diagram for Interface14:
Interface13 Interface12 Interface11 Interface10 Interface9 Interface8 Interface7 IObjCreate IObjParam Interface FPStaticInterface FPInterfaceDesc FPInterface BaseInterface InterfaceServer MaxHeapOperators

Class Description

Extends Interface13 Client code should retrieve this interface using GetCOREInterface14.

Public Member Functions

virtual ViewExp GetViewExpByID (int viewID)=0
  This method gets a ViewExp interface given a view ID.
virtual int  GetRendViewID ()=0
  Get the viewport ID used, when the rendering is locked on a viewport.
virtual void  SetRendViewID (int id)=0
  Sets the viewport ID used, when the rendering is locked on a viewport If an invalid ID is set, attempts to launch a render will fail and an error dialog will be displayed.
virtual PreviewParams  GetPreviewParams () const =0
  This method is used to access the data used when creating a preview image from the currently active viewport using the real-time (viewport) renderer.
virtual bool  OverrideLanguageSpecifiedInSceneFile () const =0
  if true, don�t use language specified in scene file when doing string conversions during scene file load, instead use value from LanguageToUseForFileIO() In scene files created by 3ds Max 2012, the 3ds Max language ID and active code page are stored in the file.
virtual void  SetOverrideLanguageSpecifiedInSceneFile (bool overrideFileLangID)=0
  sets return value from OverrideLanguageSpecifiedInSceneFile()
virtual bool  UseCodePageSpecifiedInSceneFile () const =0
  if true, use the CodePage specified in scene file when doing string conversions during scene file load instead of using the LANGID in the file or specified by LanguageToUseForFileIO() In scene files created by 3ds Max 2012, the 3ds Max language ID and active code page are stored in the file.
virtual void  SetUseCodePageSpecifiedInSceneFile (bool useFileCodePage)=0
  sets return value from UseCodePageSpecifiedInSceneFile()
virtual LANGID  LanguageToUseForFileIO () const =0
  The LANGID to use for scene, text, and other binary file io when doing string conversions.
virtual bool  SetLanguageToUseForFileIO (LANGID id)=0
  sets return value from LanguageToUseForFileIO().
virtual UINT  CodePageForLanguage (LANGID id) const =0
  returns the code page corresponding to the specified LANGID.
virtual bool  LegacyFilesCanBeStoredUsingUTF8 () const =0
  if true, when saving non-scene legacy files that are readable by 3ds Max, allow use of UTF8 encoding of strings when it is necessary to convert from wide (Unicode) strings to narrow (ascii/mbcs) strings.
virtual void  SetLegacyFilesCanBeStoredUsingUTF8 (bool allowUTF8)=0
  sets return value from LegacyFilesCanBeStoredUsingUTF8()
virtual void  ConvertAppDataChunksContainingStringToUTF8 (Animatable *anim, const Class_ID &classID, SClass_ID superClassID, Tab< DWORD > &subIDs, UINT codePage)=0
  Helper method for converting AppDataChunks containing mbcs string data to utf8 encoded string data This method is used primarily in AppDataLoadCallbacks registered using Animatable::RegisterAppDataLoadCallback to convert AppDataChunks containing mbcs string data to utf8 encoded string data.
virtual UINT  DefaultTextLoadCodePage ()=0
  returns the default code page for Loading aux file This method would be used outside of scene file io, primarily when doing aux file io.
virtual UINT  DefaultTextSaveCodePage (bool allow_utf8=false)=0
  returns the default code page for Saving aux file This method would be used outside of scene file io, primarily when doing aux file io.

Static Public Attributes

static CoreExport const
Interface_ID 
kInterface14InterfaceID
  The ID for this interface.

Member Function Documentation

virtual ViewExp& GetViewExpByID ( int  viewID ) [pure virtual]

This method gets a ViewExp interface given a view ID.

If the given view ID doesn't match any of the viewport, the ViewExp interface of the current active viewport will be returned.

Parameters:
[in] view ID the unique ID of a viewport. The view ID can be retrieved by calling ViewExp::GetViewID(). Each view is uniquely identified by an ID which is persisted with the 3ds Max file. Client code that previously (3ds Max 2012 and earlier) stored a ViewExp*, can now store the view ID. Note that since views (viewports) can be destroyed as of 3ds Max 2013, plug-ins should not store ViewExp pointers, as they will become invalid when the underlying view (viewport) is destroyed. Instead, plug-ins should store the view's unique ID.
 ViewExp* pViewExp = GetCOREInterface14()->GetViewExpByID(mStoredViewID);
 // Check the ID agaist your stored ID to make sure you get the correct ViewExp interface
 // since you may get the ViewExp interface of current active viewport if the corresponding
 // viewport got deleted.
 if (pViewExp && pViewExp->GetID() == mStoredViewID) 
 {
                // your codes below
 }
virtual int GetRendViewID ( ) [pure virtual]

Get the viewport ID used, when the rendering is locked on a viewport.

Returns:
the ID of the viewport to be rendered when the rendering is locked on a viewport.
See also:
Interface14::GetViewExpByID
virtual void SetRendViewID ( int  id ) [pure virtual]

Sets the viewport ID used, when the rendering is locked on a viewport If an invalid ID is set, attempts to launch a render will fail and an error dialog will be displayed.

Parameters:
[in] id ID of the viewport to be rendered when the rendering is locked on a viewport.
See also:
Interface14::GetViewExpByID
virtual PreviewParams GetPreviewParams ( ) const [pure virtual]

This method is used to access the data used when creating a preview image from the currently active viewport using the real-time (viewport) renderer.

Returns:
A copy of the preview parameters
virtual bool OverrideLanguageSpecifiedInSceneFile ( ) const [pure virtual]

if true, don�t use language specified in scene file when doing string conversions during scene file load, instead use value from LanguageToUseForFileIO() In scene files created by 3ds Max 2012, the 3ds Max language ID and active code page are stored in the file.

Normally, string conversions during scene file load would be based on the saved language ID. If this method returns true, the user has specified to do string conversions based on the return value of LanguageToUseForFileIO() instead.

Returns:
If true, use the language id from LanguageToUseForFileIO()for string conversions while reading scene files
virtual void SetOverrideLanguageSpecifiedInSceneFile ( bool  overrideFileLangID ) [pure virtual]

sets return value from OverrideLanguageSpecifiedInSceneFile()

Parameters:
[in] overrideFileLangID The value to return from OverrideLanguageSpecifiedInSceneFile()
virtual bool UseCodePageSpecifiedInSceneFile ( ) const [pure virtual]

if true, use the CodePage specified in scene file when doing string conversions during scene file load instead of using the LANGID in the file or specified by LanguageToUseForFileIO() In scene files created by 3ds Max 2012, the 3ds Max language ID and active code page are stored in the file.

Normally, string conversions during scene file load would be based on the saved language ID. If this method returns true, the user has specified to do string conversions based on the saved active code page instead.

Returns:
If true, use the code page specified in the scene file for string conversions while reading
virtual void SetUseCodePageSpecifiedInSceneFile ( bool  useFileCodePage ) [pure virtual]

sets return value from UseCodePageSpecifiedInSceneFile()

Parameters:
[in] useFileCodePage The value to return from UseCodePageSpecifiedInSceneFile()
virtual LANGID LanguageToUseForFileIO ( ) const [pure virtual]

The LANGID to use for scene, text, and other binary file io when doing string conversions.

This method primarily intended to support loading legacy files from mbcs builds of max (pre-3ds Max 2013), Save to Previous to those versions of max, and for writing non-scene text or binary files where conversion from wide characters to mbcs characters is required. The LANGID is typically passed to CodePageForLanguage() to get the code page to use for string conversions.

Returns:
The LANGID to use for string conversions when doing file io
virtual bool SetLanguageToUseForFileIO ( LANGID  id ) [pure virtual]

sets return value from LanguageToUseForFileIO().

Returns false if LANGID is not valid. This method primarily intended to support loading legacy files from mbcs builds of max (pre-3ds Max 2013), Save to Previous to those versions of max, and for writing non-scene text or binary files where conversion from wide characters to mbcs characters is required. The valid LANGID values are: 0 (current) 1033 (English) 1031 (German) 1036 (French) 1041 (Japanese) 1042 (Korean) 2052 (Chinese)

Parameters:
[in] id The language id to return from LanguageToUseForFileIO()
Returns:
True if the LANGID was valid
virtual UINT CodePageForLanguage ( LANGID  id ) const [pure virtual]

returns the code page corresponding to the specified LANGID.

If the LANGID is 0, the LANGID returned from MaxSDK::Util::GetLanguageID() is used. Returns the English code page if LANGID is not valid. This method primarily intended to support loading legacy files from mbcs builds of max (pre-3ds Max 2013), Save to Previous to those versions of max, and for writing non-scene text or binary files where conversion from wide characters to mbcs characters is required. The valid LANGID values are: 0 (current) 1033 (English) 1031 (German) 1036 (French) 1041 (Japanese) 1042 (Korean) 2052 (Chinese)

Parameters:
[in] id The language id to get the code page for.
Returns:
The code page
virtual bool LegacyFilesCanBeStoredUsingUTF8 ( ) const [pure virtual]

if true, when saving non-scene legacy files that are readable by 3ds Max, allow use of UTF8 encoding of strings when it is necessary to convert from wide (Unicode) strings to narrow (ascii/mbcs) strings.

If this method returns false, do string conversions based on the return value of LanguageToUseForFileIO() and CodePageForLanguage() instead.

 UINT codePage;
 Interface14 *iface = GetCOREInterface14();
 if (iface->LegacyFilesCanBeStoredUsingUTF8())
 {
     codePage = CP_UTF8;
 }
 else
 {
     LANGID langID = iface->LanguageToUseForFileIO();
     codePage = iface->CodePageForLanguage(langID);
 }
Returns:
If true, use the UTF8 codepage when writing non-scene legacy files
virtual void SetLegacyFilesCanBeStoredUsingUTF8 ( bool  allowUTF8 ) [pure virtual]

sets return value from LegacyFilesCanBeStoredUsingUTF8()

Parameters:
[in] allowUTF8 The value to return from LegacyFilesCanBeStoredUsingUTF8()
virtual void ConvertAppDataChunksContainingStringToUTF8 ( Animatable anim,
const Class_ID classID,
SClass_ID  superClassID,
Tab< DWORD > &  subIDs,
UINT  codePage 
) [pure virtual]

Helper method for converting AppDataChunks containing mbcs string data to utf8 encoded string data This method is used primarily in AppDataLoadCallbacks registered using Animatable::RegisterAppDataLoadCallback to convert AppDataChunks containing mbcs string data to utf8 encoded string data.

The utf8 encoded string data is prepended with the utf8 BOM ("\xef\xbb\xbf") to signify that it is utf8 encoded.

 void PolygonCounter::UpdateAppDataLoadProc(Animatable *anim, const Class_ID& cid, SClass_ID sid, ILoad* iload, Tab<DWORD> &subIDs)
 {
        DbgAssert( anim && iload );
        if ( anim == NULL || iload == NULL )
                return;
 
        DbgAssert (cid == POLYGON_COUNTER_CLASS_ID);
        DbgAssert (sid == UTILITY_CLASS_ID);
 
        Interface14 *iface = GetCOREInterface14();
        iface->ConvertAppDataChunksContainingStringToUTF8(anim, cid, sid, subIDs, iload->CodePage());
 }

When retrieving the string from the AppDataChunk, check to see if the first 3 chars are the utf8 BOM and convert accordingly.

 MSTR data;
 const char* raw_string = (const char*)ad->data;
 if (strncmp(raw_string, "\xef\xbb\xbf", 3) == 0)
        data = MSTR::FromUTF8(raw_string+3);
 else
 {
        DbgAssert(!_T("Should always convert appdata in UpdateAppDataLoadProc"));
        Interface14 *iface = GetCOREInterface14();
        LANGID langID = iface->LanguageToUseForFileIO();
        UINT codePage = iface->CodePageForLanguage(langID);
        data = MSTR::FromCP(codePage, raw_string);
 }
Parameters:
[in] anim The Animatable to aquire the AppDataChunk from.
[in] classID The Class_ID of the owner of the chunk.
[in] superClassID The SuperClassID of the owner of the chunk.
[in] subIDs The list of sub-chunk ids
[in] codePage The code page of the mbcs string data
virtual UINT DefaultTextLoadCodePage ( ) [pure virtual]

returns the default code page for Loading aux file This method would be used outside of scene file io, primarily when doing aux file io.

If doing scene file load, should be using the result from ILoad::CodePage().

virtual UINT DefaultTextSaveCodePage ( bool  allow_utf8 = false ) [pure virtual]

returns the default code page for Saving aux file This method would be used outside of scene file io, primarily when doing aux file io.

If doing scene file save, should be using the result from ISave::CodePage().

Parameters:
[in] allow_utf8 option to save the file in UTF8 encoding

Member Data Documentation

CoreExport const Interface_ID kInterface14InterfaceID [static]

The ID for this interface.

Pass this ID to Interface::GetInterface to get an Interface14 pointer.