now dragging an image onto an empty can be done without holding Ctrl.
authorCampbell Barton <ideasman42@gmail.com>
Sat, 2 Mar 2013 12:05:25 +0000 (12:05 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 2 Mar 2013 12:05:25 +0000 (12:05 +0000)
Make it set the empty draw type for existing empty object.
change from yakca on IRC

also some whitespace cleanup.

source/blender/blenkernel/intern/pbvh.c
source/blender/editors/mesh/editmesh_select.c
source/blender/editors/object/object_add.c
source/blender/editors/space_view3d/space_view3d.c

index 483dd2570e2e118c00a7251954c69009136f6156..477ae27394ffa0c85164d89e5e67d812f58d39b5 100644 (file)
@@ -1057,10 +1057,10 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
                                                                   node->prim_indices,
                                                                   node->totprim);
                                        break;
-                               case PBVH_BMESH:
+                               case PBVH_BMESH:
                                        node->draw_buffers =
-                                               GPU_build_bmesh_buffers(bvh->flags &
-                                                                           PBVH_DYNTOPO_SMOOTH_SHADING);
+                                           GPU_build_bmesh_buffers(bvh->flags &
+                                                                   PBVH_DYNTOPO_SMOOTH_SHADING);
                                        break;
                        }
  
@@ -1089,12 +1089,12 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
                                                                node->face_vert_indices,
                                                                bvh->show_diffuse_color);
                                        break;
-                               case PBVH_BMESH:
+                               case PBVH_BMESH:
                                        GPU_update_bmesh_buffers(node->draw_buffers,
-                                                    bvh->bm,
-                                                                                        node->bm_faces,
-                                                                                        node->bm_unique_verts,
-                                                                                        node->bm_other_verts);
+                                                                bvh->bm,
+                                                                node->bm_faces,
+                                                                node->bm_unique_verts,
+                                                                node->bm_other_verts);
                                        break;
                        }
 
index 7a2975375a99fc7cd60973991d96518eba586544..36b9463a61caf6e1dc39a428b54ad471bafdb129 100644 (file)
@@ -2951,7 +2951,7 @@ void MESH_OT_select_random(wmOperatorType *ot)
        /* props */
        RNA_def_float_percentage(ot->srna, "percent", 50.f, 0.0f, 100.0f,
                                 "Percent", "Percentage of elements to select randomly", 0.f, 100.0f);
-       RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
+       RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
 }
 
 static int edbm_select_next_loop_exec(bContext *C, wmOperator *UNUSED(op))
index 81372a753df2a719da4b712c3b85c5e07c4888ea..997cbb7168382b987a28c9be6b936f8fc68276de 100644 (file)
@@ -777,16 +777,16 @@ static int empty_drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *e
                        return OPERATOR_CANCELLED;
 
                ob = ED_object_add_type(C, OB_EMPTY, NULL, rot, FALSE, layer);
-               ob->empty_drawtype = OB_EMPTY_IMAGE;
 
                /* add under the mouse */
                ED_object_location_from_view(C, ob->loc);
                ED_view3d_cursor3d_position(C, ob->loc, event->mval);
        }
 
+       ob->empty_drawtype = OB_EMPTY_IMAGE;
        ob->data = ima;
 
-       return OPERATOR_FINISHED;
+       return OPERATOR_FINISHED;
 }
 
 void OBJECT_OT_drop_named_image(wmOperatorType *ot)
index c1e42294e71610f7052609a38e5af78ee2a2d0d4..57755231240cb18273fb42de6dc2f3d883023d54 100644 (file)
@@ -526,15 +526,12 @@ static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
 
 static int view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
 {
-       Base *base;
-
-       if (!event->ctrl)
-               return false;
+       Base *base = ED_view3d_give_base_under_cursor(C, event->mval);
 
-       base = ED_view3d_give_base_under_cursor(C, event->mval);
-       if (!base || (base && base->object->type == OB_EMPTY)) {
+       /* either holding and ctrl and no object, or dropping to empty */
+       if ((event->ctrl && !base) || (base && base->object->type == OB_EMPTY))
                return view3d_ima_drop_poll(C, drag, event);
-       }
+
        return 0;
 }
 
@@ -543,8 +540,8 @@ static int view3d_ima_mesh_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
        Base *base = ED_view3d_give_base_under_cursor(C, event->mval);
 
        if (base && base->object->type == OB_MESH)
-               return view3d_ima_drop_poll(C, drag, event);
-       return 0;
+               return view3d_ima_drop_poll(C, drag, event);
+       return 0;
 }
 
 static void view3d_ob_drop_copy(wmDrag *drag, wmDropBox *drop)