Skip to content

Commit

Permalink
Merge branch 'develop' into enhancement/resolve_menu_minimize
Browse files Browse the repository at this point in the history
  • Loading branch information
BigRoy authored Mar 25, 2024
2 parents d239614 + 15d1619 commit f384487
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 276 deletions.
4 changes: 2 additions & 2 deletions client/ayon_core/cli_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ def publish(path: str, targets: list=None, gui:bool=False) -> None:
install_ayon_plugins,
get_global_context,
)
from ayon_core.tools.utils.host_tools import show_publish
from ayon_core.tools.utils.lib import qt_app_context

# Register target and host
import pyblish.api
Expand Down Expand Up @@ -134,6 +132,8 @@ def publish(path: str, targets: list=None, gui:bool=False) -> None:
print(plugin)

if gui:
from ayon_core.tools.utils.host_tools import show_publish
from ayon_core.tools.utils.lib import qt_app_context
with qt_app_context():
show_publish()
else:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import inspect
from typing import List

import bpy

import pyblish.api

from ayon_core.pipeline.publish import (
ValidateContentsOrder,
OptionalPyblishPluginMixin,
PublishValidationError,
RepairAction
)
import ayon_core.hosts.blender.api.action


class ValidateModelMeshUvMap1(
pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin,
):
"""Validate model mesh uvs are named `map1`.
This is solely to get them to work nicely for the Maya pipeline.
"""

order = ValidateContentsOrder
hosts = ["blender"]
families = ["model"]
label = "Mesh UVs named map1"
actions = [ayon_core.hosts.blender.api.action.SelectInvalidAction,
RepairAction]
optional = True
enabled = False

@classmethod
def get_invalid(cls, instance) -> List:

invalid = []
for obj in instance:
if obj.mode != "OBJECT":
cls.log.warning(
f"Mesh object {obj.name} should be in 'OBJECT' mode"
" to be properly checked."
)

obj_data = obj.data
if isinstance(obj_data, bpy.types.Mesh):
mesh = obj_data

# Ignore mesh without UVs
if not mesh.uv_layers:
continue

# If mesh has map1 all is ok
if mesh.uv_layers.get("map1"):
continue

cls.log.warning(
f"Mesh object {obj.name} should be in 'OBJECT' mode"
" to be properly checked."
)
invalid.append(obj)

return invalid

@classmethod
def repair(cls, instance):
for obj in cls.get_invalid(instance):
mesh = obj.data

# Rename the first UV set to map1
mesh.uv_layers[0].name = "map1"

def process(self, instance):
if not self.is_active(instance.data):
return

invalid = self.get_invalid(instance)
if invalid:
raise PublishValidationError(
f"Meshes found in instance without valid UV's: {invalid}",
description=self.get_description()
)

def get_description(self):
return inspect.cleandoc(
"""## Meshes must have map1 uv set
To accompany a better Maya-focused pipeline with Alembics it is
expected that a Mesh has a `map1` UV set. Blender defaults to
a UV set named `UVMap` and thus needs to be renamed.
"""
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from ayon_core.lib import NumberDef

from ayon_core.hosts.fusion.api.plugin import GenericCreateSaver
from ayon_core.hosts.fusion.api import get_current_comp


class CreateImageSaver(GenericCreateSaver):
Expand Down

This file was deleted.

This file was deleted.

9 changes: 9 additions & 0 deletions server_addon/blender/server/settings/publish_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ class PublishPuginsModel(BaseSettingsModel):
default_factory=ValidatePluginModel,
title="Validate Mesh No Negative Scale"
)
ValidateModelMeshUvMap1: ValidatePluginModel = SettingsField(
default_factory=ValidatePluginModel,
title="Validate Model Mesh Has UV map named map1"
)
ValidateTransformZero: ValidatePluginModel = SettingsField(
default_factory=ValidatePluginModel,
title="Validate Transform Zero"
Expand Down Expand Up @@ -181,6 +185,11 @@ class PublishPuginsModel(BaseSettingsModel):
"optional": False,
"active": True
},
"ValidateModelMeshUvMap1": {
"enabled": False,
"optional": True,
"active": True
},
"ValidateTransformZero": {
"enabled": False,
"optional": True,
Expand Down
Loading

0 comments on commit f384487

Please sign in to comment.