svn merge ^/trunk/blender -r49757:49763
authorCampbell Barton <ideasman42@gmail.com>
Fri, 10 Aug 2012 10:37:31 +0000 (10:37 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 10 Aug 2012 10:37:31 +0000 (10:37 +0000)
1  2 
intern/cycles/blender/blender_object.cpp
intern/cycles/blender/blender_sync.h

index 6575cc84814ba48e93e73b0941d9b09d2797a471,eb9cc7bc4de34caaee44acd92ec4cfd220063879..813314f67a6a0582787bb5bb5baa2855500732da
@@@ -247,8 -247,11 +247,11 @@@ void BlenderSync::sync_object(BL::Objec
                scene->object_manager->tag_update(scene);
        }
  
+       /* updated dupli objects require particle sync */
+       bool need_particle_update = object_need_particle_update(b_ob);
        /* object sync */
-       if(object_updated || (object->mesh && object->mesh->need_update)) {
+       if(object_updated || (object->mesh && object->mesh->need_update) || need_particle_update) {
                object->name = b_ob.name().c_str();
                object->pass_id = b_ob.pass_index();
                object->tfm = tfm;
                object->particle_id = particle_id;
  
                /* particle sync */
-               if (object_use_particles(b_ob))
+               if (need_particle_update)
                        sync_particles(object, b_ob);
        
                object->tag_update(scene);
@@@ -302,17 -305,14 +305,17 @@@ void BlenderSync::sync_objects(BL::Spac
        BL::Scene b_sce = b_scene;
        int particle_offset = 0;
  
 -      for(; b_sce; b_sce = b_sce.background_set()) {
 -              for(b_sce.objects.begin(b_ob); b_ob != b_sce.objects.end(); ++b_ob) {
 +      bool cancel = false;
 +
 +      for(; b_sce && !cancel; b_sce = b_sce.background_set()) {
 +              for(b_sce.objects.begin(b_ob); b_ob != b_sce.objects.end() && !cancel; ++b_ob) {
                        bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render();
                        uint ob_layer = get_layer(b_ob->layers(), b_ob->layers_local_view(), object_is_light(*b_ob));
                        CYCLES_LOCAL_LAYER_HACK(render_layer.use_localview, ob_layer);
                        hide = hide || !(ob_layer & scene_layer);
  
                        if(!hide) {
 +                              progress.set_status("Synchronizing object", (*b_ob).name());
  
                                int num_particles = object_count_particles(*b_ob);
  
  
                                particle_offset += num_particles;
                        }
 +
 +                      cancel = progress.get_cancel();
                }
        }
  
 -      if(!motion) {
 +      if(!cancel && !motion) {
                sync_background_light();
  
                /* handle removed data and modified pointers */
index c7cc3fe42b18af50a16116ca0b69b7cf3e4b1934,6065235a278ba31e65b0dd98fe65e74b0e89a744..ac1fed060ee6a3f74368faf1134a8f7347343e9d
@@@ -49,7 -49,7 +49,7 @@@ class ShaderNode
  
  class BlenderSync {
  public:
 -      BlenderSync(BL::BlendData b_data, BL::Scene b_scene, Scene *scene_, bool preview_);
 +      BlenderSync(BL::RenderEngine b_engine_, BL::BlendData b_data, BL::Scene b_scene, Scene *scene_, bool preview_, Progress &progress_);
        ~BlenderSync();
  
        /* sync */
@@@ -61,7 -61,7 +61,7 @@@
  
        /* get parameters */
        static SceneParams get_scene_params(BL::Scene b_scene, bool background);
 -      static SessionParams get_session_params(BL::UserPreferences b_userpref, BL::Scene b_scene, bool background);
 +      static SessionParams get_session_params(BL::RenderEngine b_engine, BL::UserPreferences b_userpref, BL::Scene b_scene, bool background);
        static bool get_session_pause(BL::Scene b_scene, bool background);
        static BufferParams get_buffer_params(BL::Scene b_scene, Camera *cam, int width, int height);
  
@@@ -92,11 -92,10 +92,11 @@@ private
        bool BKE_object_is_modified(BL::Object b_ob);
        bool object_is_mesh(BL::Object b_ob);
        bool object_is_light(BL::Object b_ob);
-       bool object_use_particles(BL::Object b_ob);
+       bool object_need_particle_update(BL::Object b_ob);
        int object_count_particles(BL::Object b_ob);
  
        /* variables */
 +      BL::RenderEngine b_engine;
        BL::BlendData b_data;
        BL::Scene b_scene;
  
                bool use_localview;
                int samples;
        } render_layer;
 +
 +      Progress &progress;
  };
  
  /* we don't have spare bits for localview (normally 20-28)