Merge pull request #2877 from pypeclub/bugfix/missing_time_function

General: Missing time function
This commit is contained in:
Jakub Trllo 2022-03-11 16:52:51 +01:00 committed by GitHub
commit 3cbc93d59c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 8 deletions

View file

@ -5,6 +5,7 @@ from pathlib import Path
import attr
from avalon import api
from openpype.lib import get_formatted_current_time
import openpype.lib.abstract_collect_render
import openpype.hosts.harmony.api as harmony
from openpype.lib.abstract_collect_render import RenderInstance
@ -138,7 +139,7 @@ class CollectFarmRender(openpype.lib.abstract_collect_render.
render_instance = HarmonyRenderInstance(
version=version,
time=api.time(),
time=get_formatted_current_time(),
source=context.data["currentFile"],
label=node.split("/")[1],
subset=subset_name,

View file

@ -50,6 +50,7 @@ import maya.app.renderSetup.model.renderSetup as renderSetup
import pyblish.api
from avalon import api
from openpype.lib import get_formatted_current_time
from openpype.hosts.maya.api.lib_renderproducts import get as get_layer_render_products # noqa: E501
from openpype.hosts.maya.api import lib
@ -328,7 +329,7 @@ class CollectMayaRender(pyblish.api.ContextPlugin):
"family": "renderlayer",
"families": ["renderlayer"],
"asset": asset,
"time": api.time(),
"time": get_formatted_current_time(),
"author": context.data["user"],
# Add source to allow tracing back to the scene from
# which was submitted originally

View file

@ -7,6 +7,7 @@ from maya import cmds
import pyblish.api
from avalon import api
from openpype.lib import get_formatted_current_time
from openpype.hosts.maya.api import lib
@ -117,7 +118,7 @@ class CollectVrayScene(pyblish.api.InstancePlugin):
"family": "vrayscene_layer",
"families": ["vrayscene_layer"],
"asset": api.Session["AVALON_ASSET"],
"time": api.time(),
"time": get_formatted_current_time(),
"author": context.data["user"],
# Add source to allow tracing back to the scene from
# which was submitted originally

View file

@ -63,7 +63,10 @@ from .anatomy import (
Anatomy
)
from .config import get_datetime_data
from .config import (
get_datetime_data,
get_formatted_current_time
)
from .python_module_tools import (
import_filepath,
@ -309,6 +312,7 @@ __all__ = [
"Anatomy",
"get_datetime_data",
"get_formatted_current_time",
"PypeLogger",
"get_default_components",

View file

@ -26,7 +26,7 @@ class RenderInstance(object):
# metadata
version = attr.ib() # instance version
time = attr.ib() # time of instance creation (avalon.api.time())
time = attr.ib() # time of instance creation (get_formatted_current_time)
source = attr.ib() # path to source scene file
label = attr.ib() # label to show in GUI
subset = attr.ib() # subset name

View file

@ -74,3 +74,9 @@ def get_datetime_data(datetime_obj=None):
"S": str(int(seconds)),
"SS": str(seconds),
}
def get_formatted_current_time():
return datetime.datetime.now().strftime(
"%Y%m%dT%H%M%SZ"
)

View file

@ -1,12 +1,12 @@
import pyblish.api
from avalon import api
from openpype.lib import get_formatted_current_time
class CollectTime(pyblish.api.ContextPlugin):
"""Store global time at the time of publish"""
label = "Collect Current Time"
order = pyblish.api.CollectorOrder
order = pyblish.api.CollectorOrder - 0.499
def process(self, context):
context.data["time"] = api.time()
context.data["time"] = get_formatted_current_time()