Wednesday, 22 April 2015

Softimage button to apply a saved preset to a tool

Let's say you have a good preset for the Curve_To_Mesh tool and you want to apply that preset many times to different curves. It is slow to keep loading the preset manually each time you apply the tool.

Here is a way to apply the tool and then apply the preset in one handy button:

Firstly create the preset for the tool and save it somewhere. You will need the path to the preset later.

Next, open the script editor and copy the command form a previous usage. There are some command arguements that I am not yet familiar with, so copying from a previous usage guarantees that the syntax is correct.

for each curveObj in Selection
ApplyGenOp "CurveListToMesh", , curveObj, siUnspecified, siPersistentOperation, siKeepGenOpInputs

for each polyObj in Selection
LoadPreset "C:\Users\3d\Autodesk\Softimage_2012_Subscription_Advantage_Pack\Data\DSPresets\Operators\d1.Preset", (polyObj+".polymsh.CurveListToMesh")

Now I create a new Shelf

In the new shelf, I create a new Toolbar

Now I can drag my code from the script editor into the toolbar. That creates a button.

The first line reads the selection and runs the tool on the selected curve(s).

Softimage will have the newly created poly mesh object already selected, which makes the next part so much easier.

The second line gets the name of the selected poly object and applies the preset to the stack. This is where wou will need the location of the preset. Also, note the syntax of the last argument.

Having come from a Maya and MEL background I found this syntax really easy to pick up.

No comments:

Post a Comment