Commit: bc2055e7b75162453d7e68fdc5ffdf3d4c328ff1
Author: Antony Riakiotakis
Date:   Tue Apr 28 16:44:17 2015 +0200
Branches: gooseberry
https://developer.blender.org/rBbc2055e7b75162453d7e68fdc5ffdf3d4c328ff1

Merge branch 'master' into gooseberry

Conflicts:
        intern/cycles/blender/blender_object.cpp
        intern/cycles/blender/blender_sync.h
        source/blender/editors/interface/interface_utils.c

===================================================================



===================================================================

diff --cc intern/cycles/blender/blender_object.cpp
index f330cce,bcc3667..e999945
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@@ -222,52 -234,8 +234,53 @@@ void BlenderSync::sync_background_light
  
  /* Object */
  
 -Object *BlenderSync::sync_object(BL::Object b_parent, int 
persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob,
 -                                 Transform& tfm, uint layer_flag, float 
motion_time, bool hide_tris, bool *use_portal)
 +static bool object_boundbox_clip(Scene *scene,
 +                                 BL::Object b_ob,
 +                                 Transform& tfm,
 +                                 float margin)
 +{
 +      Camera *cam = scene->camera;
 +      Transform& worldtondc = cam->worldtondc;
 +      BL::Array<float, 24> boundbox = b_ob.bound_box();
 +      float3 bb_min = make_float3(FLT_MAX, FLT_MAX, FLT_MAX),
 +             bb_max = make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX);
 +      bool all_behind = true;
 +      for(int i = 0; i < 8; ++i) {
 +              float3 p = make_float3(boundbox[3 * i + 0],
 +                                     boundbox[3 * i + 1],
 +                                     boundbox[3 * i + 2]);
 +              p = transform_point(&tfm, p);
 +              p = transform_point(&worldtondc, p);
 +              if(p.z >= -margin) {
 +                      all_behind = false;
 +              }
 +              p /= p.z;
 +              bb_min = min(bb_min, p);
 +              bb_max = max(bb_max, p);
 +      }
 +      if(!all_behind) {
 +              if(bb_min.x >= 1.0f + margin ||
 +                 bb_min.y >= 1.0f + margin ||
 +                 bb_max.x <= -margin ||
 +                 bb_max.y <= -margin)
 +              {
 +                      return true;
 +              }
 +              return false;
 +      }
 +      return true;
 +}
 +
 +Object *BlenderSync::sync_object(BL::Object b_parent,
 +                                 int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
 +                                 BL::DupliObject b_dupli_ob,
 +                                 Transform& tfm,
 +                                 uint layer_flag,
 +                                 float motion_time,
 +                                 bool hide_tris,
 +                                 bool use_camera_cull,
-                                  float camera_cull_margin)
++                                 float camera_cull_margin,
++                                 bool *use_portal)
  {
        BL::Object b_ob = (b_dupli_ob ? b_dupli_ob.object() : b_parent);
        bool motion = motion_time != 0.0f;
@@@ -573,15 -519,7 +587,16 @@@ void BlenderSync::sync_objects(BL::Spac
                                                        BL::Array<int, 
OBJECT_PERSISTENT_ID_SIZE> persistent_id = b_dup->persistent_id();
  
                                                        /* sync object and mesh 
or light data */
 -                                                      Object *object = 
sync_object(b_ob, persistent_id.data, *b_dup, tfm, ob_layer, motion_time, 
hide_tris, &use_portal);
 +                                                      Object *object = 
sync_object(b_ob,
 +                                                                              
     persistent_id.data,
 +                                                                              
     *b_dup,
 +                                                                              
     tfm,
 +                                                                              
     ob_layer,
 +                                                                              
     motion_time,
 +                                                                              
     hide_tris,
 +                                                                              
     use_camera_cull,
-                                                                               
     camera_cull_margin);
++                                                                              
     camera_cull_margin,
++                                                                              
     &use_portal);
  
                                                        /* sync possible 
particle data, note particle_id
                                                         * starts counting at 
1, first is dummy particle */
@@@ -601,15 -539,7 +616,17 @@@
                                if(!object_render_hide(b_ob, true, true, 
hide_tris)) {
                                        /* object itself */
                                        Transform tfm = 
get_transform(b_ob.matrix_world());
 -                                      sync_object(b_ob, NULL, 
PointerRNA_NULL, tfm, ob_layer, motion_time, hide_tris, &use_portal);
++
 +                                      sync_object(b_ob,
 +                                                  NULL,
 +                                                  PointerRNA_NULL,
 +                                                  tfm,
 +                                                  ob_layer,
 +                                                  motion_time,
 +                                                  hide_tris,
 +                                                  use_camera_cull,
-                                                   camera_cull_margin);
++                                                  camera_cull_margin,
++                                                  &use_portal);
                                }
                        }
  
diff --cc intern/cycles/blender/blender_sync.h
index f9d22d3,89d93e1..ef279a4
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@@ -83,20 -83,13 +83,22 @@@ private
        void sync_curve_settings();
  
        void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
 -      Mesh *sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tris);
 -      void sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool 
motion, int time_index = 0);
 -      Object *sync_object(BL::Object b_parent, int 
persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob,
 -                                       Transform& tfm, uint layer_flag, float 
motion_time, bool hide_tris, bool *use_portal);
 +      Mesh *sync_mesh(BL::Object b_parent, bool object_updated, bool 
hide_tris, BL::DupliObject b_dupli_ob = PointerRNA_NULL);
 +      void sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_parent, bool 
motion, int time_index = 0, BL::DupliObject b_dupli_ob = PointerRNA_NULL);
 +      Object *sync_object(BL::Object b_parent,
 +                          int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
 +                          BL::DupliObject b_dupli_ob,
 +                          Transform& tfm,
 +                          uint layer_flag,
 +                          float motion_time,
 +                          bool hide_tris,
 +                          bool use_camera_cull,
-                           float camera_cull_margin);
-       void sync_light(BL::Object b_parent, int 
persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm);
-       void sync_background_light();
++                          float camera_cull_margin,
++                          bool *use_portal);
+       void sync_light(BL::Object b_parent, int 
persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm, bool 
*use_portal);
+       void sync_background_light(bool use_portal);
 -      void sync_mesh_motion(BL::Object b_ob, Object *object, float 
motion_time);
 +      void sync_mesh_motion(BL::Object b_parent, Object *object, float 
motion_time, BL::DupliObject b_dupli_ob = PointerRNA_NULL);
++
        void sync_camera_motion(BL::Object b_ob, float motion_time);
  
        /* particles */
diff --cc source/blender/editors/interface/interface_handlers.c
index 56e4566,1d71a5d..6525ade
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@@ -6285,15 -6253,15 +6285,10 @@@ static bool ui_but_menu(bContext *C, ui
                char buf[512];
                PointerRNA ptr_props;
  
-               if (but->rnapoin.data && but->rnaprop) {
-                       BLI_snprintf(buf, sizeof(buf), "%s.%s",
-                                    RNA_struct_identifier(but->rnapoin.type), 
RNA_property_identifier(but->rnaprop));
- 
-                       WM_operator_properties_create(&ptr_props, 
"WM_OT_doc_view_manual");
-                       RNA_string_set(&ptr_props, "doc_id", buf);
-                       uiItemFullO(layout, "WM_OT_doc_view_manual", 
CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Online Manual"),
-                                   ICON_NONE, ptr_props.data, 
WM_OP_EXEC_DEFAULT, 0);
+               if (UI_but_online_manual_id(but, buf, sizeof(buf))) {
+                       uiItemO(layout, 
CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Online Manual"),
+                               ICON_NONE, "WM_OT_doc_view_manual_ui_context");
  
 -                      WM_operator_properties_create(&ptr_props, 
"WM_OT_doc_view");
 -                      RNA_string_set(&ptr_props, "doc_id", buf);
 -                      uiItemFullO(layout, "WM_OT_doc_view", 
CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Online Python Reference"),
 -                                  ICON_NONE, ptr_props.data, 
WM_OP_EXEC_DEFAULT, 0);
 -
                        /* XXX inactive option, not for public! */
  #if 0
                        WM_operator_properties_create(&ptr_props, 
"WM_OT_doc_edit");
diff --cc source/blender/editors/interface/interface_utils.c
index 6f8ef04,14d97dd..ffcee6a
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@@ -310,25 -312,34 +313,53 @@@ int UI_calc_float_precision(int prec, d
        return prec;
  }
  
 +uiBut *ui_but_find_menu_root(struct bContext *C) {
 +      ScrArea *sa = CTX_wm_area(C);
 +      ARegion *ar;
 +      uiBlock *block;
 +      uiBut *but;
 +
 +      for (ar = sa->regionbase.first; ar; ar = ar->next) {
 +              for (block = ar->uiblocks.first; block; block = block->next) {
 +                      for (but = block->buttons.first; but; but = but->next) {
 +                              if (but->flag & UI_BUT_MENU_ROOT) {
 +                                      return but;
 +                              }
 +                      }
 +              }
 +      }
 +
 +      return NULL;
 +}
 +
+ bool UI_but_online_manual_id(const uiBut *but, char *r_str, size_t maxlength)
+ {
+       if (but->rnapoin.id.data && but->rnapoin.data && but->rnaprop) {
+               BLI_snprintf(r_str, maxlength, "%s.%s", 
RNA_struct_identifier(but->rnapoin.type),
+                            RNA_property_identifier(but->rnaprop));
+               return true;
+       }
+       else if (but->optype) {
+               WM_operator_py_idname(r_str, but->optype->idname);
+               return true;
+       }
+ 
+       *r_str = '\0';
+       return false;
+ }
+ 
+ bool UI_but_online_manual_id_from_active(const struct bContext *C, char 
*r_str, size_t maxlength)
+ {
+       uiBut *but = UI_context_active_but_get(C);
+ 
+       if (but) {
+               return UI_but_online_manual_id(but, r_str, maxlength);
+       }
+ 
+       *r_str = '\0';
+       return false;
+ }
+ 
  
  /* -------------------------------------------------------------------- */
  /* Modal Button Store API */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to