main sync #3

Merged
Patrick Busch merged 318 commits from blender/blender:main into main 2023-03-17 15:52:21 +01:00
5 changed files with 23 additions and 9 deletions
Showing only changes of commit 1dba915dff - Show all commits

View File

@ -8,7 +8,7 @@ void node_composite_luminance_matte(vec4 color,
out float matte) out float matte)
{ {
float luminance = get_luminance(color.rgb, luminance_coefficients); float luminance = get_luminance(color.rgb, luminance_coefficients);
float alpha = clamp(0.0, 1.0, (luminance - low) / (high - low)); float alpha = clamp((luminance - low) / (high - low), 0.0, 1.0);
matte = min(alpha, color.a); matte = min(alpha, color.a);
result = color * matte; result = color * matte;
} }

View File

@ -1715,6 +1715,10 @@ static int gpencil_strokes_paste_exec(bContext *C, wmOperator *op)
*/ */
for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) { for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) {
/* Active frame is copied later, so don't need duplicate the stroke here. */
if (gpl->actframe == gpf) {
continue;
}
if (gpf->flag & GP_FRAME_SELECT) { if (gpf->flag & GP_FRAME_SELECT) {
if (gpf) { if (gpf) {
/* Create new stroke */ /* Create new stroke */

View File

@ -1411,7 +1411,8 @@ static float gpencil_sculpt_rotation_eval_get(tGP_BrushEditData *gso,
const GP_SpaceConversion *gsc = &gso->gsc; const GP_SpaceConversion *gsc = &gso->gsc;
bGPDstroke *gps_orig = (gps_eval->runtime.gps_orig) ? gps_eval->runtime.gps_orig : gps_eval; bGPDstroke *gps_orig = (gps_eval->runtime.gps_orig) ? gps_eval->runtime.gps_orig : gps_eval;
bGPDspoint *pt_orig = &gps_orig->points[pt_eval->runtime.idx_orig]; bGPDspoint *pt_orig = (pt_eval->runtime.pt_orig) ? &gps_orig->points[pt_eval->runtime.idx_orig] :
pt_eval;
bGPDspoint *pt_prev_eval = NULL; bGPDspoint *pt_prev_eval = NULL;
bGPDspoint *pt_orig_prev = NULL; bGPDspoint *pt_orig_prev = NULL;
if (idx_eval != 0) { if (idx_eval != 0) {

View File

@ -3200,7 +3200,7 @@ static eSnapMode transform_snap_context_project_view3d_mixed_impl(SnapObjectCont
Depsgraph *depsgraph, Depsgraph *depsgraph,
const ARegion *region, const ARegion *region,
const View3D *v3d, const View3D *v3d,
const eSnapMode snap_to_flag, eSnapMode snap_to_flag,
const SnapObjectParams *params, const SnapObjectParams *params,
const float init_co[3], const float init_co[3],
const float mval[2], const float mval[2],
@ -3235,7 +3235,16 @@ static eSnapMode transform_snap_context_project_view3d_mixed_impl(SnapObjectCont
const RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata); const RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
bool use_occlusion_test = params->use_occlusion_test && !XRAY_ENABLED(v3d); if (snap_to_flag & (SCE_SNAP_MODE_FACE_RAYCAST | SCE_SNAP_MODE_FACE_NEAREST)) {
if (params->use_occlusion_test && XRAY_ENABLED(v3d)) {
/* Remove Snap to Face with Occlusion Test as they are not visible in wireframe mode. */
snap_to_flag &= ~(SCE_SNAP_MODE_FACE_RAYCAST | SCE_SNAP_MODE_FACE_NEAREST);
}
else if (prev_co == nullptr || init_co == nullptr) {
/* No location to work with #SCE_SNAP_MODE_FACE_NEAREST. */
snap_to_flag &= ~SCE_SNAP_MODE_FACE_NEAREST;
}
}
/* NOTE: if both face ray-cast and face nearest are enabled, first find result of nearest, then /* NOTE: if both face ray-cast and face nearest are enabled, first find result of nearest, then
* override with ray-cast. */ * override with ray-cast. */
@ -3261,7 +3270,7 @@ static eSnapMode transform_snap_context_project_view3d_mixed_impl(SnapObjectCont
} }
} }
if (snap_to_flag & SCE_SNAP_MODE_FACE_RAYCAST || use_occlusion_test) { if (snap_to_flag & SCE_SNAP_MODE_FACE_RAYCAST) {
float ray_start[3], ray_normal[3]; float ray_start[3], ray_normal[3];
if (!ED_view3d_win_to_ray_clipped_ex( if (!ED_view3d_win_to_ray_clipped_ex(
depsgraph, region, v3d, mval, nullptr, ray_normal, ray_start, true)) { depsgraph, region, v3d, mval, nullptr, ray_normal, ray_start, true)) {

View File

@ -2296,10 +2296,6 @@ typedef enum eSnapMode {
SCE_SNAP_MODE_EDGE_PERPENDICULAR = (1 << 5), SCE_SNAP_MODE_EDGE_PERPENDICULAR = (1 << 5),
SCE_SNAP_MODE_FACE_NEAREST = (1 << 8), SCE_SNAP_MODE_FACE_NEAREST = (1 << 8),
SCE_SNAP_MODE_GEOM = (SCE_SNAP_MODE_VERTEX | SCE_SNAP_MODE_EDGE | SCE_SNAP_MODE_FACE_RAYCAST |
SCE_SNAP_MODE_EDGE_PERPENDICULAR | SCE_SNAP_MODE_EDGE_MIDPOINT |
SCE_SNAP_MODE_FACE_NEAREST),
/** #ToolSettings.snap_node_mode */ /** #ToolSettings.snap_node_mode */
SCE_SNAP_MODE_NODE_X = (1 << 0), SCE_SNAP_MODE_NODE_X = (1 << 0),
SCE_SNAP_MODE_NODE_Y = (1 << 1), SCE_SNAP_MODE_NODE_Y = (1 << 1),
@ -2314,6 +2310,10 @@ typedef enum eSnapMode {
ENUM_OPERATORS(eSnapMode, SCE_SNAP_MODE_GRID) ENUM_OPERATORS(eSnapMode, SCE_SNAP_MODE_GRID)
#endif #endif
#define SCE_SNAP_MODE_GEOM \
(SCE_SNAP_MODE_VERTEX | SCE_SNAP_MODE_EDGE | SCE_SNAP_MODE_FACE_RAYCAST | \
SCE_SNAP_MODE_EDGE_PERPENDICULAR | SCE_SNAP_MODE_EDGE_MIDPOINT | SCE_SNAP_MODE_FACE_NEAREST)
/** #SequencerToolSettings.snap_mode */ /** #SequencerToolSettings.snap_mode */
#define SEQ_SNAP_TO_STRIPS (1 << 0) #define SEQ_SNAP_TO_STRIPS (1 << 0)
#define SEQ_SNAP_TO_CURRENT_FRAME (1 << 1) #define SEQ_SNAP_TO_CURRENT_FRAME (1 << 1)