Skip to content

validate_edit_mode

ValidateEditMode

Bases: ContextPlugin, OptionalPyblishPluginMixin

Validates whether zbrush is in edit mode before exporting model with tool settings.

Source code in client/ayon_zbrush/plugins/publish/validate_edit_mode.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class ValidateEditMode(pyblish.api.ContextPlugin,
                       OptionalPyblishPluginMixin):
    """Validates whether zbrush is in edit mode before
    exporting model with tool settings.
    """

    label = "Validate Edit Mode"
    order = ValidateContentsOrder
    families = ["model"]
    hosts = ["zbrush"]
    optional = True
    actions = [RepairContextAction]

    def process(self, context):
        edit_mode = is_in_edit_mode()
        if int(edit_mode) == 0:
            raise PublishValidationError(
                "Zbrush is not in edit mode, "
                "please make sure it is in edit mode before extraction."
            )

    @classmethod
    def repair(cls, context):
        # Enable Transform:Edit state
        execute_zscript("[ISet, Transform:Edit, 1]")