diff --git a/Engine/source/console/dynamicTypes.h b/Engine/source/console/dynamicTypes.h index e06f3e6b3..476d029f9 100644 --- a/Engine/source/console/dynamicTypes.h +++ b/Engine/source/console/dynamicTypes.h @@ -284,6 +284,26 @@ const EngineTypeInfo* _MAPTYPE() { return TYPE< T >(); } }; \ ConsoleType ## type gConsoleType ## type ## Instance; +#define ConsoleMappedType( typeName, type, consoleType, nativeType, typePrefix ) \ + S32 type; \ + class ConsoleType##type : public ConsoleBaseType \ + { \ + public: \ + typedef nativeType T; \ + ConsoleType##type() \ + : ConsoleBaseType( sizeof( nativeType ), &type, #type ) \ + { \ + mTypeInfo = _MAPTYPE< consoleType >(); \ + } \ + virtual void setData(void *dptr, S32 argc, const char **argv, const EnumTable *tbl, BitSet32 flag); \ + virtual const char *getData(void *dptr, const EnumTable *tbl, BitSet32 flag ); \ + virtual const char *getTypeClassName() { return #typeName ; } \ + virtual void *getNativeVariable() { T* var = new T; return (void*)var; } \ + virtual void deleteNativeVariable(void* var) { T* nativeVar = reinterpret_cast(var); delete nativeVar; } \ + virtual StringTableEntry getTypePrefix( void ) const { return StringTable->insert( typePrefix ); } \ + }; \ + ConsoleType ## type gConsoleType ## type ## Instance; + #define ImplementConsoleTypeCasters( type, nativeType ) \ const char *castConsoleTypeToString( _ConsoleConstType< nativeType >::ConstType &arg ) { return Con::getData(type, const_cast< nativeType* >( &arg ), 0); } \ bool castConsoleTypeFromString( nativeType &arg, const char *str ) { Con::setData(type, const_cast< nativeType* >( &arg ), 0, 1, &str); return true; } \ diff --git a/Engine/source/math/mathTypes.cpp b/Engine/source/math/mathTypes.cpp index ba8c49dca..14c7335e8 100644 --- a/Engine/source/math/mathTypes.cpp +++ b/Engine/source/math/mathTypes.cpp @@ -376,7 +376,7 @@ ConsoleSetType( TypeMatrixF ) //----------------------------------------------------------------------------- // TypeMatrixPosition //----------------------------------------------------------------------------- -ConsoleType(MatrixPosition, TypeMatrixPosition, MatrixF, "") +ConsoleMappedType(MatrixPosition, TypeMatrixPosition, Point3F, MatrixF, "") ConsoleGetType( TypeMatrixPosition ) { @@ -411,7 +411,7 @@ ConsoleSetType( TypeMatrixPosition ) //----------------------------------------------------------------------------- // TypeMatrixRotation //----------------------------------------------------------------------------- -ConsoleType(MatrixRotation, TypeMatrixRotation, MatrixF, "") +ConsoleMappedType(MatrixRotation, TypeMatrixRotation, AngAxisF, MatrixF, "") ConsoleGetType( TypeMatrixRotation ) {