Python Bindings

Run as Command

Dymatic provides a built in Python interpreter allowing for engine task automation. Invidual python files/commands can be executed via the viewport command line (Shorcut: ~).

Run as Plugin

Python files can persist throughout the editor lifetime as plugins, receveing overridable events from the editor. This allows for engineers to create their own developer tools/UI and respond to certain events.

Overridable events include:

DymaticOnLoad()
DymaticOnUpdate()
DymaticOnUpdate(stage) // Passes a render stage flag to draw to a specifc region (e.g. Title Bar)
DymaticOnUIRender()
DymaticOnUIRender(ts)  // Timestep (as a float between the last frame)
DymaticOnUnload()

Callable Methods

Name Parameters Description
Versioning
GetVersionMajor None Retrieves the current engine major version as an integer
GetVersionMinor None Retrieves the current engine minor version as an integer
GetVersionPatch None Retrieves the current engine patch version as an integer
GetVersionString None Retrieves the current engine version as a string in the format {major}.{minor}.{patch}
Platform Utilities
Platform.OpenFileDialogue Filter (string) Opens platform dialogue to select a single file according to the filter (e.g. "Dymatic Scene (*.dymatic)\0*.dymatic\0")
Platform.SaveFileDialogue Filter (string) Opens platform dialogue to save a single file according to the filter (e.g. "Dymatic Scene (*.dymatic)\0*.dymatic\0")
Platform.SelectFolderDialogue None Opens platform dialogue to select a single folder
Editor
Editor.NewScene None Discards the current scene and creates a new empty scene
Editor.OpenScene None Prompts the user to select a scene to open and opens the specified scene
Editor.SaveScene None Saves the current scene, or SavesSceneAs if not currently saved
Editor.SaveSceneAs None Opens a save file dialogue for the current scene
Editor.Compile None Instructs the editor to compile the active project's C# assembly
UI
UI.BeginWindow None Must be called at the start of window for subsequent draw calls
UI.EndWindow None Must be called to end the current window (failing to execute will result in a crash)
UI.BeginChildWindow None Creates a sub-window region within the current window. This reigion has it's own draw list, scroll area etc.
UI.EndChildWindow None Must be called to end the current Child Window
UI.SameLine offset = 0.0 (float), spacing (float) = 1.0 Ensures the next element is draw on the same line (as opposed to dropping down a line)
UI.Text text (string), text_end (string) = "\0" Draws a text element
UI.TextDisabled None Draws a text element (with the editor disabled color)
UI.Separator None Draws a thin horizontal line to seperate elements
UI.Button label (string), size (vec2), flags (ButtonFlags) Draws a button element
Returns true if clicked
UI.InputText label (string), value (string), flags = NoFlags (InputTextFlags) Provides a field to input/modify a string value.
Returns a tuple containing a boolean 'modified' value, and a string with the current updated data value
UI.DragInt label (string), value (integer), drag_speed = 1.0 (integer), min = 0 (integer), max = 0 (integer), format = "%d" (string), flags = NoFlags (InputTextFlags) Provides a field to input/modify an integer value.
Returns a tuple containing a boolean 'modified' value, and an integer with the current updated data value
UI.BeginMenu label (string), enabled = true (boolean) Begins a menu for subsequent menu items to be placed inside
UI.EndMenu None
UI.MenuItem Label (string), Shortcut (string), Selected (boolean), Enabled (boolean) Draws a menu item inside a menu region.
Returns true if clicked.

UI Flags

Name Description
UIRenderStage
Main Flag passed to DymaticOnIURender for the drawing of all custom windows and UI elements seperate to the main editor.
MenuBar Drawing elements (menus/items) to the main menu bar. Note additonal menus can be specified and are not limited to the sub-menus outlined below.
MenuBar_File Drawing to 'File' menu of main menu bar.
MenuBar_Edit Drawing to 'Edit' menu of main menu bar.
MenuBar_Window Drawing to 'Window' menu of main menu bar.
MenuBar_View Drawing to 'View' menu of main menu bar.
MenuBar_Script Drawing to 'Script' menu of main menu bar.
MenuBar_Help Drawing to 'Help' menu of main menu bar.
TreeFlags
NoFlags None
Selected Draw as selected.
Framed Draw frame with background.
AllowItemOverlap Hit testing to allow subsequent widgets to overlap this one.
NoTreePushOnOpen
NoAutoOpenOnLog
DefaultOpen Default node to be open.
OpenOnDoubleClick Need double-click to open node.
OpenOnArrow Only open when clicking on the arrow part.
Leaf No collapsing, no arrow (use as a convenience for leaf nodes).
Bullet Display a bullet instead of arrow.
FramePadding Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height.
SpanAvailWidth Extend hit box to the right-most edge, even if not framed.
SpanFullWidth Extend hit box to the left-most and right-most edges
NavLeftJumpsBackHere
CollapsingHeader Equivalent to Framed, NoTreePushOnOpen and NoAutoOpenOnLog
ButtonFlags
NoFlags None
MouseButtonLeft React on left mouse button (default)
MouseButtonRight React on right mouse button
MouseButtonMiddle React on center mouse button
InputTextFlags
NoFlags None
CharsDecimal Allow 0123456789.+-*/
CharsHexadecimal Allow 0123456789ABCDEFabcdef
CharsUppercase Turn a..z into A..Z
CharsNoBlank Filter out spaces, tabs
AutoSelectAll Select entire text when first taking mouse focus
EnterReturnsTrue Return 'true' when Enter is pressed (as opposed to every time the value was modified).
CallbackCompletion Callback on pressing TAB (for completion handling)
CallbackHistory Callback on pressing Up/Down arrows (for history handling)
CallbackAlways Callback on each iteration. User code may query cursor position, modify text buffer.
CallbackCharFilter
AllowTabInput Pressing TAB input a '\t' character into the text field
CtrlEnterForNewLine In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter).
NoHorizontalScroll Disable following the cursor horizontally
AlwaysOverwrite Overwrite mode
ReadOnly Read-only mode
Password Password mode, display all characters as '*'
NoUndoRedo Disable undo/redo
CharsScientific Allow 0123456789.+-*/eE (Scientific notation input)
WindowFlags
NoFlags None
NoTitleBar Disable title-bar
NoResize Disable user resizing with the lower-right grip
NoMove Disable user moving the window
NoScrollbar Disable scrollbars (window can still scroll with mouse or programmatically)
NoScrollWithMouse Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set.
NoCollapse Disable user collapsing window by double-clicking on it. Also referred to as Window Menu Button (e.g. within a docking node).
AlwaysAutoResize Resize every window to its content every frame
NoBackground Disable drawing background color (WindowBg, etc.) and outside border. Similar as using SetNextWindowBgAlpha(0.0f).
NoSavedSettings Never load/save settings in the layout save file
NoMouseInputs Disable catching mouse, hovering test with pass through.
MenuBar Has a menu-bar
HorizontalScrollbar Allow horizontal scrollbar to appear (off by default).
NoFocusOnAppearing Disable taking focus when transitioning from hidden to visible state
NoBringToFrontOnFocus Disable bringing window to front when taking focus (e.g. clicking on it or programmatically giving it focus)
AlwaysVerticalScrollbar Always show vertical scrollbar (even if ContentSize.y < Size.y)
AlwaysHorizontalScrollbar Always show horizontal scrollbar (even if ContentSize.x < Size.x)
AlwaysUseWindowPadding Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient)
NoNavInputs No gamepad/keyboard navigation within the window
NoNavFocus No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB)
UnsavedDocument Display a dot next to the title. When used in a tab/docking context, tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar.
NoDocking Disable docking of this window
NoNav Equivalent to 'NoNavInputs' and 'NoNavFocus'
NoDecoration Equivalent to 'NoTitleBar', 'NoResize', 'NoScrollbar' and 'NoCollapse'
NoInputs Equivalent to 'NoMouseInputs', 'NoNavInputs' and 'NoNavFocus'

Data Structures

The Dymatic Python interpreter includes the following built in data structures:

vec2      (x, y)
vec3      (x, y, z)
vec4      (x, y, z, w)