Skip to content
Open
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
31 changes: 30 additions & 1 deletion engine/dist/emptyproject.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<!-- The Wick Engine build is injected here during the engine build step (see gulpfile.js) -->
<script>
/*Wick Engine https://github.com/Wicklets/wick-engine*/
var WICK_ENGINE_BUILD_VERSION = "2025.10.26.20.55.41";
var WICK_ENGINE_BUILD_VERSION = "2026.1.10.14.29.18";
/*!
* Paper.js v0.12.4 - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
Expand Down Expand Up @@ -46545,6 +46545,11 @@
* @param {Wick.Base} object - the object to remove from the cache
*/
removeObject(object) {
// let info = "";
// info += "classname " + object.classname;
// info += "\n uuid " + object.uuid.substring(0, 4);
// console.log(info);

if (object.classname === 'Project') {
object.destroy();
return; // TODO, remove this.
Expand Down Expand Up @@ -46611,11 +46616,14 @@
let uuidSet = new Set(uuids);
let historyIDs = project.history.getObjectUUIDs();
uuidSet = new Set([...historyIDs, ...uuidSet]);
let info = "removeUnusedObjects()";
this.getAllObjects().forEach(object => {
if (!uuidSet.has(object.uuid)) {
info += "\n" + object.classname.padEnd(10, " ") + object.uuid;
this.removeObject(object);
}
});
console.log(info);
}

/**
Expand Down Expand Up @@ -46672,6 +46680,27 @@
getObjectsNeedAutosaved() {
return Object.keys(this._objectsNeedAutosave).map(uuid => this.getObjectByUUID(uuid));
}
static _getObjectsDebug() {
let out = [];
let print = "";
for (let elem of Wick.ObjectCache.getAllObjects()) {
let line = elem.classname.padEnd(10, " ") + elem.uuid;
if (elem._name) line += ": name = " + elem._name;else if (elem._identifier) line += ": id = " + elem._identifier;
//else if(elem._parent._identifier) line += (": parent = " + elem._parent._identifier);

out.push(line);
}
for (let line of out.sort()) {
print += "" + line + "\n";
}
console.log(print);
}
static _getObjectsInfoDebug() {
for (let elem of Wick.ObjectCache.getAllObjects()) {
console.log("\n\n" + elem.classname + " " + elem.uuid);
console.log(Wick.ObjectCache.getObjectByUUID(elem.uuid));
}
}
};
Wick.ObjectCache = new WickObjectCache();
/*
Expand Down
31 changes: 30 additions & 1 deletion engine/dist/wickengine.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*Wick Engine https://github.com/Wicklets/wick-engine*/
var WICK_ENGINE_BUILD_VERSION = "2025.10.26.20.55.41";
var WICK_ENGINE_BUILD_VERSION = "2026.1.10.14.29.18";
/*!
* Paper.js v0.12.4 - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
Expand Down Expand Up @@ -46530,6 +46530,11 @@ WickObjectCache = class {
* @param {Wick.Base} object - the object to remove from the cache
*/
removeObject(object) {
// let info = "";
// info += "classname " + object.classname;
// info += "\n uuid " + object.uuid.substring(0, 4);
// console.log(info);

if (object.classname === 'Project') {
object.destroy();
return; // TODO, remove this.
Expand Down Expand Up @@ -46596,11 +46601,14 @@ WickObjectCache = class {
let uuidSet = new Set(uuids);
let historyIDs = project.history.getObjectUUIDs();
uuidSet = new Set([...historyIDs, ...uuidSet]);
let info = "removeUnusedObjects()";
this.getAllObjects().forEach(object => {
if (!uuidSet.has(object.uuid)) {
info += "\n" + object.classname.padEnd(10, " ") + object.uuid;
this.removeObject(object);
}
});
console.log(info);
}

/**
Expand Down Expand Up @@ -46657,6 +46665,27 @@ WickObjectCache = class {
getObjectsNeedAutosaved() {
return Object.keys(this._objectsNeedAutosave).map(uuid => this.getObjectByUUID(uuid));
}
static _getObjectsDebug() {
let out = [];
let print = "";
for (let elem of Wick.ObjectCache.getAllObjects()) {
let line = elem.classname.padEnd(10, " ") + elem.uuid;
if (elem._name) line += ": name = " + elem._name;else if (elem._identifier) line += ": id = " + elem._identifier;
//else if(elem._parent._identifier) line += (": parent = " + elem._parent._identifier);

out.push(line);
}
for (let line of out.sort()) {
print += "" + line + "\n";
}
console.log(print);
}
static _getObjectsInfoDebug() {
for (let elem of Wick.ObjectCache.getAllObjects()) {
console.log("\n\n" + elem.classname + " " + elem.uuid);
console.log(Wick.ObjectCache.getObjectByUUID(elem.uuid));
}
}
};
Wick.ObjectCache = new WickObjectCache();
/*
Expand Down
51 changes: 46 additions & 5 deletions engine/src/ObjectCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,20 @@ WickObjectCache = class {

uuidSet = new Set([...historyIDs, ...uuidSet]);

this.getAllObjects().forEach(object => {
if(!uuidSet.has(object.uuid)) {
this.removeObject(object);
}
});
// // check what objects were removed during cache clear, like when the project is paused - Baron
// let info = "removeUnusedObjects()"
// this.getAllObjects().forEach(object => {
// if(!uuidSet.has(object.uuid)) {
// info += "\n" + object.classname.padEnd(10, " ") + object.uuid;

// // Check if the object has a parent in the object cache - StickmanRed
// let topLevelClip = object.topLevelClip;
// if (!topLevelClip || !uuidSet.has(topLevelClip.uuid)) {
// this.removeObject(object);
// }
// }
// });
// console.log(info);
}

/**
Expand Down Expand Up @@ -183,6 +192,38 @@ WickObjectCache = class {
getObjectsNeedAutosaved () {
return Object.keys(this._objectsNeedAutosave).map(uuid => this.getObjectByUUID(uuid));
}

/**
* DEBUG: Log basic information about every object in the cache: type, uuid, and id/name if applicable
*/
static _getObjectsDebug() {
let out = [];
let print = "";
for(let elem of Wick.ObjectCache.getAllObjects()) {
let line = elem.classname.padEnd(10, " ") + elem.uuid;

if(elem._name) line += (": name = " + elem._name);
else if(elem._identifier) line += (": id = " + elem._identifier);
//else if(elem._parent._identifier) line += (": parent = " + elem._parent._identifier);

out.push(line);
}
for(let line of out.sort()) {
print += "" + line + "\n";
}
print += "Total: " + Wick.ObjectCache.getAllObjects().length;
console.log(print);
}

/**
* DEBUG: Shortcut to call getObjectByUUID() on all objects in the cache
*/
static _getObjectsDebugDetailed() {
for(let elem of Wick.ObjectCache.getAllObjects()) {
console.log("\n\n" + elem.classname + " " + elem.uuid);
console.log(Wick.ObjectCache.getObjectByUUID(elem.uuid));
}
}
}

Wick.ObjectCache = new WickObjectCache();
19 changes: 19 additions & 0 deletions engine/src/base/Base.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,25 @@ Wick.Base = class {
return this._getParentByClassName('Clip');
}

/**
* The top-level clip of this object.
* @type {Wick.Clip}
*/
get topLevelClip () {
let topLevelClip = this.parentClip;

while (
topLevelClip
&& topLevelClip.parentClip
&& !topLevelClip.parentClip.isRoot
) {
topLevelClip = topLevelClip.parentClip;
}

return topLevelClip;
}


/**
* The parent Layer of this object.
* @type {Wick.Layer}
Expand Down
31 changes: 30 additions & 1 deletion public/corelibs/wick-engine/emptyproject.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<!-- The Wick Engine build is injected here during the engine build step (see gulpfile.js) -->
<script>
/*Wick Engine https://github.com/Wicklets/wick-engine*/
var WICK_ENGINE_BUILD_VERSION = "2025.10.26.20.55.41";
var WICK_ENGINE_BUILD_VERSION = "2026.1.10.14.29.18";
/*!
* Paper.js v0.12.4 - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
Expand Down Expand Up @@ -46545,6 +46545,11 @@
* @param {Wick.Base} object - the object to remove from the cache
*/
removeObject(object) {
// let info = "";
// info += "classname " + object.classname;
// info += "\n uuid " + object.uuid.substring(0, 4);
// console.log(info);

if (object.classname === 'Project') {
object.destroy();
return; // TODO, remove this.
Expand Down Expand Up @@ -46611,11 +46616,14 @@
let uuidSet = new Set(uuids);
let historyIDs = project.history.getObjectUUIDs();
uuidSet = new Set([...historyIDs, ...uuidSet]);
let info = "removeUnusedObjects()";
this.getAllObjects().forEach(object => {
if (!uuidSet.has(object.uuid)) {
info += "\n" + object.classname.padEnd(10, " ") + object.uuid;
this.removeObject(object);
}
});
console.log(info);
}

/**
Expand Down Expand Up @@ -46672,6 +46680,27 @@
getObjectsNeedAutosaved() {
return Object.keys(this._objectsNeedAutosave).map(uuid => this.getObjectByUUID(uuid));
}
static _getObjectsDebug() {
let out = [];
let print = "";
for (let elem of Wick.ObjectCache.getAllObjects()) {
let line = elem.classname.padEnd(10, " ") + elem.uuid;
if (elem._name) line += ": name = " + elem._name;else if (elem._identifier) line += ": id = " + elem._identifier;
//else if(elem._parent._identifier) line += (": parent = " + elem._parent._identifier);

out.push(line);
}
for (let line of out.sort()) {
print += "" + line + "\n";
}
console.log(print);
}
static _getObjectsInfoDebug() {
for (let elem of Wick.ObjectCache.getAllObjects()) {
console.log("\n\n" + elem.classname + " " + elem.uuid);
console.log(Wick.ObjectCache.getObjectByUUID(elem.uuid));
}
}
};
Wick.ObjectCache = new WickObjectCache();
/*
Expand Down
31 changes: 30 additions & 1 deletion public/corelibs/wick-engine/wickengine.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*Wick Engine https://github.com/Wicklets/wick-engine*/
var WICK_ENGINE_BUILD_VERSION = "2025.10.26.20.55.41";
var WICK_ENGINE_BUILD_VERSION = "2026.1.10.14.29.18";
/*!
* Paper.js v0.12.4 - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
Expand Down Expand Up @@ -46530,6 +46530,11 @@ WickObjectCache = class {
* @param {Wick.Base} object - the object to remove from the cache
*/
removeObject(object) {
// let info = "";
// info += "classname " + object.classname;
// info += "\n uuid " + object.uuid.substring(0, 4);
// console.log(info);

if (object.classname === 'Project') {
object.destroy();
return; // TODO, remove this.
Expand Down Expand Up @@ -46596,11 +46601,14 @@ WickObjectCache = class {
let uuidSet = new Set(uuids);
let historyIDs = project.history.getObjectUUIDs();
uuidSet = new Set([...historyIDs, ...uuidSet]);
let info = "removeUnusedObjects()";
this.getAllObjects().forEach(object => {
if (!uuidSet.has(object.uuid)) {
info += "\n" + object.classname.padEnd(10, " ") + object.uuid;
this.removeObject(object);
}
});
console.log(info);
}

/**
Expand Down Expand Up @@ -46657,6 +46665,27 @@ WickObjectCache = class {
getObjectsNeedAutosaved() {
return Object.keys(this._objectsNeedAutosave).map(uuid => this.getObjectByUUID(uuid));
}
static _getObjectsDebug() {
let out = [];
let print = "";
for (let elem of Wick.ObjectCache.getAllObjects()) {
let line = elem.classname.padEnd(10, " ") + elem.uuid;
if (elem._name) line += ": name = " + elem._name;else if (elem._identifier) line += ": id = " + elem._identifier;
//else if(elem._parent._identifier) line += (": parent = " + elem._parent._identifier);

out.push(line);
}
for (let line of out.sort()) {
print += "" + line + "\n";
}
console.log(print);
}
static _getObjectsInfoDebug() {
for (let elem of Wick.ObjectCache.getAllObjects()) {
console.log("\n\n" + elem.classname + " " + elem.uuid);
console.log(Wick.ObjectCache.getObjectByUUID(elem.uuid));
}
}
};
Wick.ObjectCache = new WickObjectCache();
/*
Expand Down