diff options
author | YimingWu <xp8110@outlook.com> | 2019-07-16 14:36:44 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2019-07-16 14:36:44 +0300 |
commit | cb17dba738afbb7f9fdec67180444e8df6557658 (patch) | |
tree | 620a4da674d68598783aefff3818f686e58a5ef7 | |
parent | 9a0c100e6c95bdcd87e6c2858891ea822696b5e4 (diff) | |
parent | 575fff2209f6cb7b9d9ed393c8a5b18d6428814a (diff) |
Merge remote-tracking branch 'origin/greasepencil-object' into soc-2019-npr
42 files changed, 448 insertions, 179 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index c5cedf2ed9b..3acdfc391a6 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -300,7 +300,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): ) min_transparent_bounces: IntProperty( name="Min Transparent Bounces", - description="Minimum number of transparnet bounces. Setting this higher reduces noise in the first bounces, " + description="Minimum number of transparent bounces. Setting this higher reduces noise in the first bounces, " "but can also be less efficient for more complex geometry like hair and volumes", min=0, max=1024, default=0, diff --git a/release/darwin/bundle.sh b/release/darwin/bundle.sh index 14c3ba81745..b0f489e6fc2 100755 --- a/release/darwin/bundle.sh +++ b/release/darwin/bundle.sh @@ -18,6 +18,7 @@ _tmp_dir="$(mktemp -d)" _tmp_dmg="/tmp/blender-tmp.dmg" _background_image="${_script_dir}/background.tif" _mount_dir="/Volumes/${_volume_name}" +_entitlements="${_script_dir}/entitlements.plist" # Handle arguments. while [[ $# -gt 0 ]]; do @@ -128,17 +129,17 @@ if [ ! -z "${C_CERT}" ]; then for f in $(find "${_mount_dir}/Blender.app/Contents/Resources" -name "python*"); do if [ -x ${f} ] && [ ! -d ${f} ]; then codesign --remove-signature "${f}" - codesign --timestamp --options runtime --sign "${C_CERT}" "${f}" + codesign --timestamp --options runtime --entitlements="${_entitlements}" --sign "${C_CERT}" "${f}" fi done echo ; echo -n "Codesigning .dylib and .so libraries" for f in $(find "${_mount_dir}/Blender.app" -name "*.dylib" -o -name "*.so"); do codesign --remove-signature "${f}" - codesign --timestamp --options runtime --sign "${C_CERT}" "${f}" + codesign --timestamp --options runtime --entitlements="${_entitlements}" --sign "${C_CERT}" "${f}" done echo ; echo -n "Codesigning Blender.app" codesign --remove-signature "${_mount_dir}/Blender.app" - codesign --timestamp --options runtime --sign "${C_CERT}" "${_mount_dir}/Blender.app" + codesign --timestamp --options runtime --entitlements="${_entitlements}" --sign "${C_CERT}" "${_mount_dir}/Blender.app" echo else echo "No codesigning cert given, skipping..." diff --git a/release/darwin/entitlements.plist b/release/darwin/entitlements.plist new file mode 100644 index 00000000000..dd853c60d2c --- /dev/null +++ b/release/darwin/entitlements.plist @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <!-- For Python ctypes to work. --> + <key>com.apple.security.cs.allow-unsigned-executable-memory</key> + <true/> + <!-- For loading unsigned dylib plugins. --> + <key>com.apple.security.cs.disable-library-validation</key> + <true/> + <!-- For LLVM. --> + <key>com.apple.security.cs.allow-jit</key> + <true/> +</dict> +</plist> diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 3b22ba5b282..57f65c73619 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -340,7 +340,7 @@ def km_window(params): ) if params.legacy: - # Old shorctus + # Old shortcuts items.extend([ ("wm.save_homefile", {"type": 'U', "value": 'PRESS', "ctrl": True}, None), ("wm.open_mainfile", {"type": 'F1', "value": 'PRESS'}, None), diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py index 6956a8379bd..d1976894653 100644 --- a/release/scripts/startup/bl_ui/space_text.py +++ b/release/scripts/startup/bl_ui/space_text.py @@ -240,6 +240,7 @@ class TEXT_MT_templates_py(Menu): bpy.utils.script_paths("templates_py"), "text.open", props_default={"internal": True}, + filter_ext=lambda ext: (ext.lower() == ".py") ) @@ -251,6 +252,7 @@ class TEXT_MT_templates_osl(Menu): bpy.utils.script_paths("templates_osl"), "text.open", props_default={"internal": True}, + filter_ext=lambda ext: (ext.lower() == ".osl") ) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index b8da053b144..db0a8fe4b41 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -3224,11 +3224,6 @@ class VIEW3D_MT_pose_context_menu(Menu): layout.separator() - layout.operator("pose.paths_calculate", text="Calculate") - layout.operator("pose.paths_clear", text="Clear") - - layout.separator() - layout.operator("pose.push") layout.operator("pose.relax") layout.operator("pose.breakdown") diff --git a/release/scripts/templates_py/background_job.py b/release/scripts/templates_py/background_job.py index 5410a7d649f..e93ca2d8c6f 100644 --- a/release/scripts/templates_py/background_job.py +++ b/release/scripts/templates_py/background_job.py @@ -44,7 +44,7 @@ def example_function(text, save_path, render_path): # Light light_data = bpy.data.lights.new("MyLight", 'POINT') - light_ob = bpy.data.objects.new(name="MyCam", object_data=light_data) + light_ob = bpy.data.objects.new(name="MyLight", object_data=light_data) scene.collection.objects.link(light_ob) light_ob.location = 2.0, 2.0, 5.0 diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 33e9d9e86ff..bee76c09cbc 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -71,7 +71,6 @@ typedef struct Global { * * -1: Disable faster motion paths computation (since 08/2018). * * 1 - 30: EEVEE debug/stats values (01/2018). * * 101: Enable UI debug drawing of fullscreen area's corner widget (10/2014). - * * 474: Disable sleeping in `gpu_select_query_end`. * * 527: Old mysterious switch in behavior of MeshDeform modifier (before 04/2010). * * 666: Use quicker batch delete for outliners' delete hierarchy (01/2019). * * 777: Enable UI node panel's sockets polling (11/2011). diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 6dd4eefc014..3e3a533275b 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -729,6 +729,21 @@ void BKE_pose_channels_hash_free(bPose *pose) } } +static void pose_channels_remove_internal_links(Object *ob, bPoseChannel *unlinked_pchan) +{ + LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) { + if (pchan->bbone_prev == unlinked_pchan) { + pchan->bbone_prev = NULL; + } + if (pchan->bbone_next == unlinked_pchan) { + pchan->bbone_next = NULL; + } + if (pchan->custom_tx == unlinked_pchan) { + pchan->custom_tx = NULL; + } + } +} + /** * Selectively remove pose channels. */ @@ -747,6 +762,7 @@ void BKE_pose_channels_remove(Object *ob, if (filter_fn(pchan->name, user_data)) { /* Bone itself is being removed */ BKE_pose_channel_free(pchan); + pose_channels_remove_internal_links(ob, pchan); if (ob->pose->chanhash) { BLI_ghash_remove(ob->pose->chanhash, pchan->name, NULL, NULL); } diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index ef5e5bb24a8..7e916feac24 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1216,9 +1216,11 @@ void dynamicPaint_Modifier_copy(const struct DynamicPaintModifierData *pmd, { /* Init modifier */ tpmd->type = pmd->type; - if ((pmd->canvas && pmd->type == MOD_DYNAMICPAINT_TYPE_CANVAS) || - (pmd->brush && pmd->type == MOD_DYNAMICPAINT_TYPE_BRUSH)) { - dynamicPaint_createType(tpmd, pmd->type, NULL); + if (pmd->canvas) { + dynamicPaint_createType(tpmd, MOD_DYNAMICPAINT_TYPE_CANVAS, NULL); + } + if (pmd->brush) { + dynamicPaint_createType(tpmd, MOD_DYNAMICPAINT_TYPE_BRUSH, NULL); } /* Copy data */ @@ -1230,6 +1232,8 @@ void dynamicPaint_Modifier_copy(const struct DynamicPaintModifierData *pmd, dynamicPaint_freeSurface(tpmd, tpmd->canvas->surfaces.first); } + tpmd->canvas->active_sur = pmd->canvas->active_sur; + /* copy existing surfaces */ for (surface = pmd->canvas->surfaces.first; surface; surface = surface->next) { DynamicPaintSurface *t_surface = dynamicPaint_createNewSurface(tpmd->canvas, NULL); @@ -1296,7 +1300,7 @@ void dynamicPaint_Modifier_copy(const struct DynamicPaintModifierData *pmd, BLI_strncpy(t_surface->output_name2, surface->output_name2, sizeof(t_surface->output_name2)); } } - else if (tpmd->brush) { + if (tpmd->brush) { DynamicPaintBrushSettings *brush = pmd->brush, *t_brush = tpmd->brush; t_brush->pmd = tpmd; @@ -2019,6 +2023,8 @@ static Mesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, Object * if (defgrp_index != -1 && !dvert && (surface->output_name[0] != '\0')) { dvert = CustomData_add_layer( &result->vdata, CD_MDEFORMVERT, CD_CALLOC, NULL, sData->total_points); + /* Make the dvert layer easily accessible from the mesh data. */ + result->dvert = dvert; } if (defgrp_index != -1 && dvert) { int i; diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index b6414a3f909..b690ee10cd1 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -1421,7 +1421,9 @@ void BKE_gpencil_vgroup_remove(Object *ob, bDeformGroup *defgroup) /* Remove the group */ BLI_freelinkN(&ob->defbase, defgroup); - DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); + if (gpd) { + DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); + } } void BKE_gpencil_dvert_ensure(bGPDstroke *gps) @@ -2526,6 +2528,12 @@ bool BKE_gpencil_close_stroke(bGPDstroke *gps) pt2 = &gps->points[0]; float dist_close = len_v3v3(&pt1->x, &pt2->x); + /* if the distance to close is very small, don't need add points and just enable cyclic. */ + if (dist_close <= dist_avg) { + gps->flag |= GP_STROKE_CYCLIC; + return true; + } + /* Calc number of points required using the average distance. */ int tot_newpoints = MAX2(dist_close / dist_avg, 1); @@ -2542,9 +2550,11 @@ bool BKE_gpencil_close_stroke(bGPDstroke *gps) pt2 = &gps->points[0]; bGPDspoint *pt = &gps->points[old_tot]; for (int i = 1; i < tot_newpoints + 1; i++, pt++) { - float step = ((float)i / (float)tot_newpoints); + float step = (tot_newpoints > 1) ? ((float)i / (float)tot_newpoints) : 0.99f; /* Clamp last point to be near, but not on top of first point. */ - CLAMP(step, 0.0f, 0.99f); + if ((tot_newpoints > 1) && (i == tot_newpoints)) { + step *= 0.99f; + } /* Average point. */ interp_v3_v3v3(&pt->x, &pt1->x, &pt2->x, step); @@ -2639,18 +2649,34 @@ static Material *gpencil_add_from_curve_material(Main *bmain, } /* Helper function to create new stroke section */ -static void gpencil_add_new_points( - bGPDstroke *gps, float *coord_array, float pressure, int init, int totpoints) +static void gpencil_add_new_points(bGPDstroke *gps, + float *coord_array, + float pressure, + int init, + int totpoints, + float init_co[3], + bool last) { for (int i = 0; i < totpoints; i++) { bGPDspoint *pt = &gps->points[i + init]; copy_v3_v3(&pt->x, &coord_array[3 * i]); + /* Be sure the last point is not on top of the first point of the curve or + * the close of the stroke will produce glitches. */ + if ((last) && (i > 0) && (i == totpoints - 1)) { + float dist = len_v3v3(init_co, &pt->x); + if (dist < 0.1f) { + /* Interpolate between previous point and current to back slightly. */ + bGPDspoint *pt_prev = &gps->points[i + init - 1]; + interp_v3_v3v3(&pt->x, &pt_prev->x, &pt->x, 0.95f); + } + } + pt->pressure = pressure; pt->strength = 1.0f; } } -/* Helper function to get the first collection that includes the object */ +/* Helper function to get the first collection that includes the object. */ static Collection *gpencil_get_parent_collection(Scene *scene, Object *ob) { Collection *mycol = NULL; @@ -2666,52 +2692,19 @@ static Collection *gpencil_get_parent_collection(Scene *scene, Object *ob) return mycol; } -/* Convert a curve object to grease pencil stroke. - * - * \param bmain: Main thread pointer - * \param scene: Original scene. - * \param ob_gp: Grease pencil object to add strokes. - * \param ob_cu: Curve to convert. - * \param gpencil_lines: Use lines for strokes. - * \param use_collections: Create layers using collection names. - */ -void BKE_gpencil_convert_curve(Main *bmain, - Scene *scene, - Object *ob_gp, - Object *ob_cu, - const bool gpencil_lines, - const bool use_collections) +/* Helper function to convert one spline to grease pencil stroke. */ +static void gpencil_convert_spline(Main *bmain, + Scene *scene, + Object *ob_gp, + Object *ob_cu, + const bool gpencil_lines, + const bool use_collections, + bGPDframe *gpf, + Nurb *nu) { - if (ELEM(NULL, ob_gp, ob_cu) || (ob_gp->type != OB_GPENCIL) || (ob_gp->data == NULL)) { - return; - } - - bGPdata *gpd = (bGPdata *)ob_gp->data; Curve *cu = (Curve *)ob_cu->data; - Nurb *nu = NULL; bool cyclic = true; - bGPDlayer *gpl = NULL; - /* Check if there is an active layer. */ - if (use_collections) { - Collection *collection = gpencil_get_parent_collection(scene, ob_cu); - if (collection != NULL) { - gpl = BLI_findstring(&gpd->layers, collection->id.name + 2, offsetof(bGPDlayer, info)); - if (gpl == NULL) { - gpl = BKE_gpencil_layer_addnew(gpd, collection->id.name + 2, true); - } - } - } - - if (gpl == NULL) { - gpl = BKE_gpencil_layer_getactive(gpd); - if (gpl == NULL) { - gpl = BKE_gpencil_layer_addnew(gpd, DATA_("GP_Layer"), true); - } - } - - /* Check if there is an active frame. */ - bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, CFRA, GP_GETFRAME_ADD_COPY); /* Create Stroke. */ bGPDstroke *gps = MEM_callocN(sizeof(bGPDstroke), "bGPDstroke"); gps->thickness = 1.0f; @@ -2732,20 +2725,16 @@ void BKE_gpencil_convert_curve(Main *bmain, */ int totpoints = 0; int segments = 0; - for (nu = cu->nurb.first; nu; nu = nu->next) { - int resolu = nu->resolu + 1; - if (nu->type == CU_BEZIER) { - segments = nu->pntsu; - if (((nu->flagu & CU_NURB_CYCLIC) == 0) || (nu->pntsu == 2)) { - segments--; - cyclic = false; - } - totpoints += resolu * segments; - } + int resolu = nu->resolu + 1; + segments = nu->pntsu; + if (((nu->flagu & CU_NURB_CYCLIC) == 0) || (nu->pntsu == 2)) { + segments--; + cyclic = false; } - totpoints -= segments - 1; - gps->totpoints = totpoints; + totpoints = (resolu * segments) - (segments - 1); + /* Allocate memory for storage points, but keep empty. */ + gps->totpoints = totpoints; gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points"); /* Initialize triangle memory to dummy data. */ gps->tot_triangles = 0; @@ -2795,11 +2784,11 @@ void BKE_gpencil_convert_curve(Main *bmain, /* Also use the first color if the fill is none for stroke color. */ ma_stroke = give_current_material(ob_cu, 1); linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, &ma_stroke->r); - /* set fill to off */ + /* set fill to off. */ mat_gp->gp_style->flag &= ~GP_STYLE_FILL_SHOW; } } - + /* Assign material index to stroke. */ gps->mat_nr = r_idx; /* Add stroke to frame.*/ @@ -2807,46 +2796,107 @@ void BKE_gpencil_convert_curve(Main *bmain, /* Read all segments of the curve. */ int init = 0; - for (nu = cu->nurb.first; nu; nu = nu->next) { - int resolu = nu->resolu + 1; - if (nu->type == CU_BEZIER) { - segments = nu->pntsu; - if (((nu->flagu & CU_NURB_CYCLIC) == 0) || (nu->pntsu == 2)) { - segments--; - } - /* Get all interpolated curve points of Beziert */ - for (int s = 0; s < segments; s++) { - int inext = (s + 1) % nu->pntsu; - BezTriple *prevbezt = &nu->bezt[s]; - BezTriple *bezt = &nu->bezt[inext]; - - float *coord_array = MEM_callocN(3 * resolu * sizeof(float), __func__); - - for (int j = 0; j < 3; j++) { - BKE_curve_forward_diff_bezier(prevbezt->vec[1][j], - prevbezt->vec[2][j], - bezt->vec[0][j], - bezt->vec[1][j], - coord_array + j, - resolu - 1, - 3 * sizeof(float)); - } - /* Add points to the stroke */ - gpencil_add_new_points(gps, coord_array, bezt->radius, init, resolu); - /* Free memory. */ - MEM_SAFE_FREE(coord_array); - - /* As the last point of segment is the first point of next segment, back one array - * element to avoid duplicated points on the same location. - */ - init += resolu - 1; - } - } + resolu = nu->resolu + 1; + segments = nu->pntsu; + if (((nu->flagu & CU_NURB_CYCLIC) == 0) || (nu->pntsu == 2)) { + segments--; + } + /* Get all interpolated curve points of Beziert */ + float init_co[3]; + for (int s = 0; s < segments; s++) { + int inext = (s + 1) % nu->pntsu; + BezTriple *prevbezt = &nu->bezt[s]; + BezTriple *bezt = &nu->bezt[inext]; + bool last = (bool)(s == segments - 1); + + float *coord_array = MEM_callocN((size_t)3 * resolu * sizeof(float), __func__); + + for (int j = 0; j < 3; j++) { + BKE_curve_forward_diff_bezier(prevbezt->vec[1][j], + prevbezt->vec[2][j], + bezt->vec[0][j], + bezt->vec[1][j], + coord_array + j, + resolu - 1, + 3 * sizeof(float)); + } + /* Save first point coordinates. */ + if (s == 0) { + copy_v3_v3(init_co, &coord_array[0]); + } + /* Add points to the stroke */ + gpencil_add_new_points(gps, coord_array, bezt->radius, init, resolu, init_co, last); + /* Free memory. */ + MEM_SAFE_FREE(coord_array); + + /* As the last point of segment is the first point of next segment, back one array + * element to avoid duplicated points on the same location. + */ + init += resolu - 1; } /* Cyclic curve, close stroke. */ if ((cyclic) && (!only_stroke)) { BKE_gpencil_close_stroke(gps); } +} + +/* Convert a curve object to grease pencil stroke. + * + * \param bmain: Main thread pointer + * \param scene: Original scene. + * \param ob_gp: Grease pencil object to add strokes. + * \param ob_cu: Curve to convert. + * \param gpencil_lines: Use lines for strokes. + * \param use_collections: Create layers using collection names. + */ +void BKE_gpencil_convert_curve(Main *bmain, + Scene *scene, + Object *ob_gp, + Object *ob_cu, + const bool gpencil_lines, + const bool use_collections) +{ + if (ELEM(NULL, ob_gp, ob_cu) || (ob_gp->type != OB_GPENCIL) || (ob_gp->data == NULL)) { + return; + } + + Curve *cu = (Curve *)ob_cu->data; + bGPdata *gpd = (bGPdata *)ob_gp->data; + bGPDlayer *gpl = NULL; + + /* If the curve is empty, cancel. */ + if (cu->nurb.first == NULL) { + return; + } + + /* Check if there is an active layer. */ + if (use_collections) { + Collection *collection = gpencil_get_parent_collection(scene, ob_cu); + if (collection != NULL) { + gpl = BLI_findstring(&gpd->layers, collection->id.name + 2, offsetof(bGPDlayer, info)); + if (gpl == NULL) { + gpl = BKE_gpencil_layer_addnew(gpd, collection->id.name + 2, true); + } + } + } + + if (gpl == NULL) { + gpl = BKE_gpencil_layer_getactive(gpd); + if (gpl == NULL) { + gpl = BKE_gpencil_layer_addnew(gpd, DATA_("GP_Layer"), true); + } + } + + /* Check if there is an active frame and add if needed. */ + bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, CFRA, GP_GETFRAME_ADD_COPY); + + /* Read all splines of the curve and create a stroke for each. */ + for (Nurb *nu = cu->nurb.first; nu; nu = nu->next) { + if (nu->type == CU_BEZIER) { + gpencil_convert_spline(bmain, scene, ob_gp, ob_cu, gpencil_lines, use_collections, gpf, nu); + } + } + /* Tag for recalculation */ DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE); } diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index 8fe2552c03f..796010205e7 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -1144,7 +1144,8 @@ static void id_delete(Main *bmain, const bool do_tagged_deletion) #ifdef DEBUG_PRINT printf("%s: deleting %s (%d)\n", __func__, id->name, id->us); #endif - BLI_assert(id->us == 0); + /* Text always has a single user, skip assert in this case. */ + BLI_assert((id->us == 0) || ELEM(GS(id->name), ID_TXT)); } BKE_id_free_ex(bmain, id, free_flag, !do_tagged_deletion); } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 975e180545f..079a348745c 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1645,7 +1645,7 @@ static int psys_map_index_on_dm(Mesh *mesh, * to their new location, which means a different index, and for faces * also a new face interpolation weights */ if (from == PART_FROM_VERT) { - if (index_dmcache == DMCACHE_NOTFOUND || index_dmcache > mesh->totvert) { + if (index_dmcache == DMCACHE_NOTFOUND || index_dmcache >= mesh->totvert) { return 0; } diff --git a/source/blender/blenkernel/intern/subdiv_ccg.c b/source/blender/blenkernel/intern/subdiv_ccg.c index 41ef2bd4b04..fac1e1dbe75 100644 --- a/source/blender/blenkernel/intern/subdiv_ccg.c +++ b/source/blender/blenkernel/intern/subdiv_ccg.c @@ -962,15 +962,31 @@ static void subdiv_ccg_average_inner_face_grids(SubdivCCG *subdiv_ccg, const int num_face_grids = face->num_grids; const int grid_size = subdiv_ccg->grid_size; CCGElem *prev_grid = grids[face->start_grid_index + num_face_grids - 1]; + /* Average boundary between neighbor grid. */ for (int corner = 0; corner < num_face_grids; corner++) { CCGElem *grid = grids[face->start_grid_index + corner]; - for (int i = 0; i < grid_size; i++) { + for (int i = 1; i < grid_size; i++) { CCGElem *prev_grid_element = CCG_grid_elem(key, prev_grid, i, 0); CCGElem *grid_element = CCG_grid_elem(key, grid, 0, i); average_grid_element(subdiv_ccg, key, prev_grid_element, grid_element); } prev_grid = grid; } + /* Average all grids centers into a single accumulator, and share it. + * Guarantees corrent and smooth averaging in the center. */ + GridElementAccumulator center_accumulator; + element_accumulator_init(¢er_accumulator); + for (int corner = 0; corner < num_face_grids; corner++) { + CCGElem *grid = grids[face->start_grid_index + corner]; + CCGElem *grid_center_element = CCG_grid_elem(key, grid, 0, 0); + element_accumulator_add(¢er_accumulator, subdiv_ccg, key, grid_center_element); + } + element_accumulator_mul_fl(¢er_accumulator, 1.0f / (float)num_face_grids); + for (int corner = 0; corner < num_face_grids; corner++) { + CCGElem *grid = grids[face->start_grid_index + corner]; + CCGElem *grid_center_element = CCG_grid_elem(key, grid, 0, 0); + element_accumulator_copy(subdiv_ccg, key, grid_center_element, ¢er_accumulator); + } } static void subdiv_ccg_average_inner_grids_task(void *__restrict userdata_v, diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c index d312dc0190b..2d0a482d223 100644 --- a/source/blender/blenkernel/intern/undo_system.c +++ b/source/blender/blenkernel/intern/undo_system.c @@ -427,7 +427,7 @@ void BKE_undosys_stack_limit_steps_and_memory(UndoStack *ustack, int steps, size /* Hack, we need to keep at least one BKE_UNDOSYS_TYPE_MEMFILE. */ if (us->type != BKE_UNDOSYS_TYPE_MEMFILE) { us_exclude = us->prev; - while (us_exclude && us->type != BKE_UNDOSYS_TYPE_MEMFILE) { + while (us_exclude && us_exclude->type != BKE_UNDOSYS_TYPE_MEMFILE) { us_exclude = us_exclude->prev; } if (us_exclude) { diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index bdaa7be60cf..39af73ac175 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -303,12 +303,24 @@ void *BLI_file_read_text_as_mem(const char *filepath, size_t pad_bytes, size_t * void *mem = NULL; if (fp) { - fseek(fp, 0L, SEEK_END); + struct stat st; + if (fstat(fileno(fp), &st) == -1) { + goto finally; + } + if (S_ISDIR(st.st_mode)) { + goto finally; + } + if (fseek(fp, 0L, SEEK_END) == -1) { + goto finally; + } + /* Don't use the 'st_size' because it may be the symlink. */ const long int filelen = ftell(fp); if (filelen == -1) { goto finally; } - fseek(fp, 0L, SEEK_SET); + if (fseek(fp, 0L, SEEK_SET) == -1) { + goto finally; + } mem = MEM_mallocN(filelen + pad_bytes, __func__); if (mem == NULL) { @@ -344,12 +356,24 @@ void *BLI_file_read_binary_as_mem(const char *filepath, size_t pad_bytes, size_t void *mem = NULL; if (fp) { - fseek(fp, 0L, SEEK_END); + struct stat st; + if (fstat(fileno(fp), &st) == -1) { + goto finally; + } + if (S_ISDIR(st.st_mode)) { + goto finally; + } + if (fseek(fp, 0L, SEEK_END) == -1) { + goto finally; + } + /* Don't use the 'st_size' because it may be the symlink. */ const long int filelen = ftell(fp); if (filelen == -1) { goto finally; } - fseek(fp, 0L, SEEK_SET); + if (fseek(fp, 0L, SEEK_SET) == -1) { + goto finally; + } mem = MEM_mallocN(filelen + pad_bytes, __func__); if (mem == NULL) { diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index b9ce9eb90cc..426bad92f8a 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -3558,6 +3558,30 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) COLLECTION_RESTRICT_SELECT | COLLECTION_RESTRICT_RENDER); } + + UnitSettings *unit = &scene->unit; + if (unit->system == USER_UNIT_NONE) { + unit->length_unit = (char)USER_UNIT_ADAPTIVE; + unit->mass_unit = (char)USER_UNIT_ADAPTIVE; + } + + RenderData *render_data = &scene->r; + switch (render_data->ffcodecdata.ffmpeg_preset) { + case FFM_PRESET_ULTRAFAST: + case FFM_PRESET_SUPERFAST: + render_data->ffcodecdata.ffmpeg_preset = FFM_PRESET_REALTIME; + break; + case FFM_PRESET_VERYFAST: + case FFM_PRESET_FASTER: + case FFM_PRESET_FAST: + case FFM_PRESET_MEDIUM: + render_data->ffcodecdata.ffmpeg_preset = FFM_PRESET_GOOD; + break; + case FFM_PRESET_SLOW: + case FFM_PRESET_SLOWER: + case FFM_PRESET_VERYSLOW: + render_data->ffcodecdata.ffmpeg_preset = FFM_PRESET_BEST; + } } LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 648e4a3334a..fa6d7bc6028 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -1528,6 +1528,19 @@ void DepsgraphNodeBuilder::build_mask(Mask *mask) NodeType::PARAMETERS, OperationCode::MASK_EVAL, function_bind(BKE_mask_eval_update, _1, mask_cow)); + /* Build parents. */ + LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) { + LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) { + for (int i = 0; i < spline->tot_point; i++) { + MaskSplinePoint *point = &spline->points[i]; + MaskParent *parent = &point->parent; + if (parent == NULL || parent->id == NULL) { + continue; + } + build_id(parent->id); + } + } + } } void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip) diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index d2f06136b7e..c59fb5f2a38 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -2329,6 +2329,24 @@ void DepsgraphRelationBuilder::build_mask(Mask *mask) /* Final mask evaluation. */ OperationKey mask_eval_key(mask_id, NodeType::PARAMETERS, OperationCode::MASK_EVAL); add_relation(mask_animation_key, mask_eval_key, "Mask Animation -> Mask Eval"); + /* Build parents. */ + LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) { + LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) { + for (int i = 0; i < spline->tot_point; i++) { + MaskSplinePoint *point = &spline->points[i]; + MaskParent *parent = &point->parent; + if (parent == NULL || parent->id == NULL) { + continue; + } + build_id(parent->id); + if (parent->id_type == ID_MC) { + OperationKey movieclip_eval_key( + parent->id, NodeType::PARAMETERS, OperationCode::MOVIECLIP_EVAL); + add_relation(movieclip_eval_key, mask_eval_key, "Movie Clip -> Mask Eval"); + } + } + } + } } void DepsgraphRelationBuilder::build_movieclip(MovieClip *clip) diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 11fbec62d60..1f310957896 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -685,8 +685,13 @@ void set_particle_system_modifiers_loaded(Object *object_cow) } } -void reset_particle_system_edit_eval(Object *object_cow) +void reset_particle_system_edit_eval(const Depsgraph *depsgraph, Object *object_cow) { + /* Inactive (and render) dependency graphs are living in own little bubble, should not care about + * edit mode at all. */ + if (!DEG_is_active(reinterpret_cast<const ::Depsgraph *>(depsgraph))) { + return; + } LISTBASE_FOREACH (ParticleSystem *, psys, &object_cow->particlesystem) { ParticleSystem *orig_psys = psys->orig_psys; if (orig_psys->edit != NULL) { @@ -696,11 +701,13 @@ void reset_particle_system_edit_eval(Object *object_cow) } } -void update_particles_after_copy(const Object *object_orig, Object *object_cow) +void update_particles_after_copy(const Depsgraph *depsgraph, + const Object *object_orig, + Object *object_cow) { update_particle_system_orig_pointers(object_orig, object_cow); set_particle_system_modifiers_loaded(object_cow); - reset_particle_system_edit_eval(object_cow); + reset_particle_system_edit_eval(depsgraph, object_cow); } void update_pose_orig_pointers(const bPose *pose_orig, bPose *pose_cow) @@ -779,7 +786,7 @@ void update_id_after_copy(const Depsgraph *depsgraph, } BKE_pose_pchan_index_rebuild(object_cow->pose); } - update_particles_after_copy(object_orig, object_cow); + update_particles_after_copy(depsgraph, object_orig, object_cow); update_modifiers_orig_pointers(object_orig, object_cow); break; } diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c b/source/blender/draw/engines/eevee/eevee_depth_of_field.c index d0f544dd3c6..12d70131031 100644 --- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c +++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c @@ -97,6 +97,9 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), int buffer_size[2] = {(int)viewport_size[0] / 2, (int)viewport_size[1] / 2}; + buffer_size[0] = max_ii(1, buffer_size[0]); + buffer_size[1] = max_ii(1, buffer_size[1]); + eGPUTextureFormat down_format = DRW_state_draw_background() ? GPU_R11F_G11F_B10F : GPU_RGBA16F; effects->dof_down_near = DRW_texture_pool_query_2d( diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c index 2d4cc069697..e6e699bef10 100644 --- a/source/blender/draw/engines/eevee/eevee_lookdev.c +++ b/source/blender/draw/engines/eevee/eevee_lookdev.c @@ -71,6 +71,8 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, View3D *v3d = draw_ctx->v3d; Scene *scene = draw_ctx->scene; + effects->lookdev_view = NULL; + if (LOOK_DEV_OVERLAY_ENABLED(v3d)) { /* Viewport / Spheres size. */ rcti rect; diff --git a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c index 7b470f9c42a..d53ed239f4e 100644 --- a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c +++ b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c @@ -159,6 +159,9 @@ int EEVEE_screen_raytrace_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) const bool high_qual_input = true; /* TODO dither low quality input */ const eGPUTextureFormat format = (high_qual_input) ? GPU_RGBA16F : GPU_RGBA8; + tracing_res[0] = max_ii(1, tracing_res[0]); + tracing_res[1] = max_ii(1, tracing_res[1]); + /* MRT for the shading pass in order to output needed data for the SSR pass. */ effects->ssr_specrough_input = DRW_texture_pool_query_2d( size_fs[0], size_fs[1], format, &draw_engine_eevee_type); diff --git a/source/blender/draw/engines/workbench/workbench_effect_dof.c b/source/blender/draw/engines/workbench/workbench_effect_dof.c index 69d0500f155..22840a2a756 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_dof.c +++ b/source/blender/draw/engines/workbench/workbench_effect_dof.c @@ -173,7 +173,7 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera) } const float *full_size = DRW_viewport_size_get(); - int size[2] = {full_size[0] / 2, full_size[1] / 2}; + int size[2] = {max_ii(1, (int)full_size[0] / 2), max_ii(1, (int)full_size[1] / 2)}; #if 0 /* NOTE: We Ceil here in order to not miss any edge texel if using a NPO2 texture. */ int shrink_h_size[2] = {ceilf(size[0] / 8.0f), size[1]}; diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index f3089231e8c..306031809d1 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -3018,7 +3018,7 @@ static void mesh_create_loop_edge_fac(MeshRenderData *rdata, GPUVertBuf *vbo) BM_ITER_ELEM (loop, &iter_loop, efa, BM_LOOPS_OF_FACE) { float ratio = mesh_loop_edge_factor_get( efa->no, loop->v->co, loop->v->no, loop->next->v->co); - vertbuf_raw_step(&wd_step, ratio * 255); + vertbuf_raw_step(&wd_step, ratio * 253 + 1); } } BLI_assert(GPU_vertbuf_raw_used(&wd_step) == loop_len); diff --git a/source/blender/draw/intern/draw_instance_data.c b/source/blender/draw/intern/draw_instance_data.c index 3e5dfb53fc7..802f49d6549 100644 --- a/source/blender/draw/intern/draw_instance_data.c +++ b/source/blender/draw/intern/draw_instance_data.c @@ -141,7 +141,8 @@ GPUBatch *DRW_temp_batch_instance_request(DRWInstanceDataList *idatalist, GPUBatch *batch = BLI_memblock_alloc(idatalist->pool_instancing); bool is_compatible = (batch->gl_prim_type == geom->gl_prim_type) && (batch->inst == buf) && - (buf->vbo_id != 0) && (batch->phase == GPU_BATCH_READY_TO_DRAW); + (buf->vbo_id != 0) && (batch->phase == GPU_BATCH_READY_TO_DRAW) && + (batch->elem == geom->elem); for (int i = 0; i < GPU_BATCH_VBO_MAX_LEN && is_compatible; i++) { if (batch->verts[i] != geom->verts[i]) { is_compatible = false; diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 2ebd64a15f9..47ebf2e01a5 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -1521,8 +1521,10 @@ static int gp_stroke_lock_color_exec(bContext *C, wmOperator *UNUSED(op)) /* first lock all colors */ for (short i = 0; i < *totcol; i++) { Material *tmp_ma = give_current_material(ob, i + 1); - tmp_ma->gp_style->flag |= GP_STYLE_COLOR_LOCKED; - DEG_id_tag_update(&tmp_ma->id, ID_RECALC_COPY_ON_WRITE); + if (tmp_ma) { + tmp_ma->gp_style->flag |= GP_STYLE_COLOR_LOCKED; + DEG_id_tag_update(&tmp_ma->id, ID_RECALC_COPY_ON_WRITE); + } } /* loop all selected strokes and unlock any color */ @@ -2433,10 +2435,12 @@ static int gpencil_lock_layer_exec(bContext *C, wmOperator *UNUSED(op)) for (short i = 0; i < *totcol; i++) { ma = give_current_material(ob, i + 1); - gp_style = ma->gp_style; - gp_style->flag |= GP_STYLE_COLOR_LOCKED; - gp_style->flag |= GP_STYLE_COLOR_HIDE; - DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE); + if (ma) { + gp_style = ma->gp_style; + gp_style->flag |= GP_STYLE_COLOR_LOCKED; + gp_style->flag |= GP_STYLE_COLOR_HIDE; + DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE); + } } /* loop all selected strokes and unlock any color used in active layer */ @@ -2515,7 +2519,7 @@ static int gpencil_color_isolate_exec(bContext *C, wmOperator *op) for (short i = 0; i < *totcol; i++) { ma = give_current_material(ob, i + 1); /* Skip if this is the active one */ - if (ma == active_ma) { + if ((ma == NULL) || (ma == active_ma)) { continue; } @@ -2534,6 +2538,9 @@ static int gpencil_color_isolate_exec(bContext *C, wmOperator *op) /* Set flags on all "other" colors */ for (short i = 0; i < *totcol; i++) { ma = give_current_material(ob, i + 1); + if (ma == NULL) { + continue; + } gp_style = ma->gp_style; if (gp_style == active_color) { continue; @@ -2548,6 +2555,9 @@ static int gpencil_color_isolate_exec(bContext *C, wmOperator *op) /* Clear flags - Restore everything else */ for (short i = 0; i < *totcol; i++) { ma = give_current_material(ob, i + 1); + if (ma == NULL) { + continue; + } gp_style = ma->gp_style; gp_style->flag &= ~flags; DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE); @@ -2610,10 +2620,12 @@ static int gpencil_color_hide_exec(bContext *C, wmOperator *op) MaterialGPencilStyle *color = NULL; for (short i = 0; i < *totcol; i++) { ma = give_current_material(ob, i + 1); - color = ma->gp_style; - if (active_color != color) { - color->flag |= GP_STYLE_COLOR_HIDE; - DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE); + if (ma) { + color = ma->gp_style; + if (active_color != color) { + color->flag |= GP_STYLE_COLOR_HIDE; + DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE); + } } } } @@ -2671,9 +2683,11 @@ static int gpencil_color_reveal_exec(bContext *C, wmOperator *UNUSED(op)) for (short i = 0; i < *totcol; i++) { ma = give_current_material(ob, i + 1); - gp_style = ma->gp_style; - gp_style->flag &= ~GP_STYLE_COLOR_HIDE; - DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE); + if (ma) { + gp_style = ma->gp_style; + gp_style->flag &= ~GP_STYLE_COLOR_HIDE; + DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE); + } } /* updates */ @@ -2722,9 +2736,11 @@ static int gpencil_color_lock_all_exec(bContext *C, wmOperator *UNUSED(op)) for (short i = 0; i < *totcol; i++) { ma = give_current_material(ob, i + 1); - gp_style = ma->gp_style; - gp_style->flag |= GP_STYLE_COLOR_LOCKED; - DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE); + if (ma) { + gp_style = ma->gp_style; + gp_style->flag |= GP_STYLE_COLOR_LOCKED; + DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE); + } } /* updates */ @@ -2773,9 +2789,11 @@ static int gpencil_color_unlock_all_exec(bContext *C, wmOperator *UNUSED(op)) for (short i = 0; i < *totcol; i++) { ma = give_current_material(ob, i + 1); - gp_style = ma->gp_style; - gp_style->flag &= ~GP_STYLE_COLOR_LOCKED; - DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE); + if (ma) { + gp_style = ma->gp_style; + gp_style->flag &= ~GP_STYLE_COLOR_LOCKED; + DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE); + } } /* updates */ diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c index 8a9f7c1224a..4d5548dcdf3 100644 --- a/source/blender/editors/gpencil/gpencil_interpolate.c +++ b/source/blender/editors/gpencil/gpencil_interpolate.c @@ -996,8 +996,9 @@ static int gpencil_interpolate_seq_exec(bContext *C, wmOperator *op) float factor; /* get interpolation factor */ - factor = (float)(cframe - prevFrame->framenum) / - (nextFrame->framenum - prevFrame->framenum + 1); + float framerange = nextFrame->framenum - prevFrame->framenum; + CLAMP_MIN(framerange, 1.0f); + factor = (float)(cframe - prevFrame->framenum) / framerange; if (ipo_settings->type == GP_IPO_CURVEMAP) { /* custom curvemap */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 0666f0e491e..a7fc0cfec25 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -758,9 +758,17 @@ static void ui_apply_but_undo(uiBut *but) /* Optionally override undo when undo system doesn't support storing properties. */ if (but->rnapoin.id.data) { - ID *id = but->rnapoin.id.data; - if (!ED_undo_is_legacy_compatible_for_property(but->block->evil_C, id)) { - str = ""; + /* Exception for renaming ID data, we always need undo pushes in this case, + * because undo systems track data by their ID, see: T67002. */ + extern PropertyRNA rna_ID_name; + if (but->rnaprop == &rna_ID_name) { + /* pass */ + } + else { + ID *id = but->rnapoin.id.data; + if (!ED_undo_is_legacy_compatible_for_property(but->block->evil_C, id)) { + str = ""; + } } } diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c index 22c62ecd6f7..53c96fb72a7 100644 --- a/source/blender/editors/interface/interface_region_popover.c +++ b/source/blender/editors/interface/interface_region_popover.c @@ -355,7 +355,7 @@ uiPopover *UI_popover_begin(bContext *C, int ui_size_x) } pup->ui_size_x = ui_size_x; - /* Opertor context default same as menus, change if needed. */ + /* Operator context default same as menus, change if needed. */ ui_popover_create_block(C, pup, WM_OP_EXEC_REGION_WIN); /* create in advance so we can let buttons point to retval already */ @@ -404,7 +404,7 @@ void UI_popover_end(bContext *C, uiPopover *pup, wmKeyMap *keymap) /* TODO(campbell): we may want to make this configurable. * The begin/end stype of calling popups doesn't allow to 'can_refresh' to be set. - * For now close this style of popvers when accessed. */ + * For now close this style of popovers when accessed. */ UI_block_flag_disable(pup->block, UI_BLOCK_KEEP_OPEN); /* panels are created flipped (from event handling pov) */ diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 6f0319223e0..a46dbffbcdd 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -7419,7 +7419,7 @@ void MESH_OT_symmetry_snap(struct wmOperatorType *ot) //#ifdef WITH_FREESTYLE /* -------------------------------------------------------------------- */ -/** \name Mark Edge (FreeStyle) Operator +/** \name Mark Edge (Freestyle) Operator * \{ */ static int edbm_mark_freestyle_edge_exec(bContext *C, wmOperator *op) @@ -7499,7 +7499,7 @@ void MESH_OT_mark_freestyle_edge(wmOperatorType *ot) /** \} */ /* -------------------------------------------------------------------- */ -/** \name Mark Face (FreeStyle) Operator +/** \name Mark Face (Freestyle) Operator * \{ */ static int edbm_mark_freestyle_face_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 4a55cb6c5c6..4e6022cf18c 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -337,10 +337,13 @@ static PTCacheEdit *pe_get_current(Depsgraph *depsgraph, Scene *scene, Object *o } } - if (edit) { + /* Don't consider inactive or render dependency graphs, since they might be evaluated for a + * different number of childrem. or have different pointer to evaluated particle system or + * modifier which will also cause troubles. */ + if (edit && DEG_is_active(depsgraph)) { edit->pid = *pid; if (edit->flags & PT_CACHE_EDIT_UPDATE_PARTICLE_FROM_EVAL) { - if (edit->psys != NULL) { + if (edit->psys != NULL && edit->psys_eval != NULL) { psys_copy_particles(edit->psys, edit->psys_eval); pe_update_hair_particle_edit_pointers(edit); } diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 86db6d50fcc..97a3c7f2480 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -797,6 +797,11 @@ void draw_image_main(const bContext *C, ARegion *ar) ima = ED_space_image(sima); ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy); + /* Tag image as in active use for garbage collector. */ + if (ima) { + BKE_image_tag_time(ima); + } + show_viewer = (ima && ima->source == IMA_SRC_VIEWER) != 0; show_render = (show_viewer && ima->type == IMA_TYPE_R_RESULT) != 0; show_paint = (ima && (sima->mode == SI_MODE_PAINT) && (show_viewer == false) && diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 08768df9d1d..d31256a1425 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -210,6 +210,7 @@ static void compo_initjob(void *cjv) /* NOTE: Don't update animation to preserve unkeyed changes, this means can not use * evaluate_on_framechange. */ + DEG_graph_flush_update(bmain, cj->compositor_depsgraph); DEG_evaluate_on_refresh(cj->compositor_depsgraph); bNodeTree *ntree_eval = (bNodeTree *)DEG_get_evaluated_id(cj->compositor_depsgraph, diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index a618f8ef4c2..89eb3b9d953 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -109,8 +109,9 @@ static void set_operation_types(SpaceOutliner *soops, } } else { - int idcode = GS(tselem->id->name); - switch (idcode) { + const int idcode = (int)GS(tselem->id->name); + bool is_standard_id = false; + switch ((ID_Type)idcode) { case ID_SCE: *scenelevel = 1; break; @@ -134,21 +135,47 @@ static void set_operation_types(SpaceOutliner *soops, case ID_KE: case ID_WO: case ID_AC: - case ID_NLA: case ID_TXT: case ID_GR: case ID_LS: case ID_LI: - if (*idlevel == 0) { - *idlevel = idcode; - } - else if (*idlevel != idcode) { - *idlevel = -1; - } - if (ELEM(*datalevel, TSE_VIEW_COLLECTION_BASE, TSE_SCENE_COLLECTION_BASE)) { - *datalevel = 0; - } + case ID_VF: + case ID_NT: + case ID_BR: + case ID_PA: + case ID_GD: + case ID_MC: + case ID_MSK: + case ID_PAL: + case ID_PC: + case ID_CF: + case ID_WS: + case ID_LP: + is_standard_id = true; break; + case ID_WM: + case ID_SCR: + /* Those are ignored here. */ + /* Note: while Screens should be manageable here, deleting a screen used by a workspace + * will cause crashes when trying to use that workspace, so for now let's play minimal, + * safe change. */ + break; + } + if (idcode == ID_NLA) { + /* Fake one, not an actual ID type... */ + is_standard_id = true; + } + + if (is_standard_id) { + if (*idlevel == 0) { + *idlevel = idcode; + } + else if (*idlevel != idcode) { + *idlevel = -1; + } + if (ELEM(*datalevel, TSE_VIEW_COLLECTION_BASE, TSE_SCENE_COLLECTION_BASE)) { + *datalevel = 0; + } } } } diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index fd7cc3d2ba2..0df5652c539 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -2319,6 +2319,7 @@ static bool ed_object_select_pick(bContext *C, retval = true; WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, basact->object); WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, basact->object); + DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); /* in weightpaint, we use selected bone to select vertexgroup, * so no switch to new active object */ diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index be7ea752fec..f7158244cc7 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1289,7 +1289,6 @@ static void createTransPose(TransInfo *t) bPose *pose = ob->pose; bArmature *arm; - short ik_on = 0; /* check validity of state */ arm = BKE_armature_from_object(tc->poseobj); @@ -1315,8 +1314,7 @@ static void createTransPose(TransInfo *t) /* do we need to add temporal IK chains? */ if ((pose->flag & POSE_AUTO_IK) && t->mode == TFM_TRANSLATION) { - ik_on = pose_grab_with_ik(bmain, ob); - if (ik_on) { + if (pose_grab_with_ik(bmain, ob)) { t->flag |= T_AUTOIK; has_translate_rotate[0] = true; } @@ -1359,7 +1357,6 @@ static void createTransPose(TransInfo *t) Object *ob = tc->poseobj; TransData *td; TransDataExtension *tdx; - short ik_on = 0; int i; PoseInitData_Mirror *pid = tc->custom.type.data; @@ -1407,7 +1404,7 @@ static void createTransPose(TransInfo *t) } /* initialize initial auto=ik chainlen's? */ - if (ik_on) { + if (t->flag & T_AUTOIK) { transform_autoik_update(t, 0); } } diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index d1d5e1d89a2..be3655648f5 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -475,6 +475,9 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, int textarget ima->gpuflag &= ~IMA_GPU_REFRESH; } + /* Tag as in active use for garbage collector. */ + BKE_image_tag_time(ima); + /* Test if we already have a texture. */ GPUTexture **tex = gpu_get_image_gputexture(ima, textarget); if (*tex) { diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 58efe3dc5c4..ba5cf214a42 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -378,7 +378,11 @@ void gpu_extensions_init(void) GG.dfdyfactors[1] = 1.0; } - if (strstr(renderer, "HD Graphics 4000")) { + if (strstr(version, "Build 10.18.10.3379") || strstr(version, "Build 10.18.10.3574") || + strstr(version, "Build 10.18.10.4252") || strstr(version, "Build 10.18.10.4358") || + strstr(version, "Build 10.18.10.4653") || strstr(version, "Build 10.18.10.5069") || + strstr(version, "Build 10.18.14.4264") || strstr(version, "Build 10.18.14.4432") || + strstr(version, "Build 10.18.14.5067")) { GG.context_local_shaders_workaround = true; } } diff --git a/source/blender/gpu/intern/gpu_vertex_format.c b/source/blender/gpu/intern/gpu_vertex_format.c index 37e1f9cf9da..e745c525df6 100644 --- a/source/blender/gpu/intern/gpu_vertex_format.c +++ b/source/blender/gpu/intern/gpu_vertex_format.c @@ -365,6 +365,11 @@ void GPU_vertformat_from_interface(GPUVertFormat *format, const GPUShaderInterfa input = next; next = input->next; + /* OpenGL attributes such as `gl_VertexID` have a location of -1. */ + if (input->location < 0) { + continue; + } + format->name_len++; /* multiname support */ format->attr_len++; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 29e6c670c00..367a5a81098 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1600,7 +1600,7 @@ static ImBuf *wm_block_splash_image(void) BLI_join_dirfile(splash_filepath, sizeof(splash_filepath), template_directory, - (U.pixelsize == 2) ? "splash_2x.png" : "splash.png"); + (U.dpi_fac > 1.0) ? "splash_2x.png" : "splash.png"); ibuf_template = IMB_loadiffname(splash_filepath, IB_rect, NULL); if (ibuf_template) { const int x_expect = ibuf->x; diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index f3550034a2f..0a68d2ce6ef 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -926,7 +926,7 @@ static const char arg_handle_debug_mode_generic_set_doc_ffmpeg[] = # ifdef WITH_FREESTYLE static const char arg_handle_debug_mode_generic_set_doc_freestyle[] = "\n\t" - "Enable debug messages for FreeStyle."; + "Enable debug messages for Freestyle."; # endif static const char arg_handle_debug_mode_generic_set_doc_python[] = "\n\t" |