Merge branch '2.x/develop' into feature/clockify_tweaks

This commit is contained in:
Milan Kolar 2020-07-17 16:52:43 +02:00
commit c0b78eb03e
10 changed files with 23 additions and 44 deletions

View file

@ -106,7 +106,7 @@ class CelactionPrelaunchHook(PypeHook):
f"--project {project}",
f"--asset {asset}",
f"--task {task}",
"--currentFile \"*SCENE*\"",
"--currentFile \\\"\"*SCENE*\"\\\"",
"--chunk *CHUNK*",
"--frameStart *START*",
"--frameEnd *END*",

View file

@ -46,9 +46,6 @@ def cli():
parser.add_argument("--resolutionHeight",
help=("Height of resolution"))
# parser.add_argument("--programDir",
# help=("Directory with celaction program installation"))
celaction.kwargs = parser.parse_args(sys.argv[1:]).__dict__
@ -78,7 +75,7 @@ def _prepare_publish_environments():
env["AVALON_WORKDIR"] = os.getenv("AVALON_WORKDIR")
env["AVALON_HIERARCHY"] = hierarchy
env["AVALON_PROJECTCODE"] = project_doc["data"].get("code", "")
env["AVALON_APP"] = publish_host
env["AVALON_APP"] = f"hosts.{publish_host}"
env["AVALON_APP_NAME"] = "celaction_local"
env["PYBLISH_HOSTS"] = publish_host

View file

@ -174,22 +174,16 @@ class BlendActionLoader(pype.hosts.blender.plugin.AssetLoader):
strips = []
for obj in collection_metadata["objects"]:
for obj in list(collection_metadata["objects"]):
# Get all the strips that use the action
arm_objs = [
arm for arm in bpy.data.objects if arm.type == 'ARMATURE']
for armature_obj in arm_objs:
if armature_obj.animation_data is not None:
for track in armature_obj.animation_data.nla_tracks:
for strip in track.strips:
if strip.action == obj.animation_data.action:
strips.append(strip)
bpy.data.actions.remove(obj.animation_data.action)
@ -277,22 +271,16 @@ class BlendActionLoader(pype.hosts.blender.plugin.AssetLoader):
objects = collection_metadata["objects"]
lib_container = collection_metadata["lib_container"]
for obj in objects:
for obj in list(objects):
# Get all the strips that use the action
arm_objs = [
arm for arm in bpy.data.objects if arm.type == 'ARMATURE']
for armature_obj in arm_objs:
if armature_obj.animation_data is not None:
for track in armature_obj.animation_data.nla_tracks:
for strip in track.strips:
if strip.action == obj.animation_data.action:
track.strips.remove(strip)
bpy.data.actions.remove(obj.animation_data.action)

View file

@ -30,9 +30,7 @@ class BlendAnimationLoader(pype.hosts.blender.plugin.AssetLoader):
color = "orange"
def _remove(self, objects, lib_container):
for obj in objects:
for obj in list(objects):
if obj.type == 'ARMATURE':
bpy.data.armatures.remove(obj.data)
elif obj.type == 'MESH':

View file

@ -28,8 +28,7 @@ class BlendCameraLoader(pype.hosts.blender.plugin.AssetLoader):
color = "orange"
def _remove(self, objects, lib_container):
for obj in objects:
for obj in list(objects):
bpy.data.cameras.remove(obj.data)
bpy.data.collections.remove(bpy.data.collections[lib_container])

View file

@ -21,7 +21,7 @@ class BlendLayoutLoader(plugin.AssetLoader):
color = "orange"
def _remove(self, objects, obj_container):
for obj in objects:
for obj in list(objects):
if obj.type == 'ARMATURE':
bpy.data.armatures.remove(obj.data)
elif obj.type == 'MESH':

View file

@ -25,8 +25,8 @@ class BlendModelLoader(plugin.AssetLoader):
color = "orange"
def _remove(self, objects, container):
for obj in objects:
for material_slot in obj.material_slots:
for obj in list(objects):
for material_slot in list(obj.material_slots):
bpy.data.materials.remove(material_slot.material)
bpy.data.meshes.remove(obj.data)

View file

@ -25,7 +25,7 @@ class BlendRigLoader(plugin.AssetLoader):
color = "orange"
def _remove(self, objects, obj_container):
for obj in objects:
for obj in list(objects):
if obj.type == 'ARMATURE':
bpy.data.armatures.remove(obj.data)
elif obj.type == 'MESH':

View file

@ -514,12 +514,6 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
instance: the instance to integrate
"""
transfers = instance.data.get("transfers", list())
for src, dest in transfers:
if os.path.normpath(src) != os.path.normpath(dest):
self.copy_file(src, dest)
transfers = instance.data.get("transfers", list())
for src, dest in transfers:
self.copy_file(src, dest)

View file

@ -2,7 +2,11 @@ import sys
import pyblish.api
import pype.api
import avalon.api
import six
try:
from pype.modules.ftrack.lib.avalon_sync import CUST_ATTR_AUTO_SYNC
except Exception:
CUST_ATTR_AUTO_SYNC = "avalon_auto_sync"
class ValidateAutoSyncOff(pyblish.api.ContextPlugin):
@ -16,15 +20,10 @@ class ValidateAutoSyncOff(pyblish.api.ContextPlugin):
order = pyblish.api.ValidatorOrder
families = ['clip']
label = 'Ftrack project\'s auto sync off'
actions = [pype.api.RepairAction]
actions = [pype.api.RepairContextAction]
def process(self, context):
session = context.data["ftrackSession"]
project_name = avalon.api.Session["AVALON_PROJECT"]
query = 'Project where full_name is "{}"'.format(project_name)
project = session.query(query).one()
invalid = self.get_invalid(context)
assert not invalid, (
"Ftrack Project has 'Auto sync' set to On."
" That may cause issues during integration."
@ -36,14 +35,18 @@ class ValidateAutoSyncOff(pyblish.api.ContextPlugin):
project_name = avalon.api.Session["AVALON_PROJECT"]
query = 'Project where full_name is "{}"'.format(project_name)
project = session.query(query).one()
return project
if project["custom_attributes"][CUST_ATTR_AUTO_SYNC]:
return project
@classmethod
def repair(cls, context):
session = context.data["ftrackSession"]
invalid = cls.get_invalid(context)
invalid['custom_attributes']['avalon_auto_sync'] = False
if not invalid:
cls.log.info("Project 'Auto sync' already fixed.")
return
invalid["custom_attributes"][CUST_ATTR_AUTO_SYNC] = False
try:
session.commit()
except Exception: