Template¶
Code author: Jeremy Ernst
-
class
Template(path=None)[source]¶ The template class saves and loads templates. Templates contain a dictionary of components, their settings, their positions, and their joint name overrides.
-
load_template(components, aim=False)[source]¶ Loads a template file from disk. If the components don’t exist (from the passed in list), then those components are created. Then, depending on the settings (load settings, positions, overrides), data is applied to those components.
- example usage:
# create a template instance using an existing path to a template on disk. inst = template.Template(r"C:\Users\jernst\Documents\ARTv2\resources\templates\test.json") inst.load_settings=False inst.load_template(["clavicle_l", "arm_l", "torso", "master"])
Parameters: - components – A list of the components from the template to load.
- aim – Whether or not aim model should be turned on the component.
-
save_template()[source]¶ Saves a template file to disk.
- example usage:
# get a filename to save a template to, then create a template instance and save the template. path = QtWidgets.QFileDialog.getSaveFileName(self, "Save Template", template_path, "*.json") if os.path.exists(os.path.dirname(path[0])): template_instance = template.Template(utils.path_unify(path[0])) template_instance.save_template()
-