Python library to execute actions on DCCs and interface with the silex socket service end using websocket.
- python 3.7
- REZ (optional)
# Simple global install
$ pip install git+https://github.com/ArtFXDev/silex_client.git
# Rez package install (require rez installed)
$ rez pip -i git+https://github.com/ArtFXDev/silex_client.git
If you use rez all these command must be executed in the rez context (rez env silex_client)
# To list all the available action
$ silex action --list
# To execute a given action (the task-id is optional)
$ silex action <action_name> --task-id <cgwire_task_id>
# You can also set some default values to the parameters (add the --parameter flag for every parameters you wan to set)
$ silex action <action_name> --task-id <cgwire_task_id> --parameter <parameter_name>=<parameter_value>
# To launch a dcc in a silex context (the silex plugin of the selected dcc must be installed)
$ silex launch --dcc <dcc_name> --task_id <cgwire_task_id>
from silex_client.core.context import Context
from silex_client.action.action_query import ActionQuery
# You can set the context by setting the cgwire entity id in an environment variable
import os
os.environ["SILEX_TASK_ID"] = "<cgwire_task_id>"
# Initialize the different modules
Context.get().start_services()
# Resolve an action
action = ActionQuery("<action_name>")
# Set some default parameter values if you want
action.set_parameter("<parameter_name>", <parameter_value>)
# You can also override some attribute of the parameters
action.set_parameter("<parameter_name>", <parameter_value>, hide=True, label=<new_label>)
# Execute the action
action.execute()