Scene Manager: request publishes missing on this site
- Request (globe) on casting rows and loaded assets whose latest publish is not on this site, and Request Missing for all of them, through the new wtdcmds command wtd_request_revisions. Requested publishes show "requested, waiting for the download". - The version picker requests a version that is not on this site. - A 404 explains that the session is gone or wtdcmds is too old. - Fake server: car (vehicles) with a publish not on this site, wtd_request_revisions and /_test/download; 45 checks. - Tested live: car_paul modeling.blend v001 -> Requested. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9ee7710479
commit
9fe38ce58a
8 files changed
+197
-19
No files matched your search
+29
-3
@@ -3,11 +3,12 @@
|
||||
python dev/fake_libreflow.py <workdir>
|
||||
|
||||
Serves a project with one shot casting bob (main_character, x2), tree (bg_set), rock (main_props),
|
||||
lamp (main_props, nothing published) and ghost (not in the flow). The asset files come
|
||||
lamp (main_props, nothing published), car (vehicles, v001 not on this site) and ghost (not in the flow). The asset files come
|
||||
from dev/make_test_assets.py (<workdir>/lib). Writes <workdir>/kabaret/server.json:
|
||||
point config LIBREFLOW_SERVER_FILE to it (see dev/test_scene_manager.py).
|
||||
|
||||
Test-only endpoints: POST /_test/publish {file_oid, name, available, path},
|
||||
POST /_test/download {revision_oid} (a requested revision reaches this site),
|
||||
POST /_test/sessions {uid: session}, POST /_test/calls (commands received).
|
||||
State lives in memory: restart the server for a clean state.
|
||||
"""
|
||||
@@ -33,10 +34,22 @@ ASSETS = { # asset oid -> (type, {file_oid: (label, [revisions oldest first])})
|
||||
f"{PROJECT}/asset_types/main_props/assets/rock": ("main_props", {f"{PROJECT}/asset_types/main_props/assets/rock/tasks/modeling/files/rock_blend": ("modeling/rock.blend", [
|
||||
rev("v001", f"{ROOT}/lib/rock/v001/rock.blend")])}),
|
||||
f"{PROJECT}/asset_types/main_props/assets/lamp": ("main_props", {}),
|
||||
f"{PROJECT}/asset_types/vehicles/assets/car": ("vehicles", {f"{PROJECT}/asset_types/vehicles/assets/car/tasks/rigging/files/car_blend": ("rigging/car.blend", [
|
||||
rev("v001", f"{ROOT}/lib/car/v001/car.blend", available=False)])}),
|
||||
}
|
||||
CASTING = [("bob", "main_character", 2), ("tree", "bg_set", 1), ("rock", "main_props", 1), ("lamp", "main_props", 1), ("ghost", "main_character", 1)]
|
||||
CASTING = [("bob", "main_character", 2), ("tree", "bg_set", 1), ("rock", "main_props", 1), ("lamp", "main_props", 1), ("car", "vehicles", 1), ("ghost", "main_character", 1)]
|
||||
CALLS = []
|
||||
|
||||
def set_oids():
|
||||
for _a, (_t, files) in ASSETS.items():
|
||||
for f, (_l, revs) in files.items():
|
||||
for r in revs: r["oid"] = f"{f}/history/revisions/{r['name']}"
|
||||
|
||||
def find_rev(oid):
|
||||
return next((r for _a, (_t, files) in ASSETS.items() for _l, revs in files.values() for r in revs if r["oid"] == oid), None)
|
||||
|
||||
set_oids()
|
||||
|
||||
def file_data(file_oid):
|
||||
for asset_oid, (atype, files) in ASSETS.items():
|
||||
if file_oid in files:
|
||||
@@ -98,6 +111,15 @@ def cmd(name, kw):
|
||||
if kw["file_oid"] in files:
|
||||
return list(reversed(files[kw["file_oid"]][1]))
|
||||
raise ValueError("No file")
|
||||
if name == "wtd_request_revisions":
|
||||
res = {}
|
||||
for oid in kw["revision_oids"]:
|
||||
r = find_rev(oid)
|
||||
if r is None:
|
||||
res[oid] = {"oid": oid, "error": f"Could not find {oid}"}; continue
|
||||
if not r["available"]: r["sync_status"] = "Requested"
|
||||
res[oid] = r
|
||||
return res
|
||||
if name == "wtd_assetize":
|
||||
src = kw["source_path"]
|
||||
if not os.path.isfile(src): raise ValueError(f"Source file {src} does not exist")
|
||||
@@ -115,7 +137,7 @@ def cmd(name, kw):
|
||||
label, revs = files.setdefault(file_oid, (f"{task}/{fname}.blend", []))
|
||||
name = f"v{len(revs) + 1:03d}"
|
||||
dest = f"{ROOT}/lib/{aname}/{name}/{fname}.blend"; os.makedirs(os.path.dirname(dest), exist_ok=True); shutil.copy(src, dest)
|
||||
revs.append(rev(name, dest, comment=kw.get("comment", "")))
|
||||
revs.append(rev(name, dest, comment=kw.get("comment", ""))); set_oids()
|
||||
return {"asset_oid": asset_oid, "asset_created": created, **file_data(file_oid)}
|
||||
raise KeyError(name)
|
||||
|
||||
@@ -139,6 +161,10 @@ class Handler(BaseHTTPRequestHandler):
|
||||
f = body["file_oid"]
|
||||
for _a, (_t, files) in ASSETS.items():
|
||||
if f in files: files[f][1].append(rev(body["name"], body.get("path", "/nowhere/" + body["name"]), body.get("available", True)))
|
||||
set_oids()
|
||||
return self.reply(200, {"result": True})
|
||||
if url.path == "/_test/download":
|
||||
r = find_rev(body["revision_oid"]); r["available"] = True; r["sync_status"] = "Available"
|
||||
return self.reply(200, {"result": True})
|
||||
if url.path == "/_test/sessions":
|
||||
SESSIONS.clear(); SESSIONS.update(body); return self.reply(200, {"result": True})
|
||||
|
||||
Reference in new issue
Block a user