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

Commit 48c3a01

Browse files
authored
Merge pull request #81 from pypeclub/develop
Develop
2 parents bc1e9f8 + 223ea37 commit 48c3a01

File tree

122 files changed

+5836
-6275
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+5836
-6275
lines changed

avalon/__main__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def main():
1313
help="Launch Instance Creator in standalone mode")
1414
parser.add_argument("--loader", action="store_true",
1515
help="Launch Asset Loader in standalone mode")
16-
parser.add_argument("--manager", action="store_true",
17-
help="Launch Manager in standalone mode")
16+
parser.add_argument("--sceneinventory", action="store_true",
17+
help="Launch Scene Inventory in standalone mode")
1818
parser.add_argument("--projectmanager", action="store_true",
1919
help="Launch Manager in standalone mode")
2020

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

37-
elif args.manager:
38-
from .tools import manager
39-
manager.show(debug=True)
37+
elif args.sceneinventory:
38+
from .tools import sceneinventory
39+
sceneinventory.show(debug=True)
4040

4141
elif args.projectmanager:
4242
from .tools import projectmanager

avalon/fusion/__init__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
)
1919

2020
from .workio import (
21-
open,
22-
save,
21+
open_file,
22+
save_file,
2323
current_file,
2424
has_unsaved_changes,
2525
file_extensions,
@@ -42,8 +42,8 @@
4242
"comp_lock_and_undo_chunk",
4343

4444
# Workfiles API
45-
"open",
46-
"save",
45+
"open_file",
46+
"save_file",
4747
"current_file",
4848
"has_unsaved_changes",
4949
"file_extensions",
@@ -52,3 +52,7 @@
5252
"maintained_selection"
5353

5454
]
55+
56+
# Backwards API compatibility
57+
open = open_file
58+
save = save_file

avalon/fusion/workio.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ def has_unsaved_changes():
1414
return comp.GetAttrs()["COMPB_Modified"]
1515

1616

17-
def save(filepath):
17+
def save_file(filepath):
1818
from avalon.fusion.pipeline import get_current_comp
1919

2020
comp = get_current_comp()
2121
comp.Save(filepath)
2222

2323

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

@@ -40,10 +40,10 @@ def current_file():
4040

4141

4242
def work_root():
43-
from avalon import api
43+
from avalon import Session
4444

45-
work_dir = api.Session["AVALON_WORKDIR"]
46-
scene_dir = api.Session.get("AVALON_SCENEDIR")
45+
work_dir = Session["AVALON_WORKDIR"]
46+
scene_dir = Session.get("AVALON_SCENEDIR")
4747
if scene_dir:
4848
return os.path.join(work_dir, scene_dir)
4949
else:

avalon/houdini/__init__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
)
1111

1212
from .workio import (
13-
open,
14-
save,
13+
open_file,
14+
save_file,
1515
current_file,
1616
has_unsaved_changes,
1717
file_extensions,
@@ -38,8 +38,8 @@
3838
"containerise",
3939

4040
# Workfiles API
41-
"open",
42-
"save",
41+
"open_file",
42+
"save_file",
4343
"current_file",
4444
"has_unsaved_changes",
4545
"file_extensions",
@@ -53,3 +53,7 @@
5353
"maintained_selection",
5454
"unique_name"
5555
]
56+
57+
# Backwards API compatibility
58+
open = open_file
59+
save = save_file

avalon/houdini/pipeline.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,17 @@ def reload_pipeline(*args):
9292

9393
"avalon.houdini.pipeline",
9494
"avalon.houdini.lib",
95-
"avalon.tools.loader.app",
9695
"avalon.tools.creator.app",
97-
"avalon.tools.manager.app",
9896

9997
# NOTE(marcus): These have circular depenendencies
10098
# that is preventing reloadability
101-
# "avalon.tools.cbloader.delegates",
102-
# "avalon.tools.cbloader.model",
103-
# "avalon.tools.cbloader.widgets",
104-
# "avalon.tools.cbloader.app",
105-
# "avalon.tools.cbsceneinventory.model",
106-
# "avalon.tools.cbsceneinventory.proxy",
107-
# "avalon.tools.cbsceneinventory.app",
99+
# "avalon.tools.loader.delegates",
100+
# "avalon.tools.loader.model",
101+
# "avalon.tools.loader.widgets",
102+
# "avalon.tools.loader.app",
103+
# "avalon.tools.sceneinventory.model",
104+
# "avalon.tools.sceneinventory.proxy",
105+
# "avalon.tools.sceneinventory.app",
108106
# "avalon.tools.projectmanager.dialogs",
109107
# "avalon.tools.projectmanager.lib",
110108
# "avalon.tools.projectmanager.model",

avalon/houdini/workio.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def has_unsaved_changes():
1212
return hou.hipFile.hasUnsavedChanges()
1313

1414

15-
def save(filepath):
15+
def save_file(filepath):
1616

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

2525

26-
def open(filepath):
26+
def open_file(filepath):
2727

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

5050

5151
def work_root():
52-
from avalon import api
52+
from avalon import Session
5353

54-
work_dir = api.Session["AVALON_WORKDIR"]
55-
scene_dir = api.Session.get("AVALON_SCENEDIR")
54+
work_dir = Session["AVALON_WORKDIR"]
55+
scene_dir = Session.get("AVALON_SCENEDIR")
5656
if scene_dir:
5757
return os.path.join(work_dir, scene_dir)
5858
else:

avalon/inventory.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ def _save_inventory_1_0(project_name, data):
258258
print("Separating project metadata: %s" % key)
259259
metadata[key] = data.pop(key)
260260

261-
document = io.find_one({"type": "project"})
261+
_filter = {"type": "project"}
262+
263+
document = io.find_one(_filter)
262264
if document is None:
263265
print("'%s' not found, creating.." % project_name)
264266
_id = create_project(project_name)
@@ -269,18 +271,21 @@ def _save_inventory_1_0(project_name, data):
269271
for key, value in metadata.items():
270272
document["data"][key] = value
271273

272-
io.save(document)
274+
io.replace_one(_filter, document)
273275

274276
print("Updating assets..")
275277
added = list()
276278
updated = list()
277279
missing = list()
278280
for silo, assets in data.items():
279281
for asset in assets:
280-
asset_doc = io.find_one({
282+
283+
_filter = {
281284
"name": asset["name"],
282285
"type": "asset",
283-
})
286+
}
287+
288+
asset_doc = io.find_one(_filter)
284289

285290
if asset_doc is None:
286291
asset["silo"] = silo
@@ -299,7 +304,7 @@ def _save_inventory_1_0(project_name, data):
299304
asset_doc["data"][key],
300305
value))
301306

302-
io.save(asset_doc)
307+
io.replace_one(_filter, asset_doc)
303308

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

319324

320325
def _save_config_1_0(project_name, data):
321-
document = io.find_one({"type": "project"})
326+
_filter = {"type": "project"}
327+
328+
document = io.find_one(_filter)
322329

323330
config = document["config"]
324331

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

331338
schema.validate(document)
332339

333-
io.save(document)
340+
io.replace_one(_filter, document)
334341

335342

336343
def _report(added, updated):

avalon/io.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def _from_environment():
191191
) if os.getenv(item[0], item[1]) is not None
192192
}
193193

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

367367
@auto_reconnect
368368
def save(*args, **kwargs):
369+
"""Deprecated, please use `replace_one`"""
369370
return self._database[Session["AVALON_PROJECT"]].save(
370371
*args, **kwargs)
371372

avalon/maya/__init__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
)
2828

2929
from .workio import (
30-
open,
31-
save,
30+
open_file,
31+
save_file,
3232
current_file,
3333
has_unsaved_changes,
3434
file_extensions,
@@ -71,8 +71,8 @@
7171
"lock_ignored",
7272

7373
# Workfiles API
74-
"open",
75-
"save",
74+
"open_file",
75+
"save_file",
7676
"current_file",
7777
"has_unsaved_changes",
7878
"file_extensions",
@@ -93,3 +93,7 @@
9393
"suspended_refresh",
9494

9595
]
96+
97+
# Backwards API compatibility
98+
open = open_file
99+
save = save_file

avalon/maya/commands.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@ def reset_frame_range():
1818
shot = io.find_one({"name": shot, "type": "asset"})
1919

2020
try:
21-
frame_start = shot["data"]["frameStart"]
22-
frame_end = shot["data"]["frameEnd"]
2321

22+
frame_start = shot["data"].get(
23+
"frameStart",
24+
# backwards compatibility
25+
shot["data"].get("edit_in")
26+
)
27+
frame_end = shot["data"].get(
28+
"frameEnd",
29+
# backwards compatibility
30+
shot["data"].get("edit_out")
31+
)
2432
except KeyError:
2533
cmds.warning("No edit information found for %s" % shot["name"])
2634
return
@@ -52,8 +60,16 @@ def reset_resolution():
5260
project = io.find_one({"type": "project"})
5361

5462
try:
55-
resolution_width = project["data"].get("resolutionWidth", 1920)
56-
resolution_height = project["data"].get("resolutionHeight", 1080)
63+
resolution_width = project["data"].get(
64+
"resolutionWidth",
65+
# backwards compatibility
66+
project["data"].get("resolution_width", 1920)
67+
)
68+
resolution_height = project["data"].get(
69+
"resolutionHeight",
70+
# backwards compatibility
71+
project["data"].get("resolution_height", 1080)
72+
)
5773
except KeyError:
5874
cmds.warning("No resolution information found for %s"
5975
% project["name"])

0 commit comments

Comments
 (0)