SaveInstanceTreeA

This function saves the selected instance and its dependancies in an array.

Syntax

//   Visual Studio for Windows
public:
__int64 __declspec(dllexport) __stdcall SaveInstanceTreeA(
            __int64             owlInstance,
            unsigned char       * content,
            __int64             * size
        );

//   Linux, OS-X and non-Visual Studio Windows solutions
public:
int64_t SaveInstanceTreeA(
            int64_t             owlInstance,
            unsigned char       * content,
            int64_t             * size
        );    

Property owlInstance

Size: 64 bit / 8 byte (value)
The handle to the specific instance in the design tree. The instance handle is static within one open model but is most probably different when the same instance is opened in another model. The instance is always exactly of one unique class.

Property content

Size: 64 bit / 8 byte (reference)
The content of this IO call, the size of the content is defined by attribute size.

Property size

Size: 64 bit / 8 byte (reference)
The size of the content as defined in number of bytes.

Example

Here you can find code snippits that show how the API call SaveInstanceTreeA can be used.

#include "engine/include/engine.h"
#include <assert.h>

void    SaveInstanceTreeByArray(int64_t myInstance, wchar_t * fileName)
{
    FILE    * myFileWrite = nullptr;

    _wfopen_s(&myFileWrite, fileName, L"wb");
    if (&myFileWrite) {
        int64_t size = 0;

        SaveInstanceTreeA(myInstance, 0, &size);

        unsigned char   * content = new unsigned char[(int_t) size];
        SaveInstanceTreeA(myInstance, content, &size);

        fwrite(content, 1, (size_t) size, myFileWrite);
        delete[] content;

        fclose(myFileWrite);
    }
    else {
        assert(false);
    }
}