Torque3D Documentation / _generateds / lightDescription.cpp

lightDescription.cpp

Engine/source/T3D/lightDescription.cpp

More...

Public Functions

ConsoleDocClass(LightDescription , "@brief A helper datablock used by classes (such as shapebase) " "that submit lights <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the scene but do not use actual \"LightBase\" objects.\n\n" "This datablock stores the properties of that light as fields that can be initialized from script." "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Declare <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> light description <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be used on <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> rocket launcher <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">projectile\n</a>" "datablock <a href="/coding/class/classlightdescription/">LightDescription</a>(RocketLauncherLightDesc)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   range = 4.0;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   color = \"1 1 0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   brightness = 5.0;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   animationType = PulseLightAnim;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   animationPeriod = 0.25;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "// Declare <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> ProjectileDatablock which uses the light <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">description\n</a>" "datablock <a href="/coding/class/classprojectiledata/">ProjectileData</a>(RocketLauncherProjectile)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   lightDesc = RocketLauncherLightDesc;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "   projectileShapeName = \"art/shapes/weapons/SwarmGun/rocket.dts\";\n\n" "   directDamage = 30;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   radiusDamage = 30;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   damageRadius = 5;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   areaImpulse = 2500;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "   // ... remaining <a href="/coding/class/classprojectiledata/">ProjectileData</a> fields not listed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">example\n</a>" "};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">LightBase\n\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Lighting\n</a>" )
DefineEngineMethod(LightDescription , apply , void , () , "@brief Force an inspectPostApply call <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the benefit of tweaking via the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">console\n\n</a>" "Normally this functionality is only exposed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> objects via the <a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a81f4537631c9ab219ec74de554483adc">World</a> Editor, once changes have been made. " "Exposing apply <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> script allows you <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> make changes <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> it on the fly without the <a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a81f4537631c9ab219ec74de554483adc">World</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Editor.\n\n</a>" " @note This is intended <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> debugging and tweaking)

Detailed Description

Public Functions

ConsoleDocClass(LightDescription , "@brief A helper datablock used by classes (such as shapebase) " "that submit lights <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the scene but do not use actual \"LightBase\" objects.\n\n" "This datablock stores the properties of that light as fields that can be initialized from script." "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Declare <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> light description <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be used on <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> rocket launcher <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">projectile\n</a>" "datablock <a href="/coding/class/classlightdescription/">LightDescription</a>(RocketLauncherLightDesc)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   range = 4.0;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   color = \"1 1 0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   brightness = 5.0;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   animationType = PulseLightAnim;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   animationPeriod = 0.25;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "// Declare <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> ProjectileDatablock which uses the light <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">description\n</a>" "datablock <a href="/coding/class/classprojectiledata/">ProjectileData</a>(RocketLauncherProjectile)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   lightDesc = RocketLauncherLightDesc;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "   projectileShapeName = \"art/shapes/weapons/SwarmGun/rocket.dts\";\n\n" "   directDamage = 30;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   radiusDamage = 30;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   damageRadius = 5;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   areaImpulse = 2500;\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "   // ... remaining <a href="/coding/class/classprojectiledata/">ProjectileData</a> fields not listed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">example\n</a>" "};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">LightBase\n\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Lighting\n</a>" )

DefineEngineMethod(LightDescription , apply , void , () , "@brief Force an inspectPostApply call <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the benefit of tweaking via the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">console\n\n</a>" "Normally this functionality is only exposed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> objects via the <a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a81f4537631c9ab219ec74de554483adc">World</a> Editor, once changes have been made. " "Exposing apply <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> script allows you <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> make changes <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> it on the fly without the <a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a81f4537631c9ab219ec74de554483adc">World</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Editor.\n\n</a>" " @note This is intended <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> debugging and tweaking)

IMPLEMENT_CO_DATABLOCK_V1(LightDescription )

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#include "platform/platform.h"
 25#include "T3D/lightDescription.h"
 26
 27#include "lighting/lightManager.h"
 28#include "T3D/lightFlareData.h"
 29#include "T3D/lightAnimData.h"
 30#include "core/stream/bitStream.h"
 31#include "lighting/lightInfo.h"
 32#include "console/engineAPI.h"
 33
 34
 35LightDescription::LightDescription()
 36 : color( LinearColorF::WHITE ),
 37   brightness( 1.0f ),
 38   range( 5.0f ),
 39   castShadows( false ),
 40   mStaticRefreshFreq( 250 ),
 41   mDynamicRefreshFreq( 8 ),
 42   animationData( NULL ),
 43   animationDataId( 0 ),
 44   animationPeriod( 1.0f ),
 45   animationPhase( 1.0f ),
 46   flareData( NULL ),
 47   flareDataId( 0 ),
 48   flareScale( 1.0f )
 49{   
 50}
 51
 52LightDescription::~LightDescription()
 53{
 54
 55}
 56
 57IMPLEMENT_CO_DATABLOCK_V1( LightDescription );
 58
 59ConsoleDocClass( LightDescription,
 60   "@brief A helper datablock used by classes (such as shapebase) "
 61   "that submit lights to the scene but do not use actual \"LightBase\" objects.\n\n"
 62
 63   "This datablock stores the properties of that light as fields that can be initialized from script."
 64
 65   "@tsexample\n"
 66   "// Declare a light description to be used on a rocket launcher projectile\n"
 67   "datablock LightDescription(RocketLauncherLightDesc)\n"
 68   "{\n"
 69   "   range = 4.0;\n"
 70   "   color = \"1 1 0\";\n"
 71   "   brightness = 5.0;\n"
 72   "   animationType = PulseLightAnim;\n"
 73   "   animationPeriod = 0.25;\n"
 74   "};\n\n"
 75   "// Declare a ProjectileDatablock which uses the light description\n"
 76   "datablock ProjectileData(RocketLauncherProjectile)\n"
 77   "{\n"
 78   "   lightDesc = RocketLauncherLightDesc;\n\n"
 79   "   projectileShapeName = \"art/shapes/weapons/SwarmGun/rocket.dts\";\n\n"
 80   "   directDamage = 30;\n"
 81   "   radiusDamage = 30;\n"
 82   "   damageRadius = 5;\n"
 83   "   areaImpulse = 2500;\n\n"
 84   "   // ... remaining ProjectileData fields not listed for this example\n"
 85   "};\n"
 86   "@endtsexample\n\n"
 87
 88   "@see LightBase\n\n"
 89   "@ingroup Lighting\n"
 90);
 91
 92void LightDescription::initPersistFields()
 93{
 94   addGroup( "Light" );
 95
 96      addField( "color", TypeColorF, Offset( color, LightDescription ), "Changes the base color hue of the light." );
 97      addField( "brightness", TypeF32, Offset( brightness, LightDescription ), "Adjusts the lights power, 0 being off completely." );      
 98      addField( "range", TypeF32, Offset( range, LightDescription ), "Controls the size (radius) of the light" );
 99      addField( "castShadows", TypeBool, Offset( castShadows, LightDescription ), "Enables/disabled shadow casts by this light." );
100      addField( "staticRefreshFreq", TypeS32, Offset( mStaticRefreshFreq, LightDescription ), "static shadow refresh rate (milliseconds)" );
101      addField( "dynamicRefreshFreq", TypeS32, Offset( mDynamicRefreshFreq, LightDescription ), "dynamic shadow refresh rate (milliseconds)");
102
103   endGroup( "Light" );
104
105   addGroup( "Light Animation" );
106
107      addField( "animationType", TYPEID< LightAnimData >(), Offset( animationData, LightDescription ), "Datablock containing light animation information (LightAnimData)" );
108      addField( "animationPeriod", TypeF32, Offset( animationPeriod, LightDescription ), "The length of time in seconds for a single playback of the light animation" );
109      addField( "animationPhase", TypeF32, Offset( animationPhase, LightDescription ), "The phase used to offset the animation start time to vary the animation of nearby lights." );
110
111   endGroup( "Light Animation" );
112
113   addGroup( "Misc" );
114
115      addField( "flareType", TYPEID< LightFlareData >(), Offset( flareData, LightDescription ), "Datablock containing light flare information (LightFlareData)" );
116      addField( "flareScale", TypeF32, Offset( flareScale, LightDescription ), "Globally scales all features of the light flare" );
117
118   endGroup( "Misc" );
119
120   LightManager::initLightFields();
121
122   Parent::initPersistFields();
123}
124
125void LightDescription::inspectPostApply()
126{
127   Parent::inspectPostApply();
128
129   // Hack to allow changing properties in game.
130   // Do the same work as preload.
131   animationData = NULL;
132   flareData = NULL;
133
134   String str;
135   _preload( false, str );
136}
137
138bool LightDescription::onAdd()
139{
140   if ( !Parent::onAdd() )
141      return false;
142
143   return true;
144}
145bool LightDescription::preload( bool server, String &errorStr )
146{
147   if ( !Parent::preload( server, errorStr ) )
148      return false;
149
150   return _preload( server, errorStr );  
151}
152
153void LightDescription::packData( BitStream *stream )
154{
155   Parent::packData( stream );
156
157   stream->write( color );
158   stream->write( brightness );
159   stream->write( range );
160   stream->writeFlag( castShadows );
161   stream->write(mStaticRefreshFreq);
162   stream->write(mDynamicRefreshFreq);
163
164   stream->write( animationPeriod );
165   stream->write( animationPhase );
166   stream->write( flareScale );
167
168   if ( stream->writeFlag( animationData ) )
169   {
170      stream->writeRangedU32( animationData->getId(),
171         DataBlockObjectIdFirst, 
172         DataBlockObjectIdLast );
173   }
174
175   if ( stream->writeFlag( flareData ) )
176   {
177      stream->writeRangedU32( flareData->getId(),
178         DataBlockObjectIdFirst, 
179         DataBlockObjectIdLast );
180   }
181}
182
183void LightDescription::unpackData( BitStream *stream )
184{
185   Parent::unpackData( stream );
186
187   stream->read( &color );
188   stream->read( &brightness );     
189   stream->read( &range );
190   castShadows = stream->readFlag();
191   stream->read(&mStaticRefreshFreq);
192   stream->read(&mDynamicRefreshFreq);
193
194   stream->read( &animationPeriod );
195   stream->read( &animationPhase );
196   stream->read( &flareScale );
197   
198   if ( stream->readFlag() )   
199      animationDataId = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );  
200
201   if ( stream->readFlag() )
202      flareDataId = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );  
203}
204
205void LightDescription::submitLight( LightState *state, const MatrixF &xfm, LightManager *lm, SimObject *object )
206{
207   LightInfo *li = state->lightInfo;
208   
209   li->setRange( range );
210   li->setColor( color );
211   li->setCastShadows( castShadows );
212   li->setStaticRefreshFreq(mStaticRefreshFreq);
213   li->setDynamicRefreshFreq(mDynamicRefreshFreq);
214   li->setTransform( xfm );
215
216   if ( animationData )
217   {      
218      LightAnimState *animState = &state->animState;   
219
220      animState->brightness = brightness;
221      animState->transform = xfm;
222      animState->color = color;
223      animState->animationPeriod = animationPeriod;
224      animState->animationPhase = animationPhase;      
225
226      animationData->animate( li, animState );
227   }
228
229   lm->registerGlobalLight( li, object );
230}
231
232void LightDescription::prepRender( SceneRenderState *sceneState, LightState *lightState, const MatrixF &xfm )
233{
234   if ( flareData )
235   {
236      LightFlareState *flareState = &lightState->flareState;
237      flareState->fullBrightness = brightness;
238      flareState->scale = flareScale;
239      flareState->lightMat = xfm;
240      flareState->lightInfo = lightState->lightInfo;
241
242      flareData->prepRender( sceneState, flareState );
243   }
244}
245
246bool LightDescription::_preload( bool server, String &errorStr )
247{
248   if (!animationData && animationDataId != 0)
249      if (Sim::findObject(animationDataId, animationData) == false)
250         Con::errorf(ConsoleLogEntry::General, "LightDescription::onAdd: Invalid packet, bad datablockId(animationData): %d", animationDataId);
251
252   if (!flareData && flareDataId != 0)
253      if (Sim::findObject(flareDataId, flareData) == false)
254         Con::errorf(ConsoleLogEntry::General, "LightDescription::onAdd: Invalid packet, bad datablockId(flareData): %d", flareDataId); 
255
256   return true;
257}
258
259DefineEngineMethod( LightDescription, apply, void, (),,
260   "@brief Force an inspectPostApply call for the benefit of tweaking via the console\n\n"
261   
262   "Normally this functionality is only exposed to objects via the World Editor, once changes have been made. "
263   "Exposing apply to script allows you to make changes to it on the fly without the World Editor.\n\n"
264
265   "@note This is intended for debugging and tweaking, not for game play\n\n"
266
267   "@tsexample\n"
268   "// Change a property of the light description\n"
269   "RocketLauncherLightDesc.brightness = 10;\n\n"
270   "// Make it so\n"
271   "RocketLauncherLightDesc.apply();\n"
272   
273   "@endtsexample\n\n"
274)
275{
276  object->inspectPostApply();
277}
278
279//ConsoleMethod( LightDescription, apply, void, 2, 2, "force an inspectPostApply for the benefit of tweaking via the console" )
280//{
281//   object->inspectPostApply();
282//}
283