-
Notifications
You must be signed in to change notification settings - Fork 30
06. Scripting
3Dickulus edited this page Dec 25, 2021
·
9 revisions
Fragmentarium can be controlled via scripting commands available in fqscript files.
- void setDefault()
- Applies the Default preset for the current tab.
- void applyPresetByName(String name)
- Applies the named preset if it exists in the preset list.
- void loadFragFile(String fileName)
- Opens a new editor tab, loads the named fragment file, initializes default preset, initializes keyframes and easing curves if the file contains these settings.
- bool initializeFragment()
- Returns success or fail. Must be called after altering a locked variable before rendering an image.
- void setAutoLoad ( bool )
- Sets reloading of fragment source if the file has been changed by an external editor.
- void saveParameters ( String fileName )
- Save the current settings as fileName, this should be in the form of fileName.parameters.
- void loadParameters ( String fileName )
- Reads the settings from fileName and applies them to the current fragment, this should be in the form of fileName.parameters.
- void setParameter( String data )
- Set a parameter from String in the form of "parameter = value" also accepts parameter file formatted string (multiple parameters where each line is terminated with "\n").
- void setParameter( String, bool)
- Sets a boolean parameter where String is the parameter name and bool is TRUE or FALSE.
- void setParameter( String, int )
- Sets an integer parameter where String is the parameter name and int is any integer.
- void setParameter( String, x )
- Sets a float parameter where String is the parameter name and x is any floating point number.
- void setParameter( String, x, y )
- Sets a float2 parameter where String is the parameter name and x,y are any floating point numbers.
- void setParameter( String, x, y, z )
- Sets a float3 parameter where String is the parameter name and x,y,z are any floating point numbers.
- void setParameter( String, x, y, z, w )
- Sets a float4 parameter where String is the parameter name and x,y,z,w are any floating point numbers.
- String getParameter( String )
- Returns a string representing the value(s) for the named parameter, user must parse this into usable values.
- float getParameter1f ( String name )
- Returns a floating point value from the named uniform.
- vec2 getParameter2f ( String name )
- Returns a floating point vec2 value from the named uniform.
- vec3 getParameter3f ( String name )
- Returns a floating point vec3 value from the named uniform.
- vec4 getParameter4f ( String name )
- Returns a floating point vec4 value from the named uniform.
- void setAnimationLength( int )
- Sets the total animation duration in seconds.
- void setTileWidth( int )
- Sets the tile width.
- void setTileHeight( int )
- Sets the tile height.
- void setTileMax(int)
- Sets the number of row and column tiles, this value squared = total tiles.
- void setSubFrames( int )
- Sets the number of frames to accumulate.
- void setOutputBaseFileName( String )
- Sets the filename for saved image, if script has total control this must be set by the script for every frame, if animation is using frag file settings, keyframes etc., then this only needs to be set once to basename and Fragmentarium will add an index padded to 5 digits.
- void setFps( int )
- Sets the frames per second for rendering.
- void setStartFrame( int )
- Sets the start frame number for rendering a range of frames.
- void setEndFrame( int )
- Sets the end frame number for rendering a range of frames.
- void setAnimation( bool )
- FALSE sets animation to script control exclusively.
- TRUE enables control from keyframes and easing curves.
- void setPreview( bool )
- TRUE will preview frames in a window on the desktop instead of saving image files. if a Preview is already being displayed it will be closed and a new one will open. Warning:Requires used interaction to close the last or only one.
- void savePreview()
- Saves the current preview. Warning: Opens the file save dialog, requires user input.
- void setAutoSave ( bool )
- Save fragment source and support files. The same as enabling this checkbox in the Hires image and animation dialog.
- void setUniqueID ( bool )
- Adds autoincremented index to fragment source file and folder. The same as enabling this checkbox in the Hires image and animation dialog.
- bool scriptRunning()
- Returns FALSE when the user selects the [Stop] button in the script editor. For user implemented test in script to break out of the script control loop.
- void stopScript()
- For user implemented test in script to break out of the script control loop or error like file not found, initialization fail etc.
- void tileBasedRender()
- Begins rendering the current frame or range of frames applying the current state for keyframes and active easing settings.
- void setFrame(int)
- Sets the timiline current frame number to this position.
- int getFrame()
- Returns the current timeline position as frame number.
- void rewind()
- Same as selecting the Rewind button in the main GUI.
- void play()
- Same as selecting the Play button in the main GUI.
- void stop()
- Same as selecting the Stop button in the main GUI.
- String currentFileName()
- Returns the full path to the currently active fragment file.
- String currentFragmentName()
- Returns only the frag name, no path and no .frag suffix.
- void addKeyFrame ( StringList )
- Adds a keyframe. The contents of this list is expected to be the same as if you block marked and copied the settings from a keyframe in the editor.
- void clearKeyFrames()
- Resets keyframe status to none.
- void initKeyFrameControl()
- Initializes keyframes from fragment.
- void selectPreset()
- Block marks the indicated preset text in the editor.
- void callRedraw()
- Redraws GL area.
- void documentWasModified()
- Sets text editor status.
- void closeTab ( int )
- Closes the currently active tab.
- int getTileAVG()
- Returns the average render time for 1 tile in milliseconds.
- int getRenderAVG()
- Returns the average render time for 1 frame in milliseconds.
- void dumpShaderAsm()
- Opens a dialog with assembler output if the hardware supports this feature.
- void loadErrorSourceFile( String fileName, int LineNumber )
- If the file is already loaded then jump to line else load the file and jump to line
- String getVersion()
- Returns the full version as a string.
- String getPresetNames ( bool keyframesORpresets = false )
- Returns all preset names (default) or keyframe names.
- void scriptExitProgram ( int x = 0 )
- Exits the program with the given error code.
All commands must be prefixed with app. when used in fqScripts as in app.setFrame(2360)