aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generat3d/dbz.py2
-rw-r--r--tests/test_dbz.py11
2 files changed, 13 insertions, 0 deletions
diff --git a/generat3d/dbz.py b/generat3d/dbz.py
index 2a56230..e5b1aea 100644
--- a/generat3d/dbz.py
+++ b/generat3d/dbz.py
@@ -54,6 +54,8 @@ def build(scene, roots):
root, bones = fig.nodes[0], fig.nodes[1:]
entry = _node(root, rest[root.id])
entry.update({
+ "name": fig.name,
+ "label": fig.label,
"class": "DzFigure",
"material groups": fig.material_groups,
"num verts": len(verts),
diff --git a/tests/test_dbz.py b/tests/test_dbz.py
index 35c7699..2e5ffe8 100644
--- a/tests/test_dbz.py
+++ b/tests/test_dbz.py
@@ -83,3 +83,14 @@ class DbzTest(unittest.TestCase):
with tempfile.TemporaryDirectory() as d:
with self.assertRaisesRegex(Error, "cannot write"):
write(self.doc, Path(d) / "missing" / "s.dbz")
+
+ def test_instance_name_and_label_on_entry(self):
+ with tempfile.TemporaryDirectory() as d:
+ duf = Path(d) / "s.duf"
+ duf.write_text(json.dumps({"scene": {"nodes": [
+ {"id": "Fig", "url": "/data/Test/Fig/Fig.dsf#Fig",
+ "name": "Alice", "label": "Alice Label"}]}}))
+ with contextlib.redirect_stderr(io.StringIO()):
+ doc = build(load(duf, Library([DATA / "lib"])), [DATA / "lib"])
+ fig = doc["figures"][0]
+ self.assertEqual((fig["name"], fig["label"], fig["id"]), ("Alice", "Alice Label", "Fig"))