diff options
71 files changed, 552 insertions, 385 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 03f62a07563..7abb6daa4df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -175,6 +175,10 @@ if(UNIX AND NOT APPLE) endif() option(WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON) +# disable for now, but plan to support on all platforms eventually +option(WITH_MEM_JEMALLOC "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF) +mark_as_advanced(WITH_MEM_JEMALLOC) + # Debug option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF) mark_as_advanced(WITH_CXX_GUARDEDALLOC) @@ -424,6 +428,15 @@ if(UNIX AND NOT APPLE) set(EXPAT_LIB expat) endif() + if(WITH_MEM_JEMALLOC) + set(JEMALLOC /usr) + set(JEMALLOC_LIBRARY ljemalloc CACHE STRING "JeMalloc library") + set(JEMALLOC_LIBPATH ${JEMALLOC}/lib CACHE FILEPATH "JeMalloc library path") + # no use for this yet. + # set(JEMALLOC_INCLUDE_DIR ${JEMALLOC}/include CACHE FILEPATH "JeMalloc include path") + unset(JEMALLOC) + endif() + find_package(X11 REQUIRED) find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH}) mark_as_advanced(X11_XF86keysym_INCLUDE_PATH) diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index ca1dd79cd8e..8a1f6875b6f 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -114,6 +114,9 @@ macro(SETUP_LIBDIRS) link_directories(${PCRE_LIBPATH}) link_directories(${EXPAT_LIBPATH}) endif() + if(WITH_MEM_JEMALLOC) + link_directories(${JEMALLOC_LIBPATH}) + endif() if(WIN32 AND NOT UNIX) link_directories(${PTHREADS_LIBPATH}) @@ -220,6 +223,9 @@ macro(setup_liblinks target_link_libraries(${target} optimized ${LCMS_LIB}) endif() endif() + if(WITH_MEM_JEMALLOC) + target_link_libraries(${target} ${JEMALLOC_LIBRARY}) + endif() if(WIN32 AND NOT UNIX) target_link_libraries(${target} ${PTHREADS_LIB}) endif() diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index ee8ec9e8018..143f7e97f2d 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -1178,25 +1178,29 @@ GHOST_TUns8* GHOST_SystemWin32::getClipboard(bool selection) const char *temp_buff; if ( IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(NULL) ) { + size_t len = 0; HANDLE hData = GetClipboardData( CF_TEXT ); if (hData == NULL) { CloseClipboard(); return NULL; } buffer = (char*)GlobalLock( hData ); + if (!buffer) { + CloseClipboard(); + return NULL; + } - temp_buff = (char*) malloc(strlen(buffer)+1); - strcpy(temp_buff, buffer); + len = strlen(buffer); + temp_buff = (char*) malloc(len+1); + strncpy(temp_buff, buffer, len); + temp_buff[len] = '\0'; + /* Buffer mustn't be accessed after CloseClipboard + it would like accessing free-d memory */ GlobalUnlock( hData ); CloseClipboard(); - temp_buff[strlen(buffer)] = '\0'; - if (buffer) { - return (GHOST_TUns8*)temp_buff; - } else { - return NULL; - } + return (GHOST_TUns8*)temp_buff; } else { return NULL; } diff --git a/intern/iksolver/intern/IK_QSegment.cpp b/intern/iksolver/intern/IK_QSegment.cpp index 4f05e750e78..237edfd4594 100644 --- a/intern/iksolver/intern/IK_QSegment.cpp +++ b/intern/iksolver/intern/IK_QSegment.cpp @@ -370,7 +370,7 @@ MT_Vector3 IK_QSphericalSegment::Axis(int dof) const void IK_QSphericalSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax) { - if (lmin >= lmax) + if (lmin > lmax) return; if (axis == 1) { @@ -613,7 +613,7 @@ void IK_QRevoluteSegment::UpdateAngleApply() void IK_QRevoluteSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax) { - if (lmin >= lmax || m_axis != axis) + if (lmin > lmax || m_axis != axis) return; // clamp and convert to axis angle parameters @@ -752,7 +752,7 @@ void IK_QSwingSegment::UpdateAngleApply() void IK_QSwingSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax) { - if (lmin >= lmax) + if (lmin > lmax) return; // clamp and convert to axis angle parameters @@ -898,7 +898,7 @@ void IK_QElbowSegment::UpdateAngleApply() void IK_QElbowSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax) { - if (lmin >= lmax) + if (lmin > lmax) return; // clamp and convert to axis angle parameters diff --git a/release/scripts/modules/view3d_utils.py b/release/scripts/modules/view3d_utils.py new file mode 100644 index 00000000000..15f5aaa20b7 --- /dev/null +++ b/release/scripts/modules/view3d_utils.py @@ -0,0 +1,93 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# <pep8 compliant> + + +def region_2d_to_vector_3d(region, rv3d, coord): + """ + Return a direction vector from the viewport at the spesific 2d region + coordinate. + + :arg region: region of the 3D viewport, typically bpy.context.region. + :type region: :class:`Region` + :arg rv3d: 3D region data, typically bpy.context.space_data.region_3d. + :type rv3d: :class:`RegionView3D` + :arg coord: 2d coordinates relative to the region; + (event.mouse_region_x, event.mouse_region_y) for example. + :type coord: 2d vector + :return: normalized 3d vector. + :rtype: :class:`Vector` + """ + from mathutils import Vector + + dx = (2.0 * coord[0] / region.width) - 1.0 + dy = (2.0 * coord[1] / region.height) - 1.0 + + viewvec = rv3d.view_matrix.inverted()[2].to_3d().normalized() + perspinv_x, perspinv_y = rv3d.perspective_matrix.inverted().to_3x3()[0:2] + return ((perspinv_x * dx + perspinv_y * dy) - viewvec).normalized() + + +def region_2d_to_location_3d(region, rv3d, coord, depth_location): + """ + Return a 3d location from the region relative 2d coords, aligned with + *depth_location*. + + :arg region: region of the 3D viewport, typically bpy.context.region. + :type region: :class:`Region` + :arg rv3d: 3D region data, typically bpy.context.space_data.region_3d. + :type rv3d: :class:`RegionView3D` + :arg coord: 2d coordinates relative to the region; + (event.mouse_region_x, event.mouse_region_y) for example. + :type coord: 2d vector + :arg depth_location: the returned vectors depth is aligned with this since + there is no defined depth with a 2d region input. + :type depth_location: 3d vector + :return: normalized 3d vector. + :rtype: :class:`Vector` + """ + from mathutils.geometry import intersect_point_line + origin_start = rv3d.view_matrix.inverted()[3].to_3d() + origin_end = origin_start + region_2d_to_vector_3d(region, rv3d, coord) + return intersect_point_line(depth_location, origin_start, origin_end)[0] + + +def location_3d_to_region_2d(region, rv3d, coord): + """ + Return the *region* relative 2d location of a 3d position. + + :arg region: region of the 3D viewport, typically bpy.context.region. + :type region: :class:`Region` + :arg rv3d: 3D region data, typically bpy.context.space_data.region_3d. + :type rv3d: :class:`RegionView3D` + :arg coord: 3d worldspace location. + :type coord: 3d vector + :return: 2d location + :rtype: :class:`Vector` + """ + prj = Vector((coord[0], coord[1], coord[2], 1.0)) * rv3d.perspective_matrix + if prj.w > 0.0: + width_half = region.width / 2.0 + height_half = region.height / 2.0 + + return Vector((width_half + width_half * (prj.x / prj.w), + height_half + height_half * (prj.y / prj.w), + )) + else: + return None diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 5c28f12b7f1..bf396e98c79 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -795,9 +795,6 @@ class USERPREF_PT_input(InputKeyMapPanel): sub.separator() - sub.label(text="Loop Cut:") - sub.prop(inputs, "loopcut_finish_on_release") - sub.label(text="Orbit Style:") sub.row().prop(inputs, "view_rotate_method", expand=True) diff --git a/source/blender/blenkernel/BKE_sketch.h b/source/blender/blenkernel/BKE_sketch.h index 360a95bfb24..087cabc5c3d 100644 --- a/source/blender/blenkernel/BKE_sketch.h +++ b/source/blender/blenkernel/BKE_sketch.h @@ -73,8 +73,8 @@ typedef struct SK_Overdraw typedef struct SK_DrawData { - short mval[2]; - short previous_mval[2]; + int mval[2]; + int previous_mval[2]; SK_PType type; } SK_DrawData; @@ -152,7 +152,7 @@ void sk_endContinuousStroke(SK_Stroke *stk); void sk_updateNextPoint(SK_Sketch *sketch, SK_Stroke *stk); -void sk_initDrawData(SK_DrawData *dd, const short mval[2]); +void sk_initDrawData(SK_DrawData *dd, const int mval[2]); void sk_deleteSelectedStrokes(SK_Sketch *sketch); void sk_selectAllSketch(SK_Sketch *sketch, int mode); diff --git a/source/blender/blenkernel/intern/sketch.c b/source/blender/blenkernel/intern/sketch.c index ec0f5d1316b..4cc5a880625 100644 --- a/source/blender/blenkernel/intern/sketch.c +++ b/source/blender/blenkernel/intern/sketch.c @@ -543,7 +543,7 @@ int sk_stroke_filtermval(SK_DrawData *dd) return retval; } -void sk_initDrawData(SK_DrawData *dd, const short mval[2]) +void sk_initDrawData(SK_DrawData *dd, const int mval[2]) { dd->mval[0] = mval[0]; dd->mval[1] = mval[1]; diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 03a6a98cc6f..16684b0d84a 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -79,7 +79,7 @@ void closest_to_line_segment_v3(float r[3], const float p[3], const float l1[3], #define ISECT_LINE_LINE_CROSS 2 int isect_line_line_v2(const float a1[2], const float a2[2], const float b1[2], const float b2[2]); -int isect_line_line_v2_short(const short a1[2], const short a2[2], const short b1[2], const short b2[2]); +int isect_line_line_v2_int(const int a1[2], const int a2[2], const int b1[2], const int b2[2]); int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2]); /* Returns the number of point of interests diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index af8c5b8475f..6df942e8b13 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -239,7 +239,7 @@ float dist_to_line_segment_v3(const float v1[3], const float v2[3], const float /******************************* Intersection ********************************/ /* intersect Line-Line, shorts */ -int isect_line_line_v2_short(const short v1[2], const short v2[2], const short v3[2], const short v4[2]) +int isect_line_line_v2_int(const int v1[2], const int v2[2], const int v3[2], const int v4[2]) { float div, labda, mu; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index fb4d99b95bc..7592e74f0bb 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4033,7 +4033,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) fluidmd->fss= newdataadr(fd, fluidmd->fss); fluidmd->fss->fmd= fluidmd; - fluidmd->fss->meshSurfNormals = NULL; + fluidmd->fss->meshVelocities = NULL; } else if (md->type==eModifierType_Smoke) { SmokeModifierData *smd = (SmokeModifierData*) md; @@ -9689,7 +9689,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) fluidmd->fss->lastgoodframe = INT_MAX; fluidmd->fss->flag = 0; - fluidmd->fss->meshSurfNormals = NULL; + fluidmd->fss->meshVelocities = NULL; } } } diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 86dc2182e03..82decf8d1cf 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -206,7 +206,7 @@ void POSE_OT_propagate(struct wmOperatorType *ot); /* editarmature.c */ EditBone *make_boneList(struct ListBase *edbo, struct ListBase *bones, struct EditBone *parent, struct Bone *actBone); -void BIF_sk_selectStroke(struct bContext *C, const short mval[2], short extend); +void BIF_sk_selectStroke(struct bContext *C, const int mval[2], short extend); /* duplicate method */ void preEditBoneDuplicate(struct ListBase *editbones); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index ea478a5e8b4..3430b4a77f0 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -1698,7 +1698,7 @@ void ARMATURE_OT_select_linked(wmOperatorType *ot) /* does bones and points */ /* note that BONE ROOT only gets drawn for root bones (or without IK) */ -static EditBone *get_nearest_editbonepoint (ViewContext *vc, const short mval[2], ListBase *edbo, int findunsel, int *selmask) +static EditBone *get_nearest_editbonepoint (ViewContext *vc, const int mval[2], ListBase *edbo, int findunsel, int *selmask) { EditBone *ebone; rcti rect; @@ -1958,7 +1958,7 @@ static int ebone_select_flag(EditBone *ebone) } /* context: editmode armature in view3d */ -int mouse_armature(bContext *C, const short mval[2], int extend) +int mouse_armature(bContext *C, const int mval[2], int extend) { Object *obedit= CTX_data_edit_object(C); bArmature *arm= obedit->data; @@ -2499,7 +2499,7 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e View3D *v3d; RegionView3D *rv3d; float dx, dy, fz, *fp = NULL, dvec[3], oldcurs[3]; - short mx, my, mval[2]; + int mx, my, mval[2]; int retv; scene= CTX_data_scene(C); @@ -2513,7 +2513,7 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e mx= event->x - ar->winrct.xmin; my= event->y - ar->winrct.ymin; - project_short_noclip(ar, fp, mval); + project_int_noclip(ar, fp, mval); initgrabz(rv3d, fp[0], fp[1], fp[2]); diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 158c0d23ddc..1fa6a88c9f3 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -702,7 +702,7 @@ static void sk_drawStrokeSubdivision(ToolSettings *toolsettings, SK_Stroke *stk) } } -static SK_Point *sk_snapPointStroke(bContext *C, SK_Stroke *stk, short mval[2], int *dist, int *index, int all_pts) +static SK_Point *sk_snapPointStroke(bContext *C, SK_Stroke *stk, int mval[2], int *dist, int *index, int all_pts) { ARegion *ar = CTX_wm_region(C); SK_Point *pt = NULL; @@ -736,7 +736,7 @@ static SK_Point *sk_snapPointStroke(bContext *C, SK_Stroke *stk, short mval[2], } #if 0 /* UNUSED 2.5 */ -static SK_Point *sk_snapPointArmature(bContext *C, Object *ob, ListBase *ebones, short mval[2], int *dist) +static SK_Point *sk_snapPointArmature(bContext *C, Object *ob, ListBase *ebones, int mval[2], int *dist) { ARegion *ar = CTX_wm_region(C); SK_Point *pt = NULL; @@ -2157,7 +2157,7 @@ static void sk_applyGesture(bContext *C, SK_Sketch *sketch) /********************************************/ -static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const short mval[2], int extend) +static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], int extend) { ViewContext vc; rcti rect; @@ -2473,7 +2473,7 @@ static int sketch_delete(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(ev return OPERATOR_FINISHED; } -void BIF_sk_selectStroke(bContext *C, const short mval[2], short extend) +void BIF_sk_selectStroke(bContext *C, const int mval[2], short extend) { ToolSettings *ts = CTX_data_tool_settings(C); SK_Sketch *sketch = contextSketch(C, 0); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 4606b443e65..ddd20e2f0e0 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -4169,7 +4169,7 @@ void CURVE_OT_make_segment(wmOperatorType *ot) /***************** pick select from 3d view **********************/ -int mouse_nurb(bContext *C, const short mval[2], int extend) +int mouse_nurb(bContext *C, const int mval[2], int extend) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -4666,7 +4666,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event) Curve *cu; ViewContext vc; float location[3]; - short mval[2]; + int mval[2]; Nurb *nu; BezTriple *bezt; diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 2baefc2de8e..c552657df96 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -378,7 +378,7 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi else { float *fp= give_cursor(scene, v3d); float dvec[3]; - short mval[2]; + int mval[2]; int mx, my; /* get screen coordinate */ @@ -390,13 +390,13 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi mx= (int)(pt->x / 100 * ar->winx); my= (int)(pt->y / 100 * ar->winy); } - mval[0]= (short)mx; - mval[1]= (short)my; + mval[0]= mx; + mval[1]= my; /* convert screen coordinate to 3d coordinates * - method taken from editview.c - mouse_cursor() */ - project_short_noclip(ar, fp, mval); + project_int_noclip(ar, fp, mval); window_to_3d(ar, dvec, mval[0]-mx, mval[1]-my); sub_v3_v3v3(p3d, fp, dvec); } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index c7d91a86ba5..f1672dce2bd 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -238,7 +238,7 @@ static short gp_stroke_filtermval (tGPsdata *p, int mval[2], int pmval[2]) /* convert screen-coordinates to buffer-coordinates */ // XXX this method needs a total overhaul! -static void gp_stroke_convertcoords (tGPsdata *p, short mval[2], float out[3], float *depth) +static void gp_stroke_convertcoords (tGPsdata *p, int mval[2], float out[3], float *depth) { bGPdata *gpd= p->gpd; @@ -250,7 +250,7 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[2], float out[3], f */ } else { - const short mx=mval[0], my=mval[1]; + const int mx=mval[0], my=mval[1]; float rvec[3], dvec[3]; /* Current method just converts each point in screen-coordinates to @@ -265,7 +265,7 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[2], float out[3], f gp_get_3d_reference(p, rvec); /* method taken from editview.c - mouse_cursor() */ - project_short_noclip(p->ar, rvec, mval); + project_int_noclip(p->ar, rvec, mval); window_to_3d_delta(p->ar, dvec, mval[0]-mx, mval[1]-my); sub_v3_v3v3(out, rvec, dvec); } @@ -386,8 +386,8 @@ static short gp_stroke_addpoint (tGPsdata *p, int mval[2], float pressure) /* temp struct for gp_stroke_smooth() */ typedef struct tGpSmoothCo { - short x; - short y; + int x; + int y; } tGpSmoothCo; /* smooth a stroke (in buffer) before storing it */ @@ -416,8 +416,8 @@ static void gp_stroke_smooth (tGPsdata *p) const tGPspoint *pd= (i+1 < cmx)?(pc+1):(pc); const tGPspoint *pe= (i+2 < cmx)?(pc+2):(pd); - spc->x= (short)(0.1*pa->x + 0.2*pb->x + 0.4*pc->x + 0.2*pd->x + 0.1*pe->x); - spc->y= (short)(0.1*pa->y + 0.2*pb->y + 0.4*pc->y + 0.2*pd->y + 0.1*pe->y); + spc->x= (int)(0.1*pa->x + 0.2*pb->x + 0.4*pc->x + 0.2*pd->x + 0.1*pe->x); + spc->y= (int)(0.1*pa->y + 0.2*pb->y + 0.4*pc->y + 0.2*pd->y + 0.1*pe->y); } /* second pass: apply smoothed coordinates */ @@ -573,7 +573,7 @@ static void gp_stroke_newfrombuffer (tGPsdata *p) /* get an array of depths, far depths are blended */ if (gpencil_project_check(p)) { - short mval[2], mval_prev[2]= {0}; + int mval[2], mval_prev[2]= {0}; int interp_depth = 0; int found_depth = 0; @@ -737,7 +737,7 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho { bGPDspoint *pt1, *pt2; int x0=0, y0=0, x1=0, y1=0; - short xyval[2]; + int xyval[2]; int i; if (gps->totpoints == 0) { @@ -749,7 +749,7 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho else if (gps->totpoints == 1) { /* get coordinates */ if (gps->flag & GP_STROKE_3DSPACE) { - project_short(p->ar, &gps->points->x, xyval); + project_int(p->ar, &gps->points->x, xyval); x0= xyval[0]; y0= xyval[1]; } @@ -803,11 +803,11 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho /* get coordinates */ if (gps->flag & GP_STROKE_3DSPACE) { - project_short(p->ar, &pt1->x, xyval); + project_int(p->ar, &pt1->x, xyval); x0= xyval[0]; y0= xyval[1]; - project_short(p->ar, &pt2->x, xyval); + project_int(p->ar, &pt2->x, xyval); x1= xyval[0]; y1= xyval[1]; } @@ -1500,8 +1500,8 @@ static int gpencil_draw_exec (bContext *C, wmOperator *op) /* get relevant data for this point from stroke */ RNA_float_get_array(&itemptr, "mouse", mousef); - p->mval[0] = (short)mousef[0]; - p->mval[1] = (short)mousef[1]; + p->mval[0] = (int)mousef[0]; + p->mval[1] = (int)mousef[1]; p->pressure= RNA_float_get(&itemptr, "pressure"); if (RNA_boolean_get(&itemptr, "is_start")) { diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 36923736068..a029c5c1f12 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -117,7 +117,7 @@ void ED_armature_deselect_all_visible(struct Object *obedit); int ED_do_pose_selectbuffer(struct Scene *scene, struct Base *base, unsigned int *buffer, short hits, short extend); -int mouse_armature(struct bContext *C, const short mval[2], int extend); +int mouse_armature(struct bContext *C, const int mval[2], int extend); int join_armature_exec(struct bContext *C, struct wmOperator *op); struct Bone *get_indexed_bone (struct Object *ob, int index); float ED_rollBoneToVector(EditBone *bone, const float new_up_axis[3], const short axis_only); diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index cfafd38ed15..6a92ee2e056 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -66,7 +66,7 @@ void free_editNurb (struct Object *obedit); void free_curve_editNurb (struct Curve *cu); -int mouse_nurb (struct bContext *C, const short mval[2], int extend); +int mouse_nurb (struct bContext *C, const int mval[2], int extend); struct Nurb *add_nurbs_primitive(struct bContext *C, float mat[4][4], int type, int newob); diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index d06b0d6c4ee..e5715316a31 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -56,7 +56,7 @@ struct wmKeyConfig; * Used as part of the 'stroke cache' used during drawing of new strokes */ typedef struct tGPspoint { - short x, y; /* x and y coordinates of cursor (in relative to area) */ + int x, y; /* x and y coordinates of cursor (in relative to area) */ float pressure; /* pressure of tablet at this point */ } tGPspoint; diff --git a/source/blender/editors/include/ED_mball.h b/source/blender/editors/include/ED_mball.h index a742be7337c..2afc3155398 100644 --- a/source/blender/editors/include/ED_mball.h +++ b/source/blender/editors/include/ED_mball.h @@ -42,7 +42,7 @@ void ED_keymap_metaball(struct wmKeyConfig *keyconf); struct MetaElem *add_metaball_primitive(struct bContext *C, float mat[4][4], int type, int newname); -int mouse_mball(struct bContext *C, const short mval[2], int extend); +int mouse_mball(struct bContext *C, const int mval[2], int extend); void free_editMball(struct Object *obedit); void make_editMball(struct Object *obedit); diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index b39b7338d3d..cab6a23b19b 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -173,7 +173,7 @@ void EDBM_hide_mesh(struct BMEditMesh *em, int swap); void EDBM_reveal_mesh(struct BMEditMesh *em); int EDBM_check_backbuf(unsigned int index); -int EDBM_mask_init_backbuf_border(struct ViewContext *vc, short mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax); +int EDBM_mask_init_backbuf_border(struct ViewContext *vc, int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax); void EDBM_free_backbuf(void); int EDBM_init_backbuf_border(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax); int EDBM_init_backbuf_circle(struct ViewContext *vc, short xs, short ys, short rads); @@ -203,7 +203,7 @@ long mesh_mirrtopo_table(struct Object *ob, char mode); //BMESH_TODO void EM_cache_x_mirror_vert(struct Object *ob, struct BMEditMesh *em); -int mouse_mesh(struct bContext *C, const short mval[2], short extend); +int mouse_mesh(struct bContext *C, const int mval[2], short extend); struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, float *co, int index); int mesh_get_x_mirror_vert(struct Object *ob, int index); @@ -232,10 +232,10 @@ void EMBM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct Obje /* editface.c */ void paintface_flush_flags(struct Object *ob); struct MTexPoly *EM_get_active_mtexpoly(struct BMEditMesh *em, struct BMFace **act_efa, struct MLoopCol **col, int sloppy); -int paintface_mouse_select(struct bContext *C, struct Object *ob, const short mval[2], int extend); +int paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], int extend); int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, int select, int extend); void paintface_deselect_all_visible(struct Object *ob, int action, short flush_flags); -void paintface_select_linked(struct bContext *C, struct Object *ob, short mval[2], int mode); +void paintface_select_linked(struct bContext *C, struct Object *ob, int mval[2], int mode); int paintface_minmax(struct Object *ob, float *min, float *max); void paintface_hide(struct Object *ob, const int unselected); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 9f42eaa0ac4..9a444c36758 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -129,7 +129,7 @@ void ED_object_constraint_update(struct Object *ob); void ED_object_constraint_dependency_update(struct Main *bmain, struct Scene *scene, struct Object *ob); /* object_lattice.c */ -int mouse_lattice(struct bContext *C, const short mval[2], int extend); +int mouse_lattice(struct bContext *C, const int mval[2], int extend); void undo_push_lattice(struct bContext *C, const char *name); /* object_lattice.c */ diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index f29284fe64d..23997e06aef 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -60,10 +60,10 @@ void PE_hide_keys_time(struct Scene *scene, struct PTCacheEdit *edit, float cfra void PE_update_object(struct Scene *scene, struct Object *ob, int useflag); /* selection tools */ -int PE_mouse_particles(struct bContext *C, const short mval[2], int extend); +int PE_mouse_particles(struct bContext *C, const int mval[2], int extend); int PE_border_select(struct bContext *C, struct rcti *rect, int select, int extend); -int PE_circle_select(struct bContext *C, int selecting, const short mval[2], float rad); -int PE_lasso_select(struct bContext *C, short mcords[][2], short moves, short extend, short select); +int PE_circle_select(struct bContext *C, int selecting, const int mval[2], float rad); +int PE_lasso_select(struct bContext *C, int mcords[][2], short moves, short extend, short select); void PE_deselect_all_visible(struct PTCacheEdit *edit); /* undo */ diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 0ea9fc1a3f9..34faa7b8726 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -67,7 +67,7 @@ typedef struct ViewContext { struct View3D *v3d; struct RegionView3D *rv3d; struct BMEditMesh *em; - short mval[2]; + int mval[2]; } ViewContext; typedef struct ViewDepths { @@ -83,9 +83,9 @@ typedef struct ViewDepths { float *give_cursor(struct Scene *scene, struct View3D *v3d); int initgrabz(struct RegionView3D *rv3d, float x, float y, float z); -void window_to_3d(struct ARegion *ar, float out[3], short mx, short my); -void window_to_3d_delta(struct ARegion *ar, float out[3], short mx, short my); -void window_to_3d_vector(struct ARegion *ar, float out[3], short mx, short my); +void window_to_3d(struct ARegion *ar, float out[3], const int mx, const int my); +void window_to_3d_delta(struct ARegion *ar, float out[3], const int mx, const int my); +void window_to_3d_vector(struct ARegion *ar, float out[3], const int mx, const int my); void view3d_unproject(struct bglMats *mats, float out[3], const short x, const short y, const float z); /* Depth buffer */ @@ -137,18 +137,18 @@ void drawcircball(int mode, const float cent[3], float rad, float tmat[][4]); /* backbuffer select and draw support */ void view3d_validate_backbuf(struct ViewContext *vc); struct ImBuf *view3d_read_backbuf(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax); -unsigned int view3d_sample_backbuf_rect(struct ViewContext *vc, const short mval[2], int size, unsigned int min, unsigned int max, int *dist, short strict, +unsigned int view3d_sample_backbuf_rect(struct ViewContext *vc, const int mval[2], int size, unsigned int min, unsigned int max, int *dist, short strict, void *handle, unsigned int (*indextest)(void *handle, unsigned int index)); unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y); /* draws and does a 4x4 sample */ -int view_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const short mval[2], float mouse_worldloc[3]); +int view_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3]); /* only draw so view_autodist_simple can be called many times after */ int view_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode); -int view_autodist_simple(struct ARegion *ar, const short mval[2], float mouse_worldloc[3], int margin, float *force_depth); -int view_autodist_depth(struct ARegion *ar, const short mval[2], int margin, float *depth); -int view_autodist_depth_segment(struct ARegion *ar, const short mval_sta[2], const short mval_end[2], int margin, float *depth); +int view_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth); +int view_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth); +int view_autodist_depth_segment(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth); /* select */ #define MAXPICKBUF 10000 @@ -157,13 +157,13 @@ short view3d_opengl_select(struct ViewContext *vc, unsigned int *buffer, unsigne void view3d_set_viewcontext(struct bContext *C, struct ViewContext *vc); void view3d_operator_needs_opengl(const struct bContext *C); void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *ar); -int view3d_get_view_aligned_coordinate(struct ViewContext *vc, float fp[3], const short mval[2], const short do_fallback); +int view3d_get_view_aligned_coordinate(struct ViewContext *vc, float fp[3], const int mval[2], const short do_fallback); void view3d_get_transformation(struct ARegion *ar, struct RegionView3D *rv3d, struct Object *ob, struct bglMats *mats); /* XXX should move to BLI_math */ int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, short x2, short y2); -int lasso_inside(short mcords[][2], short moves, short sx, short sy); -int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, int y1); +int lasso_inside(int mcords[][2], short moves, int sx, int sy); +int lasso_inside_edge(int mcords[][2], short moves, int x0, int y0, int x1, int y1); /* get 3d region from context, also if mouse is in header or toolbar */ struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C); @@ -182,7 +182,7 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, struct Object *camera, int width, int height, unsigned int flag, int drawtype, char err_out[256]); -Base *ED_view3d_give_base_under_cursor(struct bContext *C, const short mval[2]); +Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]); void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, short do_clip); int ED_view3d_lock(struct RegionView3D *rv3d); diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 12506d28593..e9fad382beb 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -97,7 +97,7 @@ static int eyedropper_cancel(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static void eyedropper_sample(bContext *C, Eyedropper *eye, short mx, short my) +static void eyedropper_sample(bContext *C, Eyedropper *eye, int mx, int my) { if(RNA_property_type(eye->prop) == PROP_FLOAT) { const int color_manage = CTX_data_scene(C)->r.color_mgt_flag & R_COLOR_MANAGEMENT; diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index a4c2dbb9943..624f06db3c1 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1625,7 +1625,7 @@ void ui_block_func_ICONTEXTROW(bContext *UNUSED(C), uiLayout *layout, void *arg_ } #if 0 -static void ui_warp_pointer(short x, short y) +static void ui_warp_pointer(int x, int y) { /* XXX 2.50 which function to use for this? */ /* OSX has very poor mousewarp support, it sends events; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index ecadb52ad5d..58ed1e31b81 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -888,7 +888,7 @@ static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect) /* textbut exception, clip right when... */ if(but->editstr && but->pos >= 0) { float width; - char buf[256]; + char buf[UI_MAX_DRAW_STR]; /* copy draw string */ BLI_strncpy(buf, but->drawstr, sizeof(buf)); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 32301dd6423..84cf5af5414 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -2028,7 +2028,7 @@ typedef struct View2DString { unsigned char ub[4]; int pack; } col; - short mval[2]; + int mval[2]; rcti rect; } View2DString; diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 62b191c2c6e..4cb67994704 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -86,6 +86,7 @@ typedef struct v2dViewPanData { /* options for version 1 */ int startx, starty; /* mouse x/y values in window when operator was initiated */ int lastx, lasty; /* previous x/y values of mouse in window */ + int invoke_event; /* event starting pan, for modal exit */ short in_scroller; /* for MMB in scrollers (old feature in past, but now not that useful) */ } v2dViewPanData; @@ -202,7 +203,8 @@ static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event) /* set initial settings */ vpd->startx= vpd->lastx= event->x; vpd->starty= vpd->lasty= event->y; - + vpd->invoke_event= event->type; + if (event->type == MOUSEPAN) { RNA_int_set(op->ptr, "deltax", event->prevx - event->x); RNA_int_set(op->ptr, "deltay", event->prevy - event->y); @@ -261,17 +263,19 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) WM_operator_name_call(C, "VIEW2D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL); return OPERATOR_FINISHED; } - case MIDDLEMOUSE: - case ESCKEY: - if (event->val==KM_RELEASE) { - /* calculate overall delta mouse-movement for redo */ - RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx)); - RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty)); - - view_pan_exit(op); - WM_cursor_restore(CTX_wm_window(C)); - - return OPERATOR_FINISHED; + + default: + if (event->type == vpd->invoke_event || event->type==ESCKEY) { + if (event->val==KM_RELEASE) { + /* calculate overall delta mouse-movement for redo */ + RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx)); + RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty)); + + view_pan_exit(op); + WM_cursor_restore(CTX_wm_window(C)); + + return OPERATOR_FINISHED; + } } break; } @@ -519,6 +523,7 @@ typedef struct v2dViewZoomData { double timer_lastdraw; int lastx, lasty; /* previous x/y values of mouse in window */ + int invoke_event; /* event type that invoked, for modal exits */ float dx, dy; /* running tally of previous delta values (for obtaining final zoom) */ float mx_2d, my_2d; /* initial mouse location in v2d coords */ } v2dViewZoomData; @@ -923,6 +928,9 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event) RNA_float_set(op->ptr, "deltax", 0); RNA_float_set(op->ptr, "deltay", 0); + /* for modal exit test */ + vzd->invoke_event= event->type; + if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) { ARegion *ar= CTX_wm_region(C); @@ -1021,8 +1029,9 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event) /* apply zooming */ view_zoomdrag_apply(C, op); } - else if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)) { /* XXX needs modal keymap */ - if (event->val==KM_RELEASE) { + else if (event->type == vzd->invoke_event || event->type==ESCKEY) { + if (event->val == KM_RELEASE) { + /* for redo, store the overall deltas - need to respect zoom-locks here... */ if ((v2d->keepzoom & V2D_LOCKZOOM_X)==0) RNA_float_set(op->ptr, "deltax", vzd->dx); diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/bmesh_select.c index de02277e8c3..df743d8a41a 100644 --- a/source/blender/editors/mesh/bmesh_select.c +++ b/source/blender/editors/mesh/bmesh_select.c @@ -144,7 +144,7 @@ unsigned int bm_solidoffs=0, bm_wireoffs=0, bm_vertoffs=0; /* set in drawobject. static char *selbuf= NULL; /* opengl doesn't support concave... */ -static void draw_triangulated(short mcords[][2], short tot) +static void draw_triangulated(int mcords[][2], short tot) { ListBase lb={NULL, NULL}; DispList *dl; @@ -238,7 +238,7 @@ void EDBM_free_backbuf(void) - grab again and compare returns 'OK' */ -int EDBM_mask_init_backbuf_border(ViewContext *vc, short mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax) +int EDBM_mask_init_backbuf_border(ViewContext *vc, int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax) { unsigned int *dr, *drm; struct ImBuf *buf, *bufmask; @@ -267,7 +267,7 @@ int EDBM_mask_init_backbuf_border(ViewContext *vc, short mcords[][2], short tot, draw_triangulated(mcords, tot); glBegin(GL_LINE_LOOP); /* for zero sized masks, lines */ - for(a=0; a<tot; a++) glVertex2s(mcords[a][0], mcords[a][1]); + for(a=0; a<tot; a++) glVertex2iv(mcords[a]); glEnd(); glFinish(); /* to be sure readpixels sees mask */ @@ -967,7 +967,7 @@ void MESH_OT_loop_multi_select(wmOperatorType *ot) /* ***************** loop select (non modal) ************** */ -static void mouse_mesh_loop(bContext *C, short mval[2], short extend, short ring) +static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring) { ViewContext vc; BMEditMesh *em; @@ -1052,7 +1052,7 @@ void MESH_OT_loop_select(wmOperatorType *ot) /* ******************* mesh shortest path select, uses prev-selected edge ****************** */ /* since you want to create paths with multiple selects, it doesn't have extend option */ -static void mouse_mesh_shortest_path(bContext *UNUSED(C), short UNUSED(mval[2])) +static void mouse_mesh_shortest_path(bContext *UNUSED(C), int UNUSED(mval[2])) { #if 0 //BMESH_TODO ViewContext vc; @@ -1152,7 +1152,7 @@ void MESH_OT_select_shortest_path(wmOperatorType *ot) /* ************************************************** */ /* here actual select happens */ /* gets called via generic mouse select operator */ -int mouse_mesh(bContext *C, const short mval[2], short extend) +int mouse_mesh(bContext *C, const int mval[2], short extend) { ViewContext vc; BMVert *eve = NULL; diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c index 5324ccb953e..972b1a8bb6e 100644 --- a/source/blender/editors/mesh/bmesh_tools.c +++ b/source/blender/editors/mesh/bmesh_tools.c @@ -2657,7 +2657,7 @@ void MESH_OT_select_vertex_path(wmOperatorType *ot) /********************** Rip Operator *************************/ /* helper to find edge for edge_rip */ -static float mesh_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *co2, short *mval) +static float mesh_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *co2, const int mval[2]) { float vec1[3], vec2[3], mvalf[2]; diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index bd63b518142..fba306cef1f 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -102,7 +102,7 @@ void paintface_flush_flags(Object *ob) } /* returns 0 if not found, otherwise 1 */ -static int facesel_face_pick(struct bContext *C, Mesh *me, Object *ob, const short mval[2], unsigned int *index, short rect) +static int facesel_face_pick(struct bContext *C, Mesh *me, Object *ob, const int mval[2], unsigned int *index, short rect) { Scene *scene = CTX_data_scene(C); ViewContext vc; @@ -327,7 +327,7 @@ static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int ind MEM_freeN(linkflag); } -void paintface_select_linked(bContext *UNUSED(C), Object *ob, short UNUSED(mval[2]), int mode) +void paintface_select_linked(bContext *UNUSED(C), Object *ob, int UNUSED(mval[2]), int mode) { Mesh *me; unsigned int index=0; @@ -749,7 +749,7 @@ void seam_mark_clear_tface(Scene *scene, short mode) } #endif -int paintface_mouse_select(struct bContext *C, Object *ob, const short mval[2], int extend) +int paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], int extend) { Mesh *me; MPoly *mface, *msel; diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index 7eb75dce79b..4ffa2b76704 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -455,7 +455,7 @@ void MBALL_OT_reveal_metaelems(wmOperatorType *ot) /* Select MetaElement with mouse click (user can select radius circle or * stiffness circle) */ -int mouse_mball(bContext *C, const short mval[2], int extend) +int mouse_mball(bContext *C, const int mval[2], int extend) { static MetaElem *startelem=NULL; Object *obedit= CTX_data_edit_object(C); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index d540be8917f..ce353f11248 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -610,7 +610,7 @@ static void spot_interactive(Object *ob, int mode) Lamp *la= ob->data; float transfac, dx, dy, ratio, origval; int keep_running= 1, center2d[2]; - short mval[2], mvalo[2]; + int mval[2], mvalo[2]; // getmouseco_areawin(mval); // getmouseco_areawin(mvalo); diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index 5921144436c..af1d76fd3d0 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -305,7 +305,7 @@ void LATTICE_OT_make_regular(wmOperatorType *ot) static void findnearestLattvert__doClosest(void *userData, BPoint *bp, int x, int y) { - struct { BPoint *bp; short dist, select, mval[2]; } *data = userData; + struct { BPoint *bp; short dist, select; int mval[2]; } *data = userData; float temp = abs(data->mval[0]-x) + abs(data->mval[1]-y); if((bp->f1 & SELECT)==data->select) @@ -318,12 +318,12 @@ static void findnearestLattvert__doClosest(void *userData, BPoint *bp, int x, in } } -static BPoint *findnearestLattvert(ViewContext *vc, const short mval[2], int sel) +static BPoint *findnearestLattvert(ViewContext *vc, const int mval[2], int sel) { /* sel==1: selected gets a disadvantage */ /* in nurb and bezt or bp the nearest is written */ /* return 0 1 2: handlepunt */ - struct { BPoint *bp; short dist, select, mval[2]; } data = {NULL}; + struct { BPoint *bp; short dist, select; int mval[2]; } data = {NULL}; data.dist = 100; data.select = sel; @@ -336,7 +336,7 @@ static BPoint *findnearestLattvert(ViewContext *vc, const short mval[2], int sel return data.bp; } -int mouse_lattice(bContext *C, const short mval[2], int extend) +int mouse_lattice(bContext *C, const int mval[2], int extend) { ViewContext vc; BPoint *bp= NULL; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index ee39e0fff26..15986fad3d8 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -338,7 +338,7 @@ typedef struct PEData { DerivedMesh *dm; PTCacheEdit *edit; - const short *mval; + const int *mval; rcti *rect; float rad; float dist; @@ -439,9 +439,9 @@ static int key_test_depth(PEData *data, float co[3]) static int key_inside_circle(PEData *data, float rad, float co[3], float *distance) { float dx, dy, dist; - short sco[2]; + int sco[2]; - project_short(data->vc.ar, co, sco); + project_int(data->vc.ar, co, sco); if(sco[0] == IS_CLIPPED) return 0; @@ -465,9 +465,9 @@ static int key_inside_circle(PEData *data, float rad, float co[3], float *distan static int key_inside_rect(PEData *data, float co[3]) { - short sco[2]; + int sco[2]; - project_short(data->vc.ar, co,sco); + project_int(data->vc.ar, co,sco); if(sco[0] == IS_CLIPPED) return 0; @@ -1369,7 +1369,7 @@ void PARTICLE_OT_select_all(wmOperatorType *ot) /************************ pick select operator ************************/ -int PE_mouse_particles(bContext *C, const short mval[2], int extend) +int PE_mouse_particles(bContext *C, const int mval[2], int extend) { PEData data; Scene *scene= CTX_data_scene(C); @@ -1484,7 +1484,7 @@ void PARTICLE_OT_select_tips(wmOperatorType *ot) static int select_linked_exec(bContext *C, wmOperator *op) { PEData data; - short mval[2]; + int mval[2]; int location[2]; RNA_int_get_array(op->ptr, "location", location); @@ -1574,7 +1574,7 @@ int PE_border_select(bContext *C, rcti *rect, int select, int extend) /************************ circle select operator ************************/ -int PE_circle_select(bContext *C, int selecting, const short mval[2], float rad) +int PE_circle_select(bContext *C, int selecting, const int mval[2], float rad) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -1599,7 +1599,7 @@ int PE_circle_select(bContext *C, int selecting, const short mval[2], float rad) /************************ lasso select operator ************************/ -int PE_lasso_select(bContext *C, short mcords[][2], short moves, short extend, short select) +int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, short select) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -1610,7 +1610,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short extend, s ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys); POINT_P; KEY_K; float co[3], mat[4][4]= MAT4_UNITY; - short vertco[2]; + int vertco[2]; PEData data; @@ -1631,7 +1631,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short extend, s LOOP_KEYS { VECCOPY(co, key->co); mul_m4_v3(mat, co); - project_short(ar, co, vertco); + project_int(ar, co, vertco); if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) { if(select && !(key->flag & PEK_SELECT)) { key->flag |= PEK_SELECT; @@ -1649,7 +1649,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short extend, s VECCOPY(co, key->co); mul_m4_v3(mat, co); - project_short(ar, co,vertco); + project_int(ar, co,vertco); if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) { if(select && !(key->flag & PEK_SELECT)) { key->flag |= PEK_SELECT; @@ -2772,7 +2772,7 @@ static void brush_cut(PEData *data, int pa_index) float rad2, cut_time= 1.0; float x0, x1, v0, v1, o0, o1, xo0, xo1, d, dv; int k, cut, keys= (int)pow(2.0, (double)pset->draw_step); - short vertco[2]; + int vertco[2]; /* blunt scissors */ if(BLI_frand() > data->cutfac) return; @@ -2785,7 +2785,7 @@ static void brush_cut(PEData *data, int pa_index) cut=0; - project_short_noclip(ar, key->co, vertco); + project_int_noclip(ar, key->co, vertco); x0= (float)vertco[0]; x1= (float)vertco[1]; @@ -2803,7 +2803,7 @@ static void brush_cut(PEData *data, int pa_index) else { /* calculate path time closest to root that was inside the circle */ for(k=1, key++; k<=keys; k++, key++) { - project_short_noclip(ar, key->co, vertco); + project_int_noclip(ar, key->co, vertco); if(key_test_depth(data, key->co) == 0) { x0= (float)vertco[0]; @@ -3467,7 +3467,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) ParticleBrushData *brush= &pset->brush[pset->brushtype]; ARegion *ar= CTX_wm_region(C); float vec[3], mousef[2]; - short mval[2], mvalo[2]; + int mval[2], mvalo[2]; int flip, mouse[2], dx, dy, removed= 0, added=0, selected= 0; int lock_root = pset->flag & PE_LOCK_FIRST; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 2b8f4e6f308..72353ce124d 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -5308,7 +5308,7 @@ static int set_clone_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event) View3D *v3d= CTX_wm_view3d(C); ARegion *ar= CTX_wm_region(C); float location[3]; - short mval[2]; + int mval[2]; mval[0]= event->x - ar->winrct.xmin; mval[1]= event->y - ar->winrct.ymin; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index cc3ee805a8b..2d74b7b382e 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -341,7 +341,7 @@ static void make_vertexcol(Object *ob) /* single ob */ //else memset(me->mcol, 255, 4*sizeof(MCol)*me->totface); - + DAG_id_tag_update(&me->id, 0); } @@ -810,10 +810,10 @@ static float calc_vp_alpha_dl(VPaint *vp, ViewContext *vc, float vpimat[][3], fl Brush *brush = paint_brush(&vp->paint); float fac, fac_2, size, dx, dy; float alpha; - short vertco[2]; + int vertco[2]; const int radius= brush_size(brush); - project_short_noclip(vc->ar, vert_nor, vertco); + project_int_noclip(vc->ar, vert_nor, vertco); dx= mval[0]-vertco[0]; dy= mval[1]-vertco[1]; @@ -1036,7 +1036,6 @@ static void sample_wpaint(Scene *scene, ARegion *ar, View3D *UNUSED(v3d), int mo else if(w4==fac) { if(mface->v4) { ts->vgroup_weight= defvert_find_weight(me->dvert+mface->v4, vgroup); ->>>>>>> .merge-right.r23146 } } diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 6c713d6e469..47b3a71a9ea 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -818,7 +818,7 @@ static int graphkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEve ARegion *ar= ac.ar; View2D *v2d= &ar->v2d; - short mval[2]; + int mval[2]; float x; /* get mouse coordinates (in region coordinates) */ diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 60c55375262..7e881e7e62f 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -268,7 +268,7 @@ static void preview_cb(struct ScrArea *sa, struct uiBlock *block) rcti *disprect= &G.scene->r.disprect; int winx= (G.scene->r.size*G.scene->r.xsch)/100; int winy= (G.scene->r.size*G.scene->r.ysch)/100; - short mval[2]; + int mval[2]; if(G.scene->r.mode & R_BORDER) { winx*= (G.scene->r.border.xmax - G.scene->r.border.xmin); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 0f361b43de6..4cdac361bf3 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -702,7 +702,7 @@ static void draw_image_view_tool(Scene *scene) { ToolSettings *settings= scene->toolsettings; Brush *brush= settings->imapaint.brush; - short mval[2]; + int mval[2]; float radius; int draw= 0; diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index 67f02ce4f8e..937b683e880 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -230,7 +230,7 @@ static int borderselect_exec(bContext *C, wmOperator *op) rcti rect; //rctf rectf, rq; short selecting= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT); - //short mval[2]; + //int mval[2]; rect.xmin= RNA_int_get(op->ptr, "xmin"); rect.ymin= RNA_int_get(op->ptr, "ymin"); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 01f32b49888..19a9bfb224b 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1010,7 +1010,7 @@ static bNode *visible_node(SpaceNode *snode, rctf *rct) /* **************************** */ typedef struct NodeViewMove { - short mvalo[2]; + int mvalo[2]; int xmin, ymin, xmax, ymax; } NodeViewMove; @@ -1615,7 +1615,7 @@ static int node_mouse_groupheader(SpaceNode *snode) { bNode *gnode; float mx=0, my=0; -// XXX short mval[2]; +// XXX int mval[2]; gnode= node_tree_get_editgroup(snode->nodetree); if(gnode==NULL) return 0; diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index 78368d91378..6bda47e5c8f 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -70,7 +70,7 @@ static bNode *node_under_mouse(bNodeTree *ntree, int mx, int my) /* ****** Click Select ****** */ -static bNode *node_mouse_select(SpaceNode *snode, ARegion *ar, const short mval[2], short extend) +static bNode *node_mouse_select(SpaceNode *snode, ARegion *ar, const int mval[2], short extend) { bNode *node; float mx, my; @@ -102,7 +102,7 @@ static int node_select_exec(bContext *C, wmOperator *op) { SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); - short mval[2]; + int mval[2]; short extend; bNode *node= NULL; @@ -125,7 +125,7 @@ static int node_select_exec(bContext *C, wmOperator *op) static int node_select_invoke(bContext *C, wmOperator *op, wmEvent *event) { ARegion *ar= CTX_wm_region(C); - short mval[2]; + int mval[2]; mval[0]= event->x - ar->winrct.xmin; mval[1]= event->y - ar->winrct.ymin; @@ -199,7 +199,7 @@ static int node_border_select_invoke(bContext *C, wmOperator *op, wmEvent *event /* this allows border select on empty space, but drag-translate on nodes */ SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); - short mval[2]; + int mval[2]; float mx, my; mval[0]= event->x - ar->winrct.xmin; diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c index 1ae36b077af..9665a152970 100644 --- a/source/blender/editors/space_node/node_state.c +++ b/source/blender/editors/space_node/node_state.c @@ -158,7 +158,7 @@ static int do_header_hidden_node(bNode *node, float mx, float my) return 0; } -static int node_toggle_visibility(SpaceNode *snode, ARegion *ar, const short mval[2]) +static int node_toggle_visibility(SpaceNode *snode, ARegion *ar, const int mval[2]) { bNode *node; float mx, my; @@ -189,7 +189,7 @@ static int node_toggle_visibility_exec(bContext *C, wmOperator *op) { SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); - short mval[2]; + int mval[2]; mval[0] = RNA_int_get(op->ptr, "mouse_x"); mval[1] = RNA_int_get(op->ptr, "mouse_y"); @@ -202,7 +202,7 @@ static int node_toggle_visibility_exec(bContext *C, wmOperator *op) static int node_toggle_visibility_invoke(bContext *C, wmOperator *op, wmEvent *event) { ARegion *ar= CTX_wm_region(C); - short mval[2]; + int mval[2]; mval[0]= event->x - ar->winrct.xmin; mval[1]= event->y - ar->winrct.ymin; diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 2ef8fb12965..77901f7fd29 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -120,7 +120,7 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, w ARegion *ar= CTX_wm_region(C); View2D *v2d= UI_view2d_fromcontext(C); - short mval[2]; + int mval[2]; float mval_v2d[2]; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 92fae3d4820..6d74ba07005 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -191,7 +191,7 @@ void boundbox_seq(Scene *scene, rctf *rect) static int mouse_frame_side(View2D *v2d, short mouse_x, int frame ) { - short mval[2]; + int mval[2]; float mouseloc[2]; mval[0]= mouse_x; @@ -284,7 +284,7 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i } -Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const short mval[2]) +Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[2]) { Sequence *seq; Editing *ed= seq_give_editing(scene, FALSE); @@ -1084,7 +1084,7 @@ static int seq_get_snaplimit(View2D *v2d) /* fake mouse coords to get the snap value a bit lazy but its only done once pre transform */ float xmouse, ymouse, x; - short mval[2] = {24, 0}; /* 24 screen px snap */ + int mval[2] = {24, 0}; /* 24 screen px snap */ UI_view2d_region_to_view(v2d, mval[0], mval[1], &xmouse, &ymouse); x = xmouse; diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 9a4796ced5e..209b39662aa 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -61,7 +61,7 @@ void seq_reset_imageofs(struct SpaceSeq *sseq); struct View2D; void seq_rectf(struct Sequence *seq, struct rctf *rectf); void boundbox_seq(struct Scene *scene, struct rctf *rect); -struct Sequence *find_nearest_seq(struct Scene *scene, struct View2D *v2d, int *hand, const short mval[2]); +struct Sequence *find_nearest_seq(struct Scene *scene, struct View2D *v2d, int *hand, const int mval[2]); struct Sequence *find_neighboring_sequence(struct Scene *scene, struct Sequence *test, int lr, int sel); void deselect_all_seq(struct Scene *scene); void recurs_sel_seq(struct Sequence *seqm); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index b2d6ab6f8ca..2cae2d17a33 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -307,7 +307,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) short left_right= RNA_boolean_get(op->ptr, "left_right"); short linked_time= RNA_boolean_get(op->ptr, "linked_time"); - short mval[2]; + int mval[2]; Sequence *seq,*neighbor, *act_orig; int hand,sel_side; @@ -489,7 +489,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) /* marker transform */ #if 0 // XXX probably need to redo this differently for 2.5 if (marker) { - short mval[2], xo, yo; + int mval[2], xo, yo; // getmouseco_areawin(mval); xo= mval[0]; yo= mval[1]; @@ -656,7 +656,7 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEv View2D *v2d= UI_view2d_fromcontext(C); short extend= RNA_boolean_get(op->ptr, "extend"); - short mval[2]; + int mval[2]; Sequence *mouse_seq; int selected, hand; @@ -837,7 +837,7 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op) rcti rect; rctf rectf, rq; short selecting = (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT); - short mval[2]; + int mval[2]; if(ed==NULL) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index e87719084ce..635e922cd65 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2109,7 +2109,7 @@ static void scroll_apply(bContext *C, wmOperator *op, wmEvent *event) SpaceText *st= CTX_wm_space_text(C); ARegion *ar= CTX_wm_region(C); TextScroll *tsc= op->customdata; - short mval[2]= {event->x, event->y}; + int mval[2]= {event->x, event->y}; short txtdelta[2] = {0, 0}; text_update_character_width(st); @@ -2283,7 +2283,7 @@ static int scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event) SpaceText *st= CTX_wm_space_text(C); ARegion *ar= CTX_wm_region(C); TextScroll *tsc; - const short *mval= event->mval; + const int *mval= event->mval; int zone= -1; if(RNA_property_is_set(op->ptr, "lines")) @@ -2694,7 +2694,7 @@ static int line_number_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *even SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); ARegion *ar= CTX_wm_region(C); - const short *mval= event->mval; + const int *mval= event->mval; double time; static int jump_to= 0; static double last_jump= 0; diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c index bd8710ec120..6e6f131655b 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_python.c @@ -54,7 +54,7 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar) TextLine *tmp; int l, x, y, w, h, i; int tgti, *top; - short mval[2] = {0, 0}; + int mval[2] = {0, 0}; if(!st || !st->text) return 0; if(!texttool_text_is_active(st->text)) return 0; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 856d5f01998..0ef3a56cb46 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -669,7 +669,7 @@ typedef struct ViewCachedString { unsigned char ub[4]; int pack; } col; - short mval[2]; + short sco[2]; short xoffs; short flag; int str_len, pad; @@ -711,8 +711,8 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa for(vos= strings->first; vos; vos= vos->next) { if(mat && !(vos->flag & V3D_CACHE_TEXT_WORLDSPACE)) mul_m4_v3(mat, vos->vec); - view3d_project_short_clip(ar, vos->vec, vos->mval, 0); - if(vos->mval[0]!=IS_CLIPPED) + view3d_project_short_clip(ar, vos->vec, vos->sco, 0); + if(vos->sco[0]!=IS_CLIPPED) tot++; } @@ -752,7 +752,7 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa continue; } #endif - if(vos->mval[0]!=IS_CLIPPED) { + if(vos->sco[0]!=IS_CLIPPED) { const char *str= (char *)(vos+1); if(col_pack_prev != vos->col.pack) { @@ -760,10 +760,10 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa col_pack_prev= vos->col.pack; } if(vos->flag & V3D_CACHE_TEXT_ASCII) { - BLF_draw_default_ascii((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, vos->str_len); + BLF_draw_default_ascii((float)vos->sco[0]+vos->xoffs, (float)vos->sco[1], (depth_write)? 0.0f: 2.0f, str, vos->str_len); } else { - BLF_draw_default((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, vos->str_len); + BLF_draw_default((float)vos->sco[0]+vos->xoffs, (float)vos->sco[1], (depth_write)? 0.0f: 2.0f, str, vos->str_len); } } } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 66f5ac18fbf..6f5960f5ed3 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -564,13 +564,13 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d) { - short mx,my,co[2]; + int mx, my, co[2]; int flag; /* we dont want the clipping for cursor */ flag= v3d->flag; v3d->flag= 0; - project_short(ar, give_cursor(scene, v3d), co); + project_int(ar, give_cursor(scene, v3d), co); v3d->flag= flag; mx = co[0]; @@ -1279,7 +1279,7 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax, } /* smart function to sample a rect spiralling outside, nice for backbuf selection */ -unsigned int view3d_sample_backbuf_rect(ViewContext *vc, const short mval[2], int size, +unsigned int view3d_sample_backbuf_rect(ViewContext *vc, const int mval[2], int size, unsigned int min, unsigned int max, int *dist, short strict, void *handle, unsigned int (*indextest)(void *handle, unsigned int index)) { diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 30bfc355480..53d2bed996e 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -396,7 +396,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) } /* for dolly */ - window_to_3d_vector(vod->ar, vod->mousevec, (vod->oldx - vod->ar->winrct.xmin)-(vod->ar->winx)/2, (vod->oldy - vod->ar->winrct.ymin)-(vod->ar->winy)/2); + window_to_3d_vector(vod->ar, vod->mousevec, vod->oldx - vod->ar->winrct.xmin, vod->oldy - vod->ar->winrct.ymin); /* lookup, we dont pass on v3d to prevent confusement */ vod->grid= v3d->grid; @@ -1349,7 +1349,7 @@ void VIEW3D_OT_zoom(wmOperatorType *ot) static void view_dolly_mouseloc(ARegion *ar, float orig_ofs[3], float dvec[3], float dfac) { RegionView3D *rv3d= ar->regiondata; - madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, 1.0 - dfac); + madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, -(1.0 - dfac)); } static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_invert) @@ -1444,7 +1444,8 @@ static int viewdolly_exec(bContext *C, wmOperator *op) else { sa= CTX_wm_area(C); ar= CTX_wm_region(C); - normalize_v3_v3(mousevec, ((RegionView3D *)ar->regiondata)->viewinv[2]); + negate_v3_v3(mousevec, ((RegionView3D *)ar->regiondata)->viewinv[2]); + normalize_v3(mousevec); } /* v3d= sa->spacedata.first; */ /* UNUSED */ @@ -1498,7 +1499,8 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event) /* overwrite the mouse vector with the view direction (zoom into the center) */ if((U.uiflag & USER_ZOOM_TO_MOUSEPOS) == 0) { - normalize_v3_v3(vod->mousevec, vod->rv3d->viewinv[2]); + negate_v3_v3(vod->mousevec, vod->rv3d->viewinv[2]); + normalize_v3(vod->mousevec); } if (event->type == MOUSEZOOM) { @@ -2733,7 +2735,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); float dx, dy, fz, *fp = NULL, dvec[3], oldcurs[3]; - short mx, my, mval[2]; + int mx, my, mval[2]; // short ctrl= 0; // XXX int flip; fp= give_cursor(scene, v3d); @@ -2744,7 +2746,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve mx= event->x - ar->winrct.xmin; my= event->y - ar->winrct.ymin; - project_short_noclip(ar, fp, mval); + project_int_noclip(ar, fp, mval); flip= initgrabz(rv3d, fp[0], fp[1], fp[2]); /* reset the depth based on the view offset */ @@ -2752,7 +2754,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve negate_v3_v3(fp, rv3d->ofs); /* re initialize */ - project_short_noclip(ar, fp, mval); + project_int_noclip(ar, fp, mval); flip= initgrabz(rv3d, fp[0], fp[1], fp[2]); } @@ -2760,7 +2762,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve short depth_used = 0; if (U.uiflag & USER_ORBIT_ZBUF) { /* maybe this should be accessed some other way */ - short mval_depth[2]; + int mval_depth[2]; mval_depth[0]= mx; mval_depth[1]= my; view3d_operator_needs_opengl(C); @@ -2891,7 +2893,7 @@ void VIEW3D_OT_enable_manipulator(wmOperatorType *ot) /* ************************* below the line! *********************** */ -static float view_autodist_depth_margin(ARegion *ar, const short mval[2], int margin) +static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int margin) { ViewDepths depth_temp= {0}; rcti rect; @@ -2919,7 +2921,7 @@ static float view_autodist_depth_margin(ARegion *ar, const short mval[2], int ma } /* XXX todo Zooms in on a border drawn by the user */ -int view_autodist(Scene *scene, ARegion *ar, View3D *v3d, const short mval[2], float mouse_worldloc[3] ) //, float *autodist ) +int view_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3] ) //, float *autodist ) { bglMats mats; /* ZBuffer depth vars */ float depth_close= FLT_MAX; @@ -2962,7 +2964,7 @@ int view_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, flo } // no 4x4 sampling, run view_autodist_init first -int view_autodist_simple(ARegion *ar, const short mval[2], float mouse_worldloc[3], int margin, float *force_depth) //, float *autodist ) +int view_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth) //, float *autodist ) { bglMats mats; /* ZBuffer depth vars, could cache? */ float depth; @@ -2990,7 +2992,7 @@ int view_autodist_simple(ARegion *ar, const short mval[2], float mouse_worldloc[ return 1; } -int view_autodist_depth(struct ARegion *ar, const short mval[2], int margin, float *depth) +int view_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth) { *depth= view_autodist_depth_margin(ar, mval, margin); @@ -3000,11 +3002,11 @@ int view_autodist_depth(struct ARegion *ar, const short mval[2], int margin, flo static int depth_segment_cb(int x, int y, void *userData) { struct { struct ARegion *ar; int margin; float depth; } *data = userData; - short mval[2]; + int mval[2]; float depth; - mval[0]= (short)x; - mval[1]= (short)y; + mval[0]= x; + mval[1]= y; depth= view_autodist_depth_margin(data->ar, mval, data->margin); @@ -3017,7 +3019,7 @@ static int depth_segment_cb(int x, int y, void *userData) } } -int view_autodist_depth_segment(struct ARegion *ar, const short mval_sta[2], const short mval_end[2], int margin, float *depth) +int view_autodist_depth_segment(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth) { struct { struct ARegion *ar; int margin; float depth; } data = {NULL}; int p1[2]; diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 32deee50fb2..e37361fbc54 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -158,7 +158,7 @@ typedef struct FlyInfo { short state; short use_precision; short redraw; - short mval[2]; + int mval[2]; /* fly state state */ float speed; /* the speed the view is moving per redraw */ diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index b35e92995fa..a9f8a3f075a 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -93,15 +93,15 @@ void view3d_set_viewcontext(bContext *C, ViewContext *vc) vc->obedit= CTX_data_edit_object(C); } -int view3d_get_view_aligned_coordinate(ViewContext *vc, float fp[3], const short mval[2], const short do_fallback) +int view3d_get_view_aligned_coordinate(ViewContext *vc, float fp[3], const int mval[2], const short do_fallback) { float dvec[3]; - short mval_cpy[2]; + int mval_cpy[2]; mval_cpy[0]= mval[0]; mval_cpy[1]= mval[1]; - project_short_noclip(vc->ar, fp, mval_cpy); + project_int_noclip(vc->ar, fp, mval_cpy); initgrabz(vc->rv3d, fp[0], fp[1], fp[2]); @@ -280,12 +280,12 @@ static int edge_inside_rect(rcti *rect, short x1, short y1, short x2, short y2) #define MOVES_GESTURE 50 #define MOVES_LASSO 500 -int lasso_inside(short mcords[][2], short moves, short sx, short sy) +int lasso_inside(int mcords[][2], short moves, int sx, int sy) { /* we do the angle rule, define that all added angles should be about zero or 2*PI */ float angletot=0.0, len, dot, ang, cross, fp1[2], fp2[2]; int a; - short *p1, *p2; + int *p1, *p2; if(sx==IS_CLIPPED) return 0; @@ -328,9 +328,9 @@ int lasso_inside(short mcords[][2], short moves, short sx, short sy) } /* edge version for lasso select. we assume boundbox check was done */ -int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, int y1) +int lasso_inside_edge(int mcords[][2], short moves, int x0, int y0, int x1, int y1) { - short v1[2], v2[2]; + int v1[2], v2[2]; int a; if(x0==IS_CLIPPED || x1==IS_CLIPPED) @@ -345,9 +345,9 @@ int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, in /* no points in lasso, so we have to intersect with lasso edge */ - if( isect_line_line_v2_short(mcords[0], mcords[moves-1], v1, v2) > 0) return 1; + if( isect_line_line_v2_int(mcords[0], mcords[moves-1], v1, v2) > 0) return 1; for(a=0; a<moves-1; a++) { - if( isect_line_line_v2_short(mcords[a], mcords[a+1], v1, v2) > 0) return 1; + if( isect_line_line_v2_int(mcords[a], mcords[a+1], v1, v2) > 0) return 1; } return 0; @@ -357,11 +357,11 @@ int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, in /* warning; lasso select with backbuffer-check draws in backbuf with persp(PERSP_WIN) and returns with persp(PERSP_VIEW). After lasso select backbuf is not OK */ -static void do_lasso_select_pose(ViewContext *vc, Object *ob, short mcords[][2], short moves, short select) +static void do_lasso_select_pose(ViewContext *vc, Object *ob, int mcords[][2], short moves, short select) { bPoseChannel *pchan; float vec[3]; - short sco1[2], sco2[2]; + int sco1[2], sco2[2]; bArmature *arm= ob->data; if(ob->type!=OB_ARMATURE || ob->pose==NULL) return; @@ -369,9 +369,9 @@ static void do_lasso_select_pose(ViewContext *vc, Object *ob, short mcords[][2], for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { if (PBONE_VISIBLE(arm, pchan->bone) && (pchan->bone->flag & BONE_UNSELECTABLE)==0) { mul_v3_m4v3(vec, ob->obmat, pchan->pose_head); - project_short(vc->ar, vec, sco1); + project_int(vc->ar, vec, sco1); mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail); - project_short(vc->ar, vec, sco2); + project_int(vc->ar, vec, sco2); if(lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) { if(select) pchan->bone->flag |= BONE_SELECTED; @@ -392,7 +392,7 @@ static void object_deselect_all_visible(Scene *scene, View3D *v3d) } } -static void do_lasso_select_objects(ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void do_lasso_select_objects(ViewContext *vc, int mcords[][2], short moves, short extend, short select) { Base *base; @@ -415,7 +415,7 @@ static void do_lasso_select_objects(ViewContext *vc, short mcords[][2], short mo } } -static void lasso_select_boundbox(rcti *rect, short mcords[][2], short moves) +static void lasso_select_boundbox(rcti *rect, int mcords[][2], short moves) { short a; @@ -432,7 +432,7 @@ static void lasso_select_boundbox(rcti *rect, short mcords[][2], short moves) static void do_lasso_select_mesh__doSelectVert(void *userData, BMVert *eve, int x, int y, int UNUSED(index)) { - struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData; + struct { ViewContext vc; rcti *rect; int (*mcords)[2], moves, select, pass, done; } *data = userData; if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) { BM_Select(data->vc.em->bm, eve, data->select); @@ -440,7 +440,7 @@ static void do_lasso_select_mesh__doSelectVert(void *userData, BMVert *eve, int } static void do_lasso_select_mesh__doSelectEdge(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index) { - struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData; + struct { ViewContext vc; rcti *rect; int (*mcords)[2], moves, select, pass, done; } *data = userData; if (EDBM_check_backbuf(bm_solidoffs+index)) { if (data->pass==0) { @@ -459,16 +459,16 @@ static void do_lasso_select_mesh__doSelectEdge(void *userData, BMEdge *eed, int } static void do_lasso_select_mesh__doSelectFace(void *userData, BMFace *efa, int x, int y, int UNUSED(index)) { - struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData; + struct { ViewContext vc; rcti *rect; int (*mcords)[2], moves, select, pass, done; } *data = userData; if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) { BM_Select(data->vc.em->bm, efa, data->select); } } -static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves, short extend, short select) { - struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } data; + struct { ViewContext vc; rcti *rect; int (*mcords)[2], moves, select, pass, done; } data; ToolSettings *ts= vc->scene->toolsettings; rcti rect; int bbsel; @@ -534,7 +534,7 @@ static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves #if 0 /* this is an exception in that its the only lasso that dosnt use the 3d view (uses space image view) */ -static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select) +static void do_lasso_select_mesh_uv(int mcords[][2], short moves, short select) { EditFace *efa; MTFace *tf; @@ -591,7 +591,7 @@ static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { - struct { ViewContext *vc; short (*mcords)[2]; short moves; short select; } *data = userData; + struct { ViewContext *vc; int (*mcords)[2]; short moves; short select; } *data = userData; Object *obedit= data->vc->obedit; Curve *cu= (Curve*)obedit->data; @@ -618,9 +618,9 @@ static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BP } } -static void do_lasso_select_curve(ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void do_lasso_select_curve(ViewContext *vc, int mcords[][2], short moves, short extend, short select) { - struct { ViewContext *vc; short (*mcords)[2]; short moves; short select; } data; + struct { ViewContext *vc; int (*mcords)[2]; short moves; short select; } data; /* set vc->editnurb */ data.vc = vc; @@ -637,15 +637,15 @@ static void do_lasso_select_curve(ViewContext *vc, short mcords[][2], short move static void do_lasso_select_lattice__doSelect(void *userData, BPoint *bp, int x, int y) { - struct { short (*mcords)[2]; short moves; short select; } *data = userData; + struct { int (*mcords)[2]; short moves; short select; } *data = userData; if (lasso_inside(data->mcords, data->moves, x, y)) { bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT); } } -static void do_lasso_select_lattice(ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void do_lasso_select_lattice(ViewContext *vc, int mcords[][2], short moves, short extend, short select) { - struct { short (*mcords)[2]; short moves; short select; } data; + struct { int (*mcords)[2]; short moves; short select; } data; /* set editdata in vc */ data.mcords = mcords; @@ -659,7 +659,7 @@ static void do_lasso_select_lattice(ViewContext *vc, short mcords[][2], short mo lattice_foreachScreenVert(vc, do_lasso_select_lattice__doSelect, &data); } -static void do_lasso_select_armature(ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void do_lasso_select_armature(ViewContext *vc, int mcords[][2], short moves, short extend, short select) { bArmature *arm= vc->obedit->data; EditBone *ebone; @@ -711,7 +711,7 @@ static void do_lasso_select_armature(ViewContext *vc, short mcords[][2], short m -static void do_lasso_select_meta(ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void do_lasso_select_meta(ViewContext *vc, int mcords[][2], short moves, short extend, short select) { MetaBall *mb = (MetaBall*)vc->obedit->data; MetaElem *ml; @@ -736,7 +736,7 @@ static void do_lasso_select_meta(ViewContext *vc, short mcords[][2], short moves } } -static void do_lasso_select_paintface(ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void do_lasso_select_paintface(ViewContext *vc, int mcords[][2], short moves, short extend, short select) { Object *ob= vc->obact; Mesh *me= ob?ob->data:NULL; @@ -761,7 +761,7 @@ static void do_lasso_select_paintface(ViewContext *vc, short mcords[][2], short } #if 0 -static void do_lasso_select_node(short mcords[][2], short moves, short select) +static void do_lasso_select_node(int mcords[][2], short moves, short select) { SpaceNode *snode = sa->spacedata.first; @@ -791,7 +791,7 @@ static void do_lasso_select_node(short mcords[][2], short moves, short select) } #endif -static void view3d_lasso_select(bContext *C, ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void view3d_lasso_select(bContext *C, ViewContext *vc, int mcords[][2], short moves, short extend, short select) { Object *ob = CTX_data_active_object(C); @@ -840,14 +840,14 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op) { ViewContext vc; int i= 0; - short mcords[1024][2]; + int mcords[1024][2]; RNA_BEGIN(op->ptr, itemptr, "path") { float loc[2]; RNA_float_get_array(&itemptr, "loc", loc); - mcords[i][0]= (short)loc[0]; - mcords[i][1]= (short)loc[1]; + mcords[i][0]= (int)loc[0]; + mcords[i][1]= (int)loc[1]; i++; if(i>=1024) break; } @@ -959,7 +959,7 @@ static void deselectall_except(Scene *scene, Base *b) /* deselect all except b } } -static Base *mouse_select_menu(bContext *C, ViewContext *vc, unsigned int *buffer, int hits, const short mval[2], short extend) +static Base *mouse_select_menu(bContext *C, ViewContext *vc, unsigned int *buffer, int hits, const int mval[2], short extend) { short baseCount = 0; short ok; @@ -1045,7 +1045,7 @@ static Base *mouse_select_menu(bContext *C, ViewContext *vc, unsigned int *buffe /* we want a select buffer with bones, if there are... */ /* so check three selection levels and compare */ -static short mixed_bones_object_selectbuffer(ViewContext *vc, unsigned int *buffer, const short mval[2]) +static short mixed_bones_object_selectbuffer(ViewContext *vc, unsigned int *buffer, const int mval[2]) { rcti rect; int offs; @@ -1102,12 +1102,12 @@ static short mixed_bones_object_selectbuffer(ViewContext *vc, unsigned int *buff } /* returns basact */ -static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int hits, const short mval[2], Base *startbase, int has_bones) +static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int hits, const int mval[2], Base *startbase, int has_bones) { Scene *scene= vc->scene; View3D *v3d= vc->v3d; Base *base, *basact= NULL; - static short lastmval[2]={-100, -100}; + static int lastmval[2]={-100, -100}; int a, donearest= 0; /* define if we use solid nearest select or not */ @@ -1195,7 +1195,7 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int } /* mval comes from event->mval, only use within region handlers */ -Base *ED_view3d_give_base_under_cursor(bContext *C, const short mval[2]) +Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2]) { ViewContext vc; Base *basact= NULL; @@ -1220,7 +1220,7 @@ Base *ED_view3d_give_base_under_cursor(bContext *C, const short mval[2]) } /* mval is region coords */ -static int mouse_select(bContext *C, const short mval[2], short extend, short obcenter, short enumerate) +static int mouse_select(bContext *C, const int mval[2], short extend, short obcenter, short enumerate) { ViewContext vc; ARegion *ar= CTX_wm_region(C); @@ -1911,7 +1911,7 @@ void VIEW3D_OT_select(wmOperatorType *ot) static void mesh_circle_doSelectVert(void *userData, BMVert *eve, int x, int y, int UNUSED(index)) { - struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; + struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; float r = sqrt(mx*mx + my*my); @@ -1921,7 +1921,7 @@ static void mesh_circle_doSelectVert(void *userData, BMVert *eve, int x, int y, } static void mesh_circle_doSelectEdge(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index)) { - struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; + struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData; if (edge_inside_circle(data->mval[0], data->mval[1], (short) data->radius, x0, y0, x1, y1)) { BM_Select(data->vc->em->bm, eed, data->select); @@ -1929,7 +1929,7 @@ static void mesh_circle_doSelectEdge(void *userData, BMEdge *eed, int x0, int y0 } static void mesh_circle_doSelectFace(void *userData, BMFace *efa, int x, int y, int UNUSED(index)) { - struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; + struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; float r = sqrt(mx*mx + my*my); @@ -1938,11 +1938,11 @@ static void mesh_circle_doSelectFace(void *userData, BMFace *efa, int x, int y, } } -static void mesh_circle_select(ViewContext *vc, int select, const short mval[2], float rad) +static void mesh_circle_select(ViewContext *vc, int select, const int mval[2], float rad) { ToolSettings *ts= vc->scene->toolsettings; int bbsel; - struct {ViewContext *vc; short select, mval[2]; float radius; } data; + struct {ViewContext *vc; short select; int mval[2]; float radius; } data; bbsel= EDBM_init_backbuf_circle(vc, mval[0], mval[1], (short)(rad+1.0)); ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */ @@ -1983,7 +1983,7 @@ static void mesh_circle_select(ViewContext *vc, int select, const short mval[2], EDBM_selectmode_flush(vc->em); } -static void paint_facesel_circle_select(ViewContext *vc, int select, const short mval[2], float rad) +static void paint_facesel_circle_select(ViewContext *vc, int select, const int mval[2], float rad) { Object *ob= vc->obact; Mesh *me = ob?ob->data:NULL; @@ -2001,7 +2001,7 @@ static void paint_facesel_circle_select(ViewContext *vc, int select, const short static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { - struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; + struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; float r = sqrt(mx*mx + my*my); Object *obedit= data->vc->obedit; @@ -2030,9 +2030,9 @@ static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint } } } -static void nurbscurve_circle_select(ViewContext *vc, int select, const short mval[2], float rad) +static void nurbscurve_circle_select(ViewContext *vc, int select, const int mval[2], float rad) { - struct {ViewContext *vc; short select, mval[2]; float radius; } data; + struct {ViewContext *vc; short select; int mval[2]; float radius; } data; /* set vc-> edit data */ @@ -2049,7 +2049,7 @@ static void nurbscurve_circle_select(ViewContext *vc, int select, const short mv static void latticecurve_circle_doSelect(void *userData, BPoint *bp, int x, int y) { - struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; + struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; float r = sqrt(mx*mx + my*my); @@ -2057,9 +2057,9 @@ static void latticecurve_circle_doSelect(void *userData, BPoint *bp, int x, int bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT); } } -static void lattice_circle_select(ViewContext *vc, int select, const short mval[2], float rad) +static void lattice_circle_select(ViewContext *vc, int select, const int mval[2], float rad) { - struct {ViewContext *vc; short select, mval[2]; float radius; } data; + struct {ViewContext *vc; short select; int mval[2]; float radius; } data; /* set vc-> edit data */ @@ -2076,7 +2076,7 @@ static void lattice_circle_select(ViewContext *vc, int select, const short mval[ // NOTE: pose-bone case is copied from editbone case... static short pchan_circle_doSelectJoint(void *userData, bPoseChannel *pchan, int x, int y) { - struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; + struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; float r = sqrt(mx*mx + my*my); @@ -2089,9 +2089,9 @@ static short pchan_circle_doSelectJoint(void *userData, bPoseChannel *pchan, int } return 0; } -static void pose_circle_select(ViewContext *vc, int select, const short mval[2], float rad) +static void pose_circle_select(ViewContext *vc, int select, const int mval[2], float rad) { - struct {ViewContext *vc; short select, mval[2]; float radius; } data; + struct {ViewContext *vc; short select; int mval[2]; float radius; } data; bPose *pose = vc->obact->pose; bPoseChannel *pchan; int change= FALSE; @@ -2136,7 +2136,7 @@ static void pose_circle_select(ViewContext *vc, int select, const short mval[2], static short armature_circle_doSelectJoint(void *userData, EditBone *ebone, int x, int y, short head) { - struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; + struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; float r = sqrt(mx*mx + my*my); @@ -2157,7 +2157,7 @@ static short armature_circle_doSelectJoint(void *userData, EditBone *ebone, int } return 0; } -static void armature_circle_select(ViewContext *vc, int select, const short mval[2], float rad) +static void armature_circle_select(ViewContext *vc, int select, const int mval[2], float rad) { struct {ViewContext *vc; short select, mval[2]; float radius; } data; bArmature *arm= vc->obedit->data; @@ -2216,7 +2216,7 @@ static void armature_circle_select(ViewContext *vc, int select, const short mval /** Callbacks for circle selection in Editmode */ -static void obedit_circle_select(ViewContext *vc, short select, const short mval[2], float rad) +static void obedit_circle_select(ViewContext *vc, short select, const int mval[2], float rad) { switch(vc->obedit->type) { case OB_MESH: @@ -2257,7 +2257,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) (obact && (obact->mode & (OB_MODE_PARTICLE_EDIT|OB_MODE_POSE))) ) { ViewContext vc; - short mval[2]; + int mval[2]; view3d_operator_needs_opengl(C); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 124b7949658..8adcd80d1c2 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -647,7 +647,7 @@ int initgrabz(RegionView3D *rv3d, float x, float y, float z) } /* always call initgrabz */ -void window_to_3d(ARegion *ar, float out[3], short mx, short my) +void window_to_3d(ARegion *ar, float out[3], const int mx, const int my) { RegionView3D *rv3d= ar->regiondata; @@ -665,7 +665,7 @@ void window_to_3d(ARegion *ar, float out[3], short mx, short my) /* always call initgrabz */ /* only to detect delta motion */ -void window_to_3d_delta(ARegion *ar, float out[3], short mx, short my) +void window_to_3d_delta(ARegion *ar, float out[3], const int mx, const int my) { RegionView3D *rv3d= ar->regiondata; float dx, dy; @@ -681,21 +681,21 @@ void window_to_3d_delta(ARegion *ar, float out[3], short mx, short my) /* doesn't rely on initgrabz */ /* for perspective view, get the vector direction to * the mouse cursor as a normalized vector */ -void window_to_3d_vector(ARegion *ar, float out[3], short mx, short my) +void window_to_3d_vector(ARegion *ar, float out[3], const int mx, const int my) { RegionView3D *rv3d= ar->regiondata; float dx, dy; float viewvec[3]; - dx= 2.0f*mx/ar->winx; - dy= 2.0f*my/ar->winy; + dx= (2.0f * mx / ar->winx) - 1.0f; + dy= (2.0f * my / ar->winy) - 1.0f; /* normalize here so vecs are proportional to eachother */ normalize_v3_v3(viewvec, rv3d->viewinv[2]); - out[0]= viewvec[0] - (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy); - out[1]= viewvec[1] - (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy); - out[2]= viewvec[2] - (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy); + out[0]= (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy) - viewvec[0]; + out[1]= (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy) - viewvec[1]; + out[2]= (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy) - viewvec[2]; normalize_v3(out); } diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index dc89ce19944..d225f1b2572 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -124,7 +124,7 @@ void setTransformViewMatrices(TransInfo *t) calculateCenter2D(t); } -void convertViewVec(TransInfo *t, float *vec, short dx, short dy) +void convertViewVec(TransInfo *t, float *vec, int dx, int dy) { if (t->spacetype==SPACE_VIEW3D) { if (t->ar->regiontype == RGN_TYPE_WINDOW) @@ -787,7 +787,7 @@ int transformEvent(TransInfo *t, wmEvent *event) case SPACEKEY: if ((t->spacetype==SPACE_VIEW3D) && event->alt) { #if 0 // TRANSFORM_FIX_ME - short mval[2]; + int mval[2]; getmouseco_sc(mval); BIF_selectOrientation(); @@ -1274,7 +1274,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) setlinestyle(3); glBegin(GL_LINE_STRIP); - glVertex2sv(t->mval); + glVertex2iv(t->mval); glVertex2fv(cent); glEnd(); @@ -1319,7 +1319,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) setlinestyle(3); glBegin(GL_LINE_STRIP); - glVertex2sv(t->mval); + glVertex2iv(t->mval); glVertex2fv(cent); glEnd(); @@ -2290,7 +2290,7 @@ int handleEventWarp(TransInfo *t, wmEvent *event) return status; } -int Warp(TransInfo *t, const short UNUSED(mval[2])) +int Warp(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; float vec[3], circumfac, dist, phi0, co, si, *curs, cursor[3], gcursor[3]; @@ -2438,7 +2438,7 @@ int handleEventShear(TransInfo *t, wmEvent *event) } -int Shear(TransInfo *t, const short UNUSED(mval[2])) +int Shear(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; float vec[3]; @@ -2704,7 +2704,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) { constraintTransLim(t, td); } -int Resize(TransInfo *t, const short mval[2]) +int Resize(TransInfo *t, const int mval[2]) { TransData *td; float size[3], mat[3][3]; @@ -2809,7 +2809,7 @@ void initToSphere(TransInfo *t) t->val /= (float)t->total; } -int ToSphere(TransInfo *t, const short UNUSED(mval[2])) +int ToSphere(TransInfo *t, const int UNUSED(mval[2])) { float vec[3]; float ratio, radius; @@ -3156,7 +3156,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3]) } } -int Rotation(TransInfo *t, const short UNUSED(mval[2])) +int Rotation(TransInfo *t, const int UNUSED(mval[2])) { char str[128], *spos= str; @@ -3264,7 +3264,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a } } -int Trackball(TransInfo *t, const short UNUSED(mval[2])) +int Trackball(TransInfo *t, const int UNUSED(mval[2])) { char str[128], *spos= str; float axis1[3], axis2[3]; @@ -3495,7 +3495,7 @@ static void applyTranslation(TransInfo *t, float vec[3]) { } /* uses t->vec to store actual translation in */ -int Translation(TransInfo *t, const short UNUSED(mval[2])) +int Translation(TransInfo *t, const int UNUSED(mval[2])) { char str[250]; @@ -3562,7 +3562,7 @@ void initShrinkFatten(TransInfo *t) -int ShrinkFatten(TransInfo *t, const short UNUSED(mval[2])) +int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) { float vec[3]; float distance; @@ -3637,7 +3637,7 @@ void initTilt(TransInfo *t) -int Tilt(TransInfo *t, const short UNUSED(mval[2])) +int Tilt(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; int i; @@ -3709,7 +3709,7 @@ void initCurveShrinkFatten(TransInfo *t) t->flag |= T_NO_CONSTRAINT; } -int CurveShrinkFatten(TransInfo *t, const short UNUSED(mval[2])) +int CurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; float ratio; @@ -3777,7 +3777,7 @@ void initPushPull(TransInfo *t) } -int PushPull(TransInfo *t, const short UNUSED(mval[2])) +int PushPull(TransInfo *t, const int UNUSED(mval[2])) { float vec[3], axis[3]; float distance; @@ -3910,7 +3910,7 @@ int handleEventBevel(TransInfo *t, wmEvent *event) return 0; } -int Bevel(TransInfo *t, const short UNUSED(mval[2])) +int Bevel(TransInfo *t, const int UNUSED(mval[2])) { float distance,d; int i; @@ -3978,7 +3978,7 @@ void initBevelWeight(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int BevelWeight(TransInfo *t, const short UNUSED(mval[2])) +int BevelWeight(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; float weight; @@ -4051,7 +4051,7 @@ void initCrease(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int Crease(TransInfo *t, const short UNUSED(mval[2])) +int Crease(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; float crease; @@ -4170,7 +4170,7 @@ static void ElementBoneSize(TransInfo *t, TransData *td, float mat[3][3]) td->loc[1]= oldy; } -int BoneSize(TransInfo *t, const short mval[2]) +int BoneSize(TransInfo *t, const int mval[2]) { TransData *td = t->data; float size[3], mat[3][3]; @@ -4246,7 +4246,7 @@ void initBoneEnvelope(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int BoneEnvelope(TransInfo *t, const short UNUSED(mval[2])) +int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; float ratio; @@ -4852,7 +4852,7 @@ int doEdgeSlide(TransInfo *t, float perc) return 1; } -int EdgeSlide(TransInfo *t, const short UNUSED(mval[2])) +int EdgeSlide(TransInfo *t, const int UNUSED(mval[2])) { char str[50]; float final; @@ -4911,7 +4911,7 @@ void initBoneRoll(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int BoneRoll(TransInfo *t, const short UNUSED(mval[2])) +int BoneRoll(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; int i; @@ -4972,7 +4972,7 @@ void initBakeTime(TransInfo *t) t->num.increment = t->snap[1]; } -int BakeTime(TransInfo *t, const short mval[2]) +int BakeTime(TransInfo *t, const int mval[2]) { TransData *td = t->data; float time; @@ -5047,7 +5047,7 @@ void initMirror(TransInfo *t) } } -int Mirror(TransInfo *t, const short UNUSED(mval[2])) +int Mirror(TransInfo *t, const int UNUSED(mval[2])) { TransData *td; float size[3], mat[3][3]; @@ -5124,7 +5124,7 @@ void initAlign(TransInfo *t) initMouseInputMode(t, &t->mouse, INPUT_NONE); } -int Align(TransInfo *t, const short UNUSED(mval[2])) +int Align(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; float center[3]; @@ -5227,7 +5227,7 @@ static void applySeqSlide(TransInfo *t, float val[2]) { } } -int SeqSlide(TransInfo *t, const short UNUSED(mval[2])) +int SeqSlide(TransInfo *t, const int UNUSED(mval[2])) { char str[200]; @@ -5517,7 +5517,7 @@ static void applyTimeTranslate(TransInfo *t, float UNUSED(sval)) } } -int TimeTranslate(TransInfo *t, const short mval[2]) +int TimeTranslate(TransInfo *t, const int mval[2]) { View2D *v2d = (View2D *)t->view; float cval[2], sval[2]; @@ -5647,7 +5647,7 @@ static void applyTimeSlide(TransInfo *t, float sval) } } -int TimeSlide(TransInfo *t, const short mval[2]) +int TimeSlide(TransInfo *t, const int mval[2]) { View2D *v2d = (View2D *)t->view; float cval[2], sval[2]; @@ -5772,7 +5772,7 @@ static void applyTimeScale(TransInfo *t) { } } -int TimeScale(TransInfo *t, const short UNUSED(mval[2])) +int TimeScale(TransInfo *t, const int UNUSED(mval[2])) { char str[200]; diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 380633fe874..1b0db37cd76 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -122,7 +122,7 @@ typedef struct TransCon { float pmtx[3][3]; /* Projection Constraint Matrix (same as imtx with some axis == 0) */ float center[3]; /* transformation center to define where to draw the view widget ALWAYS in global space. Unlike the transformation center */ - short imval[2]; /* initial mouse value for visual calculation */ + int imval[2]; /* initial mouse value for visual calculation */ /* the one in TransInfo is not garanty to stay the same (Rotates change it) */ int mode; /* Mode flags of the Constraint */ void (*drawExtra)(struct TransInfo *); @@ -227,7 +227,7 @@ typedef struct SlideData { struct EditVert *nearest; struct LinkNode *edgelist, *vertlist; */ - short start[2], end[2]; + int start[2], end[2]; struct BMEditMesh *em; float perc; } SlideData; @@ -254,12 +254,12 @@ typedef struct TransData { } TransData; typedef struct MouseInput { - void (*apply)(struct TransInfo *, struct MouseInput *, const short [2], float [3]); + void (*apply)(struct TransInfo *, struct MouseInput *, const int [2], float [3]); void (*post)(struct TransInfo *, float [3]); - short imval[2]; /* initial mouse position */ + int imval[2]; /* initial mouse position */ char precision; - short precision_mval[2]; /* mouse position when precision key was pressed */ + int precision_mval[2]; /* mouse position when precision key was pressed */ int center[2]; float factor; void *data; /* additional data, if needed by the particular function */ @@ -273,7 +273,7 @@ typedef struct TransInfo { int options; /* current context/options for transform */ float val; /* init value for some transformations (and rotation angle) */ float fac; /* factor for distance based transform */ - int (*transform)(struct TransInfo *, const short *); + int (*transform)(struct TransInfo *, const int *); /* transform function pointer */ int (*handleEvent)(struct TransInfo *, struct wmEvent *); /* event handler function pointer RETURN 1 if redraw is needed */ @@ -291,7 +291,7 @@ typedef struct TransInfo { char proptext[20]; /* proportional falloff text */ float center[3]; /* center of transformation */ int center2d[2]; /* center in screen coordinates */ - short imval[2]; /* initial mouse position */ + int imval[2]; /* initial mouse position */ short event_type; /* event->type used to invoke transform */ short idx_max; /* maximum index on the input vector */ float snap[3]; /* Snapping Gears */ @@ -340,7 +340,7 @@ typedef struct TransInfo { struct Scene *scene; struct ToolSettings *settings; struct wmTimer *animtimer; - short mval[2]; /* current mouse position */ + int mval[2]; /* current mouse position */ struct Object *obedit; void *draw_handle_apply; void *draw_handle_view; @@ -470,7 +470,7 @@ void transformApply(struct bContext *C, TransInfo *t); int transformEnd(struct bContext *C, TransInfo *t); void setTransformViewMatrices(TransInfo *t); -void convertViewVec(TransInfo *t, float *vec, short dx, short dy); +void convertViewVec(TransInfo *t, float *vec, int dx, int dy); void projectIntView(TransInfo *t, float *vec, int *adr); void projectFloatView(TransInfo *t, float *vec, float *adr); @@ -479,81 +479,81 @@ void removeAspectRatio(TransInfo *t, float *vec); void initWarp(TransInfo *t); int handleEventWarp(TransInfo *t, struct wmEvent *event); -int Warp(TransInfo *t, const short mval[2]); +int Warp(TransInfo *t, const int mval[2]); void initShear(TransInfo *t); int handleEventShear(TransInfo *t, struct wmEvent *event); -int Shear(TransInfo *t, const short mval[2]); +int Shear(TransInfo *t, const int mval[2]); void initResize(TransInfo *t); -int Resize(TransInfo *t, const short mval[2]); +int Resize(TransInfo *t, const int mval[2]); void initTranslation(TransInfo *t); -int Translation(TransInfo *t, const short mval[2]); +int Translation(TransInfo *t, const int mval[2]); void initToSphere(TransInfo *t); -int ToSphere(TransInfo *t, const short mval[2]); +int ToSphere(TransInfo *t, const int mval[2]); void initRotation(TransInfo *t); -int Rotation(TransInfo *t, const short mval[2]); +int Rotation(TransInfo *t, const int mval[2]); void initShrinkFatten(TransInfo *t); -int ShrinkFatten(TransInfo *t, const short mval[2]); +int ShrinkFatten(TransInfo *t, const int mval[2]); void initTilt(TransInfo *t); -int Tilt(TransInfo *t, const short mval[2]); +int Tilt(TransInfo *t, const int mval[2]); void initCurveShrinkFatten(TransInfo *t); -int CurveShrinkFatten(TransInfo *t, const short mval[2]); +int CurveShrinkFatten(TransInfo *t, const int mval[2]); void initTrackball(TransInfo *t); -int Trackball(TransInfo *t, const short mval[2]); +int Trackball(TransInfo *t, const int mval[2]); void initPushPull(TransInfo *t); -int PushPull(TransInfo *t, const short mval[2]); +int PushPull(TransInfo *t, const int mval[2]); void initBevel(TransInfo *t); int handleEventBevel(TransInfo *t, struct wmEvent *event); -int Bevel(TransInfo *t, const short mval[2]); +int Bevel(TransInfo *t, const int mval[2]); void initBevelWeight(TransInfo *t); -int BevelWeight(TransInfo *t, const short mval[2]); +int BevelWeight(TransInfo *t, const int mval[2]); void initCrease(TransInfo *t); -int Crease(TransInfo *t, const short mval[2]); +int Crease(TransInfo *t, const int mval[2]); void initBoneSize(TransInfo *t); -int BoneSize(TransInfo *t, const short mval[2]); +int BoneSize(TransInfo *t, const int mval[2]); void initBoneEnvelope(TransInfo *t); -int BoneEnvelope(TransInfo *t, const short mval[2]); +int BoneEnvelope(TransInfo *t, const int mval[2]); void initBoneRoll(TransInfo *t); -int BoneRoll(TransInfo *t, const short mval[2]); +int BoneRoll(TransInfo *t, const int mval[2]); void initEdgeSlide(TransInfo *t); -int EdgeSlide(TransInfo *t, const short mval[2]); +int EdgeSlide(TransInfo *t, const int mval[2]); void initTimeTranslate(TransInfo *t); -int TimeTranslate(TransInfo *t, const short mval[2]); +int TimeTranslate(TransInfo *t, const int mval[2]); void initTimeSlide(TransInfo *t); -int TimeSlide(TransInfo *t, const short mval[2]); +int TimeSlide(TransInfo *t, const int mval[2]); void initTimeScale(TransInfo *t); -int TimeScale(TransInfo *t, const short mval[2]); +int TimeScale(TransInfo *t, const int mval[2]); void initBakeTime(TransInfo *t); -int BakeTime(TransInfo *t, const short mval[2]); +int BakeTime(TransInfo *t, const int mval[2]); void initMirror(TransInfo *t); -int Mirror(TransInfo *t, const short mval[2]); +int Mirror(TransInfo *t, const int mval[2]); void initAlign(TransInfo *t); -int Align(TransInfo *t, const short mval[2]); +int Align(TransInfo *t, const int mval[2]); void initSeqSlide(TransInfo *t); -int SeqSlide(TransInfo *t, const short mval[2]); +int SeqSlide(TransInfo *t, const int mval[2]); void drawPropCircle(const struct bContext *C, TransInfo *t); @@ -657,12 +657,12 @@ typedef enum { INPUT_CUSTOM_RATIO } MouseInputMode; -void initMouseInput(TransInfo *t, MouseInput *mi, int center[2], short mval[2]); +void initMouseInput(TransInfo *t, MouseInput *mi, int center[2], int mval[2]); void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode); int handleMouseInput(struct TransInfo *t, struct MouseInput *mi, struct wmEvent *event); -void applyMouseInput(struct TransInfo *t, struct MouseInput *mi, short mval[2], float output[3]); +void applyMouseInput(struct TransInfo *t, struct MouseInput *mi, int mval[2], float output[3]); -void setCustomPoints(TransInfo *t, MouseInput *mi, short start[2], short end[2]); +void setCustomPoints(TransInfo *t, MouseInput *mi, int start[2], int end[2]); void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *, float [3])); /*********************** Generics ********************************/ diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 16a943baabe..0ca0812f050 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -665,7 +665,7 @@ void drawConstraint(TransInfo *t) char col2[3] = {255,255,255}; int depth_test_enabled; - convertViewVec(t, vec, (short)(t->mval[0] - t->con.imval[0]), (short)(t->mval[1] - t->con.imval[1])); + convertViewVec(t, vec, (t->mval[0] - t->con.imval[0]), (t->mval[1] - t->con.imval[1])); add_v3_v3(vec, tc->center); drawLine(t, tc->center, tc->mtx[0], 'X', 0); diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index b6c4deffe0a..7a16e25302c 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -43,25 +43,25 @@ /* ************************** INPUT FROM MOUSE *************************** */ -static void InputVector(TransInfo *t, MouseInput *mi, const short mval[2], float output[3]) +static void InputVector(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { float vec[3], dvec[3]; if(mi->precision) { /* calculate the main translation and the precise one separate */ - convertViewVec(t, dvec, (short)(mval[0] - mi->precision_mval[0]), (short)(mval[1] - mi->precision_mval[1])); + convertViewVec(t, dvec, (mval[0] - mi->precision_mval[0]), (mval[1] - mi->precision_mval[1])); mul_v3_fl(dvec, 0.1f); - convertViewVec(t, vec, (short)(mi->precision_mval[0] - t->imval[0]), (short)(mi->precision_mval[1] - t->imval[1])); + convertViewVec(t, vec, (mi->precision_mval[0] - t->imval[0]), (mi->precision_mval[1] - t->imval[1])); add_v3_v3v3(output, vec, dvec); } else { - convertViewVec(t, output, (short)(mval[0] - t->imval[0]), (short)(mval[1] - t->imval[1])); + convertViewVec(t, output, (mval[0] - t->imval[0]), (mval[1] - t->imval[1])); } } -static void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, const short mval[2], float output[3]) +static void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3]) { float ratio, precise_ratio, dx, dy; if(mi->precision) @@ -87,7 +87,7 @@ static void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, const short mval[2 output[0] = ratio; } -static void InputSpringFlip(TransInfo *t, MouseInput *mi, const short mval[2], float output[3]) +static void InputSpringFlip(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { InputSpring(t, mi, mval, output); @@ -100,7 +100,7 @@ static void InputSpringFlip(TransInfo *t, MouseInput *mi, const short mval[2], f } } -static void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, const short mval[2], float output[3]) +static void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3]) { if(mi->precision) @@ -118,7 +118,7 @@ static void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, const short mva output[1] *= mi->factor; } -static void InputHorizontalRatio(TransInfo *t, MouseInput *mi, const short mval[2], float output[3]) { +static void InputHorizontalRatio(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { float x, pad; pad = t->ar->winx / 10; @@ -135,7 +135,7 @@ static void InputHorizontalRatio(TransInfo *t, MouseInput *mi, const short mval[ output[0] = (x - pad) / (t->ar->winx - 2 * pad); } -static void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, const short mval[2], float output[3]) { +static void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { float vec[3]; InputVector(t, mi, mval, vec); @@ -144,7 +144,7 @@ static void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, const short mv output[0] = dot_v3v3(t->viewinv[0], vec) * 2.0f; } -static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const short mval[2], float output[3]) { +static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { float y, pad; pad = t->ar->winy / 10; @@ -160,7 +160,7 @@ static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const short mval[2] output[0] = (y - pad) / (t->ar->winy - 2 * pad); } -static void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, const short mval[2], float output[3]) { +static void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { float vec[3]; InputVector(t, mi, mval, vec); @@ -169,12 +169,12 @@ static void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, const short mval output[0] = dot_v3v3(t->viewinv[1], vec) * 2.0f; } -void setCustomPoints(TransInfo *UNUSED(t), MouseInput *mi, short start[2], short end[2]) +void setCustomPoints(TransInfo *UNUSED(t), MouseInput *mi, int start[2], int end[2]) { - short *data; + int *data; if (mi->data == NULL) { - mi->data = MEM_callocN(sizeof(short) * 4, "custom points"); + mi->data = MEM_callocN(sizeof(int) * 4, "custom points"); } data = mi->data; @@ -185,12 +185,12 @@ void setCustomPoints(TransInfo *UNUSED(t), MouseInput *mi, short start[2], short data[3] = end[1]; } -static void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, const short mval[2], float output[3]) +static void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3]) { float length; float distance; - short *data = mi->data; - short dx, dy; + int *data = mi->data; + int dx, dy; if (data) { dx = data[2] - data[0]; @@ -200,14 +200,14 @@ static void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, const short m if (mi->precision) { /* deal with Shift key by adding motion / 10 to motion before shift press */ - short mdx, mdy; + int mdx, mdy; mdx = (mi->precision_mval[0] + (float)(mval[0] - mi->precision_mval[0]) / 10.0f) - data[2]; mdy = (mi->precision_mval[1] + (float)(mval[1] - mi->precision_mval[1]) / 10.0f) - data[3]; distance = (length != 0.0f)? (mdx*dx + mdy*dy) / length: 0.0f; } else { - short mdx, mdy; + int mdx, mdy; mdx = mval[0] - data[2]; mdy = mval[1] - data[3]; @@ -218,7 +218,7 @@ static void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, const short m } } -static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const short mval[2], float output[3]) +static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3]) { double dx2 = mval[0] - mi->center[0]; double dy2 = mval[1] - mi->center[1]; @@ -279,7 +279,7 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const short mval[2] output[0] = *angle; } -void initMouseInput(TransInfo *UNUSED(t), MouseInput *mi, int center[2], short mval[2]) +void initMouseInput(TransInfo *UNUSED(t), MouseInput *mi, int center[2], int mval[2]) { mi->factor = 0; mi->precision = 0; @@ -372,7 +372,7 @@ void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *, float [3]) mi->post = post; } -void applyMouseInput(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) +void applyMouseInput(TransInfo *t, MouseInput *mi, int mval[2], float output[3]) { if (mi->apply != NULL) { diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 0c807a5618f..52386c7af10 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -1490,7 +1490,7 @@ void BIF_draw_manipulator(const bContext *C) } } -static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const short mval[2], float hotspot) +static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], float hotspot) { View3D *v3d= sa->spacedata.first; RegionView3D *rv3d= ar->regiondata; diff --git a/source/blender/makesdna/DNA_object_fluidsim.h b/source/blender/makesdna/DNA_object_fluidsim.h index e8360b99d69..6f4c16cb7f3 100644 --- a/source/blender/makesdna/DNA_object_fluidsim.h +++ b/source/blender/makesdna/DNA_object_fluidsim.h @@ -42,7 +42,10 @@ extern "C" { struct Mesh; struct Ipo; -struct MVert; + +typedef struct FluidVertexVelocity { + float vel[3]; +} FluidVertexVelocity; typedef struct FluidsimSettings { struct FluidsimModifierData *fmd; /* for fast RNA access */ @@ -82,8 +85,6 @@ typedef struct FluidsimSettings { /* store pointer to original mesh (for replacing the current one) */ struct Mesh *orgMesh; - /* pointer to the currently loaded fluidsim mesh */ - struct Mesh *meshSurface; /* a mesh to display the bounding box used for simulation */ struct Mesh *meshBB; @@ -122,8 +123,10 @@ typedef struct FluidsimSettings { /* testing vars */ float farFieldSize; - /* save fluidsurface normals in mvert.no, and surface vertex velocities (if available) in mvert.co */ - struct MVert *meshSurfNormals; + /* vertex velocities of simulated fluid mesh */ + struct FluidVertexVelocity *meshVelocities; + /* number of vertices in simulated fluid mesh */ + int totvert; /* Fluid control settings */ float cpsTimeStart; @@ -136,6 +139,8 @@ typedef struct FluidsimSettings { float velocityforceRadius; int lastgoodframe; + + int pad; } FluidsimSettings; diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index acec2ca7a24..7c93ae4168b 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -195,6 +195,18 @@ static char *rna_FluidSettings_path(PointerRNA *ptr) return BLI_sprintfN("modifiers[\"%s\"].settings", md->name); } +static void rna_FluidMeshVertex_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + FluidsimSettings *fss = (FluidsimSettings*)ptr->data; + rna_iterator_array_begin(iter, fss->meshVelocities, sizeof(float)*3, fss->totvert, 0, NULL); +} + +static int rna_FluidMeshVertex_data_length(PointerRNA *ptr) +{ + FluidsimSettings *fss = (FluidsimSettings*)ptr->data; + return fss->totvert; +} + #else static void rna_def_fluidsim_slip(StructRNA *srna) @@ -219,6 +231,24 @@ static void rna_def_fluidsim_slip(StructRNA *srna) RNA_def_property_ui_text(prop, "Partial Slip Amount", "Amount of mixing between no- and free-slip, 0 is no slip and 1 is free slip"); } +static void rna_def_fluid_mesh_vertices(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "FluidMeshVertex", NULL); + RNA_def_struct_sdna(srna, "FluidVertexVelocity"); + RNA_def_struct_ui_text(srna, "Fluid Mesh Vertex", "Vertex of a simulated fluid mesh"); + RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL); + + prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY); + RNA_def_property_array(prop, 3); + RNA_def_property_float_sdna(prop, NULL, "vel"); + RNA_def_property_ui_text(prop, "Velocity", ""); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); +} + + static void rna_def_fluidsim_domain(BlenderRNA *brna) { StructRNA *srna; @@ -367,6 +397,13 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0, 10.0); RNA_def_property_ui_text(prop, "Generate Particles", "Amount of particles to generate (0=off, 1=normal, >1=more)"); + + /* simulated fluid mesh data */ + prop= RNA_def_property(srna, "fluid_mesh_vertices", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "FluidMeshVertex"); + RNA_def_property_ui_text(prop, "Fluid Mesh Vertices", "Vertices of the fluid mesh generated by simulation"); + RNA_def_property_collection_funcs(prop, "rna_FluidMeshVertex_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_FluidMeshVertex_data_length", 0, 0); + rna_def_fluid_mesh_vertices(brna); } static void rna_def_fluidsim_volume(StructRNA *srna) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 03d79bd6844..47988e3b383 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3228,6 +3228,11 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_frame_update"); + prop= RNA_def_property(srna, "frame_subframe", PROP_FLOAT, PROP_TIME); + RNA_def_property_float_sdna(prop, NULL, "r.subframe"); + RNA_def_property_ui_text(prop, "Current Sub-Frame", ""); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE|PROP_EDITABLE); + prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_sdna(prop, NULL, "r.sfra"); diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 7db1f003146..cd001455d7c 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -139,8 +139,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd) fluid_get_bb(mesh->mvert, mesh->totvert, ob->obmat, fss->bbStart, fss->bbSize); */ - // (ab)used to store velocities - fss->meshSurfNormals = NULL; + fss->meshVelocities = NULL; fss->lastgoodframe = -1; @@ -158,10 +157,10 @@ void fluidsim_free(FluidsimModifierData *fluidmd) #ifndef DISABLE_ELBEEM if(fluidmd) { - if(fluidmd->fss->meshSurfNormals) + if(fluidmd->fss->meshVelocities) { - MEM_freeN(fluidmd->fss->meshSurfNormals); - fluidmd->fss->meshSurfNormals = NULL; + MEM_freeN(fluidmd->fss->meshVelocities); + fluidmd->fss->meshVelocities = NULL; } MEM_freeN(fluidmd->fss); } @@ -394,12 +393,12 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh * FluidsimSettings *fss = fluidmd->fss; int len = strlen(filename); int totvert = dm->getNumVerts(dm); - float *velarray = NULL; + FluidVertexVelocity *velarray = NULL; // mesh and vverts have to be valid from loading... - if(fss->meshSurfNormals) - MEM_freeN(fss->meshSurfNormals); + if(fss->meshVelocities) + MEM_freeN(fss->meshVelocities); if(len<7) { @@ -408,12 +407,10 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh * if(fss->domainNovecgen>0) return; - // abusing pointer to hold an array of 3d-velocities - fss->meshSurfNormals = MEM_callocN(sizeof(float)*3*dm->getNumVerts(dm), "Fluidsim_velocities"); - // abusing pointer to hold an INT - fss->meshSurface = SET_INT_IN_POINTER(totvert); + fss->meshVelocities = MEM_callocN(sizeof(FluidVertexVelocity)*dm->getNumVerts(dm), "Fluidsim_velocities"); + fss->totvert = totvert; - velarray = (float *)fss->meshSurfNormals; + velarray = fss->meshVelocities; // .bobj.gz , correct filename // 87654321 @@ -424,16 +421,16 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh * gzf = gzopen(filename, "rb"); if (!gzf) { - MEM_freeN(fss->meshSurfNormals); - fss->meshSurfNormals = NULL; + MEM_freeN(fss->meshVelocities); + fss->meshVelocities = NULL; return; } gzread(gzf, &wri, sizeof( wri )); if(wri != totvert) { - MEM_freeN(fss->meshSurfNormals); - fss->meshSurfNormals = NULL; + MEM_freeN(fss->meshVelocities); + fss->meshVelocities = NULL; return; } @@ -442,7 +439,7 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh * for(j=0; j<3; j++) { gzread(gzf, &wrf, sizeof( wrf )); - velarray[3*i + j] = wrf; + velarray[i].vel[j] = wrf; } } @@ -531,10 +528,10 @@ static DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData } else { - if(fss->meshSurfNormals) - MEM_freeN(fss->meshSurfNormals); + if(fss->meshVelocities) + MEM_freeN(fss->meshVelocities); - fss->meshSurfNormals = NULL; + fss->meshVelocities = NULL; } return dm; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index df69b4968de..18da1f4a094 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5387,7 +5387,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * float imat[4][4]; FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(fsob, eModifierType_Fluidsim); FluidsimSettings *fss; - float *velarray = NULL; + FluidVertexVelocity *velarray = NULL; /* only one step needed */ if(step) return 1; @@ -5401,14 +5401,14 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * invert_m4_m4(imat, mat); /* set first vertex OK */ - if(!fss->meshSurfNormals) return 0; + if(!fss->meshVelocities) return 0; - if( obr->totvert != GET_INT_FROM_POINTER(fss->meshSurface) ) { + if( obr->totvert != fss->totvert) { //fprintf(stderr, "load_fluidsimspeedvectors - modified fluidsim mesh, not using speed vectors (%d,%d)...\n", obr->totvert, fsob->fluidsimSettings->meshSurface->totvert); // DEBUG return 0; } - velarray = (float *)fss->meshSurfNormals; + velarray = fss->meshVelocities; if(obi->flag & R_TRANSFORMED) mul_m4_m4m4(winmat, obi->mat, re->winmat); @@ -5420,7 +5420,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * so that also small drops/little water volumes return a velocity != 0. But I had no luck in fixing that function - DG */ for(a=0; a<obr->totvert; a++) { - for(j=0;j<3;j++) avgvel[j] += velarray[3*a + j]; + for(j=0;j<3;j++) avgvel[j] += velarray[a].vel[j]; } for(j=0;j<3;j++) avgvel[j] /= (float)(obr->totvert); @@ -5435,7 +5435,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * // get fluid velocity fsvec[3] = 0.; //fsvec[0] = fsvec[1] = fsvec[2] = fsvec[3] = 0.; fsvec[2] = 2.; // NT fixed test - for(j=0;j<3;j++) fsvec[j] = velarray[3*a + j]; + for(j=0;j<3;j++) fsvec[j] = velarray[a].vel[j]; /* (bad) HACK insert average velocity if none is there (see previous comment) */ if((fsvec[0] == 0.0) && (fsvec[1] == 0.0) && (fsvec[2] == 0.0)) diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 8748703ad8e..ab68c6ef4d4 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -335,8 +335,8 @@ typedef struct wmEvent { short type; /* event code itself (short, is also in keymap) */ short val; /* press, release, scrollvalue */ - short x, y; /* mouse pointer position, screen coord */ - short mval[2]; /* region mouse position, name convention pre 2.5 :) */ + int x, y; /* mouse pointer position, screen coord */ + int mval[2]; /* region mouse position, name convention pre 2.5 :) */ short unicode; /* future, ghost? */ char ascii; /* from ghost */ char pad; @@ -344,9 +344,9 @@ typedef struct wmEvent { /* previous state */ short prevtype; short prevval; - short prevx, prevy; + int prevx, prevy; double prevclicktime; - short prevclickx, prevclicky; + int prevclickx, prevclicky; /* modifier states */ short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */ @@ -494,7 +494,7 @@ typedef struct wmDrag { struct ImBuf *imb; /* if no icon but imbuf should be drawn around cursor */ float scale; - short sx, sy; + int sx, sy; char opname[240]; /* FILE_MAX */ /* if set, draws operator name*/ } wmDrag; diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index feff0393b88..440ade914f0 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2293,7 +2293,7 @@ static void update_tablet_data(wmWindow *win, wmEvent *event) /* imperfect but probably usable... draw/enable drags to other windows */ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *win, wmEvent *evt) { - short mx= evt->x, my= evt->y; + int mx= evt->x, my= evt->y; if(wm->windows.first== wm->windows.last) return NULL; @@ -2310,8 +2310,8 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi return NULL; /* to desktop space */ - mx+= win->posx; - my+= win->posy; + mx += (int)win->posx; + my += (int)win->posy; /* check other windows to see if it has mouse inside */ for(owin= wm->windows.first; owin; owin= owin->next) { @@ -2319,8 +2319,8 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi if(owin!=win) { if(mx-owin->posx >= 0 && my-owin->posy >= 0 && mx-owin->posx <= owin->sizex && my-owin->posy <= owin->sizey) { - evt->x= mx-owin->posx; - evt->y= my-owin->posy; + evt->x= mx - (int)owin->posx; + evt->y= my - (int)owin->posy; return owin; } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index fa693752ff7..e624768c86e 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2492,7 +2492,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event) } { - short x, y; + int x, y; short *lasso= gesture->customdata; lasso += (2 * gesture->points - 2); |