Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / source / blender / editors / physics / editparticle.c
index 83bf12d..b92632b 100644 (file)
@@ -109,7 +109,8 @@ static int PE_poll(bContext *C)
 
 static int PE_poll_3dview(bContext *C)
 {
-       return PE_poll(C) && CTX_wm_region_view3d(C);
+       return PE_poll(C) && CTX_wm_area(C)->spacetype == SPACE_VIEW3D &&
+               CTX_wm_region(C)->regiontype == RGN_TYPE_WINDOW;
 }
 
 static void PE_free_particle_edit(ParticleSystem *psys)
@@ -2260,7 +2261,7 @@ static void toggle_particle_cursor(bContext *C, int enable)
                pset->paintcursor = NULL;
        }
        else if(enable)
-               pset->paintcursor= WM_paint_cursor_activate(CTX_wm_manager(C), PE_poll, brush_drawcursor, NULL);
+               pset->paintcursor= WM_paint_cursor_activate(CTX_wm_manager(C), PE_poll_3dview, brush_drawcursor, NULL);
 }
 
 /********************* radial control operator *********************/
@@ -3067,11 +3068,13 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
        ParticleSystemModifierData *psmd= psys_get_modifier(ob, psys);
        ParticleBrushData *brush= &pset->brush[pset->brushtype];
        ARegion *ar= CTX_wm_region(C);
-       float vec1[3], vec2[3];
+       float vec1[3], vec2[3], mousef[2];
        short mval[2], mvalo[2];
        int flip, mouse[2], dx, dy, removed= 0, selected= 0;
 
-       RNA_int_get_array(itemptr, "mouse", mouse);
+       RNA_float_get_array(itemptr, "mouse", mousef);
+       mouse[0] = mousef[0];
+       mouse[1] = mousef[1];
        flip= RNA_boolean_get(itemptr, "flip");
 
        if(bedit->first) {
@@ -3282,7 +3285,7 @@ static void brush_edit_apply_event(bContext *C, wmOperator *op, wmEvent *event)
 {
        ARegion *ar= CTX_wm_region(C);
        PointerRNA itemptr;
-       int mouse[2];
+       float mouse[2];
 
        mouse[0]= event->x - ar->winrct.xmin;
        mouse[1]= event->y - ar->winrct.ymin;
@@ -3290,7 +3293,7 @@ static void brush_edit_apply_event(bContext *C, wmOperator *op, wmEvent *event)
        /* fill in stroke */
        RNA_collection_add(op->ptr, "stroke", &itemptr);
 
-       RNA_int_set_array(&itemptr, "mouse", mouse);
+       RNA_float_set_array(&itemptr, "mouse", mouse);
        RNA_boolean_set(&itemptr, "flip", event->shift != 0); // XXX hardcoded
 
        /* apply */