Merge remote-tracking branch 'Winterleaf/Development-Console' into defineconsolemethod

Conflicts:
	Engine/source/T3D/missionMarker.cpp
This commit is contained in:
Daniel Buckmaster 2014-12-21 21:23:55 +11:00
commit 9396ae7176
146 changed files with 1713 additions and 2122 deletions

View file

@ -24,6 +24,7 @@
#include "materials/materialDefinition.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "math/mathTypes.h"
#include "materials/materialManager.h"
#include "sceneData.h"
@ -594,55 +595,55 @@ void Material::StageData::getFeatureSet( FeatureSet *outFeatures ) const
}
}
ConsoleMethod( Material, flush, void, 2, 2,
DefineConsoleMethod( Material, flush, void, (),,
"Flushes all material instances that use this material." )
{
object->flush();
}
ConsoleMethod( Material, reload, void, 2, 2,
DefineConsoleMethod( Material, reload, void, (),,
"Reloads all material instances that use this material." )
{
object->reload();
}
ConsoleMethod( Material, dumpInstances, void, 2, 2,
DefineConsoleMethod( Material, dumpInstances, void, (),,
"Dumps a formatted list of the currently allocated material instances for this material to the console." )
{
MATMGR->dumpMaterialInstances( object );
}
ConsoleMethod( Material, getAnimFlags, const char*, 3, 3, "" )
DefineConsoleMethod( Material, getAnimFlags, const char*, (U32 id), , "" )
{
char * animFlags = Con::getReturnBuffer(512);
if(object->mAnimFlags[ dAtoi(argv[2]) ] & Material::Scroll)
if(object->mAnimFlags[ id ] & Material::Scroll)
{
if(dStrcmp( animFlags, "" ) == 0)
dStrcpy( animFlags, "$Scroll" );
}
if(object->mAnimFlags[ dAtoi(argv[2]) ] & Material::Rotate)
if(object->mAnimFlags[ id ] & Material::Rotate)
{
if(dStrcmp( animFlags, "" ) == 0)
dStrcpy( animFlags, "$Rotate" );
else
dStrcat( animFlags, " | $Rotate");
}
if(object->mAnimFlags[ dAtoi(argv[2]) ] & Material::Wave)
if(object->mAnimFlags[ id ] & Material::Wave)
{
if(dStrcmp( animFlags, "" ) == 0)
dStrcpy( animFlags, "$Wave" );
else
dStrcat( animFlags, " | $Wave");
}
if(object->mAnimFlags[ dAtoi(argv[2]) ] & Material::Scale)
if(object->mAnimFlags[ id ] & Material::Scale)
{
if(dStrcmp( animFlags, "" ) == 0)
dStrcpy( animFlags, "$Scale" );
else
dStrcat( animFlags, " | $Scale");
}
if(object->mAnimFlags[ dAtoi(argv[2]) ] & Material::Sequence)
if(object->mAnimFlags[ id ] & Material::Sequence)
{
if(dStrcmp( animFlags, "" ) == 0)
dStrcpy( animFlags, "$Sequence" );
@ -653,20 +654,20 @@ ConsoleMethod( Material, getAnimFlags, const char*, 3, 3, "" )
return animFlags;
}
ConsoleMethod(Material, getFilename, const char*, 2, 2, "Get filename of material")
DefineConsoleMethod(Material, getFilename, const char*, (),, "Get filename of material")
{
SimObject *material = static_cast<SimObject *>(object);
return material->getFilename();
}
ConsoleMethod( Material, isAutoGenerated, bool, 2, 2,
DefineConsoleMethod( Material, isAutoGenerated, bool, (),,
"Returns true if this Material was automatically generated by MaterialList::mapMaterials()" )
{
return object->isAutoGenerated();
}
ConsoleMethod( Material, setAutoGenerated, void, 3, 3,
DefineConsoleMethod( Material, setAutoGenerated, void, (bool isAutoGenerated), ,
"setAutoGenerated(bool isAutoGenerated): Set whether or not the Material is autogenerated." )
{
object->setAutoGenerated(dAtob(argv[2]));
object->setAutoGenerated(isAutoGenerated);
}

View file

@ -30,6 +30,7 @@
#include "shaderGen/shaderGen.h"
#include "core/module.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
MODULE_BEGIN( MaterialManager )
@ -453,14 +454,14 @@ bool MaterialManager::_handleGFXEvent( GFXDevice::GFXDeviceEventType event_ )
return true;
}
ConsoleFunction( reInitMaterials, void, 1, 1,
DefineConsoleFunction( reInitMaterials, void, (),,
"@brief Flushes all procedural shaders and re-initializes all active material instances.\n\n"
"@ingroup Materials")
{
MATMGR->flushAndReInitInstances();
}
ConsoleFunction( addMaterialMapping, void, 3, 3, "(string texName, string matName)\n"
DefineConsoleFunction( addMaterialMapping, void, (const char * texName, const char * matName), , "(string texName, string matName)\n"
"@brief Maps the given texture to the given material.\n\n"
"Generates a console warning before overwriting.\n\n"
"Material maps are used by terrain and interiors for triggering "
@ -468,27 +469,27 @@ ConsoleFunction( addMaterialMapping, void, 3, 3, "(string texName, string matNam
"block or interior surface using the associated texture.\n\n"
"@ingroup Materials")
{
MATMGR->mapMaterial(argv[1], argv[2]);
MATMGR->mapMaterial(texName, matName);
}
ConsoleFunction( getMaterialMapping, const char*, 2, 2, "(string texName)\n"
DefineConsoleFunction( getMaterialMapping, const char*, (const char * texName), , "(string texName)\n"
"@brief Returns the name of the material mapped to this texture.\n\n"
"If no materials are found, an empty string is returned.\n\n"
"@param texName Name of the texture\n\n"
"@ingroup Materials")
{
return MATMGR->getMapEntry(argv[1]).c_str();
return MATMGR->getMapEntry(texName).c_str();
}
ConsoleFunction( dumpMaterialInstances, void, 1, 1,
DefineConsoleFunction( dumpMaterialInstances, void, (), ,
"@brief Dumps a formatted list of currently allocated material instances to the console.\n\n"
"@ingroup Materials")
{
MATMGR->dumpMaterialInstances();
}
ConsoleFunction( getMapEntry, const char *, 2, 2,
DefineConsoleFunction( getMapEntry, const char*, (const char * texName), ,
"@hide")
{
return MATMGR->getMapEntry( argv[1] );
return MATMGR->getMapEntry( String(texName) );
}