Command Evaluation

Context Evaluation context.
run Randomly run weighted commands from a set.

class revl.Context(**kwargs)[source]

Evaluation context.

Each command function needs to define this context as first parameter.


maya.OpenMaya.MDGModifier – DG modifier.


maya.OpenMaya.MDagModifier – DAG modifier.


list of maya.OpenMaya.MObject – Transform nodes. Provides data for the pickTransform() function., count, seed=None, context=None)[source]

Randomly run weighted commands from a set.

Each command comes with a weight which determines the probabilities for that command to be run.

Use validate() to check if the input command set is well-formed.

  • commands (list of revl.Command or compatible tuple) – Set of weighted commands.
  • count (int) – Total number of commands to be run. Setting a count greater than the number of weighted commands doesn’t guarantee that each command will be run once. Some might be run multiple times instead.
  • seed (object) – Hashable object to define the starting seed of the pseudo-random number generations. If None, the current system time is used. Running multiple times a same set of commands with a same fixed seed that is not None produces identitcal results.
  • context (revl.Context) – Context to use. If None, a new one is created.

The context after evaluating the commands.

Return type:



>>> import revl
>>> commands = [
...     (2.0, revl.createTransform,),
...     (1.0, revl.createPrimitive, (), {'parent': True})
... ]
>>>, 100, seed=1.23)