don't copy existing texture files
parent
378833cefd
commit
fa452311f8
|
@ -629,13 +629,15 @@ void loadImage(GeometryConverter *cvt, std::ostream &os, const std::string &text
|
|||
fileToId[filename] = image.getId();
|
||||
|
||||
boost::filesystem::path path = boost::filesystem::path(filename, boost::filesystem::native);
|
||||
ref<FileResolver> fRes = FileResolver::getInstance();
|
||||
std::string resolved = fRes->resolve(path.leaf());
|
||||
std::string targetPath = textureDir + path.leaf();
|
||||
|
||||
if (endsWith(resolved, ".rgb"))
|
||||
if (endsWith(filename, ".rgb"))
|
||||
SLog(EWarn, "Maya RGB images must be converted to PNG, EXR or JPEG! The 'imgcvt' "
|
||||
"utility found in the Maya binary directory can be used to do this.");
|
||||
|
||||
if (!FileStream::exists(targetPath)) {
|
||||
ref<FileResolver> fRes = FileResolver::getInstance();
|
||||
std::string resolved = fRes->resolve(path.leaf());
|
||||
if (!FileStream::exists(filename)) {
|
||||
if (!FileStream::exists(resolved)) {
|
||||
SLog(EWarn, "Found neither \"%s\" nor \"%s\"!", filename.c_str(), resolved.c_str());
|
||||
|
@ -646,10 +648,12 @@ void loadImage(GeometryConverter *cvt, std::ostream &os, const std::string &text
|
|||
filename = resolved;
|
||||
}
|
||||
}
|
||||
|
||||
ref<FileStream> input = new FileStream(filename, FileStream::EReadOnly);
|
||||
ref<FileStream> output = new FileStream(textureDir + path.leaf(), FileStream::ETruncReadWrite);
|
||||
ref<FileStream> output = new FileStream(targetPath, FileStream::ETruncReadWrite);
|
||||
input->copyTo(output);
|
||||
input->close();
|
||||
output->close();
|
||||
}
|
||||
|
||||
os << "\t<texture id=\"" << image.getId() << "\" type=\"ldrtexture\">" << endl;
|
||||
os << "\t\t<string name=\"filename\" value=\"" << textureDir + path.leaf() << "\"/>" << endl;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
std::string copyTexture(GeometryConverter *cvt, const std::string &textureDir, std::string filename) {
|
||||
SLog(EInfo, "Copying texture \"%s\" ..", filename.c_str());
|
||||
|
||||
#if defined(WIN32)
|
||||
for (size_t i=0; i<filename.length(); ++i)
|
||||
if (filename[i] == '/')
|
||||
|
@ -20,7 +21,11 @@ std::string copyTexture(GeometryConverter *cvt, const std::string &textureDir, s
|
|||
if (filename[i] == '\\')
|
||||
filename[i] = '/';
|
||||
#endif
|
||||
|
||||
boost::filesystem::path path = boost::filesystem::path(filename, boost::filesystem::native);
|
||||
std::string targetPath = textureDir + path.leaf();
|
||||
|
||||
if (!FileStream::exists(targetPath)) {
|
||||
ref<FileResolver> fRes = FileResolver::getInstance();
|
||||
std::string resolved = fRes->resolve(path.leaf());
|
||||
if (!FileStream::exists(filename)) {
|
||||
|
@ -34,14 +39,12 @@ std::string copyTexture(GeometryConverter *cvt, const std::string &textureDir, s
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
std::string targetPath = textureDir + path.leaf();
|
||||
|
||||
ref<FileStream> input = new FileStream(filename, FileStream::EReadOnly);
|
||||
ref<FileStream> output = new FileStream(targetPath, FileStream::ETruncReadWrite);
|
||||
input->copyTo(output);
|
||||
output->close();
|
||||
input->close();
|
||||
}
|
||||
|
||||
return targetPath;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue