Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion avalon/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,11 @@ def is_compatible_loader(Loader, context):
bool

"""
families = context["version"]["data"]["families"]
if context["subset"]["schema"] == "avalon-core:subset-3.0":
families = context["subset"]["data"]["families"]
else:
families = context["version"]["data"].get("families", [])

representation = context["representation"]
has_family = ("*" in Loader.families or
any(family in Loader.families for family in families))
Expand Down
62 changes: 62 additions & 0 deletions avalon/schema/subset-3.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",

"title": "avalon-core:subset-3.0",
"description": "A container of instances",

"type": "object",

"additionalProperties": true,

"required": [
"schema",
"type",
"parent",
"name",
"data"
],

"properties": {
"schema": {
"description": "The schema associated with this document",
"type": "string",
"enum": ["avalon-core:subset-3.0"],
"example": "avalon-core:subset-3.0"
},
"type": {
"description": "The type of document",
"type": "string",
"enum": ["subset"],
"example": "subset"
},
"parent": {
"description": "Unique identifier to parent document",
"example": "592c33475f8c1b064c4d1696"
},
"name": {
"description": "Name of directory",
"type": "string",
"pattern": "^[a-zA-Z0-9_.]*$",
"example": "shot01"
},
"data": {
"description": "Document metadata",
"type": "object",
"required": ["families"],
"properties": {
"families": {
"type": "array",
"items": {"type": "string"},
"description": "One or more families associated with this subset"
}
},
"example": {
"families" : [
"avalon.camera"
],
"frameStart": 1000,
"frameEnd": 1201
}
}
}
}
84 changes: 84 additions & 0 deletions avalon/schema/version-3.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",

"title": "avalon-core:version-3.0",
"description": "An individual version",

"type": "object",

"additionalProperties": true,

"required": [
"schema",
"type",
"parent",
"name",
"data"
],

"properties": {
"schema": {
"description": "The schema associated with this document",
"type": "string",
"enum": ["avalon-core:version-3.0"],
"example": "avalon-core:version-3.0"
},
"type": {
"description": "The type of document",
"type": "string",
"enum": ["version"],
"example": "version"
},
"parent": {
"description": "Unique identifier to parent document",
"example": "592c33475f8c1b064c4d1696"
},
"name": {
"description": "Number of version",
"type": "number",
"example": 12
},
"locations": {
"description": "Where on the planet this version can be found.",
"type": "array",
"items": {"type": "string"},
"example": ["data.avalon.com"]
},
"data": {
"description": "Document metadata",
"type": "object",
"required": ["author", "source", "time"],
"properties": {
"time": {
"description": "ISO formatted, file-system compatible time",
"type": "string"
},
"timeFormat": {
"description": "ISO format of time",
"type": "string"
},
"author": {
"description": "User logged on to the machine at time of publish",
"type": "string"
},
"version": {
"description": "Number of this version",
"type": "number"
},
"path": {
"description": "Unformatted path, e.g. '{root}/assets/Bruce/publish/lookdevDefault/v001",
"type": "string"
},
"source": {
"description": "Original file from which this version was made.",
"type": "string"
}
},
"example": {
"source" : "{root}/f02_prod/assets/BubbleWitch/work/modeling/marcus/maya/scenes/model_v001.ma",
"author" : "marcus",
"time" : "20170510T090203Z"
}
}
}
}
6 changes: 5 additions & 1 deletion avalon/tools/loader/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ def set_version(self, index, version):
frames = None
duration = None

families = version_data.get("families", [None])
if item["schema"] == "avalon-core:subset-3.0":
families = item["data"]["families"]
else:
families = version_data.get("families", [None])

family = families[0]
family_config = lib.get_family_cached_config(family)

Expand Down
18 changes: 11 additions & 7 deletions avalon/tools/sceneinventory/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,19 @@ def add_items(self, items, parent=None):
asset = io.find_one({"_id": subset["parent"]})

# Get the primary family
family = version["data"].get("family", "")
if not family:
families = version["data"].get("families", [])
if families:
family = families[0]
no_family = ""
if subset["schema"] == "avalon-core:subset-3.0":
families = subset["data"]["families"]
prim_family = families[0] if families else no_family
else:
prim_family = version["data"].get("family")
if not prim_family:
families = version["data"].get("families")
prim_family = families[0] if families else no_family

# Get the label and icon for the family if in configuration
family_config = tools_lib.get_family_cached_config(family)
family = family_config.get("label", family)
family_config = tools_lib.get_family_cached_config(prim_family)
family = family_config.get("label", prim_family)
family_icon = family_config.get("icon", None)

# Store the highest available version so the model can know
Expand Down