Merge pull request #1898 from assimp/move_logtools
move log tools from blender to logger interface.pull/1899/head
commit
45892d7fe9
|
@ -70,34 +70,6 @@ static const fpCreateModifier creators[] = {
|
|||
NULL // sentinel
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// just testing out some new macros to simplify logging
|
||||
#define ASSIMP_LOG_WARN_F(string,...)\
|
||||
DefaultLogger::get()->warn((Formatter::format(string),__VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_ERROR_F(string,...)\
|
||||
DefaultLogger::get()->error((Formatter::format(string),__VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_DEBUG_F(string,...)\
|
||||
DefaultLogger::get()->debug((Formatter::format(string),__VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_INFO_F(string,...)\
|
||||
DefaultLogger::get()->info((Formatter::format(string),__VA_ARGS__))
|
||||
|
||||
|
||||
#define ASSIMP_LOG_WARN(string)\
|
||||
DefaultLogger::get()->warn(string)
|
||||
|
||||
#define ASSIMP_LOG_ERROR(string)\
|
||||
DefaultLogger::get()->error(string)
|
||||
|
||||
#define ASSIMP_LOG_DEBUG(string)\
|
||||
DefaultLogger::get()->debug(string)
|
||||
|
||||
#define ASSIMP_LOG_INFO(string)\
|
||||
DefaultLogger::get()->info(string)
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
struct SharedModifierData : ElemBase
|
||||
{
|
||||
|
|
|
@ -47,34 +47,39 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#define INCLUDED_AI_BLEND_MODIFIER_H
|
||||
|
||||
#include "BlenderIntermediate.h"
|
||||
#include <assimp/TinyFormatter.h>
|
||||
|
||||
namespace Assimp {
|
||||
namespace Blender {
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
/** Dummy base class for all blender modifiers. Modifiers are reused between imports, so
|
||||
* they should be stateless and not try to cache model data. */
|
||||
/**
|
||||
* Dummy base class for all blender modifiers. Modifiers are reused between imports, so
|
||||
* they should be stateless and not try to cache model data.
|
||||
*/
|
||||
// -------------------------------------------------------------------------------------------
|
||||
class BlenderModifier
|
||||
{
|
||||
class BlenderModifier {
|
||||
public:
|
||||
/**
|
||||
* The class destructor, virtual.
|
||||
*/
|
||||
virtual ~BlenderModifier() {
|
||||
// empty
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// --------------------
|
||||
/** Check if *this* modifier is active, given a ModifierData& block.*/
|
||||
/**
|
||||
* Check if *this* modifier is active, given a ModifierData& block.
|
||||
*/
|
||||
virtual bool IsActive( const ModifierData& /*modin*/) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// --------------------
|
||||
/** Apply the modifier to a given output node. The original data used
|
||||
/**
|
||||
* Apply the modifier to a given output node. The original data used
|
||||
* to construct the node is given as well. Not called unless IsActive()
|
||||
* was called and gave positive response. */
|
||||
* was called and gave positive response.
|
||||
*/
|
||||
virtual void DoIt(aiNode& /*out*/,
|
||||
ConversionData& /*conv_data*/,
|
||||
const ElemBase& orig_modifier,
|
||||
|
@ -86,14 +91,13 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
/** Manage all known modifiers and instance and apply them if necessary */
|
||||
/**
|
||||
* Manage all known modifiers and instance and apply them if necessary
|
||||
*/
|
||||
// -------------------------------------------------------------------------------------------
|
||||
class BlenderModifierShowcase
|
||||
{
|
||||
class BlenderModifierShowcase {
|
||||
public:
|
||||
|
||||
// --------------------
|
||||
/** Apply all requested modifiers provided we support them. */
|
||||
void ApplyModifiers(aiNode& out,
|
||||
|
@ -103,25 +107,18 @@ public:
|
|||
);
|
||||
|
||||
private:
|
||||
|
||||
TempArray< std::vector,BlenderModifier > cached_modifiers;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// MODIFIERS
|
||||
|
||||
|
||||
// MODIFIERS /////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
/** Mirror modifier. Status: implemented. */
|
||||
/**
|
||||
* Mirror modifier. Status: implemented.
|
||||
*/
|
||||
// -------------------------------------------------------------------------------------------
|
||||
class BlenderModifier_Mirror : public BlenderModifier
|
||||
{
|
||||
class BlenderModifier_Mirror : public BlenderModifier {
|
||||
public:
|
||||
|
||||
// --------------------
|
||||
virtual bool IsActive( const ModifierData& modin);
|
||||
|
||||
|
@ -137,8 +134,7 @@ public:
|
|||
// -------------------------------------------------------------------------------------------
|
||||
/** Subdivision modifier. Status: dummy. */
|
||||
// -------------------------------------------------------------------------------------------
|
||||
class BlenderModifier_Subdivision : public BlenderModifier
|
||||
{
|
||||
class BlenderModifier_Subdivision : public BlenderModifier {
|
||||
public:
|
||||
|
||||
// --------------------
|
||||
|
@ -153,6 +149,7 @@ public:
|
|||
) ;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}}
|
||||
#endif // !INCLUDED_AI_BLEND_MODIFIER_H
|
||||
|
|
|
@ -47,13 +47,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef ASSIMP_BUILD_NO_COLLADA_IMPORTER
|
||||
|
||||
#include "ColladaLoader.h"
|
||||
#include "ColladaParser.h"
|
||||
|
||||
#include <assimp/anim.h>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/importerdesc.h>
|
||||
#include <assimp/Defines.h>
|
||||
|
||||
#include "ColladaParser.h"
|
||||
#include <assimp/fast_atof.h>
|
||||
#include <assimp/ParsingUtils.h>
|
||||
#include <assimp/SkeletonMeshBuilder.h>
|
||||
|
@ -63,7 +65,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "math.h"
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <assimp/Defines.h>
|
||||
|
||||
using namespace Assimp;
|
||||
using namespace Assimp::Formatter;
|
||||
|
|
|
@ -46,7 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef INCLUDED_AI_LOGGER_H
|
||||
#define INCLUDED_AI_LOGGER_H
|
||||
|
||||
#include "types.h"
|
||||
#include <assimp/types.h>
|
||||
#include <assimp/TinyFormatter.h>
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
|
@ -59,7 +60,7 @@ class LogStream;
|
|||
/** @brief CPP-API: Abstract interface for logger implementations.
|
||||
* Assimp provides a default implementation and uses it for almost all
|
||||
* logging stuff ('DefaultLogger'). This class defines just basic logging
|
||||
* behaviour and is not of interest for you. Instead, take a look at #DefaultLogger. */
|
||||
* behavior and is not of interest for you. Instead, take a look at #DefaultLogger. */
|
||||
class ASSIMP_API Logger
|
||||
#ifndef SWIG
|
||||
: public Intern::AllocateFromAssimpHeap
|
||||
|
@ -71,8 +72,7 @@ public:
|
|||
/** @enum LogSeverity
|
||||
* @brief Log severity to describe the granularity of logging.
|
||||
*/
|
||||
enum LogSeverity
|
||||
{
|
||||
enum LogSeverity {
|
||||
NORMAL, //!< Normal granularity of logging
|
||||
VERBOSE //!< Debug infos will be logged, too
|
||||
};
|
||||
|
@ -85,8 +85,7 @@ public:
|
|||
* A LogStream doesn't receive any messages of a specific type
|
||||
* if it doesn't specify the corresponding ErrorSeverity flag.
|
||||
*/
|
||||
enum ErrorSeverity
|
||||
{
|
||||
enum ErrorSeverity {
|
||||
Debugging = 1, //!< Debug log message
|
||||
Info = 2, //!< Info log message
|
||||
Warn = 4, //!< Warn log message
|
||||
|
@ -102,25 +101,25 @@ public:
|
|||
/** @brief Writes a debug message
|
||||
* @param message Debug message*/
|
||||
void debug(const char* message);
|
||||
inline void debug(const std::string &message);
|
||||
void debug(const std::string &message);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Writes a info message
|
||||
* @param message Info message*/
|
||||
void info(const char* message);
|
||||
inline void info(const std::string &message);
|
||||
void info(const std::string &message);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Writes a warning message
|
||||
* @param message Warn message*/
|
||||
void warn(const char* message);
|
||||
inline void warn(const std::string &message);
|
||||
void warn(const std::string &message);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Writes an error message
|
||||
* @param message Error message*/
|
||||
void error(const char* message);
|
||||
inline void error(const std::string &message);
|
||||
void error(const std::string &message);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Set a new log severity.
|
||||
|
@ -159,15 +158,19 @@ public:
|
|||
unsigned int severity = Debugging | Err | Warn | Info) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
/** Default constructor */
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
Logger();
|
||||
|
||||
/** Construction with a given log severity */
|
||||
/**
|
||||
* Construction with a given log severity
|
||||
*/
|
||||
explicit Logger(LogSeverity severity);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Called as a request to write a specific debug message
|
||||
/**
|
||||
* @brief Called as a request to write a specific debug message
|
||||
* @param message Debug message. Never longer than
|
||||
* MAX_LOG_MESSAGE_LENGTH characters (excluding the '0').
|
||||
* @note The message string is only valid until the scope of
|
||||
|
@ -176,7 +179,8 @@ protected:
|
|||
virtual void OnDebug(const char* message)= 0;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Called as a request to write a specific info message
|
||||
/**
|
||||
* @brief Called as a request to write a specific info message
|
||||
* @param message Info message. Never longer than
|
||||
* MAX_LOG_MESSAGE_LENGTH characters (ecxluding the '0').
|
||||
* @note The message string is only valid until the scope of
|
||||
|
@ -185,7 +189,8 @@ protected:
|
|||
virtual void OnInfo(const char* message) = 0;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Called as a request to write a specific warn message
|
||||
/**
|
||||
* @brief Called as a request to write a specific warn message
|
||||
* @param message Warn message. Never longer than
|
||||
* MAX_LOG_MESSAGE_LENGTH characters (exluding the '0').
|
||||
* @note The message string is only valid until the scope of
|
||||
|
@ -194,7 +199,8 @@ protected:
|
|||
virtual void OnWarn(const char* essage) = 0;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Called as a request to write a specific error message
|
||||
/**
|
||||
* @brief Called as a request to write a specific error message
|
||||
* @param message Error message. Never longer than
|
||||
* MAX_LOG_MESSAGE_LENGTH characters (exluding the '0').
|
||||
* @note The message string is only valid until the scope of
|
||||
|
@ -203,66 +209,94 @@ protected:
|
|||
virtual void OnError(const char* message) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
//! Logger severity
|
||||
LogSeverity m_Severity;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Default constructor
|
||||
inline Logger::Logger() {
|
||||
inline
|
||||
Logger::Logger() {
|
||||
setLogSeverity(NORMAL);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Virtual destructor
|
||||
inline Logger::~Logger()
|
||||
{
|
||||
inline
|
||||
Logger::~Logger() {
|
||||
// empty
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Construction with given logging severity
|
||||
inline Logger::Logger(LogSeverity severity) {
|
||||
inline
|
||||
Logger::Logger(LogSeverity severity) {
|
||||
setLogSeverity(severity);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Log severity setter
|
||||
inline void Logger::setLogSeverity(LogSeverity log_severity){
|
||||
inline
|
||||
void Logger::setLogSeverity(LogSeverity log_severity){
|
||||
m_Severity = log_severity;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Log severity getter
|
||||
inline Logger::LogSeverity Logger::getLogSeverity() const {
|
||||
inline
|
||||
Logger::LogSeverity Logger::getLogSeverity() const {
|
||||
return m_Severity;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline void Logger::debug(const std::string &message)
|
||||
{
|
||||
inline
|
||||
void Logger::debug(const std::string &message) {
|
||||
return debug(message.c_str());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline void Logger::error(const std::string &message)
|
||||
{
|
||||
inline
|
||||
void Logger::error(const std::string &message) {
|
||||
return error(message.c_str());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline void Logger::warn(const std::string &message)
|
||||
{
|
||||
inline
|
||||
void Logger::warn(const std::string &message) {
|
||||
return warn(message.c_str());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline void Logger::info(const std::string &message)
|
||||
{
|
||||
inline
|
||||
void Logger::info(const std::string &message) {
|
||||
return info(message.c_str());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#define ASSIMP_LOG_WARN_F(string,...)\
|
||||
DefaultLogger::get()->warn((Formatter::format(string),__VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_ERROR_F(string,...)\
|
||||
DefaultLogger::get()->error((Formatter::format(string),__VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_DEBUG_F(string,...)\
|
||||
DefaultLogger::get()->debug((Formatter::format(string),__VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_INFO_F(string,...)\
|
||||
DefaultLogger::get()->info((Formatter::format(string),__VA_ARGS__))
|
||||
|
||||
|
||||
#define ASSIMP_LOG_WARN(string)\
|
||||
DefaultLogger::get()->warn(string)
|
||||
|
||||
#define ASSIMP_LOG_ERROR(string)\
|
||||
DefaultLogger::get()->error(string)
|
||||
|
||||
#define ASSIMP_LOG_DEBUG(string)\
|
||||
DefaultLogger::get()->debug(string)
|
||||
|
||||
#define ASSIMP_LOG_INFO(string)\
|
||||
DefaultLogger::get()->info(string)
|
||||
|
||||
|
||||
} // Namespace Assimp
|
||||
|
||||
|
|
Loading…
Reference in New Issue