Fix: Use ASCII treeview in assimp-cmd.

pull/4728/head
Kim Kulling 2022-09-16 21:55:14 +02:00
parent 7be7e5d93e
commit e4c77aa4fa
6 changed files with 19 additions and 23 deletions

View File

@ -75,15 +75,10 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
XFileImporter::XFileImporter() XFileImporter::XFileImporter() : mBuffer() {
: mBuffer() {
// empty // empty
} }
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
XFileImporter::~XFileImporter() = default;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool XFileImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool /*checkSig*/) const { bool XFileImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool /*checkSig*/) const {

View File

@ -69,7 +69,7 @@ namespace XFile {
class XFileImporter : public BaseImporter { class XFileImporter : public BaseImporter {
public: public:
XFileImporter(); XFileImporter();
~XFileImporter() override; ~XFileImporter() override = default;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Returns whether the class can handle the format of the given file. /** Returns whether the class can handle the format of the given file.

View File

@ -42,9 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB #ifdef ASSIMP_BUILD_NO_OWN_ZLIB
#include <zlib.h> # include <zlib.h>
#else #else
#include "../contrib/zlib/zlib.h" # include "../contrib/zlib/zlib.h"
#endif #endif
#include <vector> #include <vector>

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2022, assimp team Copyright (c) 2006-2022, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
@ -68,9 +66,15 @@ const char *TREE_CONTINUE_UTF8 = "\xe2\x94\x82 ";
// this is well supported on pretty much any linux terminal. // this is well supported on pretty much any linux terminal.
// if this causes problems on some platform, // if this causes problems on some platform,
// put an #ifdef to use the ascii version for that platform. // put an #ifdef to use the ascii version for that platform.
#ifdef _WIN32
const char *TREE_BRANCH = TREE_BRANCH_ASCII;
const char *TREE_STOP = TREE_STOP_ASCII;
const char *TREE_CONTINUE = TREE_CONTINUE_ASCII;
#else
const char *TREE_BRANCH = TREE_BRANCH_UTF8; const char *TREE_BRANCH = TREE_BRANCH_UTF8;
const char *TREE_STOP = TREE_STOP_UTF8; const char *TREE_STOP = TREE_STOP_UTF8;
const char *TREE_CONTINUE = TREE_CONTINUE_UTF8; const char *TREE_CONTINUE = TREE_CONTINUE_UTF8;
#endif
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
unsigned int CountNodes(const aiNode *root) { unsigned int CountNodes(const aiNode *root) {

View File

@ -58,11 +58,12 @@ public:
~ConsoleProgressHandler() override = default; ~ConsoleProgressHandler() override = default;
bool Update(float percentage) override { bool Update(float percentage) override {
std::cout << percentage * 100.0f << " %\n"; std::cout << "\r" << percentage * 100.0f << " %";
return true; return true;
} }
}; };
const char* AICMD_MSG_ABOUT =
constexpr char AICMD_MSG_ABOUT[] =
"------------------------------------------------------ \n" "------------------------------------------------------ \n"
"Open Asset Import Library (\"Assimp\", https://github.com/assimp/assimp) \n" "Open Asset Import Library (\"Assimp\", https://github.com/assimp/assimp) \n"
" -- Commandline toolchain --\n" " -- Commandline toolchain --\n"
@ -70,7 +71,7 @@ const char* AICMD_MSG_ABOUT =
"Version %i.%i %s%s%s%s%s(GIT commit %x)\n\n"; "Version %i.%i %s%s%s%s%s(GIT commit %x)\n\n";
const char* AICMD_MSG_HELP = constexpr char AICMD_MSG_HELP[] =
"assimp <verb> <parameters>\n\n" "assimp <verb> <parameters>\n\n"
" verbs:\n" " verbs:\n"
" \tinfo - Quick file stats\n" " \tinfo - Quick file stats\n"
@ -96,8 +97,7 @@ const char* AICMD_MSG_HELP =
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Application entry point // Application entry point
int main (int argc, char* argv[]) int main (int argc, char* argv[]) {
{
if (argc <= 1) { if (argc <= 1) {
printf("assimp: No command specified. Use \'assimp help\' for a detailed command list\n"); printf("assimp: No command specified. Use \'assimp help\' for a detailed command list\n");
return AssimpCmdError::Success; return AssimpCmdError::Success;
@ -550,10 +550,7 @@ int ProcessStandardArguments(
} }
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
int Assimp_TestBatchLoad ( int Assimp_TestBatchLoad(const char* const* params, unsigned int num) {
const char* const* params,
unsigned int num)
{
for(unsigned int i = 0; i < num; ++i) { for(unsigned int i = 0; i < num; ++i) {
globalImporter->ReadFile(params[i],aiProcessPreset_TargetRealtime_MaxQuality); globalImporter->ReadFile(params[i],aiProcessPreset_TargetRealtime_MaxQuality);
// we're totally silent. scene destructs automatically. // we're totally silent. scene destructs automatically.

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AICMD_MAIN_INCLUDED #define AICMD_MAIN_INCLUDED
#ifndef _CRT_SECURE_NO_WARNINGS #ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS # define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include <stdio.h> #include <stdio.h>
@ -66,9 +66,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif #endif
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB #ifdef ASSIMP_BUILD_NO_OWN_ZLIB
#include <zlib.h> # include <zlib.h>
#else #else
#include <../contrib/zlib/zlib.h> # include <../contrib/zlib/zlib.h>
#endif #endif