Is there anyone had used the Shapes_Exporter tools in NeL

Added by wangxuan2730 about 4 years ago

Now , I can run it , and can export some pictures in the file of storage. But the window disappear very fast , I don't know it's right or not!

So someone can take some pictures when the app running . And some codes which I can't understand, if I comment it , the app also run .

the code is:
else //以下代码未发现其作用 {
std::vector<std::string> filenames;
CPath::getPathContent(exporter.settings.input_path, true, false, true, filenames);

CPath::remapFile("ma_hof_armor_00_tibia_c1.tga", "ma_hof_armor00_tibia_c1.png");
CPath::remapFile("ma_hof_armor_00_foot_c1.tga", "ma_hof_armor00_foot_c1.png");
CPath::remapFile("ma_hof_armor_01_botte_c1.tga", "ma_hof_armor01_botte_c1.png");
CPath::remapFile("ma_hof_armor_01_pied_c1.tga", "ma_hof_armor01_pied_c1.png");
CPath::remapFile("ma_hom_armor_01_botte_c1.tga", "ma_hom_armor01_botte_c1.png");
CPath::remapFile("ma_hom_armor_01_pied_c1.tga", "ma_hom_armor01_pied_c1.png");
CPath::remapFile("hair_spec.tga", "spec_hair.png");
CPath::remapFile("zo_hof_armor_00_mollet_c1.tga", "zo_hof_armor00_mollet_c1.png");
CPath::remapFile("zo_hof_armor_00_pied_c1.tga", "zo_hof_armor00_pied_c1.png");
CPath::remapFile("zo_hom_armor_00_mollet_c1.tga", "zo_hom_armor00_mollet_c1.png");
CPath::remapFile("zo_hom_armor_00_pied_c1.tga", "zo_hom_armor00_pied_c1.png");
CPath::getFileList("ps", filenames);
// search all .shape and .ps files
std::vector&lt;std::string&gt; shapes;
CPath::getFileList("shape", shapes);
CPath::getFileList("ps", shapes);
for(size_t i = 0; i < filenames.size(); ++i) {
if (filenames[i].find(".max") == std::string::npos)
continue;
std::string baseFilename = toLower(CFile::getFilenameWithoutExtension(filenames[i]));
// compute the md5 of .max file
std::string md5 = getNewMD5(filenames[i]).toString();
nlinfo("processing %s with md5 = %s", filenames[i].c_str(), md5.c_str());
// the final directory with images
std::string output_path = exporter.settings.output_path + md5.substr(0, 2) + "/" + md5;
// file is an animation
std::string animation; // CPath::lookup(baseFilename + ".anim", false, false, false);
// file is a skeleton
std::string skeleton; // CPath::lookup(baseFilename + ".skel", false, false, false);
// file is a shape
std::string shape = CPath::lookup(baseFilename + ".shape", false, false, false);
// copy .shape file
if (!shape.empty() && false) {
CIFile in;
COFile out;
// create output directory if it doesn't already exists
if (!CFile::isExists(output_path) && !CFile::createDirectoryTree(output_path)) {
nlwarning("can't create %s", output_path.c_str());
continue;
}
if (in.open(shape) && out.open(output_path + "/" + baseFilename + ".shape"))
{
uint32 size = in.getFileSize();
uint8 *buffer = new uint8[size];
in.serialBuffer(buffer, size);
out.serialBuffer(buffer, size);
delete [] buffer;
}
}
// try with several shapes binded on a skeleton
std::vector&lt;std::string&gt; filtered_shapes;
if (!animation.empty())
{
// render animation
skeleton = ShapesExporter::findSkeleton(filenames[i]); {
// skeleton = ShapesExporter::findSkeleton(shape);
// render shape
}
else if (!skeleton.empty()) {
// don't render anything
continue;
}
else {
continue;
/*
// create a temporary list with shapes which could correspond to .max file
for(size_t j = 0; j < shapes.size(); ++j) {
// only add files with the same beginning
if (shapes[j].find(baseFilename) 0) {
filtered_shapes.push_back(shapes[j]);
}
}
*/
// if there is no corresponding file, we can't render it
if (filtered_shapes.empty()) {
nlwarning("didn't find type of %s", filenames[i].c_str());
continue;
}
// if we found only one shape, we don't need a skeleton
if (filtered_shapes.size() 1) {
shape = filtered_shapes[0];
}
else {
skeleton = ShapesExporter::findSkeleton(filenames[i]);
}
}
// create output directory if it doesn't already exists
if (!CFile::isExists(output_path) && !CFile::createDirectoryTree(output_path)) {
nlwarning("can't create %s", output_path.c_str());
continue;
}
bool res = false;
if (!skeleton.empty())
{
res = exporter.exportSkeleton(skeleton, filtered_shapes, output_path);
}
else {
res = exporter.exportShape(shape, output_path);
}
if (res)
{
if (!exporter.createThumbnail(filenames[i], output_path)) {
nlwarning("can't create thumbnail");
}
}
else {
// an error occured, try to delete directory
nlwarning("can't export shape");
CFile::deleteDirectory(output_path);
}
}
}

Replies (4)

RE: Is there anyone had used the Shapes_Exporter tools in NeL - Added by kervala about 4 years ago

That's normal if the window is disappearing very fast, the goal of this application is to make a offscreen render of shapes. The window is only created to be able to make a render (the full offscreen renderer doesn't work very well and need some adjustments).

Again, this application is in a very alpha state and its goal was only to generate previews for http://media.ryzom.com

RE: Is there anyone had used the Shapes_Exporter tools in NeL - Added by wangxuan2730 about 4 years ago

Thank you , another question is what's the meaning of those code? If you comment them , it also works well.

RE: Is there anyone had used the Shapes_Exporter tools in NeL - Added by kervala about 4 years ago

1. Because it was too long to create thumbnails for all shapes so I filtered some of them.
2. Because it's not finished, some parts don't work as intended (render of full armors or animations for example).

(1-4/4)