tik_manager4.objects.work ========================= .. py:module:: tik_manager4.objects.work .. autoapi-nested-parse:: Module for Work object. Attributes ---------- .. autoapisummary:: tik_manager4.objects.work.LOG Classes ------- .. autoapisummary:: tik_manager4.objects.work.Work Module Contents --------------- .. py:class:: Work(absolute_path, name=None, path=None, parent_task=None) Bases: :py:obj:`tik_manager4.core.settings.Settings`, :py:obj:`tik_manager4.mixins.localize.LocalizeMixin` Work object to handle works and publishes. .. py:method:: apply_settings(force=False) Override the apply settings to add version serialization before. .. py:method:: check_dcc_version_mismatch() Check if there is a mismatch with the current and defined dcc versions. Returns: tuple or bool: a tuple of defined dcc version and current dcc version. Otherwise returns False. .. py:method:: check_destroy_permissions() Check the permissions for deleting the work. Users can only delete their own works. Admins can delete any work. If there is a publish of the work, only Admins can delete the work. Returns: Tuple[bool, str]: (state, message) .. py:method:: check_owner_permissions(version_number) Check the permissions for 'owner' and 'admin-only' actions. Users can only delete their own versions. Admins can delete any version. If there is a publish of the version, only Admins can delete the version. Args: version_number (int): Version number. Returns: Tuple[bool, str]: (state, message) .. py:method:: construct_names(file_format, version_number=None, thumbnail_extension='.jpg') Construct a name for the work version. Args: file_format (str): The file format of the file. version_number (int, optional): The version number. If not given, iterated on top of the last version. thumbnail_extension (str, optional): The extension of the thumbnail file. Returns: tuple: (version_number, version_name, thumbnail_name) .. py:method:: delete_version(version_number) Delete the given version of the work. Args: version_number (int): Version number. Returns: tuple: (state(int), message(str)): 1 if the operation is successful, -1 otherwise. A message is returned as well. .. py:method:: destroy() Delete the work AND all its versions AND PUBLISHES. CAUTION: This is a destructive operation. Use with caution. Returns: tuple: (state(int), message(str)): 1 if the operation is successful, -1 otherwise. A message is returned as well. .. py:method:: get_last_version() Return the last version of the work. .. py:method:: get_version(version_number) Return the version dictionary by version number. Args: version_number (int): Version number. .. py:method:: has_valid_versions() Check if the work has at least one valid version. .. py:method:: import_version(version_number, element_type=None, ingestor=None) Import the given version of the work to the scene. Args: version_number (int): Version number. element_type (str, optional): Element type of the version. ingestor (str, optional): Ingestor to use. .. py:method:: init_properties() Initialize the properties of the work from the inherited dictionary. .. py:method:: init_publish() .. py:method:: load_version(version_number, force=False, **kwargs) Load the given version of the work. Args: version_number (int): Version number. force (bool, optional): If True, force open the file. **kwargs: Additional arguments to pass to the dcc handler. .. py:method:: new_version(file_format=None, notes='', ignore_checks=True, from_selection=False) Create a new version of the work. Args: file_format (str): The file format of the file. notes (str): Notes for the version. ignore_checks (bool): If True, skip all pre-checks. Returns: dict: The version dictionary. .. py:method:: new_version_from_path(file_path, notes='', dry_version=False) Register a given path (file or folder) as a new version of the work. Args: file_path (str): The file path of the source file. This will be copied to the project. notes (str): Notes for the version. ignore_checks (bool): If True, skip all pre-checks. dry_version (bool): If True, do not actually copy the file. Just create the version entry. This is useful when used with direct publishing. Returns: dict: The version dictionary. .. py:method:: omit() Omit the work. .. py:method:: reference_version(version_number, element_type=None, ingestor=None) Reference the given version of the work to the scene. Args: version_number (int): Version number. element_type (str, optional): Element type of the version. ingestor (str, optional): Ingestor to use. .. py:method:: reload() Reload the work from file. .. py:method:: replace_thumbnail(version_number, new_thumbnail_path=None) Replace the thumbnail of the given version. Args: version_number (int): Version number. new_thumbnail_path (str): Path to the thumbnail image. If not given, a new thumbnail will be generated. Returns: int: 1 if successful, -1 if failed. .. py:method:: resurrect(dont_resurrect_versions=False) Resurrect the work and all upstream hiearachy. This won't resurrect any publish and resurrect only the last work version by default. Args: dont_resurrect_versions (bool, optional): If True, do not resurrect the versions. .. py:method:: revive() Revive the work. .. py:method:: set_parent_task(task_obj) Set the parent task of the work. .. py:property:: all_versions All versions of the work including deleted ones. .. py:property:: category The category of the work. .. py:property:: creator The creator of the work. .. py:property:: dcc Name of the DCC that the work is originated from. .. py:property:: dcc_handler DCC handler object. .. py:property:: dcc_version Version of the dcc that the work is originated from. .. py:property:: deleted Check if the work is deleted. .. py:property:: id Unique id of the work. .. py:attribute:: object_type .. py:property:: parent_task Parent task object that the work lives in. .. py:property:: state Current state of the work. .. py:property:: task_id Unique id of the task that the work belongs to. .. py:property:: task_name Name of the task that the work belongs to. .. py:property:: version_count Total number of versions belonging to the work. .. py:property:: versions Versions of the work in a list. .. py:data:: LOG