diff options
Diffstat (limited to 'source/blender')
26 files changed, 184 insertions, 127 deletions
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index 023303fe602..042fba7294c 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -63,6 +63,7 @@ void BKE_brush_randomize_texture_coords(struct UnifiedPaintSettings *ups, bool m /* brush curve */ void BKE_brush_curve_preset(struct Brush *b, int preset); +float BKE_brush_curve_strength_clamped(struct Brush *br, float p, const float len); float BKE_brush_curve_strength(struct Brush *br, float p, const float len); /* sampling */ diff --git a/source/blender/blenkernel/BKE_idcode.h b/source/blender/blenkernel/BKE_idcode.h index 10a34838662..420df77ff1e 100644 --- a/source/blender/blenkernel/BKE_idcode.h +++ b/source/blender/blenkernel/BKE_idcode.h @@ -34,6 +34,7 @@ const char *BKE_idcode_to_name(int code); const char *BKE_idcode_to_name_plural(int code); +const char *BKE_idcode_to_translation_context(int code); int BKE_idcode_from_name(const char *name); bool BKE_idcode_is_linkable(int code); bool BKE_idcode_is_valid(int code); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 307f97f1344..2464b3b2668 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -971,7 +971,7 @@ void BKE_brush_randomize_texture_coords(UnifiedPaintSettings *ups, bool mask) } } -/* Uses the brush curve control to find a strength value between 0 and 1 */ +/* Uses the brush curve control to find a strength value */ float BKE_brush_curve_strength(Brush *br, float p, const float len) { float strength; @@ -981,6 +981,15 @@ float BKE_brush_curve_strength(Brush *br, float p, const float len) strength = curvemapping_evaluateF(br->curve, 0, p); + return strength; +} + + +/* Uses the brush curve control to find a strength value between 0 and 1 */ +float BKE_brush_curve_strength_clamped(Brush *br, float p, const float len) +{ + float strength = BKE_brush_curve_strength(br, p, len); + CLAMP(strength, 0.0f, 1.0f); return strength; @@ -1042,7 +1051,7 @@ struct ImBuf *BKE_brush_gen_radial_control_imbuf(Brush *br, bool secondary) for (i = 0; i < side; ++i) { for (j = 0; j < side; ++j) { float magn = sqrtf(pow2f(i - half) + pow2f(j - half)); - im->rect_float[i * side + j] = BKE_brush_curve_strength(br, magn, half); + im->rect_float[i * side + j] = BKE_brush_curve_strength_clamped(br, magn, half); } } diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index c5f7e12c9d0..1120034e217 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -790,7 +790,17 @@ float curvemap_evaluateF(const CurveMap *cuma, float value) float curvemapping_evaluateF(const CurveMapping *cumap, int cur, float value) { const CurveMap *cuma = cumap->cm + cur; - return curvemap_evaluateF(cuma, value); + float val = curvemap_evaluateF(cuma, value); + + /* account for clipping */ + if (cumap->flag & CUMA_DO_CLIP) { + if (val < cumap->curr.ymin) + val = cumap->curr.ymin; + else if (val > cumap->curr.ymax) + val = cumap->curr.ymax; + } + + return val; } /* vector case */ diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c index 1b7a03ec80e..091d8a6ea17 100644 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -37,11 +37,15 @@ #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "BKE_idcode.h" typedef struct { unsigned short code; const char *name, *plural; + + const char *i18n_context; int flags; #define IDTYPE_FLAGS_ISLINKABLE (1 << 0) @@ -50,41 +54,41 @@ typedef struct { /* plural need to match rna_main.c's MainCollectionDef */ /* WARNING! Keep it in sync with i18n contexts in BLF_translation.h */ static IDType idtypes[] = { - { ID_AC, "Action", "actions", IDTYPE_FLAGS_ISLINKABLE }, - { ID_AR, "Armature", "armatures", IDTYPE_FLAGS_ISLINKABLE }, - { ID_BR, "Brush", "brushes", IDTYPE_FLAGS_ISLINKABLE }, - { ID_CA, "Camera", "cameras", IDTYPE_FLAGS_ISLINKABLE }, - { ID_CU, "Curve", "curves", IDTYPE_FLAGS_ISLINKABLE }, - { ID_GD, "GPencil", "grease_pencil", IDTYPE_FLAGS_ISLINKABLE }, /* rename gpencil */ - { ID_GR, "Group", "groups", IDTYPE_FLAGS_ISLINKABLE }, - { ID_ID, "ID", "ids", 0 }, /* plural is fake */ - { ID_IM, "Image", "images", IDTYPE_FLAGS_ISLINKABLE }, - { ID_IP, "Ipo", "ipos", IDTYPE_FLAGS_ISLINKABLE }, /* deprecated */ - { ID_KE, "Key", "shape_keys", 0 }, - { ID_LA, "Lamp", "lamps", IDTYPE_FLAGS_ISLINKABLE }, - { ID_LI, "Library", "libraries", 0 }, - { ID_LS, "FreestyleLineStyle", "linestyles", IDTYPE_FLAGS_ISLINKABLE }, - { ID_LT, "Lattice", "lattices", IDTYPE_FLAGS_ISLINKABLE }, - { ID_MA, "Material", "materials", IDTYPE_FLAGS_ISLINKABLE }, - { ID_MB, "Metaball", "metaballs", IDTYPE_FLAGS_ISLINKABLE }, - { ID_MC, "MovieClip", "movieclips", IDTYPE_FLAGS_ISLINKABLE }, - { ID_ME, "Mesh", "meshes", IDTYPE_FLAGS_ISLINKABLE }, - { ID_MSK, "Mask", "masks", IDTYPE_FLAGS_ISLINKABLE }, - { ID_NT, "NodeTree", "node_groups", IDTYPE_FLAGS_ISLINKABLE }, - { ID_OB, "Object", "objects", IDTYPE_FLAGS_ISLINKABLE }, - { ID_PA, "ParticleSettings", "particles", 0 }, - { ID_PAL, "Palettes", "palettes", IDTYPE_FLAGS_ISLINKABLE }, - { ID_PC, "PaintCurve", "paint_curves", IDTYPE_FLAGS_ISLINKABLE }, - { ID_SCE, "Scene", "scenes", IDTYPE_FLAGS_ISLINKABLE }, - { ID_SCR, "Screen", "screens", 0 }, - { ID_SEQ, "Sequence", "sequences", 0 }, /* not actually ID data */ - { ID_SPK, "Speaker", "speakers", IDTYPE_FLAGS_ISLINKABLE }, - { ID_SO, "Sound", "sounds", IDTYPE_FLAGS_ISLINKABLE }, - { ID_TE, "Texture", "textures", IDTYPE_FLAGS_ISLINKABLE }, - { ID_TXT, "Text", "texts", IDTYPE_FLAGS_ISLINKABLE }, - { ID_VF, "VFont", "fonts", IDTYPE_FLAGS_ISLINKABLE }, - { ID_WO, "World", "worlds", IDTYPE_FLAGS_ISLINKABLE }, - { ID_WM, "WindowManager", "window_managers", 0 }, + { ID_AC, "Action", "actions", BLF_I18NCONTEXT_ID_ACTION, IDTYPE_FLAGS_ISLINKABLE }, + { ID_AR, "Armature", "armatures", BLF_I18NCONTEXT_ID_ARMATURE, IDTYPE_FLAGS_ISLINKABLE }, + { ID_BR, "Brush", "brushes", BLF_I18NCONTEXT_ID_BRUSH, IDTYPE_FLAGS_ISLINKABLE }, + { ID_CA, "Camera", "cameras", BLF_I18NCONTEXT_ID_CAMERA, IDTYPE_FLAGS_ISLINKABLE }, + { ID_CU, "Curve", "curves", BLF_I18NCONTEXT_ID_CURVE, IDTYPE_FLAGS_ISLINKABLE }, + { ID_GD, "GPencil", "grease_pencil", BLF_I18NCONTEXT_ID_GPENCIL, IDTYPE_FLAGS_ISLINKABLE }, /* rename gpencil */ + { ID_GR, "Group", "groups", BLF_I18NCONTEXT_ID_GROUP, IDTYPE_FLAGS_ISLINKABLE }, + { ID_ID, "ID", "ids", BLF_I18NCONTEXT_ID_ID, 0 }, /* plural is fake */ + { ID_IM, "Image", "images", BLF_I18NCONTEXT_ID_IMAGE, IDTYPE_FLAGS_ISLINKABLE }, + { ID_IP, "Ipo", "ipos", "", IDTYPE_FLAGS_ISLINKABLE }, /* deprecated */ + { ID_KE, "Key", "shape_keys", BLF_I18NCONTEXT_ID_SHAPEKEY, 0 }, + { ID_LA, "Lamp", "lamps", BLF_I18NCONTEXT_ID_LAMP, IDTYPE_FLAGS_ISLINKABLE }, + { ID_LI, "Library", "libraries", BLF_I18NCONTEXT_ID_LIBRARY, 0 }, + { ID_LS, "FreestyleLineStyle", "linestyles", BLF_I18NCONTEXT_ID_FREESTYLELINESTYLE, IDTYPE_FLAGS_ISLINKABLE }, + { ID_LT, "Lattice", "lattices", BLF_I18NCONTEXT_ID_LATTICE, IDTYPE_FLAGS_ISLINKABLE }, + { ID_MA, "Material", "materials", BLF_I18NCONTEXT_ID_MATERIAL, IDTYPE_FLAGS_ISLINKABLE }, + { ID_MB, "Metaball", "metaballs", BLF_I18NCONTEXT_ID_METABALL, IDTYPE_FLAGS_ISLINKABLE }, + { ID_MC, "MovieClip", "movieclips", BLF_I18NCONTEXT_ID_MOVIECLIP, IDTYPE_FLAGS_ISLINKABLE }, + { ID_ME, "Mesh", "meshes", BLF_I18NCONTEXT_ID_MESH, IDTYPE_FLAGS_ISLINKABLE }, + { ID_MSK, "Mask", "masks", BLF_I18NCONTEXT_ID_MASK, IDTYPE_FLAGS_ISLINKABLE }, + { ID_NT, "NodeTree", "node_groups", BLF_I18NCONTEXT_ID_NODETREE, IDTYPE_FLAGS_ISLINKABLE }, + { ID_OB, "Object", "objects", BLF_I18NCONTEXT_ID_OBJECT, IDTYPE_FLAGS_ISLINKABLE }, + { ID_PA, "ParticleSettings", "particles", BLF_I18NCONTEXT_ID_PARTICLESETTINGS, 0 }, + { ID_PAL, "Palettes", "palettes", BLF_I18NCONTEXT_ID_PALETTE, IDTYPE_FLAGS_ISLINKABLE }, + { ID_PC, "PaintCurve", "paint_curves", BLF_I18NCONTEXT_ID_PAINTCURVE, IDTYPE_FLAGS_ISLINKABLE }, + { ID_SCE, "Scene", "scenes", BLF_I18NCONTEXT_ID_SCENE, IDTYPE_FLAGS_ISLINKABLE }, + { ID_SCR, "Screen", "screens", BLF_I18NCONTEXT_ID_SCREEN, 0 }, + { ID_SEQ, "Sequence", "sequences", BLF_I18NCONTEXT_ID_SEQUENCE, 0 }, /* not actually ID data */ + { ID_SPK, "Speaker", "speakers", BLF_I18NCONTEXT_ID_SPEAKER, IDTYPE_FLAGS_ISLINKABLE }, + { ID_SO, "Sound", "sounds", BLF_I18NCONTEXT_ID_SOUND, IDTYPE_FLAGS_ISLINKABLE }, + { ID_TE, "Texture", "textures", BLF_I18NCONTEXT_ID_TEXTURE, IDTYPE_FLAGS_ISLINKABLE }, + { ID_TXT, "Text", "texts", BLF_I18NCONTEXT_ID_TEXT, IDTYPE_FLAGS_ISLINKABLE }, + { ID_VF, "VFont", "fonts", BLF_I18NCONTEXT_ID_VFONT, IDTYPE_FLAGS_ISLINKABLE }, + { ID_WO, "World", "worlds", BLF_I18NCONTEXT_ID_WORLD, IDTYPE_FLAGS_ISLINKABLE }, + { ID_WM, "WindowManager", "window_managers", BLF_I18NCONTEXT_ID_WINDOWMANAGER, 0 }, }; static IDType *idtype_from_name(const char *str) @@ -176,6 +180,19 @@ const char *BKE_idcode_to_name_plural(int code) } /** + * Convert an idcode into its translations' context. + * + * \param code The code to convert. + * \return A static string representing the i18n context of the code. + */ +const char *BKE_idcode_to_translation_context(int code) +{ + IDType *idt = idtype_from_code(code); + BLI_assert(idt); + return idt ? idt->i18n_context : BLF_I18NCONTEXT_DEFAULT; +} + +/** * Return an ID code and steps the index forward 1. * * \param index start as 0. diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 45663371ae3..67839d11722 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -1537,7 +1537,7 @@ static void MARKER_OT_camera_bind(wmOperatorType *ot) { /* identifiers */ ot->name = "Bind Camera to Markers"; - ot->description = "Bind the active camera to selected markers(s)"; + ot->description = "Bind the active camera to selected marker(s)"; ot->idname = "MARKER_OT_camera_bind"; /* api callbacks */ diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 49df085f85d..89668a41f15 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -995,7 +995,7 @@ void UI_context_active_but_prop_get(const struct bContext *C, struct PointerRNA void UI_context_active_but_prop_handle(struct bContext *C); struct wmOperator *UI_context_active_operator_get(const struct bContext *C); void UI_context_update_anim_flag(const struct bContext *C); -void UI_context_active_but_prop_get_filebrowser(const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop); +void UI_context_active_but_prop_get_filebrowser(const struct bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, bool *r_is_undo); void UI_context_active_but_prop_get_templateID(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop); /* Styled text draw */ diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index 4f77185fb8f..97aa865c287 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -36,6 +36,8 @@ #include "BLI_blenlib.h" #include "BLI_math_vector.h" +#include "BLF_translation.h" + #include "BKE_context.h" #include "BKE_screen.h" #include "BKE_report.h" @@ -435,7 +437,8 @@ static int datadropper_init(bContext *C, wmOperator *op) type = RNA_property_pointer_type(&ddr->ptr, ddr->prop); ddr->idcode = RNA_type_to_ID_code(type); BLI_assert(ddr->idcode != 0); - ddr->idcode_name = BKE_idcode_to_name(ddr->idcode); + /* Note we can translate here (instead of on draw time), because this struct has very short lifetime. */ + ddr->idcode_name = TIP_(BKE_idcode_to_name(ddr->idcode)); return true; } diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 95e37f0f771..0cc9cdb05f4 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -711,14 +711,17 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n return but; } -void UI_context_active_but_prop_get_filebrowser(const bContext *C, PointerRNA *ptr, PropertyRNA **prop) +void UI_context_active_but_prop_get_filebrowser( + const bContext *C, + PointerRNA *r_ptr, PropertyRNA **r_prop, bool *r_is_undo) { ARegion *ar = CTX_wm_region(C); uiBlock *block; uiBut *but, *prevbut; - memset(ptr, 0, sizeof(*ptr)); - *prop = NULL; + memset(r_ptr, 0, sizeof(*r_ptr)); + *r_prop = NULL; + *r_is_undo = false; if (!ar) return; @@ -730,8 +733,9 @@ void UI_context_active_but_prop_get_filebrowser(const bContext *C, PointerRNA *p /* find the button before the active one */ if ((but->flag & UI_BUT_LAST_ACTIVE) && prevbut && prevbut->rnapoin.data) { if (RNA_property_type(prevbut->rnaprop) == PROP_STRING) { - *ptr = prevbut->rnapoin; - *prop = prevbut->rnaprop; + *r_ptr = prevbut->rnapoin; + *r_prop = prevbut->rnaprop; + *r_is_undo = (prevbut->flag & UI_BUT_UNDO) != 0; return; } } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 802aa2d777b..671ab171393 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1697,13 +1697,8 @@ uiBlock *ui_popup_block_refresh( ar->regiondata = handle; /* set UI_BLOCK_NUMSELECT before UI_block_end() so we get alphanumeric keys assigned */ - if (but) { - if (but->type == UI_BTYPE_PULLDOWN) { - block->flag |= UI_BLOCK_NUMSELECT; - } - } - else { - block->flag |= UI_BLOCK_POPUP | UI_BLOCK_NUMSELECT; + if (but == NULL) { + block->flag |= UI_BLOCK_POPUP; } block->flag |= UI_BLOCK_LOOP; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 2daae3ef894..090bfcfe37e 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -372,35 +372,7 @@ static const char *template_id_browse_tip(StructRNA *type) static const char *template_id_context(StructRNA *type) { if (type) { - switch (RNA_type_to_ID_code(type)) { - case ID_SCE: return BLF_I18NCONTEXT_ID_SCENE; - case ID_OB: return BLF_I18NCONTEXT_ID_OBJECT; - case ID_ME: return BLF_I18NCONTEXT_ID_MESH; - case ID_CU: return BLF_I18NCONTEXT_ID_CURVE; - case ID_MB: return BLF_I18NCONTEXT_ID_METABALL; - case ID_MA: return BLF_I18NCONTEXT_ID_MATERIAL; - case ID_TE: return BLF_I18NCONTEXT_ID_TEXTURE; - case ID_IM: return BLF_I18NCONTEXT_ID_IMAGE; - case ID_LS: return BLF_I18NCONTEXT_ID_FREESTYLELINESTYLE; - case ID_LT: return BLF_I18NCONTEXT_ID_LATTICE; - case ID_LA: return BLF_I18NCONTEXT_ID_LAMP; - case ID_CA: return BLF_I18NCONTEXT_ID_CAMERA; - case ID_WO: return BLF_I18NCONTEXT_ID_WORLD; - case ID_SCR: return BLF_I18NCONTEXT_ID_SCREEN; - case ID_TXT: return BLF_I18NCONTEXT_ID_TEXT; - case ID_SPK: return BLF_I18NCONTEXT_ID_SPEAKER; - case ID_SO: return BLF_I18NCONTEXT_ID_SOUND; - case ID_AR: return BLF_I18NCONTEXT_ID_ARMATURE; - case ID_AC: return BLF_I18NCONTEXT_ID_ACTION; - case ID_NT: return BLF_I18NCONTEXT_ID_NODETREE; - case ID_BR: return BLF_I18NCONTEXT_ID_BRUSH; - case ID_PA: return BLF_I18NCONTEXT_ID_PARTICLESETTINGS; - case ID_GD: return BLF_I18NCONTEXT_ID_GPENCIL; - case ID_MC: return BLF_I18NCONTEXT_ID_MOVIECLIP; - case ID_MSK: return BLF_I18NCONTEXT_ID_MASK; - case ID_PAL: return BLF_I18NCONTEXT_ID_PALETTE; - case ID_PC: return BLF_I18NCONTEXT_ID_PAINTCURVE; - } + return BKE_idcode_to_translation_context(RNA_type_to_ID_code(type)); } return BLF_I18NCONTEXT_DEFAULT; } diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 30ab00a72c2..e4cad389004 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -426,7 +426,7 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom) len = sqrtf(x * x + y * y); if (len <= 1) { - float avg = BKE_brush_curve_strength(br, len, 1.0f); /* Falloff curve */ + float avg = BKE_brush_curve_strength_clamped(br, len, 1.0f); /* Falloff curve */ buffer[index] = 255 - (GLubyte)(255 * avg); @@ -958,10 +958,12 @@ static void paint_cursor_on_hit(UnifiedPaintSettings *ups, Brush *brush, ViewCon static bool ommit_cursor_drawing(Paint *paint, PaintMode mode, Brush *brush) { if (paint->flags & PAINT_SHOW_BRUSH) { - if (ELEM(mode, PAINT_TEXTURE_2D, PAINT_TEXTURE_PROJECTIVE) && brush->imagepaint_tool == PAINT_TOOL_FILL) + if (ELEM(mode, PAINT_TEXTURE_2D, PAINT_TEXTURE_PROJECTIVE) && brush->imagepaint_tool == PAINT_TOOL_FILL) { return true; + } + return false; } - return false; + return true; } static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 1ad700b2964..483bf0f3190 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -359,7 +359,7 @@ static unsigned short *brush_painter_curve_mask_new(BrushPainter *painter, int d float xy[2] = {x + xoff, y + yoff}; float len = len_v2(xy); - *m = (unsigned short)(65535.0f * BKE_brush_curve_strength(brush, len, radius)); + *m = (unsigned short)(65535.0f * BKE_brush_curve_strength_clamped(brush, len, radius)); } } diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 58f1ebb9eac..46e294de956 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -4722,7 +4722,7 @@ static void *do_projectpaint_thread(void *ph_v) if (dist_sq <= brush_radius_sq) { dist = sqrtf(dist_sq); - falloff = BKE_brush_curve_strength(ps->brush, dist, brush_radius); + falloff = BKE_brush_curve_strength_clamped(ps->brush, dist, brush_radius); if (falloff > 0.0f) { float texrgb[3]; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 21beb97ffae..ece6ea7a940 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -557,7 +557,7 @@ static float paint_stroke_integrate_overlap(Brush *br, float factor) g = 1.0f / m; max = 0; for (i = 0; i < m; i++) { - float overlap = paint_stroke_overlapped_curve(br, i * g, spacing); + float overlap = fabs(paint_stroke_overlapped_curve(br, i * g, spacing)); if (overlap > max) max = overlap; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 1a31442faf4..5af327e7b49 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -936,7 +936,7 @@ static float calc_vp_strength_col_dl(VPaint *vp, ViewContext *vc, const float co else { factor = 1.0f; } - return factor * BKE_brush_curve_strength(brush, dist, brush_size_pressure); + return factor * BKE_brush_curve_strength_clamped(brush, dist, brush_size_pressure); } } if (rgba) @@ -3217,7 +3217,7 @@ static void gradientVert_update(DMGradient_userData *grad_data, int index) /* no need to clamp 'alpha' yet */ /* adjust weight */ - alpha = BKE_brush_curve_strength(grad_data->brush, alpha, 1.0f); + alpha = BKE_brush_curve_strength_clamped(grad_data->brush, alpha, 1.0f); if (alpha != 0.0f) { MDeformVert *dv = &me->dvert[index]; diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index a9feb9f48de..4e1517b4e0d 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -315,7 +315,7 @@ static void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, if ((dist = dot_v2v2(diff, diff)) <= radius) { UvElement *element; float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); + strength = alpha * BKE_brush_curve_strength_clamped(brush, sqrtf(dist), radius_root); sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * (tmp_uvdata[i].p[0] - 0.5f * (tmp_uvdata[i].b[0] + tmp_uvdata[i].sum_b[0] / tmp_uvdata[i].ncounter)); sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * (tmp_uvdata[i].p[1] - 0.5f * (tmp_uvdata[i].b[1] + tmp_uvdata[i].sum_b[1] / tmp_uvdata[i].ncounter)); @@ -379,7 +379,7 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *scul if ((dist = dot_v2v2(diff, diff)) <= radius) { UvElement *element; float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); + strength = alpha * BKE_brush_curve_strength_clamped(brush, sqrtf(dist), radius_root); sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * tmp_uvdata[i].p[0]; sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * tmp_uvdata[i].p[1]; @@ -454,7 +454,7 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, const wmEvent *e if ((dist = dot_v2v2(diff, diff)) <= radius) { UvElement *element; float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); + strength = alpha * BKE_brush_curve_strength_clamped(brush, sqrtf(dist), radius_root); normalize_v2(diff); sculptdata->uv[i].uv[0] -= strength * diff[0] * 0.001f; @@ -822,7 +822,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm diff[1] /= aspectRatio; if ((dist = dot_v2v2(diff, diff)) <= radius) { float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); + strength = alpha * BKE_brush_curve_strength_clamped(brush, sqrtf(dist), radius_root); data->initial_stroke->initialSelection[counter].uv = i; data->initial_stroke->initialSelection[counter].strength = strength; diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index ba0c22a4ade..8ad4858ff22 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -97,6 +97,7 @@ void BUTTONS_OT_toolbox(wmOperatorType *ot) typedef struct FileBrowseOp { PointerRNA ptr; PropertyRNA *prop; + bool is_undo; } FileBrowseOp; static int file_browse_exec(bContext *C, wmOperator *op) @@ -142,6 +143,10 @@ static int file_browse_exec(bContext *C, wmOperator *op) RNA_property_update(C, &fbo->ptr, fbo->prop); MEM_freeN(str); + if (fbo->is_undo) { + const char *undostr = RNA_property_identifier(fbo->prop); + ED_undo_push(C, undostr); + } /* special, annoying exception, filesel on redo panel [#26618] */ { @@ -168,6 +173,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event) { PointerRNA ptr; PropertyRNA *prop; + bool is_undo; FileBrowseOp *fbo; char *str; @@ -176,7 +182,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_CANCELLED; } - UI_context_active_but_prop_get_filebrowser(C, &ptr, &prop); + UI_context_active_but_prop_get_filebrowser(C, &ptr, &prop, &is_undo); if (!prop) return OPERATOR_CANCELLED; @@ -210,6 +216,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event) fbo = MEM_callocN(sizeof(FileBrowseOp), "FileBrowseOp"); fbo->ptr = ptr; fbo->prop = prop; + fbo->is_undo = is_undo; op->customdata = fbo; RNA_string_set(op->ptr, path_prop, str); @@ -241,7 +248,8 @@ void BUTTONS_OT_file_browse(wmOperatorType *ot) ot->exec = file_browse_exec; ot->cancel = file_browse_cancel; - ot->flag |= OPTYPE_UNDO; + /* conditional undo based on button flag */ + ot->flag = 0; /* properties */ WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, @@ -261,7 +269,8 @@ void BUTTONS_OT_directory_browse(wmOperatorType *ot) ot->exec = file_browse_exec; ot->cancel = file_browse_cancel; - ot->flag |= OPTYPE_UNDO; + /* conditional undo based on button flag */ + ot->flag = 0; /* properties */ WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index d01a48722aa..5ce509392a6 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -356,7 +356,7 @@ static void ui_imageuser_layer_menu(bContext *UNUSED(C), uiLayout *layout, void for (rl = rr->layers.last; rl; rl = rl->prev, nr--) { final: - uiDefButS(block, UI_BTYPE_BUT_MENU, B_NOP, IFACE_(rl->name), 0, 0, + uiDefButS(block, UI_BTYPE_BUT_MENU, B_NOP, rl->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_X, &iuser->layer, (float) nr, 0.0, 0, -1, ""); } @@ -671,7 +671,8 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, Image *image, RenderRes if (RE_layers_have_name(rr)) { display_name = rl ? rl->name : (fake_name ? fake_name : ""); - but = uiDefMenuBut(block, ui_imageuser_layer_menu, rnd_pt, display_name, 0, 0, wmenu2, UI_UNIT_Y, TIP_("Select Layer")); + but = uiDefMenuBut(block, ui_imageuser_layer_menu, rnd_pt, display_name, + 0, 0, wmenu2, UI_UNIT_Y, TIP_("Select Layer")); UI_but_func_set(but, image_multi_cb, rr, iuser); UI_but_type_set_menu_from_pulldown(but); } @@ -681,7 +682,8 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, Image *image, RenderRes rpass = (rl ? RE_pass_find_by_type(rl, iuser->passtype, ((RenderView *)rr->views.first)->name) : NULL); display_name = rpass ? rpass->internal_name : (fake_name ? fake_name : ""); - but = uiDefMenuBut(block, ui_imageuser_pass_menu, rnd_pt, display_name, 0, 0, wmenu3, UI_UNIT_Y, TIP_("Select Pass")); + but = uiDefMenuBut(block, ui_imageuser_pass_menu, rnd_pt, IFACE_(display_name), + 0, 0, wmenu3, UI_UNIT_Y, TIP_("Select Pass")); UI_but_func_set(but, image_multi_cb, rr, iuser); UI_but_type_set_menu_from_pulldown(but); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 2b7ed3dc057..5cc768acd35 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1932,7 +1932,7 @@ static void rna_def_space_image_uv(BlenderRNA *brna) prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_METADATA); - RNA_def_property_ui_text(prop, "Draw Metadata", "Draw metadata properties of the image"); + RNA_def_property_ui_text(prop, "Show Metadata", "Draw metadata properties of the image"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); prop = RNA_def_property(srna, "show_texpaint", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index ce5f44a3989..cf387644d66 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -231,11 +231,15 @@ static void rna_uiItemL(uiLayout *layout, const char *name, const char *text_ctx } static void rna_uiItemM(uiLayout *layout, bContext *C, const char *menuname, const char *name, const char *text_ctxt, - int translate, int icon) + int translate, int icon, int icon_value) { /* Get translated name (label). */ name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate); + if (icon_value && !icon) { + icon = icon_value; + } + uiItemM(layout, C, menuname, name, icon); } @@ -525,9 +529,7 @@ void RNA_api_ui_layout(StructRNA *srna) "The index of this button, when set a single member of an array can be accessed, " "when set to -1 all array members are used", -2, INT_MAX); /* RNA_NO_INDEX == -1 */ parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); - RNA_def_property_ui_text(parm, "Icon Value", - "Override automatic icon of the item " - "(use it e.g. with custom material icons returned by icon()...)"); + RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item"); func = RNA_def_function(srna, "props_enum", "uiItemsEnumR"); api_ui_item_rna_common(func); @@ -554,9 +556,7 @@ void RNA_api_ui_layout(StructRNA *srna) api_ui_item_op_common(func); RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, just the icon/text"); parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); - RNA_def_property_ui_text(parm, "Icon Value", - "Override automatic icon of the item " - "(use it e.g. with custom material icons returned by icon()...)"); + RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item"); parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "Operator properties to fill in, return when 'properties' is set to true"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); @@ -621,15 +621,15 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_function_ui_description(func, "Item. Display text and/or icon in the layout"); api_ui_item_common(func); parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); - RNA_def_property_ui_text(parm, "Icon Value", - "Override automatic icon of the item " - "(use it e.g. with custom material icons returned by icon()...)"); + RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item"); func = RNA_def_function(srna, "menu", "rna_uiItemM"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu"); api_ui_item_common(func); RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); + RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item"); func = RNA_def_function(srna, "separator", "uiItemS"); RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items"); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index af5ec03c7ed..3f6ba4cd21c 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -5239,7 +5239,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject good_args_str = BLI_dynstr_get_cstring(good_args); PyErr_Format(PyExc_TypeError, - "%.200s.%.200s(): was called with invalid keyword arguments(s) (%s), expected (%s)", + "%.200s.%.200s(): was called with invalid keyword argument(s) (%s), expected (%s)", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), bad_args_str, good_args_str); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index af6ea2bc81f..cac4970cd11 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -121,6 +121,17 @@ * */ +/* Freestyle needs the whole frame to be merged into memory prior to + * doing stroke rendering. This conflicts a bit with multiview save + * buffers behavior which does a merge of exr files after all the + * views are rendered. + * + * For until a proper solution is implemented we'll just merge single + * view image prior to freestyle stroke rendering, which is how this + * worked prior to multiview. Multiview+freestyle+save buffers are + * considered unsupported for the time being. + */ +#define FREESTYLR_SAVEBUFFERS_WORKAROUND /* ********* globals ******** */ @@ -1426,6 +1437,9 @@ void RE_TileProcessor(Render *re) static void do_render_3d(Render *re) { +#ifdef FREESTYLR_SAVEBUFFERS_WORKAROUND + const bool do_early_result_merge = (re->r.scemode & R_MULTIVIEW) == 0; +#endif RenderView *rv; int cfra_backup; @@ -1473,7 +1487,13 @@ static void do_render_3d(Render *re) re->draw_lock(re->dlh, 0); threaded_tile_processor(re); - + +#ifdef FREESTYLR_SAVEBUFFERS_WORKAROUND + if (do_early_result_merge) { + main_render_result_end(re); + } +#endif + #ifdef WITH_FREESTYLE /* Freestyle */ if (re->r.mode & R_EDGE_FRS) @@ -1490,7 +1510,13 @@ static void do_render_3d(Render *re) RE_Database_Free(re); } +#ifdef FREESTYLR_SAVEBUFFERS_WORKAROUND + if (!do_early_result_merge) { + main_render_result_end(re); + } +#else main_render_result_end(re); +#endif re->scene->r.cfra = cfra_backup; re->scene->r.subframe = 0.f; @@ -2929,6 +2955,13 @@ bool RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList * BKE_report(reports, RPT_ERROR, "Fields not supported in Freestyle"); return false; } + +# ifdef FREESTYLR_SAVEBUFFERS_WORKAROUND + if ((scene->r.scemode & R_MULTIVIEW) != 0 && (scene->r.scemode & R_EXR_TILE_FILE) != 0) { + BKE_report(reports, RPT_ERROR, "Multiview combined with Save Buffers not supported in Freestyle"); + return false; + } +# endif } #endif diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index 9e722acf0d4..1bcde896e82 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -547,6 +547,7 @@ static RenderPass *render_layer_add_debug_pass(RenderResult *rr, BLI_strncpy(rpass->name, debug_pass_type_name_get(debug_type), sizeof(rpass->name)); + BLI_strncpy(rpass->internal_name, rpass->name, sizeof(rpass->internal_name)); return rpass; } #endif diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 041ef6f8282..cd97293516d 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1853,17 +1853,10 @@ static void wm_block_splash_close(bContext *C, void *arg_block, void *UNUSED(arg static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unused); -/* XXX: hack to refresh splash screen with updated preset menu name, - * since popup blocks don't get regenerated like panels do */ -static void wm_block_splash_refreshmenu(bContext *UNUSED(C), void *UNUSED(arg_block), void *UNUSED(arg)) +static void wm_block_splash_refreshmenu(bContext *C, void *UNUSED(arg_block), void *UNUSED(arg)) { - /* ugh, causes crashes in other buttons, disabling for now until - * a better fix */ -#if 0 - wmWindow *win = CTX_wm_window(C); - UI_popup_block_close(C, win, arg_block); - UI_popup_block_invoke(C, wm_block_create_splash, NULL); -#endif + ARegion *ar_menu = CTX_wm_menu(C); + ED_region_tag_refresh_ui(ar_menu); } static int wm_resource_check_prev(void) @@ -1945,7 +1938,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar /* note on UI_BLOCK_NO_WIN_CLIP, the window size is not always synchronized * with the OS when the splash shows, window clipping in this case gives * ugly results and clipping the splash isn't useful anyway, just disable it [#32938] */ - UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_NO_WIN_CLIP); + UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_KEEP_OPEN | UI_BLOCK_NO_WIN_CLIP); /* XXX splash scales with pixelsize, should become widget-units */ but = uiDefBut(block, UI_BTYPE_IMAGE, 0, "", 0, 0.5f * U.widget_unit, U.pixelsize * 501, U.pixelsize * 282, ibuf, 0.0, 0.0, 0, 0, ""); /* button owns the imbuf now */ diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c index 3f80570dd7b..639c6c1d4e6 100644 --- a/source/blender/windowmanager/intern/wm_stereo.c +++ b/source/blender/windowmanager/intern/wm_stereo.c @@ -481,21 +481,25 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op) } } else if (win_src->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) { + /* ED_screen_duplicate() can't handle other cases yet T44688 */ + if (win_src->screen->state != SCREENNORMAL) { + BKE_report(op->reports, RPT_ERROR, + "Failed to switch to Time Sequential mode when in fullscreen"); + ok = false; + } /* pageflip requires a new window to be created with the proper OS flags */ - if ((win_dst = wm_window_copy_test(C, win_src))) { + else if ((win_dst = wm_window_copy_test(C, win_src))) { if (wm_stereo3d_quadbuffer_supported()) { BKE_report(op->reports, RPT_INFO, "Quad-buffer window successfully created"); } else { wm_window_close(C, wm, win_dst); win_dst = NULL; - win_src->stereo3d_format->display_mode = prev_display_mode; BKE_report(op->reports, RPT_ERROR, "Quad-buffer not supported by the system"); ok = false; } } else { - win_src->stereo3d_format->display_mode = prev_display_mode; BKE_report(op->reports, RPT_ERROR, "Failed to create a window compatible with the time sequential display method"); ok = false; @@ -521,6 +525,7 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op) else { /* without this, the popup won't be freed freed properly T44688 */ CTX_wm_window_set(C, win_src); + win_src->stereo3d_format->display_mode = prev_display_mode; return OPERATOR_CANCELLED; } } |