|
|
@ -42,47 +42,36 @@ public class OgreBinaryMeshDataObject extends SpatialAssetDataObject { |
|
|
|
} |
|
|
|
} |
|
|
|
//make sure its actually closed and all data gets reloaded
|
|
|
|
//make sure its actually closed and all data gets reloaded
|
|
|
|
closeAsset(); |
|
|
|
closeAsset(); |
|
|
|
ProgressHandle handle = ProgressHandleFactory.createHandle("Converting OgreBinary"); |
|
|
|
|
|
|
|
handle.start(); |
|
|
|
|
|
|
|
//mesh
|
|
|
|
//mesh
|
|
|
|
OgreXMLConvertOptions options = new OgreXMLConvertOptions(getPrimaryFile().getPath()); |
|
|
|
OgreXMLConvertOptions options = new OgreXMLConvertOptions(getPrimaryFile().getPath()); |
|
|
|
options.setBinaryFile(true); |
|
|
|
options.setBinaryFile(true); |
|
|
|
OgreXMLConvert conv = new OgreXMLConvert(); |
|
|
|
OgreXMLConvert conv = new OgreXMLConvert(); |
|
|
|
conv.doConvert(options, handle); |
|
|
|
conv.doConvert(options, null); |
|
|
|
//try skeleton
|
|
|
|
//try skeleton
|
|
|
|
if (getPrimaryFile().existsExt("skeleton")) { |
|
|
|
if (getPrimaryFile().existsExt("skeleton")) { |
|
|
|
OgreXMLConvertOptions options2 = new OgreXMLConvertOptions(getPrimaryFile().getParent().getFileObject(getPrimaryFile().getName(), "skeleton").getPath()); |
|
|
|
OgreXMLConvertOptions options2 = new OgreXMLConvertOptions(getPrimaryFile().getParent().getFileObject(getPrimaryFile().getName(), "skeleton").getPath()); |
|
|
|
options2.setBinaryFile(true); |
|
|
|
options2.setBinaryFile(true); |
|
|
|
OgreXMLConvert conv2 = new OgreXMLConvert(); |
|
|
|
OgreXMLConvert conv2 = new OgreXMLConvert(); |
|
|
|
conv2.doConvert(options2, handle); |
|
|
|
conv2.doConvert(options2, null); |
|
|
|
} |
|
|
|
} |
|
|
|
handle.progress("Convert Model"); |
|
|
|
|
|
|
|
String assetKey = mgr.getRelativeAssetPath(options.getDestFile()); |
|
|
|
String assetKey = mgr.getRelativeAssetPath(options.getDestFile()); |
|
|
|
FileLock lock = null; |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
lock = getPrimaryFile().lock(); |
|
|
|
|
|
|
|
listListener.start(); |
|
|
|
listListener.start(); |
|
|
|
Spatial spatial = mgr.loadModel(assetKey); |
|
|
|
Spatial spatial = mgr.loadModel(assetKey); |
|
|
|
//replace transient xml files in list of assets for this model
|
|
|
|
//replace transient xml files in list of assets for this model
|
|
|
|
replaceXmlFiles(mgr); |
|
|
|
replaceXmlFiles(mgr); |
|
|
|
listListener.stop(); |
|
|
|
listListener.stop(); |
|
|
|
SpatialUtil.storeOriginalPathUserData(spatial); |
|
|
|
SpatialUtil.storeOriginalPathUserData(spatial); |
|
|
|
lock.releaseLock(); |
|
|
|
|
|
|
|
File deleteFile = new File(options.getDestFile()); |
|
|
|
File deleteFile = new File(options.getDestFile()); |
|
|
|
deleteFile.delete(); |
|
|
|
deleteFile.delete(); |
|
|
|
handle.finish(); |
|
|
|
|
|
|
|
savable = spatial; |
|
|
|
savable = spatial; |
|
|
|
logger.log(Level.INFO, "Loaded asset {0}", getName()); |
|
|
|
logger.log(Level.INFO, "Loaded asset {0}", getName()); |
|
|
|
return spatial; |
|
|
|
return spatial; |
|
|
|
} catch (IOException ex) { |
|
|
|
} catch (Exception ex) { |
|
|
|
Exceptions.printStackTrace(ex); |
|
|
|
Exceptions.printStackTrace(ex); |
|
|
|
if (lock != null) { |
|
|
|
|
|
|
|
lock.releaseLock(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
File deleteFile = new File(options.getDestFile()); |
|
|
|
File deleteFile = new File(options.getDestFile()); |
|
|
|
deleteFile.delete(); |
|
|
|
deleteFile.delete(); |
|
|
|
handle.finish(); |
|
|
|
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|