c4d.storage

Follow me to the Inheritance diagramm.

Functions

c4d.storage.LoadDialog([type=FILESELECTTYPE_ANYTHING][, title=""][, flags=FILESELECT_LOAD][, force_suffix=""][, def_path])

Open a load dialog. The look of this dialog depends on the operating system.

Parameters:
  • type (int) –

    One of the following flags:

    FILESELECTTYPE_ANYTHING Anything.
    FILESELECTTYPE_IMAGES Images.
    FILESELECTTYPE_SCENES 3D Scenes.
    FILESELECTTYPE_COFFEE COFFEE.
    FILESELECTTYPE_BODYPAINT Bodypaint.
  • flags (int) –

    The flags:

    FILESELECT_LOAD Private.
    FILESELECT_SAVE Private.
    FILESELECT_DIRECTORY Open the directory dialog.
  • force_suffix (str) – Currently not used.
  • def_path (str) – Set the default path on popup.
Return type:

str

Returns:

The selected path.

c4d.storage.SaveDialog([type=FILESELECTTYPE_ANYTHING][title=""][, force_suffix=""][, def_path])

Open a save dialog. The look of this dialog depends on the operating system.

Parameters:
  • type (int) –

    One of the following flags:

    FILESELECTTYPE_ANYTHING Anything.
    FILESELECTTYPE_IMAGES Images.
    FILESELECTTYPE_SCENES 3D Scenes.
    FILESELECTTYPE_COFFEE COFFEE.
    FILESELECTTYPE_BODYPAINT Bodypaint.
  • title (str) – The title.
  • force_suffix (str) – The suffix.
  • def_path (str) – Set the path which is shown on popup.
Return type:

str

Returns:

The selected path.

c4d.storage.ShowInFinder(path, open)

Show the file/path in the Finder (OSX) or Explorer (Windows).

Parameters:
  • path (str) – The file/path to show.
  • open (bool) – If True the file will be opened by the assigned application.
Return type:

bool

Returns:

True if the path/file exists, otherwise False.

c4d.storage.GeGetPluginPath()

New in version R13.016.

Warning

The Python implementation is different from the C++ in the fact that, with the Python SDK, this function returns the path of the Python SDK module. To get the path of your Python plugin use __file__.

Return type: str
Returns: The path of the Python SDK module.
c4d.storage.GeGetC4DPath(whichpath)

Gets one of the CINEMA 4D paths.

Parameters: whichpath (int) –

The path to get:

C4D_PATH_PREFS CINEMA 4D prefs directory
C4D_PATH_RESOURCE CINEMA 4D resource directory
C4D_PATH_LIBRARY CINEMA 4D library directory (builtin)
C4D_PATH_LIBRARY_USER CINEMA 4D library directory (different if multiuser mode enabled).
C4D_PATH_ONLINE_HELP CINEMA 4D Online Help Directory.
C4D_PATH_DESKTOP OS Desktop Directory
C4D_PATH_HOME OS Home Directory
C4D_PATH_STARTUPWRITE Writeable StartupDir.
C4D_PATH_MYDOCUMENTS The user’s documents directory.
Return type: str
Returns: The retrieved path.
c4d.storage.GeGetStartupApplication()

Returns the complete path of the host application (CINEMA 4D, BODYPAINT 3D, NET) of the plugin:

(Mac) e.g: '/Applications/MAXON/CINEMA 4D R12/CINEMA 4D.app'
Return type: str
Returns: The complete path to the host application.
c4d.storage.GeGetStartupWritePath()

Returns the writeable startup directory. This is the directory where all user data (preferences, libraries etc.) are stored:

(Mac) e.g: '/Users/UserName/Library/Preferences/MAXON/CINEMA 4D R12_C333CB6C'

Note

Use this for example to store plugin preferences because Windows Vista and Apple Leopard do not allow to write files into the application folder.

Return type: str
Returns: The writeable startup directory.
c4d.storage.GeGetMemoryStat()

Gets CINEMA 4D memory statistics.

Return type: BaseContainer
Returns: Can be None if receiving memory container failed. Assigned statistics:
C4D_MEMORY_STAT_MEMORY_INUSE long Bytes in use.
C4D_MEMORY_STAT_MEMORY_PEAK long Peak usage in bytes.
C4D_MEMORY_STAT_NO_OF_ALLOCATIONS_TOTAL long Total number of allocations.
C4D_MEMORY_STAT_NO_OF_ALLOCATIONS_CURRENT long Current number of allocations.
C4D_MEMORY_STAT_EOGL_TEXBUFFER long Texture buffer usage.
C4D_MEMORY_STAT_EOGL_VERTEXBUFFER long Vertex buffer usage.
C4D_MEMORY_STAT_LOWMEMCNT int The number of low memory conditions (out of memory).
C4D_MEMORY_STAT_EOGL_VERTEXBUFFER_CNT int The number of VBOs (Vertex Buffer Objects).
C4D_MEMORY_STAT_EOGL_TEXTUREBUFFER_CNT int The number of texture buffers.
C4D_MEMORY_STAT_OPENGL_TOTAL int The total OpenGL memory in KB.
C4D_MEMORY_STAT_OPENGL_FREE int The free OpenGL memory in KB.
c4d.storage.GeMemGetFreePhysicalMemoryEstimate()

Get the estimated free physical memory.

Return type: long
Returns: The estiumated free physical memory.
c4d.storage.WriteHyperFile(doc, node, filename, ident)

New in version R13.016.

Writes a single list node to disk as a hyper file.

Parameters:
  • doc (BaseDocument) – The document of the node.
  • node (GeListNode) – The node to write.
  • filename (str or MemoryFileStruct) –

    Changed in version R13.029: It is now possible to pass a memory file.

    A file to write to.

  • ident (long) – A unique file identification, to make sure that you only read your own files.
Return type:

int

Returns:

The result:

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.

c4d.storage.ReadHyperFile(doc, node, filename, ident)

New in version R13.016.

Reads a single list node from a hyper file on disk. The read data replaces the data in node.

Parameters:
  • doc (BaseDocument) – The document of the node.
  • node (GeListNode) – The node to read to.
  • filename (str or MemoryFileStruct) –

    Changed in version R13.029: It is now possible to pass a memory file.

    A file to read from.

  • ident (long) – A unique file identification, to make sure that you only read your own files.
Return type:

int

Returns:

The result:

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.

c4d.storage.GeGetStartupPath()

Get the path for the main folder CINEMA:

(Mac) e.g: '/Applications/MAXON/CINEMA 4D R12'
Return type: str
Returns: The main path for the CINEMA application.
c4d.storage.GeExecuteProgram(app, path)

Execute an application.

Note

The application will be started asynchronous.

Parameters:
  • app (str) – The name of an optional file to open using the application.
  • path (str) – The name of the application to execute.
Return type:

bool

Returns:

Success of executing the application.

c4d.storage.GeExecuteFile(path)

Execute a file with a defined application.

Parameters: path (str) – The name of the application to execute.
Return type: bool
Returns: Success of executing the application.
c4d.storage.GeGetMovieInfo(path)

Get information from a movie file.

Parameters: path (str or MemoryFileStruct) –

The path of the movie file.

Changed in version R13.029: It is now possible to pass a memory file.

Return type: dict{frames: int, fps: float}
Returns: The number of frames and frames per second.
c4d.storage.GeIdentifyFile(name, probe, recognition)

Identify the file in name.

Parameters:
  • name (str or MemoryFileStruct) –

    The file to check.

    Changed in version R13.029: It is now possible to pass a memory file.

  • 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.
  • recognition (int) –

    Identification flags:

    IDENTIFYFILE_0 None.
    IDENTIFYFILE_SCENE Scene file.
    IDENTIFYFILE_IMAGE Image file.
    IDENTIFYFILE_MOVIE Movie file.
    IDENTIFYFILE_SKIPQUICKTIME Flag to skip files that require QuickTime.
    IDENTIFYFILE_SCRIPT Script file.
    IDENTIFYFILE_COFFEE C.O.F.F.E.E. file.
    IDENTIFYFILE_SOUND Sound file.
    IDENTIFYFILE_LAYOUT Layout file.
Return type:

tuple(int, BasePlugin)

Returns:

The result and, for image formats, the image loader that was identified.

IDENTIFYFILE_0

None.

IDENTIFYFILE_SCENE

Scene file.

IDENTIFYFILE_IMAGE

Image file.

IDENTIFYFILE_MOVIE

Movie file.

IDENTIFYFILE_SKIPQUICKTIME

Flag to skip files that require QuickTime.

IDENTIFYFILE_SCRIPT

Script file.

IDENTIFYFILE_COFFEE

C.O.F.F.E.E. file.

IDENTIFYFILE_SOUND

Sound file.

IDENTIFYFILE_LAYOUT

Layout file.

Table Of Contents