diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-07-16 22:09:30 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-07-16 22:09:30 +0300 |
commit | fca4826c7f9d3258434df1b463189ca232cfd5c8 (patch) | |
tree | 04b6a047cd3ba879a2c886365c2228bde6a644f0 /source | |
parent | b0845fc1332bf242237fe858803bcebe87ffd7b3 (diff) | |
parent | a36a44bb811d8dbe39dfaf79e21c509b3134ec66 (diff) |
Merge branch 'master' into soc-2019-openxr
Diffstat (limited to 'source')
58 files changed, 496 insertions, 144 deletions
diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h index c1e36f5dd83..972ae5e8628 100644 --- a/source/blender/blenkernel/BKE_collection.h +++ b/source/blender/blenkernel/BKE_collection.h @@ -85,7 +85,7 @@ struct Scene *BKE_collection_master_scene_search(const struct Main *bmain, /* Collection Objects */ -bool BKE_collection_has_object(struct Collection *collection, struct Object *ob); +bool BKE_collection_has_object(struct Collection *collection, const struct Object *ob); bool BKE_collection_has_object_recursive(struct Collection *collection, struct Object *ob); struct Collection *BKE_collection_object_find(struct Main *bmain, struct Scene *scene, diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 072a234992b..a72c7a7be15 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/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h index cc3f5bbb42e..4c023f54e04 100644 --- a/source/blender/blenkernel/BKE_rigidbody.h +++ b/source/blender/blenkernel/BKE_rigidbody.h @@ -44,8 +44,10 @@ void BKE_rigidbody_free_constraint(struct Object *ob); /* ...... */ -struct RigidBodyOb *BKE_rigidbody_copy_object(const struct Object *ob, const int flag); -struct RigidBodyCon *BKE_rigidbody_copy_constraint(const struct Object *ob, const int flag); +void BKE_rigidbody_object_copy(struct Main *bmain, + struct Object *ob_dst, + const struct Object *ob_src, + const int flag); /* Callback format for performing operations on ID-pointers for rigidbody world. */ typedef void (*RigidbodyWorldIDFunc)(struct RigidBodyWorld *rbw, 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/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index 570805a01d0..afbd2627a2a 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -670,9 +670,14 @@ WorkspaceConfigFileData *BKE_blendfile_workspace_config_read(const char *filepat } if (bfd) { - workspace_config = MEM_mallocN(sizeof(*workspace_config), __func__); + workspace_config = MEM_callocN(sizeof(*workspace_config), __func__); workspace_config->main = bfd->main; - workspace_config->workspaces = bfd->main->workspaces; + + /* Only 2.80+ files have actual workspaces, don't try to use screens + * from older versions. */ + if (bfd->main->versionfile >= 280) { + workspace_config->workspaces = bfd->main->workspaces; + } MEM_freeN(bfd); } diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index ac55846714b..965f6e4bc51 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -287,16 +287,6 @@ static Collection *collection_duplicate_recursive(Main *bmain, collection_object_add(bmain, collection_new, ob_new, 0, true); collection_object_remove(bmain, collection_new, ob_old, false); - - if (ob_new->rigidbody_object != NULL) { - BLI_assert(ob_old->rigidbody_object != NULL); - for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) { - if (scene->rigidbody_world != NULL && - BKE_collection_has_object(scene->rigidbody_world->group, ob_old)) { - collection_object_add(bmain, scene->rigidbody_world->group, ob_new, 0, true); - } - } - } } } @@ -572,7 +562,7 @@ bool BKE_collection_object_cyclic_check(Main *bmain, Object *object, Collection /******************* Collection Object Membership *******************/ -bool BKE_collection_has_object(Collection *collection, Object *ob) +bool BKE_collection_has_object(Collection *collection, const Object *ob) { if (ELEM(NULL, collection, ob)) { return false; 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/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/object.c b/source/blender/blenkernel/intern/object.c index 2a66edc8d42..d7256cc9604 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1417,8 +1417,7 @@ void BKE_object_copy_data(Main *bmain, Object *ob_dst, const Object *ob_src, con } } BKE_object_copy_softbody(ob_dst, ob_src, flag_subdata); - ob_dst->rigidbody_object = BKE_rigidbody_copy_object(ob_src, flag_subdata); - ob_dst->rigidbody_constraint = BKE_rigidbody_copy_constraint(ob_src, flag_subdata); + BKE_rigidbody_object_copy(bmain, ob_dst, ob_src, flag_subdata); BKE_object_copy_particlesystems(ob_dst, ob_src, flag_subdata); 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/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index d441ffdc8ff..b577efd2a22 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1590,7 +1590,7 @@ void BKE_ptcache_id_from_softbody(PTCacheID *pid, Object *ob, SoftBody *sb) pid->stack_index = pid->cache->index; - pid->default_step = 10; + pid->default_step = 1; pid->max_step = 20; pid->file_type = PTCACHE_FILE_PTCACHE; } @@ -1655,7 +1655,7 @@ void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *p pid->info_types = (1 << BPHYS_DATA_TIMES); - pid->default_step = 10; + pid->default_step = 1; pid->max_step = 20; pid->file_type = PTCACHE_FILE_PTCACHE; } diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index a3a0ebd6cb3..c9b18dfc7e6 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -34,6 +34,7 @@ #include "MEM_guardedalloc.h" #include "BLI_math.h" +#include "BLI_listbase.h" #ifdef WITH_BULLET # include "RBI_api.h" @@ -228,7 +229,7 @@ void BKE_rigidbody_free_constraint(Object *ob) * be added to relevant groups later... */ -RigidBodyOb *BKE_rigidbody_copy_object(const Object *ob, const int flag) +static RigidBodyOb *rigidbody_copy_object(const Object *ob, const int flag) { RigidBodyOb *rboN = NULL; @@ -249,7 +250,7 @@ RigidBodyOb *BKE_rigidbody_copy_object(const Object *ob, const int flag) return rboN; } -RigidBodyCon *BKE_rigidbody_copy_constraint(const Object *ob, const int UNUSED(flag)) +static RigidBodyCon *rigidbody_copy_constraint(const Object *ob, const int UNUSED(flag)) { RigidBodyCon *rbcN = NULL; @@ -268,6 +269,54 @@ RigidBodyCon *BKE_rigidbody_copy_constraint(const Object *ob, const int UNUSED(f return rbcN; } +void BKE_rigidbody_object_copy(Main *bmain, Object *ob_dst, const Object *ob_src, const int flag) +{ + ob_dst->rigidbody_object = rigidbody_copy_object(ob_src, flag); + ob_dst->rigidbody_constraint = rigidbody_copy_constraint(ob_src, flag); + + if (flag & LIB_ID_CREATE_NO_MAIN) { + return; + } + + /* We have to ensure that duplicated object ends up in relevant rigidbody collections... + * Otherwise duplicating the RB data itself is meaningless. */ + LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { + RigidBodyWorld *rigidbody_world = scene->rigidbody_world; + + if (rigidbody_world != NULL) { + bool need_objects_update = false; + bool need_constraints_update = false; + + if (ob_dst->rigidbody_object) { + if (BKE_collection_has_object(rigidbody_world->group, ob_src)) { + BKE_collection_object_add(bmain, rigidbody_world->group, ob_dst); + need_objects_update = true; + } + } + if (ob_dst->rigidbody_constraint) { + if (BKE_collection_has_object(rigidbody_world->constraints, ob_src)) { + BKE_collection_object_add(bmain, rigidbody_world->constraints, ob_dst); + need_constraints_update = true; + } + } + + if ((flag & LIB_ID_CREATE_NO_DEG_TAG) == 0 && + (need_objects_update || need_constraints_update)) { + BKE_rigidbody_cache_reset(rigidbody_world); + + DEG_relations_tag_update(bmain); + if (need_objects_update) { + DEG_id_tag_update(&rigidbody_world->group->id, ID_RECALC_COPY_ON_WRITE); + } + if (need_constraints_update) { + DEG_id_tag_update(&rigidbody_world->constraints->id, ID_RECALC_COPY_ON_WRITE); + } + DEG_id_tag_update(&ob_dst->id, ID_RECALC_TRANSFORM); + } + } + } +} + /* ************************************** */ /* Setup Utilities - Validate Sim Instances */ @@ -1983,13 +2032,8 @@ void BKE_rigidbody_do_simulation(Depsgraph *depsgraph, Scene *scene, float ctime # pragma GCC diagnostic ignored "-Wunused-parameter" # endif -struct RigidBodyOb *BKE_rigidbody_copy_object(const Object *ob, const int flag) -{ - return NULL; -} -struct RigidBodyCon *BKE_rigidbody_copy_constraint(const Object *ob, const int flag) +void BKE_rigidbody_object_copy(Main *bmain, Object *ob_dst, const Object *ob_src, const int flag) { - return NULL; } void BKE_rigidbody_validate_sim_world(Scene *scene, RigidBodyWorld *rbw, bool rebuild) { 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 5d899ef73a6..ce06364a9f0 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -3504,6 +3504,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/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 06f6682f401..eabd9469582 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -804,7 +804,10 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia matNode.set_alpha(ef->getOpaqueMode(), ef->getTransparent(), ef->getTransparency()); /* following mapping still needs to be verified */ +#if 0 + // needs rework to be done for 2.81 matNode.set_shininess(ef->getShininess()); +#endif matNode.set_reflectivity(ef->getReflectivity()); /* not supported by principled BSDF */ diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp index 394c79bb988..a784776d342 100644 --- a/source/blender/collada/EffectExporter.cpp +++ b/source/blender/collada/EffectExporter.cpp @@ -208,21 +208,20 @@ void EffectsExporter::operator()(Material *ma, Object *ob) COLLADASW::EffectProfile ep(mSW); ep.setProfileType(COLLADASW::EffectProfile::COMMON); ep.openProfile(); - set_shader_type(ep, ma); + set_shader_type(ep, ma); // creates a Lambert Shader for now COLLADASW::ColorOrTexture cot; set_diffuse_color(ep, ma); set_emission(ep, ma); set_ior(ep, ma); - set_shininess(ep, ma); set_reflectivity(ep, ma); set_transparency(ep, ma); - /* TODO: from where to get ambient, specular and reflective? */ + /* TODO: */ + // set_shininess(ep, ma); shininess not supported for lambert // set_ambient(ep, ma); // set_specular(ep, ma); - // set_reflective(ep, ma); get_images(ma, material_image_map); std::string active_uv(getActiveUVLayerName(ob)); diff --git a/source/blender/collada/Materials.cpp b/source/blender/collada/Materials.cpp index aa35b71b9db..d8a0f06c12b 100644 --- a/source/blender/collada/Materials.cpp +++ b/source/blender/collada/Materials.cpp @@ -131,18 +131,24 @@ void MaterialNode::add_link(bNode *from_node, int from_index, bNode *to_node, in void MaterialNode::set_reflectivity(COLLADAFW::FloatOrParam &val) { float reflectivity = val.getFloatValue(); - bNodeSocket *socket = nodeFindSocket(shader_node, SOCK_IN, "Metallic"); - ((bNodeSocketValueFloat *)socket->default_value)->value = reflectivity; - - material->metallic = reflectivity; + if (reflectivity >= 0) { + bNodeSocket *socket = nodeFindSocket(shader_node, SOCK_IN, "Metallic"); + ((bNodeSocketValueFloat *)socket->default_value)->value = reflectivity; + material->metallic = reflectivity; + } } +#if 0 +// needs rework to be done for 2.81 void MaterialNode::set_shininess(COLLADAFW::FloatOrParam &val) { float roughness = val.getFloatValue(); - bNodeSocket *socket = nodeFindSocket(shader_node, SOCK_IN, "Roughness"); - ((bNodeSocketValueFloat *)socket->default_value)->value = roughness; + if (roughness >= 0) { + bNodeSocket *socket = nodeFindSocket(shader_node, SOCK_IN, "Roughness"); + ((bNodeSocketValueFloat *)socket->default_value)->value = roughness; + } } +#endif void MaterialNode::set_ior(COLLADAFW::FloatOrParam &val) { 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 453e9e06a6a..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 @@ -578,6 +578,7 @@ void update_armature_edit_mode_pointers(const Depsgraph * /*depsgraph*/, const bArmature *armature_orig = (const bArmature *)id_orig; bArmature *armature_cow = (bArmature *)id_cow; armature_cow->edbo = armature_orig->edbo; + armature_cow->act_edbone = armature_orig->act_edbone; } void update_curve_edit_mode_pointers(const Depsgraph * /*depsgraph*/, @@ -684,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) { @@ -695,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) @@ -778,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_armature.c b/source/blender/draw/intern/draw_armature.c index 4f387de16a8..f97efa9aed9 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -883,7 +883,7 @@ static void update_color(const Object *ob, const float const_color[4]) #define NO_ALPHA(c) (((c)[3] = 1.0f), (c)) UI_GetThemeColor3fv(TH_SELECT, NO_ALPHA(g_theme.select_color)); - UI_GetThemeColor3fv(TH_EDGE_SELECT, NO_ALPHA(g_theme.edge_select_color)); + UI_GetThemeColorShade3fv(TH_EDGE_SELECT, 60, NO_ALPHA(g_theme.edge_select_color)); UI_GetThemeColorShade3fv(TH_EDGE_SELECT, -20, NO_ALPHA(g_theme.bone_select_color)); UI_GetThemeColor3fv(TH_WIRE, NO_ALPHA(g_theme.wire_color)); UI_GetThemeColor3fv(TH_WIRE_EDIT, NO_ALPHA(g_theme.wire_edit_color)); @@ -1886,19 +1886,23 @@ static void draw_armature_edit(Object *ob) { const DRWContextState *draw_ctx = DRW_context_state_get(); EditBone *eBone; - bArmature *arm = ob->data; int index; const bool is_select = DRW_state_is_select(); - update_color(ob, NULL); - edbo_compute_bbone_child(arm); - const bool show_text = DRW_state_show_text(); const bool show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) == 0); - const Object *orig_object = DEG_get_original_object(ob); + const Object *ob_orig = DEG_get_original_object(ob); + /* FIXME(campbell): We should be able to use the CoW object, + * however the active bone isn't updated. Long term solution is an 'EditArmature' struct. + * for now we can draw from the original armature. See: T66773. */ + // bArmature *arm = ob->data; + bArmature *arm = ob_orig->data; + + update_color(ob, NULL); + edbo_compute_bbone_child(arm); - for (eBone = arm->edbo->first, index = orig_object->runtime.select_id; eBone; + for (eBone = arm->edbo->first, index = ob_orig->runtime.select_id; eBone; eBone = eBone->next, index += 0x10000) { if (eBone->layer & arm->layer) { if ((eBone->flag & BONE_HIDDEN_A) == 0) { @@ -1993,8 +1997,8 @@ static void draw_armature_pose(Object *ob, const float const_color[4]) } if (arm->flag & ARM_POSEMODE) { - const Object *orig_object = DEG_get_original_object(ob); - index = orig_object->runtime.select_id; + const Object *ob_orig = DEG_get_original_object(ob); + index = ob_orig->runtime.select_id; } } 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_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index f5b27d8268d..7d866aedd87 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -579,6 +579,7 @@ static bool gp_brush_push_apply( mul_v3_v3fl(delta, gso->dvec, inf); /* apply */ + mul_mat3_m4_v3(gso->object->obmat, delta); /* only rotation component */ add_v3_v3(&pt->x, delta); /* compute lock axis */ @@ -646,7 +647,9 @@ static bool gp_brush_pinch_apply( inf = gp_brush_influence_calc(gso, radius, co) / 5.0f; /* 1) Make this point relative to the cursor/midpoint (dvec) */ - sub_v3_v3v3(vec, &pt->x, gso->dvec); + float fpt[3]; + mul_v3_m4v3(fpt, gso->object->obmat, &pt->x); + sub_v3_v3v3(vec, fpt, gso->dvec); /* 2) Shrink the distance by pulling the point towards the midpoint * (0.0 = at midpoint, 1 = at edge of brush region) @@ -664,7 +667,8 @@ static bool gp_brush_pinch_apply( mul_v3_fl(vec, fac); /* 3) Translate back to original space, with the shrinkage applied */ - add_v3_v3v3(&pt->x, gso->dvec, vec); + add_v3_v3v3(fpt, gso->dvec, vec); + mul_v3_m4v3(&pt->x, gso->object->imat, fpt); /* compute lock axis */ gpsculpt_compute_lock_axis(gso, pt, save_pt); @@ -713,11 +717,14 @@ static bool gp_brush_twist_apply( axis_angle_normalized_to_mat3(rmat, axis, angle); - /* Rotate point (no matrix-space transforms needed, as GP points are in world space) */ - sub_v3_v3v3(vec, &pt->x, gso->dvec); /* make relative to center - * (center is stored in dvec) */ + /* Rotate point */ + float fpt[3]; + mul_v3_m4v3(fpt, gso->object->obmat, &pt->x); + sub_v3_v3v3(vec, fpt, gso->dvec); /* make relative to center + * (center is stored in dvec) */ mul_m3_v3(rmat, vec); - add_v3_v3v3(&pt->x, vec, gso->dvec); /* restore */ + add_v3_v3v3(fpt, vec, gso->dvec); /* restore */ + mul_v3_m4v3(&pt->x, gso->object->imat, fpt); /* compute lock axis */ gpsculpt_compute_lock_axis(gso, pt, save_pt); @@ -1090,8 +1097,12 @@ static void gp_brush_clone_add(bContext *C, tGP_BrushEditData *gso) * get pasted relative to where the cursor is now */ for (i = 0, pt = new_stroke->points; i < new_stroke->totpoints; i++, pt++) { + /* Rotate around center new position */ + mul_mat3_m4_v3(gso->object->obmat, &pt->x); /* only rotation component */ + /* assume that the delta can just be applied, and then everything works */ add_v3_v3(&pt->x, delta); + mul_m4_v3(gso->object->imat, &pt->x); } /* Store ref for later */ diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 941c7645dc0..90a2b2d613c 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/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 5d8038d0b28..d2613facd83 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -393,6 +393,9 @@ bool ED_mesh_color_remove_named(struct Mesh *me, const char *name); void ED_mesh_report_mirror(struct wmOperator *op, int totmirr, int totfail); void ED_mesh_report_mirror_ex(struct wmOperator *op, int totmirr, int totfail, char selectmode); +/* Returns the pinned mesh, the mesh from the pinned object, or the mesh from the active object. */ +struct Mesh *ED_mesh_context(struct bContext *C); + /* mesh backup */ typedef struct BMBackup { struct BMesh *bmcopy; diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index fc43144417a..e67a3b003fc 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -337,6 +337,7 @@ bool ED_operator_object_active(struct bContext *C); bool ED_operator_object_active_editable(struct bContext *C); bool ED_operator_object_active_editable_mesh(struct bContext *C); bool ED_operator_object_active_editable_font(struct bContext *C); +bool ED_operator_editable_mesh(struct bContext *C); bool ED_operator_editmesh(struct bContext *C); bool ED_operator_editmesh_view3d(struct bContext *C); bool ED_operator_editmesh_region_view3d(struct bContext *C); diff --git a/source/blender/editors/interface/interface_eyedropper_depth.c b/source/blender/editors/interface/interface_eyedropper_depth.c index adb317f488c..fc60fc06ac0 100644 --- a/source/blender/editors/interface/interface_eyedropper_depth.c +++ b/source/blender/editors/interface/interface_eyedropper_depth.c @@ -31,6 +31,7 @@ #include "DNA_space_types.h" #include "DNA_screen_types.h" #include "DNA_object_types.h" +#include "DNA_camera_types.h" #include "DNA_view3d_types.h" #include "BLI_string.h" @@ -102,8 +103,9 @@ static int depthdropper_init(bContext *C, wmOperator *op) if (rv3d && rv3d->persp == RV3D_CAMOB) { View3D *v3d = CTX_wm_view3d(C); if (v3d->camera && v3d->camera->data && !ID_IS_LINKED(v3d->camera->data)) { - RNA_id_pointer_create(v3d->camera->data, &ddr->ptr); - ddr->prop = RNA_struct_find_property(&ddr->ptr, "dof_distance"); + Camera *camera = (Camera *)v3d->camera->data; + RNA_pointer_create(&camera->id, &RNA_CameraDOFSettings, &camera->dof, &ddr->ptr); + ddr->prop = RNA_struct_find_property(&ddr->ptr, "focus_distance"); ddr->is_undo = true; } } 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_hud.c b/source/blender/editors/interface/interface_region_hud.c index 6d1b2baeff9..43afdc534ad 100644 --- a/source/blender/editors/interface/interface_region_hud.c +++ b/source/blender/editors/interface/interface_region_hud.c @@ -27,6 +27,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_screen_types.h" #include "DNA_userdef_types.h" #include "BLI_string.h" @@ -231,6 +232,11 @@ ARegionType *ED_area_type_hud(int space_type) art->init = hud_region_init; art->free = hud_region_free; + /* We need to indicate a preferred size to avoid false `RGN_FLAG_TOO_SMALL` + * the first time the region is created. */ + art->prefsizex = AREAMINX; + art->prefsizey = HEADERY; + hud_panels_register(art, space_type, art->regionid); art->lock = 1; /* can become flag, see BKE_spacedata_draw_locks */ 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 a5790022f43..919de4cdb20 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -7418,7 +7418,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) @@ -7498,7 +7498,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/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index a6934326d68..ee8de9d8ea9 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -41,6 +41,7 @@ #include "DEG_depsgraph.h" +#include "RNA_access.h" #include "RNA_define.h" #include "WM_api.h" @@ -629,8 +630,7 @@ void MESH_OT_vertex_color_remove(wmOperatorType *ot) static int mesh_customdata_clear_exec__internal(bContext *C, char htype, int type) { - Object *obedit = ED_object_context(C); - Mesh *me = obedit->data; + Mesh *me = ED_mesh_context(C); int tot; CustomData *data = mesh_customdata_get_type(me, htype, &tot); @@ -788,8 +788,7 @@ void MESH_OT_customdata_skin_clear(wmOperatorType *ot) /* Clear custom loop normals */ static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator *UNUSED(op)) { - Object *ob = ED_object_context(C); - Mesh *me = ob->data; + Mesh *me = ED_mesh_context(C); if (!BKE_mesh_has_custom_loop_normals(me)) { CustomData *data = GET_CD_DATA(me, ldata); @@ -853,7 +852,7 @@ void MESH_OT_customdata_custom_splitnormals_add(wmOperatorType *ot) /* api callbacks */ ot->exec = mesh_customdata_custom_splitnormals_add_exec; - ot->poll = ED_operator_object_active_editable_mesh; + ot->poll = ED_operator_editable_mesh; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -861,8 +860,7 @@ void MESH_OT_customdata_custom_splitnormals_add(wmOperatorType *ot) static int mesh_customdata_custom_splitnormals_clear_exec(bContext *C, wmOperator *UNUSED(op)) { - Object *ob = ED_object_context(C); - Mesh *me = ob->data; + Mesh *me = ED_mesh_context(C); if (BKE_mesh_has_custom_loop_normals(me)) { return mesh_customdata_clear_exec__internal(C, BM_LOOP, CD_CUSTOMLOOPNORMAL); @@ -879,7 +877,7 @@ void MESH_OT_customdata_custom_splitnormals_clear(wmOperatorType *ot) /* api callbacks */ ot->exec = mesh_customdata_custom_splitnormals_clear_exec; - ot->poll = ED_operator_object_active_editable_mesh; + ot->poll = ED_operator_editable_mesh; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1289,3 +1287,23 @@ void ED_mesh_report_mirror(wmOperator *op, int totmirr, int totfail) { ED_mesh_report_mirror_ex(op, totmirr, totfail, SCE_SELECT_VERTEX); } + +Mesh *ED_mesh_context(struct bContext *C) +{ + Mesh *mesh = CTX_data_pointer_get_type(C, "mesh", &RNA_Mesh).data; + if (mesh != NULL) { + return mesh; + } + + Object *ob = ED_object_active_context(C); + if (ob == NULL) { + return NULL; + } + + ID *data = (ID *)ob->data; + if (data == NULL || GS(data->name) != ID_ME) { + return NULL; + } + + return (Mesh *)data; +} 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/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 5fc7979a631..c9a45728bc2 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -74,6 +74,7 @@ #include "ED_clip.h" #include "ED_image.h" #include "ED_keyframes_draw.h" +#include "ED_mesh.h" #include "ED_object.h" #include "ED_screen.h" #include "ED_screen_types.h" @@ -371,6 +372,12 @@ bool ED_operator_object_active_editable_font(bContext *C) return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob) && (ob->type == OB_FONT)); } +bool ED_operator_editable_mesh(bContext *C) +{ + Mesh *mesh = ED_mesh_context(C); + return (mesh != NULL) && !ID_IS_LINKED(mesh); +} + bool ED_operator_editmesh(bContext *C) { Object *obedit = CTX_data_edit_object(C); diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 65e24cecf82..ac74afce79e 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -964,9 +964,9 @@ static void paint_draw_curve_cursor(Brush *brush, ViewContext *vc) immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); float selec_col[4], handle_col[4], pivot_col[4]; - UI_GetThemeColor4fv(TH_VERTEX_SELECT, selec_col); - UI_GetThemeColor4fv(TH_PAINT_CURVE_HANDLE, handle_col); - UI_GetThemeColor4fv(TH_PAINT_CURVE_PIVOT, pivot_col); + UI_GetThemeColorType4fv(TH_VERTEX_SELECT, SPACE_VIEW3D, selec_col); + UI_GetThemeColorType4fv(TH_PAINT_CURVE_HANDLE, SPACE_VIEW3D, handle_col); + UI_GetThemeColorType4fv(TH_PAINT_CURVE_PIVOT, SPACE_VIEW3D, pivot_col); for (i = 0; i < pc->tot_points - 1; i++, cp++) { int j; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 316ae6189f0..0c08af2b020 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2271,7 +2271,6 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P vwpaint_update_cache_variants(C, wp, ob, itemptr); float mat[4][4]; - float mval[2]; const float brush_alpha_value = BKE_brush_alpha_get(scene, brush); @@ -2321,7 +2320,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P /* calculate pivot for rotation around seletion if needed */ /* also needed for "View Selected" on last stroke */ - paint_last_stroke_update(scene, vc->ar, mval); + paint_last_stroke_update(scene, vc->ar, ss->cache->mouse); BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL); @@ -3273,12 +3272,12 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P VPaint *vp = ts->vpaint; ViewContext *vc = &vpd->vc; Object *ob = vc->obact; + SculptSession *ss = ob->sculpt; Sculpt *sd = CTX_data_tool_settings(C)->sculpt; vwpaint_update_cache_variants(C, vp, ob, itemptr); float mat[4][4]; - float mval[2]; ED_view3d_init_mats_rv3d(ob, vc->rv3d); @@ -3300,7 +3299,7 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P /* calculate pivot for rotation around seletion if needed */ /* also needed for "View Selected" on last stroke */ - paint_last_stroke_update(scene, vc->ar, mval); + paint_last_stroke_update(scene, vc->ar, ss->cache->mouse); ED_region_tag_redraw(vc->ar); 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_userpref/userpref_ops.c b/source/blender/editors/space_userpref/userpref_ops.c index bd3ddf18144..c932d537b54 100644 --- a/source/blender/editors/space_userpref/userpref_ops.c +++ b/source/blender/editors/space_userpref/userpref_ops.c @@ -26,6 +26,7 @@ #include "DNA_screen_types.h" #include "BKE_context.h" +#include "BKE_global.h" #include "BKE_main.h" #include "BKE_report.h" @@ -71,7 +72,39 @@ static void PREFERENCES_OT_reset_default_theme(wmOperatorType *ot) /** \} */ +/* -------------------------------------------------------------------- */ +/** \name Toggle Auto-Save Override + * + * This operator only exists so there is a useful tool-tip for for adjusting the global flag. + * \{ */ + +static int preferences_autosave_override_toggle_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) +{ + G.f ^= G_FLAG_USERPREF_NO_SAVE_ON_EXIT; + return OPERATOR_FINISHED; +} + +static void PREFERENCES_OT_autosave_override_toggle(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Toggle Override Auto-Save"; + ot->idname = "PREFERENCES_OT_autosave_override_toggle"; + ot->description = + "The current session has \"Factory Preferences\" loaded " + "which disables automatically saving.\n" + "Disable this to auto-save the preferences"; + + /* callbacks */ + ot->exec = preferences_autosave_override_toggle_exec; + + /* flags */ + ot->flag = OPTYPE_REGISTER; +} + +/** \} */ + void ED_operatortypes_userpref(void) { WM_operatortype_append(PREFERENCES_OT_reset_default_theme); + WM_operatortype_append(PREFERENCES_OT_autosave_override_toggle); } 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 27a2ab85127..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); } } @@ -2537,6 +2534,7 @@ void flushTransParticles(TransInfo *t) } PE_update_object(t->depsgraph, scene, OBACT(view_layer), 1); + BKE_particle_batch_cache_dirty_tag(psys, BKE_PARTICLE_BATCH_DIRTY_ALL); DEG_id_tag_update(&ob->id, ID_RECALC_PSYS_REDO); } } 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/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 26b45bbef0d..2677f8ddfdd 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -187,7 +187,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes } } - if (harden_normals && !(((Mesh *)ctx->object->data)->flag & ME_AUTOSMOOTH)) { + Object *ob = ctx->object; + + if (harden_normals && (ob->type == OB_MESH) && !(((Mesh *)ob->data)->flag & ME_AUTOSMOOTH)) { modifier_setError(md, "Enable 'Auto Smooth' option in mesh settings for hardening"); harden_normals = false; } diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index 857c69eab50..11f001d7a85 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -335,7 +335,7 @@ static Mesh *doMirrorOnAxis(MirrorModifierData *mmd, } /* handle custom split normals */ - if ((((Mesh *)ob->data)->flag & ME_AUTOSMOOTH) && + if (ob->type == OB_MESH && (((Mesh *)ob->data)->flag & ME_AUTOSMOOTH) && CustomData_has_layer(&result->ldata, CD_CUSTOMLOOPNORMAL)) { const int totloop = result->totloop; const int totpoly = result->totpoly; diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index ef957fa03c5..d517622645c 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -634,7 +634,17 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) /* confusing this global... */ G.relbase_valid = 1; - retval = BKE_blendfile_read(C, filepath, &(const struct BlendFileReadParams){0}, reports); + retval = BKE_blendfile_read( + C, + filepath, + /* Loading preferences when the user intended to load a regular file is a security risk, + * because the excluded path list is also loaded. + * Further it's just confusing if a user loads a file and various preferences change. */ + &(const struct BlendFileReadParams){ + .is_startup = false, + .skip_flags = BLO_READ_SKIP_USERDEF, + }, + reports); /* BKE_file_read sets new Main into context. */ Main *bmain = CTX_data_main(C); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 4ff58f2a867..aded1994c18 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1601,7 +1601,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 8affda7189c..34c2dd5305a 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -929,7 +929,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" |