Fix #35696: cycles crash with no world assigned to scene, after recent changes.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 9 Jun 2013 18:05:53 +0000 (18:05 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 9 Jun 2013 18:05:53 +0000 (18:05 +0000)
intern/cycles/blender/blender_sync.cpp

index ef9ce85ddf8080cc8d34e7aff93e6439dfa25026..72ed1b84915b4ebf0289b2bc3e79891ad0e7d650 100644 (file)
@@ -211,7 +211,6 @@ void BlenderSync::sync_integrator()
 void BlenderSync::sync_film()
 {
        PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
-       BL::WorldMistSettings b_mist = b_scene.world().mist_settings();
 
        Film *film = scene->film;
        Film prevfilm = *film;
@@ -220,19 +219,23 @@ void BlenderSync::sync_film()
        film->filter_type = (FilterType)RNA_enum_get(&cscene, "filter_type");
        film->filter_width = (film->filter_type == FILTER_BOX)? 1.0f: get_float(cscene, "filter_width");
 
-       film->mist_start = b_mist.start();
-       film->mist_depth = b_mist.depth();
-
-       switch(b_mist.falloff()) {
-               case BL::WorldMistSettings::falloff_QUADRATIC:
-                       film->mist_falloff = 2.0f;
-                       break;
-               case BL::WorldMistSettings::falloff_LINEAR:
-                       film->mist_falloff = 1.0f;
-                       break;
-               case BL::WorldMistSettings::falloff_INVERSE_QUADRATIC:
-                       film->mist_falloff = 0.5f;
-                       break;
+       if(b_scene.world()) {
+               BL::WorldMistSettings b_mist = b_scene.world().mist_settings();
+
+               film->mist_start = b_mist.start();
+               film->mist_depth = b_mist.depth();
+
+               switch(b_mist.falloff()) {
+                       case BL::WorldMistSettings::falloff_QUADRATIC:
+                               film->mist_falloff = 2.0f;
+                               break;
+                       case BL::WorldMistSettings::falloff_LINEAR:
+                               film->mist_falloff = 1.0f;
+                               break;
+                       case BL::WorldMistSettings::falloff_INVERSE_QUADRATIC:
+                               film->mist_falloff = 0.5f;
+                               break;
+               }
        }
 
        if(film->modified(prevfilm))