Vizard 7 » Command Index » Vizard modules » viz » <viz>.addChildFromBuffer
7.7

<viz>.addChildFromBuffer

Load a model file from a memory buffer

<viz>.addChildFromBuffer(  
filename  
buffer  
parent = viz.WORLD  
scene = viz.MainScene  
flags = 0  
)  
filename
Filename associated with the buffer. The extension of the filename will tell Vizard what model format the buffer provides (ive, osg, etc..)
buffer
Buffer containing the model file data or one of the following buffer flags:

Buffer flags

viz.BUFFER_MMAP

Load buffer through a memory mapped file. This can be used in cluster mode to have the master transfer the file contents to the clients at runtime.

parent = viz.WORLD
viz.WORLD
viz.SCREEN
viz.ORTHO
<node3d> object
scene = viz.MainScene
If the parent is viz.WORLD or viz.SCREEN, then the argument represents the scene to add the object to.
If the parent is viz.ORTHO, then the argument represents the window to add the object to.
If the parent is a valid node3d object, then the argument is ignored.
flags = 0
Can include any combination of the following Load flags and one of the Rotate modes:

Load Flag

Description

viz.LOAD_ASYNC

Load the model asynchronously. See remarks below.

viz.LOAD_IGNORE_LIGHTS

Ignore all lights in the model.

viz.LOAD_IGNORE_SCENE_SETTINGS

Ignore scene settings embedded in the model.



Rotate Mode

Description

viz.ROTATE_DEFAULT

Automatically detect the coordinate frame based on the file type.

viz.ROTATE_NONE

Do not rotate the model.

viz.ROTATE_Y_UP

Rotate the model from a Y-up coordinate frame.

viz.ROTATE_Z_UP

Rotate the model from a Z-up coordinate frame.


Remarks

This command will load a model using data from memory, instead of a file. The filename must contain the same extension as the format the buffer represents.

The following file types support loading from a memory buffer:

If the viz.LOAD_ASYNC flag is set, the model will be loaded asynchronously. In this case, the command will return immediately with a valid node handle. The status of the async operation can be queried using the <node3d>.getAsyncStatus command. When the async operation completes, due to either success or failure, a viz.ASYNC_EVENT will be triggered. The <vizact>.onAsyncLoad or <viztask>.waitAsyncLoad commands can be used to automatically process this event for a specified node.

Note: When loading asynchronously, most node commands will not work properly until the asynchronous operation has completed successfully.

Return Value

<node3d> object

See also

<viz>.addChild
<vizact>.onAsyncLoad
<viztask>.waitAsyncLoad
<node3d>.getAsyncStatus