Просмотр исходного кода

~ Material's passes do not have textures everytime

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
Alexis Maiquez 7 лет назад
Родитель
Сommit
b85b12d4a1
1 измененных файлов с 18 добавлено и 17 удалено
  1. 18 17
      wallpaperengine/core/objects/images/materials/passes.cpp

+ 18 - 17
wallpaperengine/core/objects/images/materials/passes.cpp

@@ -57,14 +57,12 @@ passes* passes::fromJSON (json data)
         throw std::runtime_error ("Material pass must have shader specified");
         throw std::runtime_error ("Material pass must have shader specified");
     }
     }
 
 
-    if (textures_it == data.end ())
+    if (textures_it != data.end ())
     {
     {
-        throw std::runtime_error ("Material pass must have textures specified");
-    }
-
-    if ((*textures_it).is_array () == false)
-    {
-        throw std::runtime_error ("Textures for material must be a list");
+        if ((*textures_it).is_array () == false)
+        {
+            throw std::runtime_error ("Textures for material must be a list");
+        }
     }
     }
 
 
     passes* pass = new passes (
     passes* pass = new passes (
@@ -75,18 +73,21 @@ passes* passes::fromJSON (json data)
         *shader_it
         *shader_it
     );
     );
 
 
-    json::const_iterator cur = (*textures_it).begin ();
-    json::const_iterator end = (*textures_it).end ();
-
-    for (;cur != end; cur ++)
+    if (textures_it != data.end ())
     {
     {
-        if ((*cur).is_null () == true)
-        {
-            pass->insertTexture ("");
-        }
-        else
+        json::const_iterator cur = (*textures_it).begin ();
+        json::const_iterator end = (*textures_it).end ();
+
+        for (;cur != end; cur ++)
         {
         {
-            pass->insertTexture (*cur);
+            if ((*cur).is_null () == true)
+            {
+                pass->insertTexture ("");
+            }
+            else
+            {
+                pass->insertTexture (*cur);
+            }
         }
         }
     }
     }