mirror of
https://github.com/Misterblue/convoar.git
synced 2026-08-14 00:57:55 +00:00
Remove unused parameter from GetStorageDir() and StorageDirectory().
Use parameters "OutputDir" as the base directory for storage.
This commit is contained in:
@@ -46,9 +46,9 @@ namespace org.herbal3d.cs.os.CommonEntities {
|
||||
// often UUID's are turned to strings with hyphens. Make sure they are gone.
|
||||
return PersistRules.GetFilename(this.AssetType, this.ID, pLongName, _params).Replace("-", "");
|
||||
}
|
||||
public string GetStorageDir(string pBaseDirectory, string pStorageName) {
|
||||
public string GetStorageDir(string pStorageName) {
|
||||
string strippedStorageName = Path.GetFileNameWithoutExtension(pStorageName);
|
||||
return PersistRules.StorageDirectory(pBaseDirectory, strippedStorageName, _params);
|
||||
return PersistRules.StorageDirectory(strippedStorageName, _params);
|
||||
}
|
||||
public string GetURI(string pURIBase, string pStorageName) {
|
||||
return PersistRules.ReferenceURL(pURIBase, pStorageName);
|
||||
@@ -1198,7 +1198,7 @@ namespace org.herbal3d.cs.os.CommonEntities {
|
||||
|
||||
public void WriteBuffer() {
|
||||
string outFilename = this.GetFilename(_identifyingString);
|
||||
string outDir = this.GetStorageDir(null, outFilename);
|
||||
string outDir = this.GetStorageDir(outFilename);
|
||||
string absDir = PersistRules.CreateDirectory(outDir, _params);
|
||||
File.WriteAllBytes(Path.Combine(absDir, outFilename), bufferBytes);
|
||||
// _log.DebugFormat("{0} WriteBinaryFiles: filename={1}", LogHeader, outFilename);
|
||||
@@ -1426,7 +1426,7 @@ namespace org.herbal3d.cs.os.CommonEntities {
|
||||
public void WriteImage() {
|
||||
// string imgFilename = this.GetFilename(underlyingUUID.ToString());
|
||||
string imgFilename = this.GetFilename(imageInfo.GetBHash().ToString());
|
||||
string imgDir = this.GetStorageDir(null, imgFilename);
|
||||
string imgDir = this.GetStorageDir(imgFilename);
|
||||
string absDir = PersistRules.CreateDirectory(imgDir, _params);
|
||||
var targetType = PersistRules.FigureOutTargetTypeFromAssetType(AssetType, _params);
|
||||
imageInfo.image.Save(Path.Combine(absDir, imgFilename),
|
||||
|
||||
@@ -52,7 +52,8 @@ namespace org.herbal3d.cs.os.CommonEntities {
|
||||
BMP,
|
||||
Mesh,
|
||||
Buff,
|
||||
Gltf
|
||||
Gltf,
|
||||
Glb
|
||||
};
|
||||
|
||||
// Some asset types have their own sub-directory to live in
|
||||
@@ -70,7 +71,7 @@ namespace org.herbal3d.cs.os.CommonEntities {
|
||||
{ AssetType.ImageTrans, TargetType.Default},
|
||||
{ AssetType.Mesh, TargetType.Mesh},
|
||||
{ AssetType.Buff, TargetType.Buff},
|
||||
{ AssetType.Scene, TargetType.Gltf},
|
||||
{ AssetType.Scene, TargetType.Default}, // Gltf or Glb depending on binary file format
|
||||
};
|
||||
|
||||
// The extension to add to target type filenames when stored
|
||||
@@ -83,6 +84,7 @@ namespace org.herbal3d.cs.os.CommonEntities {
|
||||
{ TargetType.Mesh, "mesh" },
|
||||
{ TargetType.Buff, "buf" },
|
||||
{ TargetType.Gltf, "gltf" },
|
||||
{ TargetType.Glb, "glb" },
|
||||
};
|
||||
|
||||
// Parameter system can specify types to output. THis converts the parameter to a target type code
|
||||
@@ -120,6 +122,14 @@ namespace org.herbal3d.cs.os.CommonEntities {
|
||||
if (pAssetType == AssetType.ImageTrans) {
|
||||
ret = TextureFormatToTargetType[pParams.P<string>("PreferredTextureFormat").ToLower()];
|
||||
}
|
||||
if (pAssetType == AssetType.Scene) {
|
||||
if (pParams.P<bool>("WriteBinaryGltf")) {
|
||||
ret = TargetType.Glb;
|
||||
}
|
||||
else {
|
||||
ret = TargetType.Gltf;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -156,8 +166,9 @@ namespace org.herbal3d.cs.os.CommonEntities {
|
||||
// should be stored in.
|
||||
// Uses sub-directories made out of the filename.
|
||||
// "01234567890123456789" => "baseDirectory/01/23/45/6789"
|
||||
public static string StorageDirectory(string baseDirectory, string pHash, IParameters pParams) {
|
||||
public static string StorageDirectory(string pHash, IParameters pParams) {
|
||||
string ret = null;
|
||||
string baseDirectory = pParams.P<string>("OutputDir");
|
||||
if (pParams.P<bool>("UseDeepFilenames") && pHash.Length >= 10) {
|
||||
if (String.IsNullOrEmpty(baseDirectory)) {
|
||||
ret = Path.Combine(pHash.Substring(0, 2),
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ namespace org.herbal3d.convoar {
|
||||
Globals.log.DebugFormat("{0} num Gltf.bufferViews={1}", _logHeader, gltf.bufferViews.Count);
|
||||
|
||||
string gltfFilename = gltf.GetFilename(gltf.IdentifyingString);
|
||||
string gltfDir = gltf.GetStorageDir(null, gltfFilename);
|
||||
string gltfDir = gltf.GetStorageDir(gltfFilename);
|
||||
string absDir = PersistRules.CreateDirectory(gltfDir, Globals.parms);
|
||||
string gltfPath = Path.Combine(absDir, gltfFilename);
|
||||
|
||||
|
||||
@@ -66,6 +66,8 @@ namespace org.herbal3d.convoar {
|
||||
true ),
|
||||
new ParameterDefn<bool>("UseDeepFilenames", "Whether filenames be organized into a deep directory structure",
|
||||
false ),
|
||||
new ParameterDefn<bool>("WriteBinaryGltf", "Whether to write .gltf or .glb file",
|
||||
false ),
|
||||
|
||||
new ParameterDefn<string>("==========", "OAR Reading Specific Parameters", null),
|
||||
new ParameterDefn<string>("ConvoarID", "GUID for 'convoar' identity (used for CreatorID, ...)",
|
||||
|
||||
@@ -1 +1 @@
|
||||
Sun 02/17/2019 13:14:26.62
|
||||
Sun 02/17/2019 15:13:05.42
|
||||
|
||||
@@ -1 +1 @@
|
||||
b123f9657895ab19b484c3410554dac03a3733e5
|
||||
df185c529955ff2967283074d621999d4be9a19c
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Reference in New Issue
Block a user