c4d.plugins.SceneLoaderData

A data class for creating scene loaders. Use RegisterSceneLoaderPlugin() to register the plugin.

Note

Before you start writing your own SceneLoaderData plugin, you should read NodeData Management before.

class c4d.plugins.SceneLoaderData

Inheritance

Methods

SceneLoaderData.Identify(self, node, name, probe, size)

Override - Identify the file type as one that can be loaded using this plugin. If possible, the file should not be identified through the suffix, but through the probe data.

Parameters:
  • node (BaseList2D) – The node object.
  • name (str) – The name of the loader.
  • probe (buffer) – The start of a small chunk of data from the start of the file for testing this file type. Usually the probe size is 1024 bytes. Never call the buffer outside this method!
  • size (int) – The size of the chunk for testing this file type.
Return type:

bool

Returns:

True if your plugin recognises this file.

SceneLoaderData.Load(self, node, name, doc, filterflags, error, bt)

Override - Load the file into the document.

Parameters:
  • node (BaseList2D) – The node object.
  • name (str) – The filename of the file to load.
  • doc (BaseDocument) – The document that the selected objects should be loaded into.
  • filterflags (int) –

    Information about what can be done during this load call:

    SCENEFILTER_0 No flags.
    SCENEFILTER_OBJECTS Load/save only the objects and associated items, such as materials used.
    SCENEFILTER_MATERIALS Load/save only the materials.
    SCENEFILTER_DIALOGSALLOWED Flag to inform your plugin that a dialog can be displayed if you wish, if this flag not set then no dialogs must be opened.
    SCENEFILTER_PROGRESSALLOWED Flag to inform your plugin that a progress bar can be displayed if you wish. The progress bar can be set by calling StatusSetBar().
    SCENEFILTER_MERGESCENE Flag to inform your plugin that this is a merge operation, i.e. that the document you’re inserting to is an existing scene.
    SCENEFILTER_NONEWMARKERS Objects loaded from disk will keep their markers
    SCENEFILTER_SAVECACHES Caches of objects will also be written (only supported by C4D file format). This equals the global option “Save Polygon Objects for Melange Exchange”
  • error (None) – Currently not used.
  • bt (None) – Currently not used
Return type:

int

Returns:

The return values:

FILEERROR_NONE

No error.

FILEERROR_OPEN

Problems opening the file.

FILEERROR_CLOSE

Problems closing the file.

FILEERROR_READ

Problems reading the file.

FILEERROR_WRITE

Problems writing the file.

FILEERROR_SEEK

Problems seeking the file.

FILEERROR_INVALID

Invalid parameter or operation (e.g. writing in read-mode).

FILEERROR_MEMORY

Not enough memory.

FILEERROR_USERBREAK

User break.

FILEERROR_WRONG_VALUE

Other value detected than expected.

FILEERROR_CHUNK_NUMBER

Wrong number of chunks or sub chunks detected.

FILEERROR_VALUE_NO_CHUNK

There was a value without any enclosing START/STOP chunks.

FILEERROR_FILE_END

The file end was reached without finishing reading.

FILEERROR_UNKNOWN_VALUE

Unknown value detected.

Table Of Contents