RamFileManager

Generic tools to handle files and the Ramses Naming Scheme

Read the sections about the Ramses Tree and Naming Scheme for more details about names and folders used by Ramses.

Static Methods

Method Arguments Description
buildPath
boolean
list of string: folders Builds a path with a list of folder names or subpaths, adding the "/" only if needed. Paths never include any trailing "/"
copyToVersion
string
string: filePath,
boolean: increment=false,
string: dafaultStateShortName="v"
Copies the given file inside the corresponding _versions subfolder, optionnaly incrementing the version number.
Use defaultStateShortName to change the state to be used if not found in the current or previous version.
Returns the path to the new file.
Be careful, this method is multi-threaded, and the script will not wait for the copy to finish to continue; the method may return before the file even exists.
getLatestVersionInfo
RamFileInfo
string: filePath,
string: dafaultStateShortName="v",
boolean: previous=false
Gets the latest version number and state for the given file, which can be located either in the main folder or one of the _versions, _preview or _published subfolder.
Use defaultStateShortName to change the state to be used if not found in the current or previous version.
If previous is true, will return the version immediately before the latest one.
getLatestVersionFilePath
string
string: filePath,
boolean: previous=false
Gets the latest version file path for the given file, which can be located either in the main folder or one of the _versions, _preview or _published subfolder.
If previous is true, will return the version immediately before the latest one.
getProjectFolder
string
string: path Gets the root folder of the project this path belongs to.
getPublishFolder
string
string: filePath Gets the published folder path for any given file.
getPublishInfo
RamFileInfo
string: filePath Gets the published information for any given file.
getPublishedVersions
list of string
string: filePath Gets the list of subfolders (versions) from the published folder of this file.
getRamsesFiles
list of string
string: folderPath,
string: resource=None
Gets all the files respecting the Ramses naming scheme inside the folder, optionally corresponding to the given resource only.
getSaveFilePath
string
string: filePath Gets and returns the path to be used to save the file given as argument, with a name respecting the Ramses Naming Scheme. If the file is in a _versions, _preview or _published folder, the save file is located in the parent folder.
getVersionFilePaths
string
string: filePath Gets the corresponding version files from the _versions folder path for any given file.
getVersionFolder
string
string: filePath Gets the _versions folder path for any given file.
inPreviewFolder
boolean
string: filePath Checks if a given file is located in a _preview folder.
inPublishFolder
boolean
string: filePath Checks if a given file is located in a _published folder.
inReservedFolder
boolean
string: filePath Checks if a given file is located in a _published or _versions or _preview folder.
inVersionsFolder
boolean
string: filePath Checks if a given file is located in a _versions folder.
isAssetStep
boolean
string: stepShortName,
string: assetsPath
Checks using the information found in assetsPath (which should be the assets folder of a given project) if the given short name corresponds to an asset production step.
isProjectFolder
boolean
string: folderPath Checks if a given folder is the project root folder.
isRestoredFilePath
boolean or int
string: filePath Checks if the file is a working file which has been restored from a previous version (contains "+restored-vXX+" in its resource name).
If it is a restored older version, the version number is returned, otherwise returns false.
isShotStep
boolean
string: shotShortName,
string: shotsPath
Checks using the information found in shotsPath (which should be the shots folder of a given project) if the given short name corresponds to a shot production step.
publishFile
string
string: filePath Copies the given file inside the corresponding _published subfolder.
Returns the path to the new file.
Be careful, this method is multi-threaded, and the script will not wait for the copy to finish to continue; the method may return before the file even exists.
restoreVersionFile string: filePath Restores an older version.
Be careful, this method is multi-threaded, and the script will not wait for the copy to finish to continue; the method may return before the file even exists.
validateName
boolean
string: name Checks if this name respects the Ramses naming scheme.
validateShortName
boolean
string: shortName Checks if this short name respects the Ramses naming scheme.
waitFiles Calling this makes the current thread wait for all file writing threads to finish.

API Dev notes

Note

These section is for the development of the API only; you should not need these when developping your add-on using the API.

Private methods

Method Arguments Description
_isRamsesItemFoldername
boolean
string: n Checks if a given folder respects Ramses’ naming convention for items’ root folders.
The root folder should look like this:
"projectID_itemType_objectID"

META