Python Script

Python Script

Tool - Write Python scripts inside Smode

If you do not find the Python script tool, please Generate a license request File How to create a License request Read More .
This tool lets you run Python scripts in Smode.

Code execution

The parameter Launch Mode defines when the script is executed. By default it is set to "Manual".
The options are:
  • Manual : when the Execute trigger is pressed
  • At Preload : at script preload, for instance when the project is loading
  • At Activation : at script activation and reactivation
  • At Parameter Change : when a parameter of the script changes
  • At Every Update : every frame
  • At Deactivation : at script deactivation
  • At Unload : at script unload, for instance when the project is closing

CTRL + ENTER: Compile your script (the console will display every Syntax Errors if you have some)
CTRL + SPACE: Run your script ( + Compilation if needed)
Here is your first script
text = "Smode"
print(f"Hello {text} World")

What Python does (and what it cannot do) ?

The script runs inside the rendering service. If the code take too long to execute, the framerate will be impacted. That's why the time.sleep() function need to be used carefully.
It doesn't have access to UI function (example: Learn is not available)
It can't draw on the rendering

Parameters

  • Launch Mode (Python Script Launch Mode) : Defines when the current script is executed
  • Execute (Trigger) : Manually execute the script

CATALOG

General:

Use Oil.docMe() to get a view of the possibilities - a best way to have an idea of what an object can do

Get and set parameters for a layer from python - What to do when you need to set and get a parameter

Expose Python scripts parameters - Configurable parameter for scripts

Navigate through element Tree in python - How to navigate in element tree and parameters

Get Source Elements - Find tracks, exposed parameters, links and more of parameters

accces Files and Directory - Reload and get file in your media Directory

Elements Creation:

Cloning Elements - Very simple way to quickly replicate elements

Create Layers with python - How to create layers with python?

Create Objects with python - How to create object with python

Timeline:

Timeline Parsing with Python - List all element Block and Key inside the timeline

Timeline Manipulation with Python - Create move edit Block and Keyframe inside Timeline

Others:

Import and Export your Python Script - Reuse your script

Install Python modules - Upgrade the possibilities by installing sub modules for python

Integrated Scripts:

batch rename Script - Place the script in a element where you want to rename all chidren of it

Screate Scene Banks Script - Script to create Banks in each of the child Scenes where the script is placed.

Generate Test Patterns Script - Parse the pipeline to automatically generate test patterns

Crop Content Maps Script - Change the resolution of a contentMap and keep the resolution of the contentAreas

See Also: