If edits are being made to blocks that are offscreen, just edit the model directly instead of going through the scene block

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@596 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Charlie Groves
2008-05-14 06:32:22 +00:00
parent c6818a167f
commit 2e8fa57f7c
@@ -578,12 +578,18 @@ public class EditorScenePanel extends StageScenePanel
if (!_model.setBaseTile(fqTileId, x, y)) { if (!_model.setBaseTile(fqTileId, x, y)) {
return false; return false;
} }
getBlock(x, y).updateBaseTile(fqTileId, x, y); SceneBlock block = getBlock(x, y);
if (block != null && block.isResolved()) {
block.updateBaseTile(fqTileId, x, y);
}
// and recompute any surrounding fringe // and recompute any surrounding fringe
for (int fx = x - 1, xn = x + 1; fx <= xn; fx++) { for (int fx = x - 1, xn = x + 1; fx <= xn; fx++) {
for (int fy = y - 1, yn = y + 1; fy <= yn; fy++) { for (int fy = y - 1, yn = y + 1; fy <= yn; fy++) {
getBlock(fx, fy).updateFringe(fx, fy); block = getBlock(fx, fy);
if (block != null && block.isResolved()) {
block.updateFringe(fx, fy);
}
} }
} }
return true; return true;
@@ -626,13 +632,15 @@ public class EditorScenePanel extends StageScenePanel
// first attempt to add it to the appropriate scene block; this // first attempt to add it to the appropriate scene block; this
// will fail if there's already a copy of the same object at this // will fail if there's already a copy of the same object at this
// coordinate // coordinate
if (getBlock(oinfo.x, oinfo.y).addObject(oinfo)) { SceneBlock block = getBlock(oinfo.x, oinfo.y);
if (block== null || !block.isResolved() || block.addObject(oinfo)) {
// create an object info and add it to the scene model // create an object info and add it to the scene model
_model.addObject(oinfo); if (_model.addObject(oinfo)) {
// recompute our visible object set // recompute our visible object set
recomputeVisible(); recomputeVisible();
return oinfo; return oinfo;
} }
}
return null; return null;
} }
@@ -664,7 +672,10 @@ public class EditorScenePanel extends StageScenePanel
// remove it from the scene model // remove it from the scene model
if (_model.removeObject(info)) { if (_model.removeObject(info)) {
// clear the object out of its block // clear the object out of its block
getBlock(info.x, info.y).deleteObject(info); SceneBlock block = getBlock(info.x, info.y);
if (block != null && block.isResolved()) {
block.deleteObject(info);
}
// recompute our visible object set // recompute our visible object set
recomputeVisible(); recomputeVisible();