STEAM GROUP
Open Source Filmmaker osfm
STEAM GROUP
Open Source Filmmaker osfm
554
IN-GAME
3,632
ONLINE
Founded
15 August, 2012
Showing 1-10 of 16 entries
2
Autosave script
0
SFM Python Built-In Modules Reference
Sticking this here for reference's sake. This is the output of help(module) for all the built-in modules that sfm provides for python scripts (besides the source sdk stuff, in which case you're better off importing the vs package, anyway). A lot of the sfm module is already explained on the wiki but there have been some functions removed and others added since that was written.

Notably, there is a function sfm.console(string) which will execute a command as if it were entered in the game console. Interesting stuff in the sfmApp module as well.

Help on module sfm: NAME sfm FILE (built-in) FUNCTIONS AimConstraint(...) Create an aim constraint, name='Constraint Name', group='Animation Set Group Name', mo='Maintain Offset', w='Weight', wu='World up vector', wuSpace='World up space', refObject='Dag node to specify the space world up vector', controls='Create weight controls and channels' BeginRig(...) Start a rig and make it the active rig, append='Flag specifying if appending elements to an existing rig is allowed' ClearSelection(...) Clear the current selection, removing all currently selected dag nodes CreateAnimationSet(...) Create an animation set for the specified element, target='Element for which animation set is to be created' CreateAttachmentHandle(...) Create a dag node for an attachment point CreateDag(...) Create a dag node and transform controls in the specified animation set, pos='Dag position', rot='Rag rotation (pitch, yaw, roll)', animSet='Animation set to which the dag is to be added.' CreateModel(...) Create a CDmeGameModel referencing the specified mdl CreateRigHandle(...) Create a rig handle, pos='Rig handle position', rot='Rig handle rotation (pitch, yaw, roll)', group='Animation Set Group Name', posControl='Create a position control and channel for the handle', rotControl='Create a rotation control and channel for the handle' EndRig(...) End the currently active rig ErrMsg(...) Redirects stderr FindDag(...) Find the dag within the current or specified animation set with the specified name FirstSelectedDag(...) Get the first dag node in the current selection. GenerateSamples(...) Resample the position and orientation of the selected dag nodes and store in the logs for each node, parent='Generate samples using the specified node as the parent', pos='Generate position values', rot='Generate rotation values', world='Generate samples in world space, ignoring the any parent' GetCurrentAnimationSet(...) Get the currently active selected animation set. GetCurrentFrame(...) Return the shot relative frame number corresponding to the current time GetCurrentRig(...) End the currently active rig GetCurrentShot(...) Get the currently selected shot. GetPosition(...) Get dag node position, space='Space in which the move is to occur', refObject='Dag node to be used for reference space mode' GetRotation(...) Get dag node position, space='Space in which the move is to occur', refObject='Dag node to be used for reference space mode' IKConstraint(...) Create 2-bone IK Constraint, poleVector='World space pole vector', pvTarget='Pole vector target vector', name='Constraint Name', group='Animation Set Group Name', mo='Maintain Offset', w='Weight', controls='Create weight controls and channels' Move(...) Move the currently selected dag nodes, ='Amount to move along X', ='Amount to move along Y', ='Amount to move along Z', relative='Move the nodes relative to their current position', offsetMode='Apply the move as an offset over the time selection instead of an absolute value', space='Space in which the move is to occur', refObject='Dag node to be used for reference space mode' Msg(...) Redirects stdout NextSelectedDag(...) Get the next selected control in the current selection. OrientConstraint(...) Create orientation constraint, name='Constraint Name', group='Animation Set Group Name', mo='Maintain Offset', w='Weight', controls='Create weight controls and channels' Parent(...) Make primary selection the parent of all other selected dag nodes, world='Parent the selected nodes to the world (unparent).', maintainWorldPos='Maintain the world space positions of the children.', logMode='Specification of how logs on the child dag are to be updated.' ParentConstraint(...) Create parent constraint, name='Constraint Name', group='Animation Set Group Name', mo='Maintain Offset', w='Weight', controls='Create weight controls and channels' PointConstraint(...) Create point constraint, name='Constraint Name', group='Animation Set Group Name', mo='Maintain Offset', w='Weight', controls='Create weight controls and channels' PopSelection(...) Pop the current selection off of the stack and restore the previously pushed selection. PrintDagOperators(...) Print an ordered list of operators for the selected dag node, local='local only' PushSelection(...) Push the current selection on to the stack, so that it may be restored later. RemoveConstraints(...) Remove all constraints from the selected dag nodes Rotate(...) Rotate the currently selected dag nodes, ='Amount to move rotate around X', ='Amount to move rotate around Y', ='Amount to move rotate around Z', relative='Move the nodes relative to their current position', offsetMode='Apply the move as an offset over the time selection instead of an absolute value', space='Space in which the move is to occur', refObject='Dag node to be used for reference space mode' Select(...) Select one or more dag nodes, r='Remove the dag from the selection', tgl='Toggle selection, remove if in selection, add if not in selection', error='Error if the specified selection does not exist' SelectAll(...) Select all of the dag nodes in the animation set SelectDag(...) Add a dag node to the selection SetCurrentFrame(...) Set the current time for script operation to the specified frame relative to the start of the shot, ='Frame number' SetDefault(...) Set the default position and orientation of the currently selected nodes, pos='Flag indicating if the position default should be set', rot='Flag indicating if the rotation default should be set' SetOperationMode(...) Set the current channel operation mode SetReferencePose(...) Move the currently selected dag nodes to their reference pose position UsingAnimationSet(...) Specify an animation set to be assumed for commands in which an animation set is not explicitly specified. console(...) Dispatch string to command console None Help on module sfmApp: NAME sfmApp FILE (built-in) FUNCTIONS CloseDocument(...) Closes current document. qApp will emit DocumentClosed when done. Keyword arguments: forceSilent -- no dialog is shown in case of an error (True) ExecuteGameCommand(...) Executes the command in the game console. GetClipsOfTrack(...) Returns a list of the clips of a track. GetDocumentRoot(...) Returns the root of the current document or None. GetElementForHandle(...) Returns the element for the handle, or None. GetFramesPerSecond(...) Returns frames per second. GetHeadTimeInFrames(...) Returns the current time in frames. GetHeadTimeInSeconds(...) Returns the current time in seconds. GetMainWindow(...) Returns the current QMainWindow. GetMovie(...) Returns current active movie as CDmeFilmClip. GetNameForTimelineMode(...) Returns current recording state. GetParentClip(...) Returns the parent clip of a track group. GetParentTrack(...) Returns the parent track of a clip. GetParentTrackGroup(...) Returns the parent track group of a track. GetScriptController(...) Returns the instance of the script controller. GetScriptsMenu(...) Returns the script menu. Keyword arguments: None yet GetShotAtCurrentTime(...) Returns the clip at the current time or None. GetShots(...) Returns list of current shots in the Timeline. GetTimelineMode(...) Returns current recording state. GetTrackGroupsOfClip(...) Returns a list of the track groups of a clip. GetTracksOfTrackGroup(...) Returns a list of the tracks of a track groups. HasDocument(...) Returns a boolean whether a document is available. LoadMap(...) Loads a new map. qApp will emit LevelLoadingStarted when started and LevelLoadingFinished when done. Keyword arguments: name -- name of the map forceSilent -- no dialog is shown in case of an error (True) NewDocument(...) Creates a new document. Closes the current document, if applicable Keyword arguments: filename -- absolute filename of the document (last used directory with filename) name -- name of the document (last used name with a number appended) framerate -- framerate as float. (24.0) defaultContent -- create default content for the document (True) forceSilent -- no dialog is shown in case of an error (True) OpenDocument(...) Opens an existing document. Returns True on success. qApp will emit DocumentLoaded when done. Keyword arguments: filename -- absolute filename of the document forceSilent -- no dialog is shown in case of an error (True) ProcessEvents(...) Calls qApp->processEvents and renders one frame. qApp will emit InteractiveRenderFinished when done with all requested rendering. RegisterTabWindow(...) Registers a widget in the SFM Tabbed Environment. Arguments: Pretty Name, Internal Name, Pointer to Widget (shiboken::getCppPointer( widget )[0] ) RescanScriptMenus(...) Rescans all menus and deletes existing content. qApp emits RescanMenuFinished when done. SaveDocument(...) Saves the current document. Returns True on success. qApp will emit DocumentSaved when done. Keyword arguments: filename -- absolute filename of the document. If missing, than uses existing path forceSilent -- no dialog is shown in case of an error (True) SetHeadTimeInFrames(...) Sets the current time in frames. SetHeadTimeInSeconds(...) Sets the current time in seconds. SetTimelineMode(...) Sets the new recording state. ShowTabWindow(...) Show a widget in the SFM Tabbed Environment with the name Internal Name Arguments: Internal Name Version(...) Version of the SFM as string in the form x.x.x.x None Help on module sfmClipEditor: NAME sfmClipEditor FILE (built-in) FUNCTIONS GetSelectedClips(...) Returns list of currently selected clips. Keyword arguments: type -- clip type for filtering selected clips ( CDmeFilmClip | CDmeSoundClip | CDmeFXClip | CDmeChannelsClip) GetSelectedShots(...) Returns list of current selected shots in the Timeline. None Help on module sfmConsole: NAME sfmConsole FILE (built-in) FUNCTIONS ClearScriptOutput(...) Clears the output in the Script Editor Console. SetEchoScriptOutput(...) Enables echo of executed scripts. StderrMsg(...) Used to redirect the error output of Python to the Script Editor Console. StdoutMsg(...) Used to redirect the output of Python to the Script Editor Console. None
20
Welcome to the Pun Run!
2
Parametric Motion Script
I've been playing around with DAG scripts the last few days, came up with this script this afternoon. Basically, you select a node, enter some equations for X, Y, and Z, and then the script creates a path. This could be used (for example) to create a realistic trajectory, or a sine wave, circle, spiral, etc.

The script itself if super rough around the edges. I don't really know how useful it may be in practice but I'll toss it out to the public anyway.

See here for a visual overview[imgur.com]

To install:
-Download .py file here[dl.dropbox.com]
-Place the file in "[SourceFilmmaker]/game/platform/scripts/sfm/dag/exact/count1"

To use:
-Select a period of time in the motion editor.
-Right click a bone, go to DAG utilities, and select "parametric_motion"
-A dialog will pop up. Enter equations for X, Y, and Z (and rotations) in the variable 't'. The range for t is 0 <= t < nframes; t is equal to the number of frames elapsed since the first frame.
-Press OK, and the script will do its thing

Notes:
-Like I said, it's rough. It will probably crash if you give it invalid input, or do anything terribly out of the ordinary (also keep an eye out for math errors, ie div by 0, inputs outside a function's range, etc). You have been warned.
-The script uses python's 'eval()' for the equations, so any valid Python expression that returns a number should work. Refer to this page[docs.python.org] for a list of available math functions (you need not type "math." before each function).

Updated 4 April 2013
30
ROBOT WEEK !
43
ZOMBIE WEEK
84
CRITTER WEEK !
Showing 1-10 of 16 entries