tik_manager4.objects.work
Module for Work object.
Attributes
Classes
Work object to handle works and publishes. |
Module Contents
- class Work(absolute_path, name=None, path=None, parent_task=None)
Bases:
tik_manager4.core.settings.Settings,tik_manager4.mixins.localize.LocalizeMixinWork object to handle works and publishes.
- apply_settings(force=False)
Override the apply settings to add version serialization before.
- 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.
- 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)
- 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)
- 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)
- 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.
- 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.
- get_last_version()
Return the last version of the work.
- get_version(version_number)
Return the version dictionary by version number.
- Args:
version_number (int): Version number.
- has_valid_versions()
Check if the work has at least one valid version.
- 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.
- init_properties()
Initialize the properties of the work from the inherited dictionary.
- init_publish()
- 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.
- 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.
- new_version_from_path(file_path, notes='')
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.
- Returns:
dict: The version dictionary.
- omit()
Omit the work.
- 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.
- reload()
Reload the work from file.
- 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.
- 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.
- revive()
Revive the work.
- set_parent_task(task_obj)
Set the parent task of the work.
- property all_versions
- All versions of the work including deleted ones.
- property category
- The category of the work.
- property creator
- The creator of the work.
- property dcc
- Name of the DCC that the work is originated from.
- property dcc_handler
- DCC handler object.
- property dcc_version
- Version of the dcc that the work is originated from.
- property deleted
- Check if the work is deleted.
- property id
- Unique id of the work.
- object_type
- property parent_task
- Parent task object that the work lives in.
- property state
- Current state of the work.
- property task_id
- Unique id of the task that the work belongs to.
- property task_name
- Name of the task that the work belongs to.
- property version_count
- Total number of versions belonging to the work.
- property versions
- Versions of the work in a list.
- LOG