Browse Source

Merge pull request #152 from AtomicGameEngine/JME-ATOMIC-LIGHT2DFIXES

Guard against editor in Light2D
JoshEngebretson 10 years ago
parent
commit
b78358484f
1 changed files with 4 additions and 4 deletions
  1. 4 4
      Source/Atomic/Atomic2D/Light2D.cpp

+ 4 - 4
Source/Atomic/Atomic2D/Light2D.cpp

@@ -55,7 +55,7 @@ void Light2D::SetNumRays(int numRays)
 
 void Light2D::OnSceneSet(Scene* scene)
 {
-    if (scene)
+    if (scene && !context_->GetEditorContext())
     {
         PODVector<Light2DGroup*> lightgroups;
         scene->GetComponents<Light2DGroup>(lightgroups, true);
@@ -383,7 +383,7 @@ void PositionalLight2D::RegisterObject(Context* context)
 
 void PositionalLight2D::UpdateVertices()
 {
-    if (!lightgroup_ || !enabled_)
+    if (!lightgroup_ || !enabled_ || context_->GetEditorContext())
     {
         vertices_.Clear();
         return;
@@ -499,7 +499,7 @@ void PointLight2D::UpdateVertices()
 {
     const Node* lightNode = GetNode();
 
-    if (!lightgroup_ || !enabled_ || !lightNode)
+    if (!lightgroup_ || !enabled_ || !lightNode || context_->GetEditorContext())
     {
         vertices_.Clear();
         return;
@@ -536,7 +536,7 @@ void Light2DGroup::RegisterObject(Context* context)
 void Light2DGroup::OnSceneSet(Scene* scene)
 {
 
-    if (scene && node_)
+    if (scene && node_ && !context_->GetEditorContext())
     {
         physicsWorld_ = scene->GetOrCreateComponent<PhysicsWorld2D>();