c4d.storage

Follow me to the Inheritance diagramm .

Classes

Functions

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

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

../../_images/load.png

Warning

If the filename returned by LoadDialog() will be passed to a non-Cinema 4D function it must be decoded to an utf-8 object:

fn = LoadDialog()
f = open(fn.decode("utf-8"))
# open() is a non-Cinema 4D function so it needs a decode but it works with a Cinema 4D function:
doc = LoadDocument(fn)
# or
doc = LoadDocument(fn.decode("utf8"))
							
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.
  • 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 ) – The default path on popup.
  • def_file ( str ) –

    New in version R18.057.

    The default file on popup.

Return type:

str

Returns:

The selected path.

c4d.storage. SaveDialog ( [type=FILESELECTTYPE_ANYTHING][title=”“][, force_suffix=”“][, def_path][, def_file=”“] )

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

../../_images/save.png
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 ) – The default path on popup.
  • def_file ( str ) –

    New in version R18.057.

    The default file 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 ( )

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__ .

See also

Directory Structure

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: c4d.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 )

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

Parameters:
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 )

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

Parameters:
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 4D:

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

New in version R15.037.

Get the path to the site folder in the user folder.

(Windows 64-bits) e.g: ‘C:/Users/$UserName/AppData/Roaming/MAXON/R15/library/python/packages/win64’

Note

This folder exists so that 3rd party packages can be installed in it.

Return type: str
Returns: The path to the site folder in the user folder.
c4d.storage. GetFreeVolumeSpace ( drive )

New in version R16.021.

Calculate the free space on a volume.

Parameters: drive ( str ) – Can point to a volume or directory.
Return type: tuple(long, long)
Returns: The number of available bytes on the volume and the total size of the volume in bytes.
c4d.storage. GeExecuteProgram ( app , path )

Executes an application.

Note

The application is started asynchronously.

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

bool

Returns:

True if the application was executed, otherwise False .

c4d.storage. GeExecuteFile ( path )

Executes a file.

Note

Opens a file as if the user double-clicked it: the default application for this file will open.

Parameters: path ( str ) – The name of the application to execute.
Return type: bool
Returns: True if the application was executed, otherwise False .
c4d.storage. GeGetMovieInfo ( path )

Get information from a movie file.

Parameters: path (str or MemoryFileStruct ) – The path of the movie 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.
  • 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