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
9 changes: 9 additions & 0 deletions corrupted/15_no_attachments.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
embedded_components {
id: "corruption_case"
type: "spinemodel"
data: "spine_scene: \"/corrupted/_assets/cases/15_no_attachments/case.spinescene\"\n"
"default_animation: \"idle\"\n"
"skin: \"\"\n"
"material: \"/corrupted/_assets/shared/spine.material\"\n"
""
}
1 change: 1 addition & 0 deletions corrupted/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ atlas and exercises the intended attachment-loader failure.
| `12_missing_deform_attachment.go` | Animation deform timeline references an absent attachment. | SkeletonBinary.c: attachment timeline lookup | Fatal 'Animation corrupted' resource error. |
| `13_unknown_attachment_type.go` | Skin attachment has the unused type value 7. | SkeletonBinary.c: attachment switch default / readSkin NULL | Must not crash. Current runtime silently drops it and opens empty. |
| `14_non_finite_transform.go` | Valid structure contains NaN as the root bone X position. | Operation path after a successful binary load | Must not crash while creating, updating, or previewing the skeleton. |
| `15_no_attachments.go` | Valid binary with a slot but no attachments. | Editor render path with empty vertex and index buffers | Opens with an empty preview and updates without an error. |

## Known limits

Expand Down
Binary file added corrupted/_assets/cases/15_no_attachments/case.skel
Binary file not shown.
2 changes: 2 additions & 0 deletions corrupted/_assets/cases/15_no_attachments/case.spinescene
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
spine_json: "/corrupted/_assets/cases/15_no_attachments/case.skel"
atlas: "/corrupted/_assets/shared/test.atlas"
19 changes: 17 additions & 2 deletions corrupted/_assets/tools/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,13 @@ def build_unknown_attachment_type() -> bytes:
return writer.finish()


def build_no_attachments() -> bytes:
writer = BinaryWriter()
write_skeleton_prefix(writer, [], None)
write_default_skin(writer, [], [])
return finish_skeleton(writer, animations=[("idle", write_empty_animation)])


CASES = [
Case(
"00_valid_control",
Expand Down Expand Up @@ -556,6 +563,14 @@ def build_unknown_attachment_type() -> bytes:
"idle",
lambda: build_valid_control(bone_x=math.nan),
),
Case(
"15_no_attachments",
"Valid binary with a slot but no attachments.",
"Opens with an empty preview and updates without an error.",
"Editor render path with empty vertex and index buffers",
"idle",
build_no_attachments,
),
]


Expand Down Expand Up @@ -712,7 +727,7 @@ def generated_files() -> dict[Path, bytes]:
SHARED_ROOT / "spine.material": MATERIAL.encode(),
SHARED_ROOT / "spine.vp": VERTEX_SHADER.encode(),
SHARED_ROOT / "spine.fp": FRAGMENT_SHADER.encode(),
ASSETS_ROOT / "README.md": make_readme().encode(),
CORRUPTED_ROOT / "README.md": make_readme().encode(),
}

for case in CASES:
Expand Down Expand Up @@ -749,7 +764,7 @@ def check(files: dict[Path, bytes]) -> int:
elif path.read_bytes() != expected:
errors.append(f"out of date: {path.relative_to(CORRUPTED_ROOT)}")

expected_root_files = {f"{case.key}.go" for case in CASES}
expected_root_files = {"README.md"} | {f"{case.key}.go" for case in CASES}
actual_root_files = {path.name for path in CORRUPTED_ROOT.iterdir() if path.is_file()}
for unexpected in sorted(actual_root_files - expected_root_files):
errors.append(f"unexpected root file: {unexpected}")
Expand Down
28 changes: 14 additions & 14 deletions defold-spine/editor/src/spineext.clj
Original file line number Diff line number Diff line change
Expand Up @@ -333,20 +333,20 @@


(defn- render-group-transparent [^GL2 gl render-args override-shader group]
(let [renderable (:renderable group)
user-data (:user-data renderable)
gpu-texture (or (get user-data :gpu-texture) texture/white-pixel)
shader (or override-shader (:shader user-data))
vb (:vertex-buffer group)
ib (:index-buffer group)
draw-descs (:draw-descs group)
vertex-binding (vtx2/use-with ::spine-trans vb shader)
bindings (cond-> [shader gpu-texture vertex-binding]
ib (conj ib))]
(gl/with-gl-bindings gl render-args bindings
(run! (fn [draw-desc]
(do-draw-desc! gl render-args shader renderable draw-desc))
draw-descs))))
(when-let [vb (:vertex-buffer group)]
(let [renderable (:renderable group)
user-data (:user-data renderable)
gpu-texture (or (get user-data :gpu-texture) texture/white-pixel)
shader (or override-shader (:shader user-data))
ib (:index-buffer group)
draw-descs (:draw-descs group)
vertex-binding (vtx2/use-with ::spine-trans vb shader)
bindings (cond-> [shader gpu-texture vertex-binding]
ib (conj ib))]
(gl/with-gl-bindings gl render-args bindings
(run! (fn [draw-desc]
(do-draw-desc! gl render-args shader renderable draw-desc))
draw-descs)))))

;; When debugging render using REPL, don't forget to run (dev/clear-caches!)
;; Also, it's possible to switch render modes in the Debug Editor using Cmd+T
Expand Down
Loading