Converts all game, gui editor, and system classes to utilize assets

Processed core, tools and default modules to utilize assets
Converted all console types that were string based, such as TypeImageFilename to utilize const char*/the string table, which avoids a lot of type swapping shenanigans and avoids string corruption
Removed unneeded MainEditor mockup module
Removed some unused/duplicate image assets from the tools
This commit is contained in:
Areloch 2021-07-19 01:07:08 -05:00
parent 83b0432283
commit 5525f8ecdd
1708 changed files with 19619 additions and 4596 deletions

View file

@ -208,7 +208,7 @@ bool VehicleData::preload(bool server, String &errorStr)
if (!collisionDetails.size() || collisionDetails[0] == -1)
{
Con::errorf("VehicleData::preload failed: Vehicle models must define a collision-1 detail");
errorStr = String::ToString("VehicleData: Couldn't load shape \"%s\"", mShapeName);
errorStr = String::ToString("VehicleData: Couldn't load shape asset \"%s\"", mShapeAsset.getAssetId());
return false;
}

View file

@ -75,8 +75,8 @@ ConsoleDocClass( WheeledVehicleTire,
WheeledVehicleTire::WheeledVehicleTire()
{
shape = 0;
shapeName = "";
INIT_SHAPEASSET(Shape);
staticFriction = 1;
kineticFriction = 0.5f;
restitution = 1;
@ -94,21 +94,17 @@ bool WheeledVehicleTire::preload(bool server, String &errorStr)
{
// Load up the tire shape. ShapeBase has an option to force a
// CRC check, this is left out here, but could be easily added.
if (shapeName && shapeName[0])
if (!mShape)
{
errorStr = String::ToString("WheeledVehicleTire: Couldn't load shape \"%s\"", mShapeAssetId);
return false;
}
else
{
// Load up the shape resource
shape = ResourceManager::get().load(shapeName);
if (!bool(shape))
{
errorStr = String::ToString("WheeledVehicleTire: Couldn't load shape \"%s\"",shapeName);
return false;
}
// Determinw wheel radius from the shape's bounding box.
// The tire should be built with it's hub axis along the
// object's Y axis.
radius = shape->mBounds.len_z() / 2;
radius = mShape->mBounds.len_z() / 2;
}
return true;
@ -116,8 +112,8 @@ bool WheeledVehicleTire::preload(bool server, String &errorStr)
void WheeledVehicleTire::initPersistFields()
{
addField( "shapeFile",TypeShapeFilename,Offset(shapeName,WheeledVehicleTire),
"The path to the shape to use for the wheel." );
INITPERSISTFIELD_SHAPEASSET(Shape, WheeledVehicleTire, "The shape to use for the wheel.");
addField( "mass", TypeF32, Offset(mass, WheeledVehicleTire),
"The mass of the wheel.\nCurrently unused." );
addField( "radius", TypeF32, Offset(radius, WheeledVehicleTire),
@ -181,7 +177,8 @@ void WheeledVehicleTire::packData(BitStream* stream)
{
Parent::packData(stream);
stream->writeString(shapeName);
PACKDATA_SHAPEASSET(Shape);
stream->write(mass);
stream->write(staticFriction);
stream->write(kineticFriction);
@ -199,7 +196,8 @@ void WheeledVehicleTire::unpackData(BitStream* stream)
{
Parent::unpackData(stream);
shapeName = stream->readSTString();
UNPACKDATA_SHAPEASSET(Shape);
stream->read(&mass);
stream->read(&staticFriction);
stream->read(&kineticFriction);
@ -1542,8 +1540,8 @@ void WheeledVehicle::unpackUpdate(NetConnection *con, BitStream *stream)
// Create an instance of the tire for rendering
delete wheel->shapeInstance;
wheel->shapeInstance = (wheel->tire->shape == NULL) ? 0:
new TSShapeInstance(wheel->tire->shape);
wheel->shapeInstance = (wheel->tire->mShape == NULL) ? 0:
new TSShapeInstance(wheel->tire->mShape);
}
}
}

View file

@ -31,6 +31,8 @@
#include "collision/clippedPolyList.h"
#endif
#include "T3D/assets/ShapeAsset.h"
class ParticleEmitter;
class ParticleEmitterData;
@ -41,8 +43,8 @@ struct WheeledVehicleTire: public SimDataBlock
{
typedef SimDataBlock Parent;
//
StringTableEntry shapeName;// Max shape to render
DECLARE_SHAPEASSET(WheeledVehicleTire, Shape, onShapeChanged);
DECLARE_SHAPEASSET_SETGET(WheeledVehicleTire, Shape);
// Physical properties
F32 mass; // Mass of the whole wheel
@ -62,7 +64,6 @@ struct WheeledVehicleTire: public SimDataBlock
F32 longitudinalRelaxation;
// Shape information initialized in the preload
Resource<TSShape> shape; // The loaded shape
F32 radius; // Tire radius
//
@ -72,6 +73,8 @@ struct WheeledVehicleTire: public SimDataBlock
bool preload(bool, String &errorStr);
virtual void packData(BitStream* stream);
virtual void unpackData(BitStream* stream);
void onShapeChanged() {}
};