Skip to content

Commit

Permalink
Clean up dep.{width,height,dstX,dstY} and sprites/oldSprites
Browse files Browse the repository at this point in the history
  • Loading branch information
Jbudone committed Feb 10, 2019
1 parent c4b760a commit f358f55
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
5 changes: 5 additions & 0 deletions resourceBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,11 @@ const packageRoutines = {

delete sheet.dirty;
delete sheet.newDependencies;
delete sheet.oldSprites;

if (sheet.sprites && sheet.sprites.length === 0) {
delete sheet.sprites;
}

console.log(sheet);
return;
Expand Down
9 changes: 0 additions & 9 deletions tools/toolbelt/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,6 @@
</div>

<div id="tilesheetFolderHierarchyImageCtrl" class="hidden">
<div class="tilesheetFolderHierarchyImageCtrlContainer">
<span>Image Size: </span>
<input type="text" placeholder="width" val="128" disabled id="tilesheetFolderHierarchyImageCtrlImgSrcW" class="tilesheetFolderHierarchyImageCtrlText" />
<input type="text" placeholder="height" val="64" disabled id="tilesheetFolderHierarchyImageCtrlImgSrcH" class="tilesheetFolderHierarchyImageCtrlText" />

<span> --&gt; </span>
<input type="text" placeholder="width" val="width" id="tilesheetFolderHierarchyImageCtrlImgDstW" class="tilesheetFolderHierarchyImageCtrlText" />
<input type="text" placeholder="height" val="height" id="tilesheetFolderHierarchyImageCtrlImgDstH" class="tilesheetFolderHierarchyImageCtrlText" />
</div>
<div class="tilesheetFolderHierarchyImageCtrlContainer">
<input type="text" placeholder=" -filter box -scale 20% -scale 500% -posterize 7" id="tilesheetFolderHierarchyImageCtrlImgProcess" class="tilesheetFolderHierarchyImageCtrlText" />
</div>
Expand Down
23 changes: 2 additions & 21 deletions tools/toolbelt/js/modTilesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,8 @@ const ModTilesheet = (function(containerEl){
imgProcEl.val(dependency.processing);

imgSrcEl.attr('src', `../../${file.pathTo}`);
imgSrcEl.one("load", function() {
imgSrcHEl.val(imgSrcEl[0].naturalHeight);
imgSrcWEl.val(imgSrcEl[0].naturalWidth);
imgDstHEl.val(dependency.height);
imgDstWEl.val(dependency.width);
}).each(function() {
imgSrcEl.one("load", function() {})
.each(function() {
if(this.complete) $(this).load();
});

Expand Down Expand Up @@ -546,8 +542,6 @@ const ModTilesheet = (function(containerEl){
resImg.onload = () => {
const dep = {
imageSrc: file.pathTo,
width: resImg.width,
height: resImg.height,
processing: ''
};

Expand Down Expand Up @@ -804,15 +798,6 @@ const ModTilesheet = (function(containerEl){
// FIXME: More shit here
});
debugger; // Why did we hit here while reloading a dep??
} else {
// We've moved the spriteGroup from the dep. If the dep is an image then the entire image is a single
// spriteGroup, and we have no need to store the spriteGroup. But if we don't store the spriteGroup then we
// need to store dstX/dstY on the dep itself. Find the top-left most sprite and set the dep dstX/dstY to
// that here
if (existingDep.imageSrc) {
existingDep.dstX = minX;
existingDep.dstY = minY;
}
}

// 6) Add sprites, delete old sprites (in case size has changed this is much easier); modify spriteGroup to reference new sprites
Expand Down Expand Up @@ -1185,8 +1170,6 @@ const ModTilesheet = (function(containerEl){
dep.imageSrc = _dep.imageSrc;
dep.previewSrc = _dep.previewSrc;
dep.processing = _dep.processing;
dep.width = _dep.width;
dep.height = _dep.height;
} else {
dep.assetId = _dep.assetId;
dep.sprites = _.clone(_dep.sprites);
Expand Down Expand Up @@ -1653,8 +1636,6 @@ const ModTilesheet = (function(containerEl){
saveDep.imageSrc = dep.imageSrc;
saveDep.previewSrc = dep.previewSrc;
saveDep.processing = dep.processing;
saveDep.width = dep.width;
saveDep.height = dep.height;
} else {
debugger; // FIXME: I bet we can't clone sprites like this
saveDep.assetId = dep.assetId;
Expand Down

0 comments on commit f358f55

Please sign in to comment.