Difference between revisions of "App Class"

From TouchDesigner Documentation
Jump to: navigation, search
(App Class Auto Create)
m
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{TDClassSummary|summary=This class contains specific application details, such as its version and installation folders. It can be accessed with the app object, found in the automatically imported td module.
+
{{TDClassSummary|label=App|summary=This class contains specific application details, such as its version and installation folders. It can be accessed with the app object, found in the automatically imported [[td Module|td module]].
NOTE: See also Variables and Dialogs -> Variables where more built-in paths and strings are available via expressions in the form var('DESKTOP'), var('MYDOCUMENTS') and var('TOENAME').}}
+
 
{{HelpbodyBegin}}
+
'''NOTE:''' See also [[Variables]] and Dialogs -> Variables where more built-in paths and strings are available via expressions in the form <code>var('DESKTOP')</code>, <code>var('MYDOCUMENTS')</code> and <code>var('TOENAME')</code>.}}
 +
<section begin=HELPBODY />
 
{{ClassMemberSection|empty=
 
{{ClassMemberSection|empty=
 
|Sectionsummary=
 
|Sectionsummary=
 
|items=
 
|items=
 
 
{{ClassMember
 
{{ClassMember
 
     |class=App
 
     |class=App
 
     |name=architecture
 
     |name=architecture
     |returns=
+
     |type=str
 
     |set=0
 
     |set=0
 
     |text=The architecture of the compile.  Generally 32 or 64 bit.
 
     |text=The architecture of the compile.  Generally 32 or 64 bit.
Line 16: Line 16:
 
     |class=App
 
     |class=App
 
     |name=binFolder
 
     |name=binFolder
     |returns=
+
     |type=str
 
     |set=0
 
     |set=0
 
     |text=Installation folder containing the binaries.
 
     |text=Installation folder containing the binaries.
Line 23: Line 23:
 
     |class=App
 
     |class=App
 
     |name=build
 
     |name=build
     |returns=
+
     |type=str
 
     |set=0
 
     |set=0
 
     |text=Application build number.
 
     |text=Application build number.
Line 30: Line 30:
 
     |class=App
 
     |class=App
 
     |name=compileDate
 
     |name=compileDate
     |returns=
+
     |type=tuple(year, month, day)
 
     |set=0
 
     |set=0
 
     |text=The date the application was compiled, expressed as a tuple (year, month, day).
 
     |text=The date the application was compiled, expressed as a tuple (year, month, day).
Line 37: Line 37:
 
     |class=App
 
     |class=App
 
     |name=configFolder
 
     |name=configFolder
     |returns=
+
     |type=str
 
     |set=0
 
     |set=0
 
     |text=Installation folder containing configuration files.
 
     |text=Installation folder containing configuration files.
 +
}}
 +
{{ClassMember
 +
    |class=App
 +
    |name=desktopFolder
 +
    |type=str
 +
    |set=0
 +
    |text=Current user's desktop folder.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=App
 
     |class=App
 
     |name=enableOptimizedExprs
 
     |name=enableOptimizedExprs
     |returns=
+
     |type=bool
     |set=0
+
     |set=1
 
     |text=Get or set if Python expression optimization is enabled. Defaults to True every time TouchDesigner starts.
 
     |text=Get or set if Python expression optimization is enabled. Defaults to True every time TouchDesigner starts.
 
}}
 
}}
Line 51: Line 58:
 
     |class=App
 
     |class=App
 
     |name=installFolder
 
     |name=installFolder
     |returns=
+
     |type=str
 
     |set=0
 
     |set=0
 
     |text=Main installation folder.
 
     |text=Main installation folder.
Line 58: Line 65:
 
     |class=App
 
     |class=App
 
     |name=launchTime
 
     |name=launchTime
     |returns=
+
     |type=float
 
     |set=0
 
     |set=0
 
     |text=Total time required to launch and begin playing the toe file, measured in seconds.
 
     |text=Total time required to launch and begin playing the toe file, measured in seconds.
 +
}}
 +
{{ClassMember
 +
    |class=App
 +
    |name=logExtensionCompiles
 +
    |type=bool
 +
    |set=1
 +
    |text=Get or set if extra messages for starting and ending compiling extensions is sent to the textport. Additional error stack will be printed if compilation fails.  Defaults to False every time TouchDesigner starts.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=App
 
     |class=App
 
     |name=osName
 
     |name=osName
     |returns=
+
     |type=str
 
     |set=0
 
     |set=0
 
     |text=The operating system name.
 
     |text=The operating system name.
Line 72: Line 86:
 
     |class=App
 
     |class=App
 
     |name=osVersion
 
     |name=osVersion
     |returns=
+
     |type=str
 
     |set=0
 
     |set=0
 
     |text=The operating system version.
 
     |text=The operating system version.
Line 79: Line 93:
 
     |class=App
 
     |class=App
 
     |name=power
 
     |name=power
     |returns=
+
     |type=bool
     |set=0
+
     |set=1
     |text=Get or set the overall processing state of the process. When True, processing is enabled.  When False processing is halted. This is identical to pressing the power button on the main interface. This has a greater effect than simply pausing or stopping the playbar.
+
     |text=Get or set the overall processing state of the process. When True, processing is enabled.  When False processing is halted. This is identical to pressing the power button on the main interface. This has a greater effect than simply pausing or stopping the playbar.
Example:
+
<syntaxhighlight lang=python>
 
+
app.power = False #turn off the power button.
app.power = False #turn off the power button.
+
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=App
 
     |class=App
 
     |name=preferencesFolder
 
     |name=preferencesFolder
     |returns=
+
     |type=str
 
     |set=0
 
     |set=0
 
     |text=Folder where the preferences file is located.
 
     |text=Folder where the preferences file is located.
Line 96: Line 110:
 
     |class=App
 
     |class=App
 
     |name=product
 
     |name=product
     |returns=
+
     |type=str
 
     |set=0
 
     |set=0
     |text=Application name. For example, 'TouchDesigner', 'TouchPlayer'. See also licences.type in Licences Class.
+
     |text=Application name. For example, 'TouchDesigner', 'TouchPlayer'. See also licences.type in [[Licenses Class]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=App
 
     |class=App
 
     |name=recentFiles
 
     |name=recentFiles
     |returns=
+
     |type=list
     |set=0
+
     |set=1
 
     |text=Get or set the list of most recently saved or loaded files.
 
     |text=Get or set the list of most recently saved or loaded files.
 
}}
 
}}
Line 110: Line 123:
 
     |class=App
 
     |class=App
 
     |name=samplesFolder
 
     |name=samplesFolder
     |returns=
+
     |type=str
 
     |set=0
 
     |set=0
 
     |text=Installation folder containing configuration files.
 
     |text=Installation folder containing configuration files.
Line 117: Line 130:
 
     |class=App
 
     |class=App
 
     |name=userPaletteFolder
 
     |name=userPaletteFolder
     |returns=
+
     |type=str
 
     |set=0
 
     |set=0
 
     |text=Folder where custom user palettes are located.
 
     |text=Folder where custom user palettes are located.
Line 124: Line 137:
 
     |class=App
 
     |class=App
 
     |name=version
 
     |name=version
     |returns=
+
     |type=str
 
     |set=0
 
     |set=0
 
     |text=Application version number.
 
     |text=Application version number.
 +
}}
 +
{{ClassMember
 +
    |class=App
 +
    |name=windowColorBits
 +
    |type=int
 +
    |set=0
 +
    |text=The number of color bits per color channel the TouchDesigner window is running at. By default this will be 8-bits per channel, but can be increased to 10-bits by settings env var TOUCH_10_BIT_COLOR=1. Only works on displays that support 10-bit color.
 
}}}}
 
}}}}
 
{{ClassMethodSection|empty=
 
{{ClassMethodSection|empty=
 
|Sectionsummary=
 
|Sectionsummary=
 
|items=
 
|items=
 
 
{{ClassMethod
 
{{ClassMethod
 
     |class=App
 
     |class=App
 
     |name=addNonCommercialLimit
 
     |name=addNonCommercialLimit
 
     |call=addNonCommercialLimit(password)
 
     |call=addNonCommercialLimit(password)
     |returns=
+
     |returns=None
     |text=:
+
     |text=Limits the application to operate at non-commercial license level. Multiple calls can be made, but each can be undone with a  matching removeNonCommercialLimit(password).  If the password is blank the operation cannot be undone.
Limits the application to operate at non-commercial license level. Multiple calls can be made, but each can be undone with a  matching removeNonCommercialLimit(password).  If the password is blank the operation cannot be undone.
+
*password - (Keyword, Optional) Password to later remove the restriction.
password - (Keyword, Optional) Password to later remove the restriction.
+
<syntaxhighlight lang=python>
 
app.addNonCommercialLimit('secret123')  #undoable with password
 
app.addNonCommercialLimit('secret123')  #undoable with password
 
app.addNonCommercialLimit()  #permanent during length of session.
 
app.addNonCommercialLimit()  #permanent during length of session.
}}
+
</syntaxhighlight>
 +
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=App
 
     |class=App
 
     |name=removeNonCommercialLimit
 
     |name=removeNonCommercialLimit
 
     |call=removeNonCommercialLimit(password)
 
     |call=removeNonCommercialLimit(password)
     |returns=
+
     |returns=bool
     |text=: -> bool
+
     |text=Removes the restriction previously added. Returns True if successful.
Removes the restriction previously added. Returns True if successful.
+
*password - (Keyword) Password previously used when restriction added.
password - (Keyword) Password previously used when restriction added.
+
<syntaxhighlight lang=python>
 
app.removeNonCommercialLimit('secret123')
 
app.removeNonCommercialLimit('secret123')
 +
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 157: Line 178:
 
     |name=addResolutionLimit
 
     |name=addResolutionLimit
 
     |call=addResolutionLimit(x,y password)
 
     |call=addResolutionLimit(x,y password)
     |returns=
+
     |returns=None
     |text=:
+
     |text=Limits all textures to the specified amount. Multiple calls can be made, but each can be undone with a  matching removeResolutionLimit(password).  The final resolution limit will be the minimum of all calls. If the password is blank the operation cannot be undone.
Limits all textures to the specified amount. Multiple calls can be made, but each can be undone with a  matching removeResolutionLimit(password).  The final resolution limit will be the minimum of all calls. If the password is blank the operation cannot be undone.
+
*x - Width of maximum texture resolution, measured in pixels.
x - Width of maximum texture resolution, measured in pixels.
+
*y - Height of maximum texture resolution, measured in pixels.
y - Height of maximum texture resolution, measured in pixels.
+
*password - (Keyword, Optional) Password to later remove the restriction.
password - (Keyword, Optional) Password to later remove the restriction.
+
<syntaxhighlight lang=python>
 
app.addResolutionLimit(600, 480, 'secret123')  #undoable with password
 
app.addResolutionLimit(600, 480, 'secret123')  #undoable with password
 
app.addResolutionLimit()  #permanent during length of session.
 
app.addResolutionLimit()  #permanent during length of session.
 +
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 170: Line 192:
 
     |name=removeResolutionLimit
 
     |name=removeResolutionLimit
 
     |call=removeResolutionLimit(password)
 
     |call=removeResolutionLimit(password)
     |returns=
+
     |returns=bool
     |text=: -> bool
+
     |text=Removes the restriction previously added. Returns True if successful.
Removes the restriction previously added. Returns True if successful.
+
*password - (Keyword) Password previously used when restriction added.
password - (Keyword) Password previously used when restriction added.
+
<syntaxhighlight lang=python>
 
app.removeResolutionLimit('secret123')
 
app.removeResolutionLimit('secret123')
 +
</syntaxhighlight>
 
}}}}
 
}}}}
{{HelpbodyEnd}}
+
<section end=HELPBODY />
 
{{History}}
 
{{History}}
 
{{#invoke:Category|list|Python Reference}}
 
{{#invoke:Category|list|Python Reference}}

Latest revision as of 22:18, 16 June 2020

This class contains specific application details, such as its version and installation folders. It can be accessed with the app object, found in the automatically imported td module.

NOTE: See also Variables and Dialogs -> Variables where more built-in paths and strings are available via expressions in the form var('DESKTOP'), var('MYDOCUMENTS') and var('TOENAME').


Members[edit]

architecturestr (Read Only):

The architecture of the compile. Generally 32 or 64 bit.

binFolderstr (Read Only):

Installation folder containing the binaries.

buildstr (Read Only):

Application build number.

compileDatetuple(year, month, day) (Read Only):

The date the application was compiled, expressed as a tuple (year, month, day).

configFolderstr (Read Only):

Installation folder containing configuration files.

desktopFolderstr (Read Only):

Current user's desktop folder.

enableOptimizedExprsbool :

Get or set if Python expression optimization is enabled. Defaults to True every time TouchDesigner starts.

installFolderstr (Read Only):

Main installation folder.

launchTimefloat (Read Only):

Total time required to launch and begin playing the toe file, measured in seconds.

logExtensionCompilesbool :

Get or set if extra messages for starting and ending compiling extensions is sent to the textport. Additional error stack will be printed if compilation fails. Defaults to False every time TouchDesigner starts.

osNamestr (Read Only):

The operating system name.

osVersionstr (Read Only):

The operating system version.

powerbool :

Get or set the overall processing state of the process. When True, processing is enabled. When False processing is halted. This is identical to pressing the power button on the main interface. This has a greater effect than simply pausing or stopping the playbar.

app.power = False #turn off the power button.

preferencesFolderstr (Read Only):

Folder where the preferences file is located.

productstr (Read Only):

Application name. For example, 'TouchDesigner', 'TouchPlayer'. See also licences.type in Licenses Class.

recentFileslist :

Get or set the list of most recently saved or loaded files.

samplesFolderstr (Read Only):

Installation folder containing configuration files.

userPaletteFolderstr (Read Only):

Folder where custom user palettes are located.

versionstr (Read Only):

Application version number.

windowColorBitsint (Read Only):

The number of color bits per color channel the TouchDesigner window is running at. By default this will be 8-bits per channel, but can be increased to 10-bits by settings env var TOUCH_10_BIT_COLOR=1. Only works on displays that support 10-bit color.

Methods[edit]

addNonCommercialLimit(password)None:

Limits the application to operate at non-commercial license level. Multiple calls can be made, but each can be undone with a matching removeNonCommercialLimit(password). If the password is blank the operation cannot be undone.

  • password - (Keyword, Optional) Password to later remove the restriction.
app.addNonCommercialLimit('secret123')  #undoable with password
app.addNonCommercialLimit()  #permanent during length of session.

removeNonCommercialLimit(password)bool:

Removes the restriction previously added. Returns True if successful.

  • password - (Keyword) Password previously used when restriction added.
app.removeNonCommercialLimit('secret123')

addResolutionLimit(x,y password)None:

Limits all textures to the specified amount. Multiple calls can be made, but each can be undone with a matching removeResolutionLimit(password). The final resolution limit will be the minimum of all calls. If the password is blank the operation cannot be undone.

  • x - Width of maximum texture resolution, measured in pixels.
  • y - Height of maximum texture resolution, measured in pixels.
  • password - (Keyword, Optional) Password to later remove the restriction.
app.addResolutionLimit(600, 480, 'secret123')  #undoable with password
app.addResolutionLimit()  #permanent during length of session.

removeResolutionLimit(password)bool:

Removes the restriction previously added. Returns True if successful.

  • password - (Keyword) Password previously used when restriction added.
app.removeResolutionLimit('secret123')

TouchDesigner Build:

The operating system's holder of files and other folders (directories). It does not refer to operators within TouchDesigner. See Network Path.