Shape Resources

Shape Cache

A nonempty cache key explicitly names a resource. It is not a geometry hash. Reusing a key reacquires its existing geometry even if the new constructor dimensions differ. Assign unique keys to different geometry versions.

APIContract
cache_keyASCII, at most 255 bytes. Primitive constructors are uncached by default; loading uses the path by default.
jolt_shape_cache_count()Entry count, or -1 on failure.
jolt_shape_cache_clear()Boolean result; releases cache-owned references, not live body or wrapper references.
GML
var a = jolt_shape_box(1, 1, 1, "crate-v1");
var b = jolt_shape_box(1, 1, 1, "crate-v1");
show_debug_message(jolt_shape_cache_count());
if (!is_undefined(a)) a.destroy();
if (!is_undefined(b)) b.destroy();
if (!jolt_shape_cache_clear()) show_debug_message(jolt_get_error_message());

Verified operation contracts#

These contracts distinguish units, return values, errors and lifetime according to the current implementation. Check results: false, 0 and undefined can mean different things for different methods.

Symbol / ownerSignatureOperation contract
jolt_shape_cache_clearjolt_shape_cache_clear()Clear Boolean releases cache references, does not destroy existing bodies using the shape. Count returns cache-entry count or -1 on error.
jolt_shape_cache_countjolt_shape_cache_count()Clear Boolean releases cache references, does not destroy existing bodies using the shape. Count returns cache-entry count or -1 on error.