Don't save empty sections when saving scenes.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2586 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: SparseMisoSceneModel.java,v 1.6 2003/04/25 22:26:25 mdb Exp $
|
// $Id: SparseMisoSceneModel.java,v 1.7 2003/05/16 17:26:07 ray Exp $
|
||||||
|
|
||||||
package com.threerings.miso.data;
|
package com.threerings.miso.data;
|
||||||
|
|
||||||
@@ -172,6 +172,24 @@ public class SparseMisoSceneModel extends MisoSceneModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this section contains no data beyond the default.
|
||||||
|
* Used when saving a sparse scene: we omit blank sections.
|
||||||
|
*/
|
||||||
|
public boolean isBlank ()
|
||||||
|
{
|
||||||
|
if ((objectTileIds.length != 0) || (objectInfo.length != 0)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int ii=0, nn=baseTileIds.length; ii < nn; ii++) {
|
||||||
|
if (baseTileIds[ii] != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public Object clone () {
|
public Object clone () {
|
||||||
try {
|
try {
|
||||||
Section section = (Section)super.clone();
|
Section section = (Section)super.clone();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: SparseMisoSceneWriter.java,v 1.2 2003/04/21 17:08:57 mdb Exp $
|
// $Id: SparseMisoSceneWriter.java,v 1.3 2003/05/16 17:26:07 ray Exp $
|
||||||
|
|
||||||
package com.threerings.miso.tools.xml;
|
package com.threerings.miso.tools.xml;
|
||||||
|
|
||||||
@@ -50,6 +50,9 @@ public class SparseMisoSceneWriter implements NestableWriter
|
|||||||
writer.startElement("sections");
|
writer.startElement("sections");
|
||||||
for (Iterator iter = model.getSections(); iter.hasNext(); ) {
|
for (Iterator iter = model.getSections(); iter.hasNext(); ) {
|
||||||
Section sect = (Section)iter.next();
|
Section sect = (Section)iter.next();
|
||||||
|
if (sect.isBlank()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
AttributesImpl attrs = new AttributesImpl();
|
AttributesImpl attrs = new AttributesImpl();
|
||||||
attrs.addAttribute("", "x", "", "", String.valueOf(sect.x));
|
attrs.addAttribute("", "x", "", "", String.valueOf(sect.x));
|
||||||
attrs.addAttribute("", "y", "", "", String.valueOf(sect.y));
|
attrs.addAttribute("", "y", "", "", String.valueOf(sect.y));
|
||||||
|
|||||||
Reference in New Issue
Block a user