Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-03-26 13:09:31 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-03-26 13:09:31 +0400
commit18d2dd7e3ae0338829fd61740151f41c21668474 (patch)
tree53d755b496944c9017c2cda0ac812e7c545f4024 /source/blender/editors
parentfc9e0a37f0087d003808a87c26e46ed573ae39dd (diff)
parentf1ed223e34e61777af46d33e5bfc2fc03223a689 (diff)
Merging r55547 through r55594 from trunk into soc-2008-mxcurioni
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c2
-rw-r--r--source/blender/editors/armature/armature_naming.c6
-rw-r--r--source/blender/editors/armature/pose_lib.c4
-rw-r--r--source/blender/editors/armature/pose_slide.c3
-rw-r--r--source/blender/editors/curve/editcurve.c30
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c21
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c77
-rw-r--r--source/blender/editors/include/BIF_glutil.h2
-rw-r--r--source/blender/editors/include/ED_view3d.h2
-rw-r--r--source/blender/editors/include/UI_interface.h5
-rw-r--r--source/blender/editors/interface/interface.c4
-rw-r--r--source/blender/editors/interface/interface_handlers.c36
-rw-r--r--source/blender/editors/interface/interface_intern.h4
-rw-r--r--source/blender/editors/interface/interface_widgets.c9
-rw-r--r--source/blender/editors/mesh/editmesh_add.c18
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c16
-rw-r--r--source/blender/editors/object/object_add.c16
-rw-r--r--source/blender/editors/object/object_vgroup.c4
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c6
-rw-r--r--source/blender/editors/render/render_shading.c6
-rw-r--r--source/blender/editors/screen/area.c1
-rw-r--r--source/blender/editors/screen/screen_ops.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c17
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h2
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c19
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c2
-rw-r--r--source/blender/editors/space_clip/clip_editor.c198
-rw-r--r--source/blender/editors/space_file/file_draw.c2
-rw-r--r--source/blender/editors/space_file/file_ops.c40
-rw-r--r--source/blender/editors/space_logic/logic_window.c6
-rw-r--r--source/blender/editors/space_node/node_intern.h2
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c6
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h10
-rw-r--r--source/blender/editors/space_text/space_text.c18
-rw-r--r--source/blender/editors/space_text/text_header.c32
-rw-r--r--source/blender/editors/space_text/text_intern.h4
-rw-r--r--source/blender/editors/space_text/text_ops.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c42
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h1
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_project.c41
-rw-r--r--source/blender/editors/space_view3d/view3d_ruler.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c33
-rw-r--r--source/blender/editors/transform/transform_ops.c2
-rw-r--r--source/blender/editors/transform/transform_orientations.c3
-rw-r--r--source/blender/editors/transform/transform_snap.c2
-rw-r--r--source/blender/editors/util/crazyspace.c4
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c9
50 files changed, 563 insertions, 220 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index c7b28587e47..2dae78ce5eb 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -3524,7 +3524,7 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale
but = uiDefButR(block, TEX, 1, "", offset + 3, yminc, RENAME_TEXT_WIDTH, channel_height,
&ptr, RNA_property_identifier(prop), -1, 0, 0, -1, -1, NULL);
uiButSetFunc(but, achannel_setting_rename_done_cb, ac->ads, NULL);
- uiButActiveOnly(C, block, but);
+ uiButActiveOnly(C, ac->ar, block, but);
uiBlockSetEmboss(block, UI_EMBOSSN);
}
diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c
index 561e196bf41..196b8064967 100644
--- a/source/blender/editors/armature/armature_naming.c
+++ b/source/blender/editors/armature/armature_naming.c
@@ -38,6 +38,8 @@
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
+#include "BLF_translation.h"
+
#include "BKE_animsys.h"
#include "BKE_action.h"
#include "BKE_armature.h"
@@ -85,7 +87,7 @@ void unique_editbone_name(ListBase *edbo, char *name, EditBone *bone)
data.lb = edbo;
data.bone = bone;
- BLI_uniquename_cb(editbone_unique_check, &data, "Bone", '.', name, sizeof(bone->name));
+ BLI_uniquename_cb(editbone_unique_check, &data, DATA_("Bone"), '.', name, sizeof(bone->name));
}
/* ************************************************** */
@@ -98,7 +100,7 @@ static bool bone_unique_check(void *arg, const char *name)
static void unique_bone_name(bArmature *arm, char *name)
{
- BLI_uniquename_cb(bone_unique_check, (void *)arm, "Bone", '.', name, sizeof(((Bone *)NULL)->name));
+ BLI_uniquename_cb(bone_unique_check, (void *)arm, DATA_("Bone"), '.', name, sizeof(((Bone *)NULL)->name));
}
/* helper call for armature_bone_rename */
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c
index 09c0f7e9647..cb7a699b522 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -462,7 +462,7 @@ static int poselib_add_exec(bContext *C, wmOperator *op)
}
/* validate name */
- BLI_uniquename(&act->markers, marker, "Pose", '.', offsetof(TimeMarker, name), sizeof(marker->name));
+ BLI_uniquename(&act->markers, marker, DATA_("Pose"), '.', offsetof(TimeMarker, name), sizeof(marker->name));
/* use Keying Set to determine what to store for the pose */
/* FIXME: in the past, the Keying Set respected selections (LocRotScale), but the current one doesn't
@@ -666,7 +666,7 @@ static int poselib_rename_exec(bContext *C, wmOperator *op)
/* copy name and validate it */
BLI_strncpy(marker->name, newname, sizeof(marker->name));
- BLI_uniquename(&act->markers, marker, "Pose", '.', offsetof(TimeMarker, name), sizeof(marker->name));
+ BLI_uniquename(&act->markers, marker, DATA_("Pose"), '.', offsetof(TimeMarker, name), sizeof(marker->name));
/* send notifiers for this - using keyframe editing notifiers, since action
* may be being shown in anim editors as active action
diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c
index d19d8084608..ac01cbb5f4a 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -277,8 +277,9 @@ static void pose_slide_apply_vec3(tPoseSlideOp *pso, tPChanFCurveLink *pfl, floa
/* using this path, find each matching F-Curve for the variables we're interested in */
while ( (ld = poseAnim_mapping_getNextFCurve(&pfl->fcurves, ld, path)) ) {
FCurve *fcu = (FCurve *)ld->data;
-
+
/* just work on these channels one by one... there's no interaction between values */
+ BLI_assert(fcu->array_index < 3);
pose_slide_apply_val(pso, fcu, &vec[fcu->array_index]);
}
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index f95fbd1eacb..314967d4426 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -4644,7 +4644,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
copy_v3_v3(location, give_cursor(vc.scene, vc.v3d));
}
- view3d_get_view_aligned_coordinate(vc.ar, location, event->mval, true);
+ ED_view3d_win_to_3d_int(vc.ar, location, event->mval, location);
RNA_float_set_array(op->ptr, "location", location);
}
@@ -6150,20 +6150,20 @@ static const char *get_curve_defname(int type)
if ((type & CU_TYPE) == CU_BEZIER) {
switch (stype) {
- case CU_PRIM_CURVE: return DATA_("BezierCurve");
- case CU_PRIM_CIRCLE: return DATA_("BezierCircle");
- case CU_PRIM_PATH: return DATA_("CurvePath");
+ case CU_PRIM_CURVE: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "BezierCurve");
+ case CU_PRIM_CIRCLE: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "BezierCircle");
+ case CU_PRIM_PATH: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "CurvePath");
default:
- return DATA_("Curve");
+ return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "Curve");
}
}
else {
switch (stype) {
- case CU_PRIM_CURVE: return DATA_("NurbsCurve");
- case CU_PRIM_CIRCLE: return DATA_("NurbsCircle");
- case CU_PRIM_PATH: return DATA_("NurbsPath");
+ case CU_PRIM_CURVE: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "NurbsCurve");
+ case CU_PRIM_CIRCLE: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "NurbsCircle");
+ case CU_PRIM_PATH: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "NurbsPath");
default:
- return DATA_("Curve");
+ return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "Curve");
}
}
}
@@ -6173,13 +6173,13 @@ static const char *get_surf_defname(int type)
int stype = type & CU_PRIMITIVE;
switch (stype) {
- case CU_PRIM_CURVE: return DATA_("SurfCurve");
- case CU_PRIM_CIRCLE: return DATA_("SurfCircle");
- case CU_PRIM_PATCH: return DATA_("SurfPatch");
- case CU_PRIM_SPHERE: return DATA_("SurfSphere");
- case CU_PRIM_DONUT: return DATA_("SurfTorus");
+ case CU_PRIM_CURVE: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "SurfCurve");
+ case CU_PRIM_CIRCLE: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "SurfCircle");
+ case CU_PRIM_PATCH: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "SurfPatch");
+ case CU_PRIM_SPHERE: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "SurfSphere");
+ case CU_PRIM_DONUT: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "SurfTorus");
default:
- return DATA_("Surface");
+ return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "Surface");
}
}
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 59850aff72f..fae3416e00a 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -499,9 +499,7 @@ static void gp_draw_strokes(bGPDframe *gpf, int offsx, int offsy, int winx, int
continue;
/* check which stroke-drawer to use */
- if (gps->totpoints == 1)
- gp_draw_stroke_point(gps->points, lthick, dflag, gps->flag, offsx, offsy, winx, winy);
- else if (dflag & GP_DRAWDATA_ONLY3D) {
+ if (dflag & GP_DRAWDATA_ONLY3D) {
const int no_xray = (dflag & GP_DRAWDATA_NO_XRAY);
int mask_orig = 0;
@@ -519,7 +517,12 @@ static void gp_draw_strokes(bGPDframe *gpf, int offsx, int offsy, int winx, int
#endif
}
- gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, debug);
+ if (gps->totpoints == 1) {
+ gp_draw_stroke_point(gps->points, lthick, dflag, gps->flag, offsx, offsy, winx, winy);
+ }
+ else {
+ gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, debug);
+ }
if (no_xray) {
glDepthMask(mask_orig);
@@ -532,8 +535,14 @@ static void gp_draw_strokes(bGPDframe *gpf, int offsx, int offsy, int winx, int
#endif
}
}
- else if (gps->totpoints > 1)
- gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, offsx, offsy, winx, winy);
+ else {
+ if (gps->totpoints == 1) {
+ gp_draw_stroke_point(gps->points, lthick, dflag, gps->flag, offsx, offsy, winx, winy);
+ }
+ else {
+ gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, offsx, offsy, winx, winy);
+ }
+ }
}
}
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index bc68ad8869a..22ec2c8cfa5 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -138,7 +138,8 @@ enum {
/* Runtime flags */
enum {
GP_PAINTFLAG_FIRSTRUN = (1 << 0), /* operator just started */
- GP_PAINTFLAG_STROKEADDED = (1 << 1)
+ GP_PAINTFLAG_STROKEADDED = (1 << 1),
+ GP_PAINTFLAG_V3D_ERASER_DEPTH = (1 << 2)
};
/* ------ */
@@ -842,8 +843,41 @@ static short gp_stroke_eraser_splitdel(bGPDframe *gpf, bGPDstroke *gps, int i)
}
}
+/* which which point is infront (result should only be used for comparison) */
+static float view3d_point_depth(const RegionView3D *rv3d, const float co[3])
+{
+ if (rv3d->is_persp) {
+ return ED_view3d_calc_zfac(rv3d, co, NULL);
+ }
+ else {
+ return -dot_v3v3(rv3d->viewinv[2], co);
+ }
+}
+
+static bool gp_stroke_eraser_is_occluded(tGPsdata *p,
+ const bGPDspoint *pt, const int x, const int y)
+{
+ if ((p->sa->spacetype == SPACE_VIEW3D) &&
+ (p->flags & GP_PAINTFLAG_V3D_ERASER_DEPTH))
+ {
+ RegionView3D *rv3d = p->ar->regiondata;
+ const int mval[2] = {x, y};
+ float mval_3d[3];
+
+ if (ED_view3d_autodist_simple(p->ar, mval, mval_3d, 0, NULL)) {
+ const float depth_mval = view3d_point_depth(rv3d, mval_3d);
+ const float depth_pt = view3d_point_depth(rv3d, &pt->x);
+
+ if (depth_pt > depth_mval) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
/* eraser tool - check if part of stroke occurs within last segment drawn by eraser */
-static short gp_stroke_eraser_strokeinside(const int mval[], const int UNUSED(mvalo[]),
+static short gp_stroke_eraser_strokeinside(const int mval[2], const int UNUSED(mvalo[2]),
int rad, int x0, int y0, int x1, int y1)
{
/* simple within-radius check for now */
@@ -893,7 +927,7 @@ static void gp_point_to_xy(ARegion *ar, View2D *v2d, rctf *subrect, bGPDstroke *
/* eraser tool - evaluation per stroke */
/* TODO: this could really do with some optimization (KD-Tree/BVH?) */
static void gp_stroke_eraser_dostroke(tGPsdata *p,
- const int mval[], const int mvalo[],
+ const int mval[2], const int mvalo[2],
short rad, const rcti *rect, bGPDframe *gpf, bGPDstroke *gps)
{
bGPDspoint *pt1, *pt2;
@@ -940,9 +974,13 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
* - this assumes that linewidth is irrelevant
*/
if (gp_stroke_eraser_strokeinside(mval, mvalo, rad, x0, y0, x1, y1)) {
- /* if function returns true, break this loop (as no more point to check) */
- if (gp_stroke_eraser_splitdel(gpf, gps, i))
- break;
+ if ((gp_stroke_eraser_is_occluded(p, pt1, x0, y0) == false) ||
+ (gp_stroke_eraser_is_occluded(p, pt2, x1, y1) == false))
+ {
+ /* if function returns true, break this loop (as no more point to check) */
+ if (gp_stroke_eraser_splitdel(gpf, gps, i))
+ break;
+ }
}
}
}
@@ -961,7 +999,16 @@ static void gp_stroke_doeraser(tGPsdata *p)
rect.ymin = p->mval[1] - p->radius;
rect.xmax = p->mval[0] + p->radius;
rect.ymax = p->mval[1] + p->radius;
-
+
+ if (p->sa->spacetype == SPACE_VIEW3D) {
+ if (p->flags & GP_PAINTFLAG_V3D_ERASER_DEPTH) {
+ View3D *v3d = p->sa->spacedata.first;
+
+ view3d_region_operator_needs_opengl(p->win, p->ar);
+ ED_view3d_autodist_init(p->scene, p->ar, v3d, 0);
+ }
+ }
+
/* loop over strokes, checking segments for intersections */
for (gps = gpf->strokes.first; gps; gps = gpn) {
gpn = gps->next;
@@ -1213,9 +1260,17 @@ static void gp_paint_initstroke(tGPsdata *p, short paintmode)
/* set 'eraser' for this stroke if using eraser */
p->paintmode = paintmode;
- if (p->paintmode == GP_PAINTMODE_ERASER)
+ if (p->paintmode == GP_PAINTMODE_ERASER) {
p->gpd->sbuffer_sflag |= GP_STROKE_ERASER;
-
+
+ /* check if we should respect depth while erasing */
+ if (p->sa->spacetype == SPACE_VIEW3D) {
+ if (p->gpl->flag & GP_LAYER_NO_XRAY) {
+ p->flags |= GP_PAINTFLAG_V3D_ERASER_DEPTH;
+ }
+ }
+ }
+
/* set 'initial run' flag, which is only used to denote when a new stroke is starting */
p->flags |= GP_PAINTFLAG_FIRSTRUN;
@@ -1910,12 +1965,12 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
*/
/* printf("\t\tGP - resize eraser\n"); */
switch (event->type) {
- case WHEELUPMOUSE: /* larger */
+ case WHEELDOWNMOUSE: /* larger */
case PADPLUSKEY:
p->radius += 5;
break;
- case WHEELDOWNMOUSE: /* smaller */
+ case WHEELUPMOUSE: /* smaller */
case PADMINUS:
p->radius -= 5;
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index 39d1e283f54..5774a057eb5 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -188,7 +188,7 @@ gla2DDrawInfo *glaBegin2DDraw(struct rcti *screen_rect, struct rctf *world_rect
void gla2DDrawTranslatePt(gla2DDrawInfo *di, float wo_x, float wo_y, int *sc_x_r, int *sc_y_r);
/** Translate the \a world point from world coordiantes into screen space. */
-void gla2DDrawTranslatePtv(gla2DDrawInfo * di, float world[2], int screen_r[2]);
+void gla2DDrawTranslatePtv(gla2DDrawInfo *di, float world[2], int screen_r[2]);
/* Restores the previous OpenGL state and free's the auxilary
* gla data.
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 81f49b4e1f8..ee0946be620 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -199,6 +199,7 @@ float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3], bo
void ED_view3d_win_to_ray(const struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3]);
void ED_view3d_global_to_vector(const struct RegionView3D *rv3d, const float coord[3], float vec[3]);
void ED_view3d_win_to_3d(const struct ARegion *ar, const float depth_pt[3], const float mval[2], float out[3]);
+void ED_view3d_win_to_3d_int(const struct ARegion *ar, const float depth_pt[3], const int mval[2], float out[3]);
void ED_view3d_win_to_delta(const struct ARegion *ar, const float mval[2], float out[3], const float zfac);
void ED_view3d_win_to_vector(const struct ARegion *ar, const float mval[2], float out[3]);
void ED_view3d_win_to_segment(const struct ARegion *ar, struct View3D *v3d, const float mval[2],
@@ -261,7 +262,6 @@ 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);
-bool view3d_get_view_aligned_coordinate(struct ARegion *ar, float fp[3], const int mval[2], const bool do_fallback);
void view3d_opengl_read_pixels(struct ARegion *ar, int x, int y, int w, int h, int format, int type, void *data);
void view3d_get_transformation(const struct ARegion *ar, struct RegionView3D *rv3d, struct Object *ob, struct bglMats *mats);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 3b4415703d5..2572d4b4d99 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -448,7 +448,7 @@ void uiButSetDrawFlag(uiBut *but, int flag);
void uiButClearDrawFlag(uiBut *but, int flag);
/* special button case, only draw it when used actively, for outliner etc */
-int uiButActiveOnly(const struct bContext *C, uiBlock *block, uiBut *but);
+int uiButActiveOnly(const struct bContext *C, struct ARegion *ar, uiBlock *block, uiBut *but);
void uiButExecute(const struct bContext *C, uiBut *but);
@@ -643,6 +643,9 @@ void uiBlockSetDrawExtraFunc(uiBlock *block,
void (*func)(const struct bContext *C, void *, void *, void *, struct rcti *rect),
void *arg1, void *arg2);
+bool UI_textbutton_activate_event(const struct bContext *C, struct ARegion *ar,
+ const void *rna_poin_data, const char *rna_prop_id);
+
void uiButSetFocusOnEnter(struct wmWindow *win, uiBut *but);
/* Autocomplete
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 16598511921..be51651dee7 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -682,7 +682,7 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
/* needed for temporarily rename buttons, such as in outliner or file-select,
* they should keep calling uiDefButs to keep them alive */
/* returns 0 when button removed */
-int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but)
+int uiButActiveOnly(const bContext *C, ARegion *ar, uiBlock *block, uiBut *but)
{
uiBlock *oldblock;
uiBut *oldbut;
@@ -704,7 +704,7 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but)
}
}
if ((activate == TRUE) || (found == FALSE)) {
- ui_button_activate_do((bContext *)C, CTX_wm_region(C), but);
+ ui_button_activate_do((bContext *)C, ar, but);
}
else if ((found == TRUE) && (isactive == FALSE)) {
BLI_remlink(&block->buttons, but);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index b34f4c9653f..6d30db9c4d6 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2997,7 +2997,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
}
else if (data->state == BUTTON_STATE_NUM_EDITING) {
- if (event->type == ESCKEY) {
+ if (event->type == ESCKEY || event->type == RIGHTMOUSE) {
data->cancel = TRUE;
data->escapecancel = TRUE;
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -3261,7 +3261,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
}
}
else if (data->state == BUTTON_STATE_NUM_EDITING) {
- if (event->type == ESCKEY) {
+ if (event->type == ESCKEY || event->type == RIGHTMOUSE) {
data->cancel = TRUE;
data->escapecancel = TRUE;
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -3839,7 +3839,7 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
}
}
else if (data->state == BUTTON_STATE_NUM_EDITING) {
- if (event->type == ESCKEY) {
+ if (event->type == ESCKEY || event->type == RIGHTMOUSE) {
data->cancel = TRUE;
data->escapecancel = TRUE;
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -4036,7 +4036,7 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
}
else if (data->state == BUTTON_STATE_NUM_EDITING) {
- if (event->type == ESCKEY) {
+ if (event->type == ESCKEY || event->type == RIGHTMOUSE) {
data->cancel = TRUE;
data->escapecancel = TRUE;
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -7456,4 +7456,32 @@ void UI_remove_popup_handlers(ListBase *handlers, uiPopupBlockHandle *popup)
WM_event_remove_ui_handler(handlers, ui_handler_popup, ui_handler_remove_popup, popup, FALSE);
}
+bool UI_textbutton_activate_event(const bContext *C, ARegion *ar,
+ const void *rna_poin_data, const char *rna_prop_id)
+{
+ uiBlock *block;
+ uiBut *but = NULL;
+
+ for (block = ar->uiblocks.first; block; block = block->next) {
+ for (but = block->buttons.first; but; but = but->next) {
+ if (but->type == TEX) {
+ if (but->rnaprop && but->rnapoin.data == rna_poin_data) {
+ if (STREQ(RNA_property_identifier(but->rnaprop), rna_prop_id)) {
+ break;
+ }
+ }
+ }
+ }
+ if (but)
+ break;
+ }
+
+ if (but) {
+ uiButActiveOnly(C, ar, block, but);
+ return true;
+ }
+ else {
+ return false;
+ }
+}
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 9f836ed789f..e7b659f99fc 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -520,9 +520,9 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y
void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy, float rad, bool use_alpha);
void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect);
uiWidgetColors *ui_tooltip_get_theme(void);
-void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock * block, rcti * rect);
+void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *block, rcti *rect);
void ui_draw_search_back(struct uiStyle *style, uiBlock *block, rcti *rect);
-int ui_link_bezier_points(const rcti * rect, float coord_array[][2], int resol);
+int ui_link_bezier_points(const rcti *rect, float coord_array[][2], int resol);
void ui_draw_link_bezier(const rcti *rect);
extern void ui_draw_but(const struct bContext *C, ARegion *ar, struct uiStyle *style, uiBut *but, rcti *rect);
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 96c8ded46da..b5b10b623d2 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -3527,7 +3527,6 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int
rcti trect = *rect, bg_rect;
float font_dims[2] = {0.0f, 0.0f};
uiWidgetType *wt = widget_type(UI_WTYPE_MENU_ITEM);
- unsigned char bg_col[3];
wt->state(wt, state);
wt->draw(&wt->wcol, rect, 0, 0);
@@ -3553,16 +3552,12 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int
if (bg_rect.xmax > rect->xmax - PREVIEW_PAD)
bg_rect.xmax = rect->xmax - PREVIEW_PAD;
- UI_GetThemeColor3ubv(TH_BUTBACK, bg_col);
- glColor4ubv((unsigned char *)wt->wcol.item);
+ glColor4ubv((unsigned char *)wt->wcol_theme->inner_sel);
glEnable(GL_BLEND);
glRecti(bg_rect.xmin, bg_rect.ymin, bg_rect.xmax, bg_rect.ymax);
glDisable(GL_BLEND);
- if (state == UI_ACTIVE)
- glColor4ubv((unsigned char *)wt->wcol.text);
- else
- glColor4ubv((unsigned char *)wt->wcol.text_sel);
+ glColor3ubv((unsigned char *)wt->wcol.text);
uiStyleFontDraw(fstyle, &trect, name);
}
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index 1daf39d3319..3117f45156d 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -108,7 +108,7 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op)
unsigned int layer;
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, DATA_("Plane"), &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Plane"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(em, op, "verts.out",
@@ -149,7 +149,7 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op)
unsigned int layer;
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, DATA_("Cube"), &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Cube"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(em, op, "verts.out", "create_cube matrix=%m4 size=%f", mat, dia * 2.0f)) {
@@ -198,7 +198,7 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op)
cap_tri = (cap_end == 2);
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, DATA_("Circle"), &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Circle"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(em, op, "verts.out",
@@ -253,7 +253,7 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
cap_tri = (cap_end == 2);
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, DATA_("Cylinder"), &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Cylinder"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(
@@ -314,7 +314,7 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op)
cap_tri = (cap_end == 2);
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, DATA_("Cone"), &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Cone"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(
@@ -371,7 +371,7 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op)
unsigned int layer;
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, DATA_("Grid"), &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Grid"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(em, op, "verts.out",
@@ -427,7 +427,7 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
if (!view_aligned)
rot[0] += (float)M_PI / 2.0f;
- obedit = make_prim_init(C, DATA_("Suzanne"), &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Suzanne"), &dia, mat, &state, loc, rot, layer);
mat[0][0] *= dia;
mat[1][1] *= dia;
mat[2][2] *= dia;
@@ -470,7 +470,7 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
unsigned int layer;
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, DATA_("Sphere"), &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Sphere"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(em, op, "verts.out",
@@ -522,7 +522,7 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
unsigned int layer;
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, DATA_("Icosphere"), &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Icosphere"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 13660a47248..f05df06ffa2 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -862,7 +862,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
copy_v3_v3(min, cent);
mul_m4_v3(vc.obedit->obmat, min); /* view space */
- view3d_get_view_aligned_coordinate(vc.ar, min, event->mval, true);
+ ED_view3d_win_to_3d_int(vc.ar, min, event->mval, min);
mul_m4_v3(vc.obedit->imat, min); // back in object space
sub_v3_v3(min, cent);
@@ -911,7 +911,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
BMOIter oiter;
copy_v3_v3(min, curs);
- view3d_get_view_aligned_coordinate(vc.ar, min, event->mval, false);
+ ED_view3d_win_to_3d_int(vc.ar, min, event->mval, min);
invert_m4_m4(vc.obedit->imat, vc.obedit->obmat);
mul_m4_v3(vc.obedit->imat, min); // back in object space
@@ -1238,6 +1238,8 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
const short use_smooth = edbm_add_edge_face__smooth_get(em->bm);
+ const int totedge_orig = em->bm->totedge;
+ const int totface_orig = em->bm->totface;
/* when this is used to dissolve we could avoid this, but checking isnt too slow */
#ifdef USE_FACE_CREATE_SEL_EXTEND
@@ -1258,6 +1260,14 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
BMO_op_exec(em->bm, &bmop);
+ /* cancel if nothing was done */
+ if ((totedge_orig == em->bm->totedge) &&
+ (totface_orig == em->bm->totface))
+ {
+ EDBM_op_finish(em, &bmop, op, true);
+ return OPERATOR_CANCELLED;
+ }
+
#ifdef USE_FACE_CREATE_SEL_EXTEND
/* normally we would want to leave the new geometry selected,
* but being able to press F many times to add geometry is too useful! */
@@ -1279,7 +1289,7 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
}
EDBM_update_generic(em, true, true);
-
+
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 63582feadb7..b33c7212f0e 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -452,7 +452,7 @@ static int effector_add_exec(bContext *C, wmOperator *op)
if (!ob)
return OPERATOR_CANCELLED;
- rename_id(&ob->id, DATA_("CurveGuide"));
+ rename_id(&ob->id, CTX_DATA_(BLF_I18NCONTEXT_ID_OBJECT, "CurveGuide"));
((Curve *)ob->data)->flag |= CU_PATH | CU_3D;
ED_object_editmode_enter(C, 0);
ED_object_new_primitive_matrix(C, ob, loc, rot, mat, FALSE);
@@ -465,7 +465,7 @@ static int effector_add_exec(bContext *C, wmOperator *op)
if (!ob)
return OPERATOR_CANCELLED;
- rename_id(&ob->id, DATA_("Field"));
+ rename_id(&ob->id, CTX_DATA_(BLF_I18NCONTEXT_ID_OBJECT, "Field"));
if (ELEM(type, PFIELD_WIND, PFIELD_VORTEX))
ob->empty_drawtype = OB_SINGLE_ARROW;
}
@@ -822,13 +822,13 @@ void OBJECT_OT_drop_named_image(wmOperatorType *ot)
static const char *get_lamp_defname(int type)
{
switch (type) {
- case LA_LOCAL: return DATA_("Point");
- case LA_SUN: return DATA_("Sun");
- case LA_SPOT: return DATA_("Spot");
- case LA_HEMI: return DATA_("Hemi");
- case LA_AREA: return DATA_("Area");
+ case LA_LOCAL: return CTX_DATA_(BLF_I18NCONTEXT_ID_LAMP, "Point");
+ case LA_SUN: return CTX_DATA_(BLF_I18NCONTEXT_ID_LAMP, "Sun");
+ case LA_SPOT: return CTX_DATA_(BLF_I18NCONTEXT_ID_LAMP, "Spot");
+ case LA_HEMI: return CTX_DATA_(BLF_I18NCONTEXT_ID_LAMP, "Hemi");
+ case LA_AREA: return CTX_DATA_(BLF_I18NCONTEXT_ID_LAMP, "Area");
default:
- return DATA_("Lamp");
+ return CTX_DATA_(BLF_I18NCONTEXT_ID_LAMP, "Lamp");
}
}
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 5abbb7124c0..bdf04dcd20d 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -52,6 +52,8 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_deform.h"
@@ -135,7 +137,7 @@ bDeformGroup *ED_vgroup_add_name(Object *ob, const char *name)
bDeformGroup *ED_vgroup_add(Object *ob)
{
- return ED_vgroup_add_name(ob, "Group");
+ return ED_vgroup_add_name(ob, DATA_("Group"));
}
void ED_vgroup_delete(Object *ob, bDeformGroup *defgroup)
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index aa4652af0ba..05c3af40a29 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -66,12 +66,14 @@ static int surface_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
/* Make sure we're dealing with a canvas */
pmd = (DynamicPaintModifierData *)modifiers_findByType(cObject, eModifierType_DynamicPaint);
- if (!pmd || !pmd->canvas) return OPERATOR_CANCELLED;
+ if (!pmd || !pmd->canvas)
+ return OPERATOR_CANCELLED;
canvas = pmd->canvas;
surface = dynamicPaint_createNewSurface(canvas, CTX_data_scene(C));
- if (!surface) return OPERATOR_CANCELLED;
+ if (!surface)
+ return OPERATOR_CANCELLED;
/* set preview for this surface only and set active */
canvas->active_sur = 0;
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index d1254a7cb78..87d83f820c9 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -46,6 +46,8 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_curve.h"
@@ -383,7 +385,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
ma = BKE_material_copy(ma);
}
else {
- ma = BKE_material_add(bmain, "Material");
+ ma = BKE_material_add(bmain, DATA_("Material"));
if (BKE_scene_use_new_shading_nodes(scene)) {
ED_node_shader_default(C, &ma->id);
@@ -436,7 +438,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
if (tex)
tex = BKE_texture_copy(tex);
else
- tex = add_texture(bmain, "Texture");
+ tex = add_texture(bmain, DATA_("Texture"));
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 2d6e8d0ada0..eb52c06d08f 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1847,7 +1847,6 @@ void ED_region_header(const bContext *C, ARegion *ar)
void ED_region_header_init(ARegion *ar)
{
- ar->v2d.flag &= ~V2D_IS_INITIALISED;
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
}
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index d5d5add215c..68dd6c65e36 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -3520,7 +3520,7 @@ static int scene_new_exec(bContext *C, wmOperator *op)
int type = RNA_enum_get(op->ptr, "type");
if (type == SCE_COPY_NEW) {
- newscene = BKE_scene_add(bmain, "Scene");
+ newscene = BKE_scene_add(bmain, DATA_("Scene"));
}
else { /* different kinds of copying */
newscene = BKE_scene_copy(scene, type);
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 4f935ebdd8c..4478d68d3be 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -407,6 +407,9 @@ void paint_brush_init_tex(Brush *brush)
MTex *mtex = &brush->mtex;
if (mtex->tex && mtex->tex->nodetree)
ntreeTexBeginExecTree(mtex->tex->nodetree); /* has internal flag to detect it only does it once */
+ mtex = &brush->mask_mtex;
+ if (mtex->tex && mtex->tex->nodetree)
+ ntreeTexBeginExecTree(mtex->tex->nodetree);
}
}
@@ -416,6 +419,9 @@ void paint_brush_exit_tex(Brush *brush)
MTex *mtex = &brush->mtex;
if (mtex->tex && mtex->tex->nodetree)
ntreeTexEndExecTree(mtex->tex->nodetree->execdata);
+ mtex = &brush->mask_mtex;
+ if (mtex->tex && mtex->tex->nodetree)
+ ntreeTexEndExecTree(mtex->tex->nodetree->execdata);
}
}
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 90a2c8037c4..9bc232c6a61 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -793,7 +793,7 @@ void *paint_2d_new_stroke(bContext *C, wmOperator *op)
return s;
}
-void paint_2d_redraw (const bContext *C, void *ps, int final)
+void paint_2d_redraw(const bContext *C, void *ps, int final)
{
ImagePaintState *s = ps;
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 7a0f7b817b3..5dcfa181fa2 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -264,7 +264,8 @@ typedef struct ProjPaintState {
short is_ortho;
bool do_masking; /* use masking during painting. Some operations such as airbrush may disable */
- short is_texbrush; /* only to avoid running */
+ bool is_texbrush; /* only to avoid running */
+ bool is_maskbrush;
#ifndef PROJ_DEBUG_NOSEAMBLEED
float seam_bleed_px;
#endif
@@ -3905,6 +3906,10 @@ static void *do_projectpaint_thread(void *ph_v)
alpha = 1.0f;
}
+ if (ps->is_maskbrush) {
+ alpha *= BKE_brush_sample_masktex(ps->scene, ps->brush, projPixel->projCoSS, thread_index, pool);
+ }
+
if (!ps->do_masking) {
/* for an aurbrush there is no real mask, so just multiply the alpha by it */
alpha *= falloff * BKE_brush_alpha_get(ps->scene, brush);
@@ -4153,14 +4158,15 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int
ps->blend = brush->blend;
/* disable for 3d mapping also because painting on mirrored mesh can create "stripes" */
- ps->do_masking = (brush->flag & BRUSH_AIRBRUSH || brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW ||
- brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) ? false : true;
- ps->is_texbrush = (brush->mtex.tex && brush->imagepaint_tool == PAINT_TOOL_DRAW) ? 1 : 0;
+ ps->do_masking = (brush->flag & BRUSH_AIRBRUSH || brush->mtex.brush_map_mode != MTEX_MAP_MODE_TILED) ? false : true;
+ ps->is_texbrush = (brush->mtex.tex && brush->imagepaint_tool == PAINT_TOOL_DRAW) ? true : false;
+ ps->is_maskbrush = (brush->flag & BRUSH_USE_MASK && brush->mask_mtex.tex) ? true : false;
}
else {
/* brush may be NULL*/
ps->do_masking = false;
ps->is_texbrush = false;
+ ps->is_maskbrush = false;
}
/* sizeof(ProjPixel), since we alloc this a _lot_ */
@@ -4321,7 +4327,8 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
}
/* override */
- ps.is_texbrush = 0;
+ ps.is_texbrush = false;
+ ps.is_maskbrush = false;
ps.do_masking = false;
orig_brush_size = BKE_brush_size_get(scene, ps.brush);
BKE_brush_size_set(scene, ps.brush, 32); /* cover the whole image */
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index a15795dc2da..88c18602c89 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -125,7 +125,7 @@ void image_undo_restore(struct bContext *C, struct ListBase *lb);
void image_undo_free(struct ListBase *lb);
void imapaint_image_update(struct SpaceImage *sima, struct Image *image, struct ImBuf *ibuf, short texpaint);
struct ImagePaintPartialRedraw *get_imapaintpartial(void);
-void set_imapaintpartial(struct ImagePaintPartialRedraw * ippr);
+void set_imapaintpartial(struct ImagePaintPartialRedraw *ippr);
void imapaint_clear_partial_redraw(void);
void imapaint_dirty_region(struct Image *ima, struct ImBuf *ibuf, int x, int y, int w, int h);
int get_imapaint_zoom(struct bContext *C, float *zoomx, float *zoomy);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 8c5552f48bc..d7e2d010f03 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -178,13 +178,22 @@ static void paint_brush_update(bContext *C, Brush *brush, PaintMode mode,
ELEM4(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK,
SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE)))
{
- copy_v2_v2(ups->tex_mouse, mouse);
-
- if ((brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW) &&
- (brush->flag & BRUSH_RANDOM_ROTATION) &&
+ if (((brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW) ||
+ (brush->mtex.brush_map_mode == MTEX_MAP_MODE_RANDOM)) &&
!(brush->flag & BRUSH_RAKE))
{
- ups->brush_rotation = 2.0f * (float)M_PI * BLI_frand();
+ if (brush->flag & BRUSH_RANDOM_ROTATION)
+ ups->brush_rotation = 2.0f * (float)M_PI * BLI_frand();
+ else
+ ups->brush_rotation = 0.0f;
+ }
+
+ if ((brush->mtex.brush_map_mode == MTEX_MAP_MODE_RANDOM)) {
+ ups->tex_mouse[0] = BLI_frand() * stroke->vc.ar->sizex;
+ ups->tex_mouse[1] = BLI_frand() * stroke->vc.ar->sizey;;
+ }
+ else {
+ copy_v2_v2(ups->tex_mouse, mouse);
}
}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 51500ab8e1c..20b8f90df8b 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3456,7 +3456,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob,
free_sculptsession_deformMats(ss);
- ss->orig_cos = (ss->kb) ? BKE_key_convert_to_vertcos(ob, ss->kb) : mesh_getVertexCos(me, NULL);
+ ss->orig_cos = (ss->kb) ? BKE_key_convert_to_vertcos(ob, ss->kb) : BKE_mesh_vertexCos_get(me, NULL);
crazyspace_build_sculpt(scene, ob, &ss->deform_imats, &ss->deform_cos);
BKE_pbvh_apply_vertCos(ss->pbvh, ss->deform_cos);
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 6d9c5b4ba46..05e05b95967 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -741,14 +741,16 @@ void ED_space_clip_free_texture_buffer(SpaceClip *sc)
typedef struct PrefetchJob {
MovieClip *clip;
- int start_frame, end_frame;
+ int start_frame, current_frame, end_frame;
short render_size, render_flag;
} PrefetchJob;
typedef struct PrefetchQueue {
- int current_frame, start_frame, end_frame;
+ int initial_frame, current_frame, start_frame, end_frame;
short render_size, render_flag;
+ short direction;
+
SpinLock spin;
short *stop;
@@ -828,19 +830,29 @@ static unsigned char *prefetch_read_file_to_memory(MovieClip *clip, int current_
/* find first uncached frame within prefetching frame range */
static int prefetch_find_uncached_frame(MovieClip *clip, int from_frame, int end_frame,
- short render_size, short render_flag)
+ short render_size, short render_flag, short direction)
{
int current_frame;
+ MovieClipUser user = {0};
- for (current_frame = from_frame; current_frame <= end_frame; current_frame++) {
- MovieClipUser user = {0};
+ user.render_size = render_size;
+ user.render_flag = render_flag;
- user.framenr = current_frame;
- user.render_size = render_size;
- user.render_flag = render_flag;
+ if (direction > 0) {
+ for (current_frame = from_frame; current_frame <= end_frame; current_frame++) {
+ user.framenr = current_frame;
- if (!BKE_movieclip_has_cached_frame(clip, &user))
- break;
+ if (!BKE_movieclip_has_cached_frame(clip, &user))
+ break;
+ }
+ }
+ else {
+ for (current_frame = from_frame; current_frame >= end_frame; current_frame--) {
+ user.framenr = current_frame;
+
+ if (!BKE_movieclip_has_cached_frame(clip, &user))
+ break;
+ }
}
return current_frame;
@@ -853,12 +865,23 @@ static unsigned char *prefetch_thread_next_frame(PrefetchQueue *queue, MovieClip
unsigned char *mem = NULL;
BLI_spin_lock(&queue->spin);
- if (!*queue->stop && queue->current_frame <= queue->end_frame && check_prefetch_allowed()) {
+ if (!*queue->stop && check_prefetch_allowed() &&
+ IN_RANGE_INCL(queue->current_frame, queue->start_frame, queue->end_frame))
+ {
int current_frame;
- current_frame = prefetch_find_uncached_frame(clip, queue->current_frame + 1, queue->end_frame,
- queue->render_size, queue->render_flag);
- if (current_frame <= queue->end_frame) {
+ if (queue->direction > 0) {
+ current_frame = prefetch_find_uncached_frame(clip, queue->current_frame + 1, queue->end_frame,
+ queue->render_size, queue->render_flag, 1);
+ }
+ else {
+ current_frame = prefetch_find_uncached_frame(clip, queue->current_frame - 1, queue->start_frame,
+ queue->render_size, queue->render_flag, -1);
+ }
+
+ if (IN_RANGE_INCL(current_frame, queue->start_frame, queue->end_frame)) {
+ int frames_processed;
+
mem = prefetch_read_file_to_memory(clip, current_frame, queue->render_size,
queue->render_flag, size_r);
@@ -866,9 +889,22 @@ static unsigned char *prefetch_thread_next_frame(PrefetchQueue *queue, MovieClip
queue->current_frame = current_frame;
+ if (queue->direction > 0) {
+ frames_processed = queue->current_frame - queue->initial_frame;
+ }
+ else {
+ frames_processed = (queue->end_frame - queue->initial_frame) +
+ (queue->initial_frame - queue->current_frame);
+ }
+
*queue->do_update = 1;
- *queue->progress = (float)(queue->current_frame - queue->start_frame) /
- (queue->end_frame - queue->start_frame);
+ *queue->progress = (float)frames_processed / (queue->end_frame - queue->start_frame);
+
+ /* switch direction if read frames from current up to scene end frames */
+ if (current_frame == queue->end_frame) {
+ queue->current_frame = queue->initial_frame;
+ queue->direction = -1;
+ }
}
}
BLI_spin_unlock(&queue->spin);
@@ -911,8 +947,9 @@ static void *do_prefetch_thread(void *data_v)
return NULL;
}
-static void start_prefetch_threads(MovieClip *clip, int start_frame, int end_frame, short render_size,
- short render_flag, short *stop, short *do_update, float *progress)
+static void start_prefetch_threads(MovieClip *clip, int start_frame, int current_frame, int end_frame,
+ short render_size, short render_flag, short *stop, short *do_update,
+ float *progress)
{
ListBase threads;
PrefetchQueue queue;
@@ -927,11 +964,13 @@ static void start_prefetch_threads(MovieClip *clip, int start_frame, int end_fra
/* initialize queue */
BLI_spin_init(&queue.spin);
- queue.current_frame = start_frame;
+ queue.current_frame = current_frame;
+ queue.initial_frame = current_frame;
queue.start_frame = start_frame;
queue.end_frame = end_frame;
queue.render_size = render_size;
queue.render_flag = render_flag;
+ queue.direction = 1;
queue.stop = stop;
queue.do_update = do_update;
@@ -962,45 +1001,70 @@ static void start_prefetch_threads(MovieClip *clip, int start_frame, int end_fra
MEM_freeN(handles);
}
-static void do_prefetch_movie(MovieClip *clip, int start_frame, int end_frame, short render_size,
- short render_flag, short *stop, short *do_update, float *progress)
+static bool prefetch_movie_frame(MovieClip *clip, int frame, short render_size,
+ short render_flag, short *stop)
{
- int current_frame;
-
- for (current_frame = start_frame; current_frame <= end_frame; current_frame++) {
- MovieClipUser user = {0};
- ImBuf *ibuf;
-
- if (!check_prefetch_allowed() || *stop)
- break;
+ MovieClipUser user = {0};
+ ImBuf *ibuf;
- user.framenr = current_frame;
- user.render_size = render_size;
- user.render_flag = render_flag;
+ if (!check_prefetch_allowed() || *stop)
+ return false;
- if (!BKE_movieclip_has_cached_frame(clip, &user)) {
- ibuf = BKE_movieclip_anim_ibuf_for_frame(clip, &user);
+ user.framenr = frame;
+ user.render_size = render_size;
+ user.render_flag = render_flag;
- if (ibuf) {
- int result;
+ if (!BKE_movieclip_has_cached_frame(clip, &user)) {
+ ibuf = BKE_movieclip_anim_ibuf_for_frame(clip, &user);
- result = BKE_movieclip_put_frame_if_possible(clip, &user, ibuf);
+ if (ibuf) {
+ int result;
- if (!result) {
- /* no more space in the cache, we could stop prefetching here */
- *stop = 1;
- }
+ result = BKE_movieclip_put_frame_if_possible(clip, &user, ibuf);
- IMB_freeImBuf(ibuf);
- }
- else {
- /* error reading frame, fair enough stop attempting further reading */
+ if (!result) {
+ /* no more space in the cache, we could stop prefetching here */
*stop = 1;
}
+
+ IMB_freeImBuf(ibuf);
}
+ else {
+ /* error reading frame, fair enough stop attempting further reading */
+ *stop = 1;
+ }
+ }
+
+ return true;
+}
+
+static void do_prefetch_movie(MovieClip *clip, int start_frame, int current_frame, int end_frame,
+ short render_size, short render_flag, short *stop, short *do_update,
+ float *progress)
+{
+ int frame;
+ int frames_processed = 0;
+
+ /* read frames starting from current frame up to scene end frame */
+ for (frame = current_frame; frame <= end_frame; frame++) {
+ if (!prefetch_movie_frame(clip, frame, render_size, render_flag, stop))
+ return;
+
+ frames_processed++;
+
+ *do_update = 1;
+ *progress = (float) frames_processed / (end_frame - start_frame);
+ }
+
+ /* read frames starting from current frame up to scene start frame */
+ for (frame = current_frame; frame >= start_frame; frame--) {
+ if (!prefetch_movie_frame(clip, frame, render_size, render_flag, stop))
+ return;
+
+ frames_processed++;
*do_update = 1;
- *progress = (float)(current_frame - start_frame) / (end_frame - start_frame);
+ *progress = (float) frames_processed / (end_frame - start_frame);
}
}
@@ -1010,13 +1074,13 @@ static void prefetch_startjob(void *pjv, short *stop, short *do_update, float *p
if (pj->clip->source == MCLIP_SRC_SEQUENCE) {
/* read sequence files in multiple threads */
- start_prefetch_threads(pj->clip, pj->start_frame, pj->end_frame,
+ start_prefetch_threads(pj->clip, pj->start_frame, pj->current_frame, pj->end_frame,
pj->render_size, pj->render_flag,
stop, do_update, progress);
}
else if (pj->clip->source == MCLIP_SRC_MOVIE) {
/* read movie in a single thread */
- do_prefetch_movie(pj->clip, pj->start_frame, pj->end_frame,
+ do_prefetch_movie(pj->clip, pj->start_frame, pj->current_frame, pj->end_frame,
pj->render_size, pj->render_flag,
stop, do_update, progress);
}
@@ -1032,6 +1096,13 @@ static void prefetch_freejob(void *pjv)
MEM_freeN(pj);
}
+static int prefetch_get_start_frame(const bContext *C)
+{
+ Scene *scene = CTX_data_scene(C);
+
+ return SFRA;
+}
+
static int prefetch_get_final_frame(const bContext *C)
{
Scene *scene = CTX_data_scene(C);
@@ -1059,6 +1130,20 @@ static bool prefetch_check_early_out(const bContext *C)
if (clip->prefetch_ok)
return true;
+ if (clip->source == MCLIP_SRC_MOVIE) {
+ /* for movies we only prefetch undistorted proxy,
+ * in other cases prefetching could lead to issues
+ * due to timecodes issues.
+ */
+
+ if (clip->flag & MCLIP_USE_PROXY) {
+ MovieClipUser *user = &sc->user;
+
+ if ((user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT) == 0)
+ return true;
+ }
+ }
+
clip_len = BKE_movieclip_get_duration(clip);
/* check whether all the frames from prefetch range are cached */
@@ -1066,10 +1151,18 @@ static bool prefetch_check_early_out(const bContext *C)
first_uncached_frame =
prefetch_find_uncached_frame(clip, sc->user.framenr, end_frame,
- sc->user.render_size, sc->user.render_flag);
+ sc->user.render_size, sc->user.render_flag, 1);
- if (first_uncached_frame > end_frame || first_uncached_frame == clip_len)
- return true;
+ if (first_uncached_frame > end_frame || first_uncached_frame == clip_len) {
+ int start_frame = prefetch_get_start_frame(C);
+
+ first_uncached_frame =
+ prefetch_find_uncached_frame(clip, sc->user.framenr, start_frame,
+ sc->user.render_size, sc->user.render_flag, -1);
+
+ if (first_uncached_frame < start_frame)
+ return true;
+ }
return false;
}
@@ -1101,7 +1194,8 @@ void clip_start_prefetch_job(const bContext *C)
/* create new job */
pj = MEM_callocN(sizeof(PrefetchJob), "prefetch job");
pj->clip = ED_space_clip_get_clip(sc);
- pj->start_frame = sc->user.framenr;
+ pj->start_frame = prefetch_get_start_frame(C);
+ pj->current_frame = sc->user.framenr;
pj->end_frame = prefetch_get_final_frame(C);
pj->render_size = sc->user.render_size;
pj->render_flag = sc->user.render_flag;
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 5b6b8656072..1c677d7c006 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -538,7 +538,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
uiButSetRenameFunc(but, renamebutton_cb, file);
uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
uiButClearFlag(but, UI_BUT_UNDO);
- if (0 == uiButActiveOnly(C, block, but)) {
+ if (0 == uiButActiveOnly(C, ar, block, but)) {
file->selflag &= ~EDITING_FILE;
}
}
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index f705831c715..e3270d9ce8e 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -1460,17 +1460,21 @@ static int file_delete_poll(bContext *C)
{
int poll = ED_operator_file_active(C);
SpaceFile *sfile = CTX_wm_space_file(C);
- struct direntry *file;
if (sfile && sfile->params) {
- if (sfile->params->active_file < 0) {
- poll = 0;
+ char dir[FILE_MAX], group[FILE_MAX];
+ int numfiles = filelist_numfiles(sfile->files);
+ int i;
+ int num_selected = 0;
+
+ if (filelist_islibrary(sfile->files, dir, group)) poll = 0;
+ for (i = 0; i < numfiles; i++) {
+ if (filelist_is_selected(sfile->files, i, CHECK_FILES)) {
+ num_selected++;
+ }
}
- else {
- char dir[FILE_MAX], group[FILE_MAX];
- if (filelist_islibrary(sfile->files, dir, group)) poll = 0;
- file = filelist_file(sfile->files, sfile->params->active_file);
- if (file && S_ISDIR(file->type)) poll = 0;
+ if (num_selected <= 0) {
+ poll = 0;
}
}
else
@@ -1484,12 +1488,18 @@ int file_delete_exec(bContext *C, wmOperator *UNUSED(op))
char str[FILE_MAX];
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile = CTX_wm_space_file(C);
- struct direntry *file;
-
+ struct direntry *file;
+ int numfiles = filelist_numfiles(sfile->files);
+ int i;
+
+ for (i = 0; i < numfiles; i++) {
+ if (filelist_is_selected(sfile->files, i, CHECK_FILES)) {
+ file = filelist_file(sfile->files, i);
+ BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname);
+ BLI_delete(str, false, false);
+ }
+ }
- file = filelist_file(sfile->files, sfile->params->active_file);
- BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname);
- BLI_delete(str, false, false);
ED_fileselect_clear(wm, sfile);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
@@ -1500,8 +1510,8 @@ int file_delete_exec(bContext *C, wmOperator *UNUSED(op))
void FILE_OT_delete(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Delete File";
- ot->description = "Delete selected file";
+ ot->name = "Delete Selected Files";
+ ot->description = "Delete selected files";
ot->idname = "FILE_OT_delete";
/* api callbacks */
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 816ad9960df..578006115a5 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -1116,7 +1116,7 @@ static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr)
uiLayout *row, *col;
row = uiLayoutRow(layout, FALSE);
- uiItemL(row, IFACE_("Key:"), ICON_NONE);
+ uiItemL(row, CTX_IFACE_(BLF_I18NCONTEXT_ID_WINDOWMANAGER, "Key:"), ICON_NONE);
col = uiLayoutColumn(row, FALSE);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == FALSE);
uiItemR(col, ptr, "key", UI_ITEM_R_EVENT, "", ICON_NONE);
@@ -2155,7 +2155,11 @@ static void draw_actuator_steering(uiLayout *layout, PointerRNA *ptr)
uiItemR(row, ptr, "update_period", 0, NULL, ICON_NONE);
row = uiLayoutRow(layout, FALSE);
}
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "show_visualization", 0, NULL, ICON_NONE);
+ if (RNA_enum_get(ptr, "mode") != ACT_STEERING_PATHFOLLOWING) {
+ uiLayoutSetActive(row, FALSE);
+ }
}
static void draw_brick_actuator(uiLayout *layout, PointerRNA *ptr, bContext *C)
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 2f6090d67ce..48051014c58 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -135,7 +135,7 @@ void NODE_OT_backimage_sample(struct wmOperatorType *ot);
/* drawnode.c */
void node_draw_link(struct View2D *v2d, struct SpaceNode *snode, struct bNodeLink *link);
void node_draw_link_bezier(struct View2D *v2d, struct SpaceNode *snode, struct bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3);
-int node_link_bezier_points(struct View2D * v2d, struct SpaceNode * snode, struct bNodeLink * link, float coord_array[][2], int resol);
+int node_link_bezier_points(struct View2D *v2d, struct SpaceNode *snode, struct bNodeLink *link, float coord_array[][2], int resol);
// void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3 );
void draw_nodespace_back_pix(const struct bContext *C, struct ARegion *ar, struct SpaceNode *snode);
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 26a0d0a2fa8..418d4ff04a4 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -506,8 +506,8 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
Object *ob = (Object *)tselem->id; // id = object
bActionGroup *grp = te->directdata;
- BLI_uniquename(&ob->pose->agroups, grp, "Group", '.', offsetof(bActionGroup, name),
- sizeof(grp->name));
+ BLI_uniquename(&ob->pose->agroups, grp, CTX_DATA_(BLF_I18NCONTEXT_ID_ACTION, "Group"), '.',
+ offsetof(bActionGroup, name), sizeof(grp->name));
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
}
break;
@@ -1043,7 +1043,7 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa
uiButSetRenameFunc(bt, namebutton_cb, tselem);
/* returns false if button got removed */
- if (0 == uiButActiveOnly(C, block, bt) )
+ if (0 == uiButActiveOnly(C, ar, block, bt) )
tselem->flag &= ~TSE_TEXTBUT;
}
}
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index 935bd13fcfc..cd79c43eac2 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -167,11 +167,11 @@ void sequencer_operatortypes(void);
void sequencer_keymap(struct wmKeyConfig *keyconf);
/* sequencer_scope.c */
-struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf);
-struct ImBuf *make_sep_waveform_view_from_ibuf(struct ImBuf * ibuf);
-struct ImBuf *make_vectorscope_view_from_ibuf(struct ImBuf * ibuf);
-struct ImBuf *make_zebra_view_from_ibuf(struct ImBuf * ibuf, float perc);
-struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf * ibuf);
+struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf *ibuf);
+struct ImBuf *make_sep_waveform_view_from_ibuf(struct ImBuf *ibuf);
+struct ImBuf *make_vectorscope_view_from_ibuf(struct ImBuf *ibuf);
+struct ImBuf *make_zebra_view_from_ibuf(struct ImBuf *ibuf, float perc);
+struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf *ibuf);
/* sequencer_buttons.c */
void sequencer_buttons_register(struct ARegionType *art);
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 58e45bc766f..61cdddfc740 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -220,6 +220,8 @@ static void text_operatortypes(void)
WM_operatortype_append(TEXT_OT_replace);
WM_operatortype_append(TEXT_OT_replace_set_selected);
+ WM_operatortype_append(TEXT_OT_start_find);
+
WM_operatortype_append(TEXT_OT_to_3d_object);
WM_operatortype_append(TEXT_OT_resolve_conflict);
@@ -233,9 +235,9 @@ static void text_keymap(struct wmKeyConfig *keyconf)
wmKeyMapItem *kmi;
keymap = WM_keymap_find(keyconf, "Text Generic", SPACE_TEXT, 0);
- WM_keymap_add_item(keymap, "TEXT_OT_properties", FKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "TEXT_OT_start_find", FKEY, KM_PRESS, KM_CTRL, 0);
#ifdef __APPLE__
- WM_keymap_add_item(keymap, "TEXT_OT_properties", FKEY, KM_PRESS, KM_OSKEY, 0);
+ WM_keymap_add_item(keymap, "TEXT_OT_start_find", FKEY, KM_PRESS, KM_OSKEY, 0);
#endif
keymap = WM_keymap_find(keyconf, "Text", SPACE_TEXT, 0);
@@ -515,7 +517,19 @@ static void text_properties_area_init(wmWindowManager *wm, ARegion *ar)
static void text_properties_area_draw(const bContext *C, ARegion *ar)
{
+ SpaceText *st = CTX_wm_space_text(C);
+
ED_region_panels(C, ar, 1, NULL, -1);
+
+ /* this flag trick is make sure buttons have been added already */
+ if (st->flags & ST_FIND_ACTIVATE) {
+ if (UI_textbutton_activate_event(C, ar, st, "find_text")) {
+ /* if the panel was already open we need to do another redraw */
+ ScrArea *sa = CTX_wm_area(C);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_TEXT, sa);
+ }
+ st->flags &= ~ST_FIND_ACTIVATE;
+ }
}
/********************* registration ********************/
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index 605a08e587a..aaeea40c1a5 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -113,6 +113,38 @@ void TEXT_OT_properties(wmOperatorType *ot)
ot->poll = text_properties_poll;
}
+static int text_text_search_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ ScrArea *sa = CTX_wm_area(C);
+ ARegion *ar = text_has_properties_region(sa);
+ SpaceText *st = CTX_wm_space_text(C);
+
+ if (ar) {
+ if (ar->flag & RGN_FLAG_HIDDEN)
+ ED_region_toggle_hidden(C, ar);
+
+ /* cannot send a button activate yet for case when region wasn't visible yet */
+ /* flag gets checked and cleared in main draw callback */
+ st->flags |= ST_FIND_ACTIVATE;
+
+ ED_region_tag_redraw(ar);
+ }
+ return OPERATOR_FINISHED;
+}
+
+
+void TEXT_OT_start_find(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Find";
+ ot->description = "Start searching text";
+ ot->idname = "TEXT_OT_start_find";
+
+ /* api callbacks */
+ ot->exec = text_text_search_exec;
+ ot->poll = text_properties_poll;
+}
+
/******************** XXX popup menus *******************/
#if 0
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index 799bc49b624..371ccfd9bd9 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -134,11 +134,15 @@ void TEXT_OT_line_number(struct wmOperatorType *ot);
void TEXT_OT_properties(struct wmOperatorType *ot);
+/* find = find indicated text */
void TEXT_OT_find(struct wmOperatorType *ot);
void TEXT_OT_find_set_selected(struct wmOperatorType *ot);
void TEXT_OT_replace(struct wmOperatorType *ot);
void TEXT_OT_replace_set_selected(struct wmOperatorType *ot);
+/* text_find = open properties, activate search button */
+void TEXT_OT_start_find(struct wmOperatorType *ot);
+
void TEXT_OT_to_3d_object(struct wmOperatorType *ot);
void TEXT_OT_resolve_conflict(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index cdbb3e7c600..b4dc4f55368 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -2966,7 +2966,7 @@ static int text_find_exec(bContext *C, wmOperator *op)
void TEXT_OT_find(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Find";
+ ot->name = "Find Next";
ot->idname = "TEXT_OT_find";
ot->description = "Find specified text";
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 9d9dd0535ff..9dbdd8a9789 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -2665,6 +2665,48 @@ void VIEW3D_OT_view_center_cursor(wmOperatorType *ot)
ot->flag = 0;
}
+static int viewcenter_pick_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
+{
+ View3D *v3d = CTX_wm_view3d(C);
+ RegionView3D *rv3d = CTX_wm_region_view3d(C);
+ Scene *scene = CTX_data_scene(C);
+ ARegion *ar = CTX_wm_region(C);
+
+ if (rv3d) {
+ float new_ofs[3];
+
+ view3d_operator_needs_opengl(C);
+
+ if (ED_view3d_autodist(scene, ar, v3d, event->mval, new_ofs, false)) {
+ /* pass */
+ }
+ else {
+ /* fallback to simple pan */
+ negate_v3_v3(new_ofs, rv3d->ofs);
+ ED_view3d_win_to_3d_int(ar, new_ofs, event->mval, new_ofs);
+ }
+ negate_v3(new_ofs);
+ view3d_smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, NULL, NULL);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void VIEW3D_OT_view_center_pick(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Center View to Mouse";
+ ot->description = "Center the view to the Z-depth position under the mouse cursor";
+ ot->idname = "VIEW3D_OT_view_center_pick";
+
+ /* api callbacks */
+ ot->invoke = viewcenter_pick_invoke;
+ ot->poll = ED_operator_view3d_active;
+
+ /* flags */
+ ot->flag = 0;
+}
+
static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */
{
Scene *scene = CTX_data_scene(C);
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 11cd0fdb1d7..3e79696f209 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -86,6 +86,7 @@ void VIEW3D_OT_view_selected(struct wmOperatorType *ot);
void VIEW3D_OT_view_lock_clear(struct wmOperatorType *ot);
void VIEW3D_OT_view_lock_to_active(struct wmOperatorType *ot);
void VIEW3D_OT_view_center_cursor(struct wmOperatorType *ot);
+void VIEW3D_OT_view_center_pick(struct wmOperatorType *ot);
void VIEW3D_OT_view_center_camera(struct wmOperatorType *ot);
void VIEW3D_OT_view_pan(struct wmOperatorType *ot);
void VIEW3D_OT_view_persportho(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index e567ebda4b7..00356074605 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -146,6 +146,7 @@ void view3d_operatortypes(void)
WM_operatortype_append(VIEW3D_OT_view_lock_clear);
WM_operatortype_append(VIEW3D_OT_view_lock_to_active);
WM_operatortype_append(VIEW3D_OT_view_center_cursor);
+ WM_operatortype_append(VIEW3D_OT_view_center_pick);
WM_operatortype_append(VIEW3D_OT_view_center_camera);
WM_operatortype_append(VIEW3D_OT_select);
WM_operatortype_append(VIEW3D_OT_select_border);
@@ -245,6 +246,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_camera", HOMEKEY, KM_PRESS, 0, 0); /* only with camera view */
WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_cursor", HOMEKEY, KM_PRESS, KM_ALT, 0);
+ WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_pick", FKEY, KM_PRESS, KM_ALT, 0);
kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "center", FALSE); /* only without camera view */
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
index 7d728234c92..ccfbf964d36 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -347,6 +347,39 @@ void ED_view3d_global_to_vector(const RegionView3D *rv3d, const float coord[3],
normalize_v3(vec);
}
+/* very similar to ED_view3d_win_to_3d() but has no advantage, de-duplicating */
+#if 0
+bool view3d_get_view_aligned_coordinate(ARegion *ar, float fp[3], const int mval[2], const bool do_fallback)
+{
+ RegionView3D *rv3d = ar->regiondata;
+ float dvec[3];
+ int mval_cpy[2];
+ eV3DProjStatus ret;
+
+ ret = ED_view3d_project_int_global(ar, fp, mval_cpy, V3D_PROJ_TEST_NOP);
+
+ if (ret == V3D_PROJ_RET_OK) {
+ const float mval_f[2] = {(float)(mval_cpy[0] - mval[0]),
+ (float)(mval_cpy[1] - mval[1])};
+ const float zfac = ED_view3d_calc_zfac(rv3d, fp, NULL);
+ ED_view3d_win_to_delta(ar, mval_f, dvec, zfac);
+ sub_v3_v3(fp, dvec);
+
+ return true;
+ }
+ else {
+ /* fallback to the view center */
+ if (do_fallback) {
+ negate_v3_v3(fp, rv3d->ofs);
+ return view3d_get_view_aligned_coordinate(ar, fp, mval, false);
+ }
+ else {
+ return false;
+ }
+ }
+}
+#endif
+
/**
* Calculate a 3d location from 2d window coordinates.
* \param ar The region (used for the window width and height).
@@ -357,7 +390,7 @@ void ED_view3d_global_to_vector(const RegionView3D *rv3d, const float coord[3],
void ED_view3d_win_to_3d(const ARegion *ar, const float depth_pt[3], const float mval[2], float out[3])
{
RegionView3D *rv3d = ar->regiondata;
-
+
float line_sta[3];
float line_end[3];
@@ -384,6 +417,12 @@ void ED_view3d_win_to_3d(const ARegion *ar, const float depth_pt[3], const float
}
}
+void ED_view3d_win_to_3d_int(const ARegion *ar, const float depth_pt[3], const int mval[2], float out[3])
+{
+ const float mval_fl[2] = {mval[0], mval[1]};
+ ED_view3d_win_to_3d(ar, depth_pt, mval_fl, out);
+}
+
/**
* Calculate a 3d difference vector from 2d window offset.
* note that ED_view3d_calc_zfac() must be called first to determine
diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c
index d6cc218e266..ef8c2b5eff6 100644
--- a/source/blender/editors/space_view3d/view3d_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_ruler.c
@@ -653,7 +653,7 @@ static void view3d_ruler_free(RulerInfo *ruler_info)
static void view3d_ruler_item_project(RulerInfo *ruler_info, float r_co[3],
const int xy[2])
{
- view3d_get_view_aligned_coordinate(ruler_info->ar, r_co, xy, true);
+ ED_view3d_win_to_3d_int(ruler_info->ar, r_co, xy, r_co);
}
/* use for mousemove events */
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index a84075fb60e..209bb76df91 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -108,39 +108,6 @@ void view3d_set_viewcontext(bContext *C, ViewContext *vc)
vc->obedit = CTX_data_edit_object(C);
}
-/**
- * Re-project \a fp so it stays on the same view-plane but is under \a mval (normally the cursor location).
- */
-bool view3d_get_view_aligned_coordinate(ARegion *ar, float fp[3], const int mval[2], const bool do_fallback)
-{
- RegionView3D *rv3d = ar->regiondata;
- float dvec[3];
- int mval_cpy[2];
- eV3DProjStatus ret;
-
- ret = ED_view3d_project_int_global(ar, fp, mval_cpy, V3D_PROJ_TEST_NOP);
-
- if (ret == V3D_PROJ_RET_OK) {
- const float mval_f[2] = {(float)(mval_cpy[0] - mval[0]),
- (float)(mval_cpy[1] - mval[1])};
- const float zfac = ED_view3d_calc_zfac(rv3d, fp, NULL);
- ED_view3d_win_to_delta(ar, mval_f, dvec, zfac);
- sub_v3_v3(fp, dvec);
-
- return true;
- }
- else {
- /* fallback to the view center */
- if (do_fallback) {
- negate_v3_v3(fp, rv3d->ofs);
- return view3d_get_view_aligned_coordinate(ar, fp, mval, false);
- }
- else {
- return false;
- }
- }
-}
-
/*
* ob == NULL if you want global matrices
* */
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 60b0c655691..778795bb3a1 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -721,7 +721,7 @@ static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot)
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
- ot->poll = ED_operator_screenactive;
+ ot->poll = ED_operator_view3d_active;
RNA_def_float_factor(ot->srna, "value", 0, 0, 1, "Factor", "", 0, 1);
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index b12c0906fa0..0c1f169935a 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -96,7 +96,8 @@ static bool uniqueOrientationNameCheck(void *arg, const char *name)
static void uniqueOrientationName(ListBase *lb, char *name)
{
- BLI_uniquename_cb(uniqueOrientationNameCheck, lb, "Space", '.', name, sizeof(((TransformOrientation *)NULL)->name));
+ BLI_uniquename_cb(uniqueOrientationNameCheck, lb, CTX_DATA_(BLF_I18NCONTEXT_ID_SCENE, "Space"), '.', name,
+ sizeof(((TransformOrientation *)NULL)->name));
}
void BIF_createTransformOrientation(bContext *C, ReportList *reports, char *name, int use, int overwrite)
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index c92cd77449e..fdbfdfc8675 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -282,7 +282,7 @@ int handleSnapping(TransInfo *t, const wmEvent *event)
void applyProject(TransInfo *t)
{
/* XXX FLICKER IN OBJECT MODE */
- if ((t->tsnap.project) && activeSnap(t) && (t->flag & T_NO_PROJECT) == 0) {
+ if ((t->tsnap.project) && activeSnap(t) && (t->flag & T_NO_PROJECT) == 0 && (t->con.mode & CON_APPLY) == 0) {
TransData *td = t->data;
float tvec[3];
float imat[4][4];
diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c
index e953aa2f0ed..7f534493975 100644
--- a/source/blender/editors/util/crazyspace.c
+++ b/source/blender/editors/util/crazyspace.c
@@ -332,7 +332,7 @@ int sculpt_get_first_deform_matrices(Scene *scene, Object *ob, float (**deformma
if (!defmats) {
Mesh *me = (Mesh *)ob->data;
dm = mesh_create_derived(me, ob, NULL);
- deformedVerts = mesh_getVertexCos(me, &numVerts);
+ deformedVerts = BKE_mesh_vertexCos_get(me, &numVerts);
defmats = MEM_callocN(sizeof(*defmats) * numVerts, "defmats");
for (a = 0; a < numVerts; a++)
@@ -413,7 +413,7 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3
int a, numVerts;
Mesh *me = (Mesh *)ob->data;
- *deformcos = mesh_getVertexCos(me, &numVerts);
+ *deformcos = BKE_mesh_vertexCos_get(me, &numVerts);
*deformmats = MEM_callocN(sizeof(*(*deformmats)) * numVerts, "defmats");
for (a = 0; a < numVerts; a++)
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index 4c56a016176..8f8c5b8e03c 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -754,7 +754,8 @@ static void stitch_set_face_preview_buffer_position(BMFace *efa, StitchPreviewer
/* setup face preview for all coincident uvs and their faces */
static void stitch_setup_face_preview_for_uv_group(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data,
- PreviewPosition *preview_position) {
+ PreviewPosition *preview_position)
+{
StitchPreviewer *preview = state->stitch_preview;
/* static island does not change so returning immediately */
@@ -774,7 +775,8 @@ static void stitch_setup_face_preview_for_uv_group(UvElement *element, StitchSta
/* checks if uvs are indeed stitchable and registers so that they can be shown in preview */
static void stitch_validate_uv_stichability(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data,
- PreviewPosition *preview_position) {
+ PreviewPosition *preview_position)
+{
UvElement *element_iter;
StitchPreviewer *preview = state->stitch_preview;
int vert_index;
@@ -809,7 +811,8 @@ static void stitch_validate_uv_stichability(UvElement *element, StitchState *sta
static void stitch_validate_edge_stichability(UvEdge *edge, StitchState *state, IslandStitchData *island_stitch_data,
- PreviewPosition *preview_position) {
+ PreviewPosition *preview_position)
+{
UvEdge *edge_iter = edge->first;
StitchPreviewer *preview = state->stitch_preview;