mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 19:53:48 +00:00
Adds handling for datablocks to be reloaded if the assets they utilize have their files directly edited.
This commit is contained in:
parent
0eafadb1a0
commit
f31acf774e
23 changed files with 121 additions and 37 deletions
|
|
@ -425,39 +425,42 @@ void SimDataBlock::write(Stream &stream, U32 tabStop, U32 flags)
|
|||
// MARK: ---- API ----
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod( SimDataBlock, reloadOnLocalClient, void, (),,
|
||||
"Reload the datablock. This can only be used with a local client configuration." )
|
||||
void SimDataBlock::reloadOnLocalClient()
|
||||
{
|
||||
// Make sure we're running a local client.
|
||||
|
||||
GameConnection* localClient = GameConnection::getLocalClientConnection();
|
||||
if( !localClient )
|
||||
if (!localClient)
|
||||
return;
|
||||
|
||||
// Do an in-place pack/unpack/preload.
|
||||
|
||||
if( !object->preload( true, NetConnection::getErrorBuffer() ) )
|
||||
if (!preload(true, NetConnection::getErrorBuffer()))
|
||||
{
|
||||
Con::errorf( NetConnection::getErrorBuffer() );
|
||||
Con::errorf(NetConnection::getErrorBuffer());
|
||||
return;
|
||||
}
|
||||
|
||||
U8 buffer[ 16384 ];
|
||||
BitStream stream( buffer, 16384 );
|
||||
U8 buffer[16384];
|
||||
BitStream stream(buffer, 16384);
|
||||
|
||||
object->packData( &stream );
|
||||
packData(&stream);
|
||||
stream.setPosition(0);
|
||||
object->unpackData( &stream );
|
||||
unpackData(&stream);
|
||||
|
||||
if( !object->preload( false, NetConnection::getErrorBuffer() ) )
|
||||
if (!preload(false, NetConnection::getErrorBuffer()))
|
||||
{
|
||||
Con::errorf( NetConnection::getErrorBuffer() );
|
||||
Con::errorf(NetConnection::getErrorBuffer());
|
||||
return;
|
||||
}
|
||||
|
||||
// Trigger a post-apply so that change notifications respond.
|
||||
object->inspectPostApply();
|
||||
inspectPostApply();
|
||||
}
|
||||
DefineEngineMethod( SimDataBlock, reloadOnLocalClient, void, (),,
|
||||
"Reload the datablock. This can only be used with a local client configuration." )
|
||||
{
|
||||
object->reloadOnLocalClient();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue