Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #81 from pypeclub/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mkolar authored Nov 6, 2019
2 parents bc1e9f8 + 223ea37 commit 48c3a01
Show file tree
Hide file tree
Showing 122 changed files with 5,836 additions and 6,275 deletions.
10 changes: 5 additions & 5 deletions avalon/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def main():
help="Launch Instance Creator in standalone mode")
parser.add_argument("--loader", action="store_true",
help="Launch Asset Loader in standalone mode")
parser.add_argument("--manager", action="store_true",
help="Launch Manager in standalone mode")
parser.add_argument("--sceneinventory", action="store_true",
help="Launch Scene Inventory in standalone mode")
parser.add_argument("--projectmanager", action="store_true",
help="Launch Manager in standalone mode")

Expand All @@ -34,9 +34,9 @@ def main():
from .tools import loader
loader.show(debug=True)

elif args.manager:
from .tools import manager
manager.show(debug=True)
elif args.sceneinventory:
from .tools import sceneinventory
sceneinventory.show(debug=True)

elif args.projectmanager:
from .tools import projectmanager
Expand Down
12 changes: 8 additions & 4 deletions avalon/fusion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
)

from .workio import (
open,
save,
open_file,
save_file,
current_file,
has_unsaved_changes,
file_extensions,
Expand All @@ -42,8 +42,8 @@
"comp_lock_and_undo_chunk",

# Workfiles API
"open",
"save",
"open_file",
"save_file",
"current_file",
"has_unsaved_changes",
"file_extensions",
Expand All @@ -52,3 +52,7 @@
"maintained_selection"

]

# Backwards API compatibility
open = open_file
save = save_file
10 changes: 5 additions & 5 deletions avalon/fusion/workio.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ def has_unsaved_changes():
return comp.GetAttrs()["COMPB_Modified"]


def save(filepath):
def save_file(filepath):
from avalon.fusion.pipeline import get_current_comp

comp = get_current_comp()
comp.Save(filepath)


def open(filepath):
def open_file(filepath):
# Hack to get fusion, see avalon.fusion.pipeline.get_current_comp()
fusion = getattr(sys.modules["__main__"], "fusion", None)

Expand All @@ -40,10 +40,10 @@ def current_file():


def work_root():
from avalon import api
from avalon import Session

work_dir = api.Session["AVALON_WORKDIR"]
scene_dir = api.Session.get("AVALON_SCENEDIR")
work_dir = Session["AVALON_WORKDIR"]
scene_dir = Session.get("AVALON_SCENEDIR")
if scene_dir:
return os.path.join(work_dir, scene_dir)
else:
Expand Down
12 changes: 8 additions & 4 deletions avalon/houdini/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
)

from .workio import (
open,
save,
open_file,
save_file,
current_file,
has_unsaved_changes,
file_extensions,
Expand All @@ -38,8 +38,8 @@
"containerise",

# Workfiles API
"open",
"save",
"open_file",
"save_file",
"current_file",
"has_unsaved_changes",
"file_extensions",
Expand All @@ -53,3 +53,7 @@
"maintained_selection",
"unique_name"
]

# Backwards API compatibility
open = open_file
save = save_file
16 changes: 7 additions & 9 deletions avalon/houdini/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,17 @@ def reload_pipeline(*args):

"avalon.houdini.pipeline",
"avalon.houdini.lib",
"avalon.tools.loader.app",
"avalon.tools.creator.app",
"avalon.tools.manager.app",

# NOTE(marcus): These have circular depenendencies
# that is preventing reloadability
# "avalon.tools.cbloader.delegates",
# "avalon.tools.cbloader.model",
# "avalon.tools.cbloader.widgets",
# "avalon.tools.cbloader.app",
# "avalon.tools.cbsceneinventory.model",
# "avalon.tools.cbsceneinventory.proxy",
# "avalon.tools.cbsceneinventory.app",
# "avalon.tools.loader.delegates",
# "avalon.tools.loader.model",
# "avalon.tools.loader.widgets",
# "avalon.tools.loader.app",
# "avalon.tools.sceneinventory.model",
# "avalon.tools.sceneinventory.proxy",
# "avalon.tools.sceneinventory.app",
# "avalon.tools.projectmanager.dialogs",
# "avalon.tools.projectmanager.lib",
# "avalon.tools.projectmanager.model",
Expand Down
10 changes: 5 additions & 5 deletions avalon/houdini/workio.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def has_unsaved_changes():
return hou.hipFile.hasUnsavedChanges()


def save(filepath):
def save_file(filepath):

# Force forwards slashes to avoid segfault
filepath = filepath.replace("\\", "/")
Expand All @@ -23,7 +23,7 @@ def save(filepath):
return filepath


def open(filepath):
def open_file(filepath):

# Force forwards slashes to avoid segfault
filepath = filepath.replace("\\", "/")
Expand All @@ -49,10 +49,10 @@ def current_file():


def work_root():
from avalon import api
from avalon import Session

work_dir = api.Session["AVALON_WORKDIR"]
scene_dir = api.Session.get("AVALON_SCENEDIR")
work_dir = Session["AVALON_WORKDIR"]
scene_dir = Session.get("AVALON_SCENEDIR")
if scene_dir:
return os.path.join(work_dir, scene_dir)
else:
Expand Down
21 changes: 14 additions & 7 deletions avalon/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ def _save_inventory_1_0(project_name, data):
print("Separating project metadata: %s" % key)
metadata[key] = data.pop(key)

document = io.find_one({"type": "project"})
_filter = {"type": "project"}

document = io.find_one(_filter)
if document is None:
print("'%s' not found, creating.." % project_name)
_id = create_project(project_name)
Expand All @@ -269,18 +271,21 @@ def _save_inventory_1_0(project_name, data):
for key, value in metadata.items():
document["data"][key] = value

io.save(document)
io.replace_one(_filter, document)

print("Updating assets..")
added = list()
updated = list()
missing = list()
for silo, assets in data.items():
for asset in assets:
asset_doc = io.find_one({

_filter = {
"name": asset["name"],
"type": "asset",
})
}

asset_doc = io.find_one(_filter)

if asset_doc is None:
asset["silo"] = silo
Expand All @@ -299,7 +304,7 @@ def _save_inventory_1_0(project_name, data):
asset_doc["data"][key],
value))

io.save(asset_doc)
io.replace_one(_filter, asset_doc)

for data in missing:
print("+ added %s" % data["name"])
Expand All @@ -318,7 +323,9 @@ def _save_inventory_1_0(project_name, data):


def _save_config_1_0(project_name, data):
document = io.find_one({"type": "project"})
_filter = {"type": "project"}

document = io.find_one(_filter)

config = document["config"]

Expand All @@ -330,7 +337,7 @@ def _save_config_1_0(project_name, data):

schema.validate(document)

io.save(document)
io.replace_one(_filter, document)


def _report(added, updated):
Expand Down
3 changes: 2 additions & 1 deletion avalon/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def _from_environment():
) if os.getenv(item[0], item[1]) is not None
}

session["schema"] = "avalon-core:session-1.0"
session["schema"] = "avalon-core:session-2.0"
try:
schema.validate(session)
except schema.ValidationError as e:
Expand Down Expand Up @@ -366,6 +366,7 @@ def find_one(filter, projection=None, sort=None):

@auto_reconnect
def save(*args, **kwargs):
"""Deprecated, please use `replace_one`"""
return self._database[Session["AVALON_PROJECT"]].save(
*args, **kwargs)

Expand Down
12 changes: 8 additions & 4 deletions avalon/maya/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
)

from .workio import (
open,
save,
open_file,
save_file,
current_file,
has_unsaved_changes,
file_extensions,
Expand Down Expand Up @@ -71,8 +71,8 @@
"lock_ignored",

# Workfiles API
"open",
"save",
"open_file",
"save_file",
"current_file",
"has_unsaved_changes",
"file_extensions",
Expand All @@ -93,3 +93,7 @@
"suspended_refresh",

]

# Backwards API compatibility
open = open_file
save = save_file
24 changes: 20 additions & 4 deletions avalon/maya/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@ def reset_frame_range():
shot = io.find_one({"name": shot, "type": "asset"})

try:
frame_start = shot["data"]["frameStart"]
frame_end = shot["data"]["frameEnd"]

frame_start = shot["data"].get(
"frameStart",
# backwards compatibility
shot["data"].get("edit_in")
)
frame_end = shot["data"].get(
"frameEnd",
# backwards compatibility
shot["data"].get("edit_out")
)
except KeyError:
cmds.warning("No edit information found for %s" % shot["name"])
return
Expand Down Expand Up @@ -52,8 +60,16 @@ def reset_resolution():
project = io.find_one({"type": "project"})

try:
resolution_width = project["data"].get("resolutionWidth", 1920)
resolution_height = project["data"].get("resolutionHeight", 1080)
resolution_width = project["data"].get(
"resolutionWidth",
# backwards compatibility
project["data"].get("resolution_width", 1920)
)
resolution_height = project["data"].get(
"resolutionHeight",
# backwards compatibility
project["data"].get("resolution_height", 1080)
)
except KeyError:
cmds.warning("No resolution information found for %s"
% project["name"])
Expand Down
4 changes: 2 additions & 2 deletions avalon/maya/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def remove_googleapiclient():
"""Check if the compatibility must be maintained
The Maya 2018 version tries to import the `http` module from
Maya2018\plug-ins\MASH\scripts\googleapiclient\http.py in stead of the
Maya2018/plug-ins/MASH/scripts/googleapiclient/http.py in stead of the
module from six.py. This import conflict causes a crash Avalon's publisher.
This is due to Autodesk adding paths to the PYTHONPATH environment variable
which contain modules instead of only packages.
Expand Down Expand Up @@ -92,7 +92,7 @@ def load(Loader,
suffix="_",
)

# TODO(roy): add compatibility check, see `tools.cbloader.lib`
# TODO(roy): add compatibility check, see `tools.loader.lib`

Loader.log.info(
"Running '%s' on '%s'" % (Loader.__name__, asset["name"])
Expand Down
Loading

0 comments on commit 48c3a01

Please sign in to comment.