Browse Source

Detached component is considered as not enabled effectively regardless of its own enabled flag. Tweaked the 'expansion triangle' icon.

Wei Tjong Yao 12 years ago
parent
commit
2a4a089fc1

BIN
Bin/Data/Textures/UI.png


+ 1 - 2
Engine/Audio/SoundSource3D.cpp

@@ -103,8 +103,7 @@ void SoundSource3D::CalculateAttenuation()
         SoundListener* listener = audio_->GetListener();
         SoundListener* listener = audio_->GetListener();
         
         
         // Listener must either be sceneless or in the same scene, else attenuate sound to silence
         // Listener must either be sceneless or in the same scene, else attenuate sound to silence
-        if (listener && listener->GetNode() && listener->IsEnabledEffective() && (!listener->GetScene() ||
-            listener->GetScene() == GetScene()))
+        if (listener && listener->IsEnabledEffective() && (!listener->GetScene() || listener->GetScene() == GetScene()))
         {
         {
             Node* listenerNode = listener->GetNode();
             Node* listenerNode = listener->GetNode();
             Vector3 relativePos(listenerNode->GetWorldRotation().Inverse() * (node_->GetWorldPosition() - listenerNode->GetWorldPosition()));
             Vector3 relativePos(listenerNode->GetWorldRotation().Inverse() * (node_->GetWorldPosition() - listenerNode->GetWorldPosition()));

+ 2 - 2
Engine/Graphics/Terrain.cpp

@@ -640,6 +640,8 @@ void Terrain::CreateGeometry()
 
 
         patches_.Reserve(numPatches_.x_ * numPatches_.y_);
         patches_.Reserve(numPatches_.x_ * numPatches_.y_);
 
 
+        bool enabled = IsEnabledEffective();
+
         // Create patches and set node transforms
         // Create patches and set node transforms
         for (int z = 0; z < numPatches_.y_; ++z)
         for (int z = 0; z < numPatches_.y_; ++z)
         {
         {
@@ -657,8 +659,6 @@ void Terrain::CreateGeometry()
                 patch->SetOwner(this);
                 patch->SetOwner(this);
                 patch->SetCoordinates(IntVector2(x, z));
                 patch->SetCoordinates(IntVector2(x, z));
                 
                 
-                bool enabled = IsEnabledEffective();
-                
                 // Copy initial drawable parameters
                 // Copy initial drawable parameters
                 patch->SetEnabled(enabled);
                 patch->SetEnabled(enabled);
                 patch->SetMaterial(material_);
                 patch->SetMaterial(material_);

+ 1 - 1
Engine/Graphics/View.cpp

@@ -276,7 +276,7 @@ bool View::Define(RenderSurface* renderTarget, Viewport* viewport)
 {
 {
     Scene* scene = viewport->GetScene();
     Scene* scene = viewport->GetScene();
     Camera* camera = viewport->GetCamera();
     Camera* camera = viewport->GetCamera();
-    if (!scene || !camera || !camera->GetNode() || !camera->IsEnabledEffective())
+    if (!scene || !camera || !camera->IsEnabledEffective())
         return false;
         return false;
     
     
     // If scene is loading asynchronously, it is incomplete and should not be rendered
     // If scene is loading asynchronously, it is incomplete and should not be rendered

+ 1 - 1
Engine/Graphics/Zone.cpp

@@ -83,7 +83,7 @@ void Zone::OnSetAttribute(const AttributeInfo& attr, const Variant& src)
 {
 {
     Component::OnSetAttribute(attr, src);
     Component::OnSetAttribute(attr, src);
     
     
-    // If bounding box, visibility or priority changes, dirty the drawable as applicable
+    // If bounding box or priority changes, dirty the drawable as applicable
     if ((attr.offset_ >= offsetof(Zone, boundingBox_) && attr.offset_ < (offsetof(Zone, boundingBox_) + sizeof(BoundingBox))) ||
     if ((attr.offset_ >= offsetof(Zone, boundingBox_) && attr.offset_ < (offsetof(Zone, boundingBox_) + sizeof(BoundingBox))) ||
         attr.offset_ == offsetof(Zone, priority_))
         attr.offset_ == offsetof(Zone, priority_))
         OnMarkedDirty(node_);
         OnMarkedDirty(node_);

+ 1 - 1
Engine/Scene/Component.cpp

@@ -216,7 +216,7 @@ Component* Component::GetComponent(ShortStringHash type) const
 
 
 bool Component::IsEnabledEffective() const
 bool Component::IsEnabledEffective() const
 {
 {
-    return node_ ? node_->IsEnabled() && enabled_ : enabled_;
+    return enabled_ && node_ && node_->IsEnabled();
 }
 }
 
 
 void Component::GetComponents(PODVector<Component*>& dest, ShortStringHash type) const
 void Component::GetComponents(PODVector<Component*>& dest, ShortStringHash type) const