Project Class

From Derivative
Jump to: navigation, search

The Project class describes the current session. It can be accessed with the project object, found in the automatically imported td module.



Members

Project.cacheParametersbool :

Cache parameter values instead of always evaluating.

Project.cookRatefloat :

Get or set the maximum number of frames processed each second. In general you should not need to use this. It is preferred to look at the FPS of the root component to know the cooking rate. Individual components may have their own rates, specified by rate.
a = project.cookRate # get the current cook rate 
project.cookRate = 30 # set the cook rate to 30 FPS
Note: This is displayed and set in the user interface at the bottom-left: the "FPS" field.

Project.externalToxModifiedInProjectbool (Read Only):

Callback for when an external tox has been modified in the current project and there are other instances of the same tox loaded elsewhere in the project.

Project.externalToxModifiedOnDiskbool (Read Only):

Callback for when an external tox file has been modified on disk.

Project.folderstr (Read Only):

The folder at which the project resides.

Project.isPrivatebool (Read Only):

True when the project networks cannot be directly viewed.

Project.isPrivateKeybool (Read Only):

True when the private networks are accessible by a pass phrase.

Project.namestr (Read Only):

The filename under which the project is saved.

Project.pathsdict (Read Only):

A dictionary which can be used to define URL-syntax path prefixes, enabling you to move your media to different locations easily. This dictionary is saved and loaded in the .toe file. Example: Run project.paths['movies'] = 'C:/MyMovies', and reference it with a parameter expression: movies://butterfly.jpg. To manually convert between expanded and collapsed paths, use tdu.collapsePath() and tdu.expandPath from the Tdu Module, for example tdu.expandPath('movies://butterfly.jpg') expands to C:/MyMovies/butterfly.jpg. Alternately, to enable you to have different media locations on different machines, you can put a JSON file in the same folder as your .toe that gets read on startup. It would contain something like { "project.paths": { "movies": "M:/MyMovies" } }. If your .toe file is called MyProject.10.toe, the JSON file must be called MyProject.Settings.json. (Setting project.paths with python in your .toe overrides the JSON file.)

Project.realTimebool :

Get or set the real time cooking state. When True, frames may be skipped in order to maintain the cookRate. When False, all frames are processed sequentially regardless of duration. This is useful to render movies out using the Movie File Out TOP without dropping any frames for example.
a = project.realTime
project.realTime = False # turn off real time playback.

Project.saveBuildstr (Read Only):

The App build number when the project was last saved.

Project.saveOsNamestr (Read Only):

The App operating system name when the project was last saved.

Project.saveOsVersionstr (Read Only):

The App operating system version when the project was last saved.

Project.saveVersionstr (Read Only):

The App version number when the project was last saved.

Methods

Project.load(path)None:

Load a specific .toe file from disk.
  • path - (Optional) The path of the file to load. If not specified, loads the default toe file, as specified in preferences.
project.load('test_demo.toe')

Project.pythonStack()str:

Formatted contents of current python stack.
print(project.pythonStack())

Project.stack()str:

Formatted contents of current cook and parameter evaluation stack.
print(project.stack())

Project.quit(force=False, crash=False)None:

Quit the project.
  • force - (Keyword, Optional) If set to True, unsaved changes will be discarded without prompting.
  • crash - (Keyword, Optional) If set to True, the application will terminate unexpectedly. This is used for system testing.
project.quit()  #quit project, possibly prompting for unsaved changes if 'Prompt to Save on Exit' in Preferences dialog is enabled.
project.quit(force=True)  #quit project immediately.

Project.removePrivacy(key)bool:

Completely remove privacy from a toe file.
  • key - The current privacy key phrase.
project.removePrivacy('secret')

Project.save(path, saveExternalToxs=False)bool:

Save the current session to disk. Returns True if a file was saved, False otherwise (eg, if the file exists, and when prompted, the user selects to not overwrite).
  • path - (Optional) If not provided the default/current filename is incremented and used. The current file is project.name under folder project.folder.
  • saveExternalToxs - (Keyword, Optional) If set to True, will save out the contents of any COMP that references an external .tox into the referenced .tox file.
project.save('test_demo.toe')
project.save()

Project.accessPrivateContents(key)bool:

Gain access to a private file. The file will still be private the next time it is saved or re-opened.
  • key - The current privacy key phrase.
project.accessPrivateContents('secret')

Project.addPrivacy(key)bool:

Add privacy to a toe file with the given key.

Privacy can only be added to toes that currently have no privacy, and are using a Pro license.

  • key - The key phrase. This should resolve to a non-blank string.
project.addPrivacy('secret')


Some operators have a DAT docked to them that contains some python functions. These functions, called "callbacks", get called when something in the operator changes.

TOuch Environment file, the file type used by TouchDesigner to save your project.

An Operator Family that creates, composites and modifies images, and reads/writes images and movies to/from files and the network. TOPs run on the graphics card's GPU.

An Operator Family that contains its own Network inside. There are twelve 3D Object Component and eight 2D Panel Component types. See also Path.

TouchDesigner Component file, the file type used to save a Component from TouchDesigner.