diff options
author | YimingWu <xp8110@outlook.com> | 2019-06-17 09:58:39 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2019-06-17 09:58:39 +0300 |
commit | 915a928067a89923fab144ca4a7ca2e75337a5e8 (patch) | |
tree | c0c1dae1f4f39c1e2a5d451f2c8e9fc5cd726319 /source | |
parent | fe71389950aa611aac12cc88bdc965363dbcdc7d (diff) | |
parent | 5364e62b0535cdadbd1db27dc1633cfd253a49ef (diff) |
Merge branch 'master' into soc-2019-npr
Diffstat (limited to 'source')
182 files changed, 2550 insertions, 2272 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 9fe8fc3880f..bee76c09cbc 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -75,7 +75,7 @@ typedef struct Global { * * 666: Use quicker batch delete for outliners' delete hierarchy (01/2019). * * 777: Enable UI node panel's sockets polling (11/2011). * * 799: Enable some mysterious new depsgraph behavior (05/2015). - * * 1112: Disable new Cloth internal springs hanlding (09/2014). + * * 1112: Disable new Cloth internal springs handling (09/2014). * * 1234: Disable new dyntopo code fixing skinny faces generation (04/2015). * * 16384 and above: Reserved for python (add-ons) usage. */ diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index ebc21493b53..8fc513d8a14 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -86,7 +86,7 @@ void BKE_gpencil_make_local(struct Main *bmain, struct bGPdata *gpd, const bool void BKE_gpencil_frame_delete_laststroke(struct bGPDlayer *gpl, struct bGPDframe *gpf); /* materials */ -void BKE_gpencil_material_index_remove(struct bGPdata *gpd, int index); +void BKE_gpencil_material_index_reassign(struct bGPdata *gpd, int totcol, int index); void BKE_gpencil_material_remap(struct bGPdata *gpd, const unsigned int *remap, unsigned int remap_len); diff --git a/source/blender/blenkernel/BKE_library_override.h b/source/blender/blenkernel/BKE_library_override.h index bdecff87cf1..5440b0ebe63 100644 --- a/source/blender/blenkernel/BKE_library_override.h +++ b/source/blender/blenkernel/BKE_library_override.h @@ -25,39 +25,39 @@ */ struct ID; -struct IDOverrideStatic; -struct IDOverrideStaticProperty; -struct IDOverrideStaticPropertyOperation; +struct IDOverrideLibrary; +struct IDOverrideLibraryProperty; +struct IDOverrideLibraryPropertyOperation; struct Main; -void BKE_override_static_enable(const bool do_enable); -bool BKE_override_static_is_enabled(void); +void BKE_override_library_enable(const bool do_enable); +bool BKE_override_library_is_enabled(void); -struct IDOverrideStatic *BKE_override_static_init(struct ID *local_id, struct ID *reference_id); -void BKE_override_static_copy(struct ID *dst_id, const struct ID *src_id); -void BKE_override_static_clear(struct IDOverrideStatic *override); -void BKE_override_static_free(struct IDOverrideStatic **override); +struct IDOverrideLibrary *BKE_override_library_init(struct ID *local_id, struct ID *reference_id); +void BKE_override_library_copy(struct ID *dst_id, const struct ID *src_id); +void BKE_override_library_clear(struct IDOverrideLibrary *override); +void BKE_override_library_free(struct IDOverrideLibrary **override); -struct ID *BKE_override_static_create_from_id(struct Main *bmain, struct ID *reference_id); -bool BKE_override_static_create_from_tag(struct Main *bmain); +struct ID *BKE_override_library_create_from_id(struct Main *bmain, struct ID *reference_id); +bool BKE_override_library_create_from_tag(struct Main *bmain); -struct IDOverrideStaticProperty *BKE_override_static_property_find( - struct IDOverrideStatic *override, const char *rna_path); -struct IDOverrideStaticProperty *BKE_override_static_property_get( - struct IDOverrideStatic *override, const char *rna_path, bool *r_created); -void BKE_override_static_property_delete(struct IDOverrideStatic *override, - struct IDOverrideStaticProperty *override_property); +struct IDOverrideLibraryProperty *BKE_override_library_property_find( + struct IDOverrideLibrary *override, const char *rna_path); +struct IDOverrideLibraryProperty *BKE_override_library_property_get( + struct IDOverrideLibrary *override, const char *rna_path, bool *r_created); +void BKE_override_library_property_delete(struct IDOverrideLibrary *override, + struct IDOverrideLibraryProperty *override_property); -struct IDOverrideStaticPropertyOperation *BKE_override_static_property_operation_find( - struct IDOverrideStaticProperty *override_property, +struct IDOverrideLibraryPropertyOperation *BKE_override_library_property_operation_find( + struct IDOverrideLibraryProperty *override_property, const char *subitem_refname, const char *subitem_locname, const int subitem_refindex, const int subitem_locindex, const bool strict, bool *r_strict); -struct IDOverrideStaticPropertyOperation *BKE_override_static_property_operation_get( - struct IDOverrideStaticProperty *override_property, +struct IDOverrideLibraryPropertyOperation *BKE_override_library_property_operation_get( + struct IDOverrideLibraryProperty *override_property, const short operation, const char *subitem_refname, const char *subitem_locname, @@ -66,32 +66,32 @@ struct IDOverrideStaticPropertyOperation *BKE_override_static_property_operation const bool strict, bool *r_strict, bool *r_created); -void BKE_override_static_property_operation_delete( - struct IDOverrideStaticProperty *override_property, - struct IDOverrideStaticPropertyOperation *override_property_operation); +void BKE_override_library_property_operation_delete( + struct IDOverrideLibraryProperty *override_property, + struct IDOverrideLibraryPropertyOperation *override_property_operation); -bool BKE_override_static_status_check_local(struct Main *bmain, struct ID *local); -bool BKE_override_static_status_check_reference(struct Main *bmain, struct ID *local); +bool BKE_override_library_status_check_local(struct Main *bmain, struct ID *local); +bool BKE_override_library_status_check_reference(struct Main *bmain, struct ID *local); -bool BKE_override_static_operations_create(struct Main *bmain, - struct ID *local, - const bool force_auto); -void BKE_main_override_static_operations_create(struct Main *bmain, const bool force_auto); +bool BKE_override_library_operations_create(struct Main *bmain, + struct ID *local, + const bool force_auto); +void BKE_main_override_library_operations_create(struct Main *bmain, const bool force_auto); -void BKE_override_static_update(struct Main *bmain, struct ID *local); -void BKE_main_override_static_update(struct Main *bmain); +void BKE_override_library_update(struct Main *bmain, struct ID *local); +void BKE_main_override_library_update(struct Main *bmain); /* Storage (.blend file writing) part. */ /* For now, we just use a temp main list. */ -typedef struct Main OverrideStaticStorage; +typedef struct Main OverrideLibraryStorage; -OverrideStaticStorage *BKE_override_static_operations_store_initialize(void); -struct ID *BKE_override_static_operations_store_start(struct Main *bmain, - OverrideStaticStorage *override_storage, - struct ID *local); -void BKE_override_static_operations_store_end(OverrideStaticStorage *override_storage, - struct ID *local); -void BKE_override_static_operations_store_finalize(OverrideStaticStorage *override_storage); +OverrideLibraryStorage *BKE_override_library_operations_store_initialize(void); +struct ID *BKE_override_library_operations_store_start(struct Main *bmain, + OverrideLibraryStorage *override_storage, + struct ID *local); +void BKE_override_library_operations_store_end(OverrideLibraryStorage *override_storage, + struct ID *local); +void BKE_override_library_operations_store_finalize(OverrideLibraryStorage *override_storage); #endif /* __BKE_LIBRARY_OVERRIDE_H__ */ diff --git a/source/blender/blenkernel/BKE_library_query.h b/source/blender/blenkernel/BKE_library_query.h index 94e7830aabe..4f74b2b5a6b 100644 --- a/source/blender/blenkernel/BKE_library_query.h +++ b/source/blender/blenkernel/BKE_library_query.h @@ -51,8 +51,8 @@ enum { * How to handle that kind of cases totally depends on what caller code is doing... */ IDWALK_CB_LOOPBACK = (1 << 4), - /** That ID is used as static override's reference by its owner. */ - IDWALK_CB_STATIC_OVERRIDE_REFERENCE = (1 << 5), + /** That ID is used as library override's reference by its owner. */ + IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE = (1 << 5), /** * Adjusts #ID.us reference-count. diff --git a/source/blender/blenkernel/BKE_library_remap.h b/source/blender/blenkernel/BKE_library_remap.h index 41ac8c8c8e6..d51bc5c2bce 100644 --- a/source/blender/blenkernel/BKE_library_remap.h +++ b/source/blender/blenkernel/BKE_library_remap.h @@ -61,8 +61,8 @@ enum { * is also performed. Usual nightmare... */ ID_REMAP_NO_INDIRECT_PROXY_DATA_USAGE = 1 << 4, - /** Do not remap static override pointers. */ - ID_REMAP_SKIP_STATIC_OVERRIDE = 1 << 5, + /** Do not remap library override pointers. */ + ID_REMAP_SKIP_OVERRIDE_LIBRARY = 1 << 5, }; /* Note: Requiring new_id to be non-null, this *may* not be the case ultimately, diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 0909e73777a..30a366805b6 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -391,15 +391,15 @@ typedef struct CDMaskLink { struct CustomData_MeshMasks mask; } CDMaskLink; -/* Calculates and returns a linked list of CustomData_MeshMasks indicating the - * data required by each modifier in the stack pointed to by md for correct - * evaluation, assuming the data indicated by dataMask is required at the - * end of the stack. +/* Calculates and returns a linked list of CustomData_MeshMasks and modified + * final datamask, indicating the data required by each modifier in the stack + * pointed to by md for correct evaluation, assuming the data indicated by + * final_datamask is required at the end of the stack. */ struct CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, struct Object *ob, struct ModifierData *md, - const struct CustomData_MeshMasks *dataMask, + struct CustomData_MeshMasks *final_datamask, int required_mode, ModifierData *previewmd, const struct CustomData_MeshMasks *previewmask); diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 164dbbbf482..ca3a560286f 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -38,6 +38,7 @@ struct ParticleKey; struct ParticleSettings; struct ParticleSystem; struct ParticleSystemModifierData; +struct ParticleSystemModifierDataRuntime; struct BVHTreeRay; struct BVHTreeRayHit; @@ -608,6 +609,13 @@ float psys_get_current_display_percentage(struct ParticleSystem *psys, #define DMCACHE_NOTFOUND -1 #define DMCACHE_ISCHILD -2 +/* **** Particle system modifier helpers. **** */ + +struct Mesh *BKE_particle_modifier_mesh_final_get(struct ParticleSystemModifierData *psmd); +struct Mesh *BKE_particle_modifier_mesh_original_get(struct ParticleSystemModifierData *psmd); +struct ParticleSystemModifierDataRuntime *BKE_particle_modifier_runtime_ensure( + struct ParticleSystemModifierData *psmd); + /* **** Depsgraph evaluation **** */ struct Depsgraph; diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 4694e86f4d6..1567985bd53 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -29,10 +29,10 @@ # include <AUD_Device.h> #endif +struct Depsgraph; struct Main; struct Sequence; struct bSound; -struct Depsgraph; typedef struct SoundWaveform { int length; diff --git a/source/blender/blenkernel/BKE_subdiv.h b/source/blender/blenkernel/BKE_subdiv.h index 781c036d222..dd139233ee3 100644 --- a/source/blender/blenkernel/BKE_subdiv.h +++ b/source/blender/blenkernel/BKE_subdiv.h @@ -107,7 +107,7 @@ typedef struct SubdivStats { double begin_timestamp_[NUM_SUBDIV_STATS_VALUES]; } SubdivStats; -/* Functor which evaluates dispalcement at a given (u, v) of given ptex face. */ +/* Functor which evaluates displacement at a given (u, v) of given ptex face. */ typedef struct SubdivDisplacement { /* Initialize displacement evaluator. * @@ -205,7 +205,7 @@ Subdiv *BKE_subdiv_new_from_mesh(const SubdivSettings *settings, const struct Me * new one is created from scratch. * * NOTE: It is allowed to pass NULL as an existing subdivision surface - * descriptor. This will create enw descriptor without any extra checks. + * descriptor. This will create a new descriptor without any extra checks. */ Subdiv *BKE_subdiv_update_from_converter(Subdiv *subdiv, const SubdivSettings *settings, diff --git a/source/blender/blenkernel/BKE_subdiv_eval.h b/source/blender/blenkernel/BKE_subdiv_eval.h index f8b8a25bfb6..1d794e4d61a 100644 --- a/source/blender/blenkernel/BKE_subdiv_eval.h +++ b/source/blender/blenkernel/BKE_subdiv_eval.h @@ -73,8 +73,8 @@ void BKE_subdiv_eval_face_varying(struct Subdiv *subdiv, /* NOTE: Expects derivatives to be correct. * * TODO(sergey): This is currently used together with - * BKE_subdiv_eval_final_point() which cas easily evaluate derivatives. - * Would be nice to have dispalcement evaluation function which does not require + * BKE_subdiv_eval_final_point() which can easily evaluate derivatives. + * Would be nice to have displacement evaluation function which does not require * knowing derivatives ahead of a time. */ void BKE_subdiv_eval_displacement(struct Subdiv *subdiv, const int ptex_face_index, diff --git a/source/blender/blenkernel/BKE_subdiv_foreach.h b/source/blender/blenkernel/BKE_subdiv_foreach.h index 5de4edf40df..d9e0678670e 100644 --- a/source/blender/blenkernel/BKE_subdiv_foreach.h +++ b/source/blender/blenkernel/BKE_subdiv_foreach.h @@ -116,8 +116,8 @@ typedef struct SubdivForeachContext { SubdivForeachVertexFromCornerCb vertex_every_corner; SubdivForeachVertexFromEdgeCb vertex_every_edge; /* Those callbacks are run once per subdivision vertex, ptex is undefined - * as in it will be whatever first ptex face happened to be tarversed in - * the multi-threaded environment ahd which shares "emitting" vertex or + * as in it will be whatever first ptex face happened to be traversed in + * the multi-threaded environment and which shares "emitting" vertex or * edge. */ SubdivForeachVertexFromCornerCb vertex_corner; @@ -159,7 +159,7 @@ typedef struct SubdivForeachContext { * Returns truth if the whole topology was traversed, without any early exits. * * TODO(sergey): Need to either get rid of subdiv or of coarse_mesh. - * The main point here is th be abel to get base level topology, which can be + * The main point here is to be able to get base level topology, which can be * done with either of those. Having both of them is kind of redundant. */ bool BKE_subdiv_foreach_subdiv_geometry(struct Subdiv *subdiv, diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 2fc486687bb..7f1a0e6a744 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1033,18 +1033,18 @@ static void mesh_copy_autosmooth(Mesh *me, Mesh *me_orig) } static void mesh_calc_modifier_final_normals(const Mesh *mesh_input, - const CustomData_MeshMasks *dataMask, + const CustomData_MeshMasks *final_datamask, const bool sculpt_dyntopo, Mesh *mesh_final) { /* Compute normals. */ const bool do_loop_normals = ((mesh_input->flag & ME_AUTOSMOOTH) != 0 || - (dataMask->lmask & CD_MASK_NORMAL) != 0); + (final_datamask->lmask & CD_MASK_NORMAL) != 0); /* Some modifiers may need this info from their target (other) object, * simpler to generate it here as well. * Note that they will always be generated when no loop normals are comptuted, * since they are needed by drawing code. */ - const bool do_poly_normals = ((dataMask->pmask & CD_MASK_NORMAL) != 0); + const bool do_poly_normals = ((final_datamask->pmask & CD_MASK_NORMAL) != 0); if (do_loop_normals) { /* In case we also need poly normals, add the layer and compute them here @@ -1071,7 +1071,7 @@ static void mesh_calc_modifier_final_normals(const Mesh *mesh_input, if (sculpt_dyntopo == false) { /* watch this! after 2.75a we move to from tessface to looptri (by default) */ - if (dataMask->fmask & CD_MASK_MFACE) { + if (final_datamask->fmask & CD_MASK_MFACE) { BKE_mesh_tessface_ensure(mesh_final); } @@ -1197,8 +1197,9 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, * this fine grained so that for example vertex groups are preserved up to * an armature modifier, but not through a following subsurf modifier where * subdividing them is expensive. */ + CustomData_MeshMasks final_datamask = *dataMask; CDMaskLink *datamasks = modifiers_calcDataMasks( - scene, ob, md, dataMask, required_mode, previewmd, &previewmask); + scene, ob, md, &final_datamask, required_mode, previewmd, &previewmask); CDMaskLink *md_datamask = datamasks; /* XXX Always copying POLYINDEX, else tessellated data are no more valid! */ CustomData_MeshMasks append_mask = CD_MASK_BAREMESH_ORIGINDEX; @@ -1316,8 +1317,8 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, continue; } - /* Add an orco layer if needed by this modifier. */ - if (mesh_final && mti->requiredDataMask) { + /* Add orco mesh as layer if needed by this modifier. */ + if (mesh_final && mesh_orco && mti->requiredDataMask) { CustomData_MeshMasks mask = {0}; mti->requiredDataMask(ob, md, &mask); if (mask.vmask & CD_MASK_ORCO) { @@ -1359,7 +1360,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, nextmask = md_datamask->next->mask; } else { - nextmask = *dataMask; + nextmask = final_datamask; } /* apply vertex coordinates or build a Mesh as necessary */ @@ -1557,7 +1558,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, const bool is_own_mesh = (mesh_final != mesh_input); /* Add orco coordinates to final and deformed mesh if requested. */ - if (dataMask->vmask & CD_MASK_ORCO) { + if (final_datamask.vmask & CD_MASK_ORCO) { /* No need in ORCO layer if the mesh was not deformed or modified: undeformed mesh in this case * matches input mesh. */ if (is_own_mesh) { @@ -1578,7 +1579,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, /* Compute normals. */ if (is_own_mesh) { - mesh_calc_modifier_final_normals(mesh_input, dataMask, sculpt_dyntopo, mesh_final); + mesh_calc_modifier_final_normals(mesh_input, &final_datamask, sculpt_dyntopo, mesh_final); } else { Mesh_Runtime *runtime = &mesh_input->runtime; @@ -1587,7 +1588,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, BLI_mutex_lock(runtime->eval_mutex); if (runtime->mesh_eval == NULL) { mesh_final = BKE_mesh_copy_for_eval(mesh_input, true); - mesh_calc_modifier_final_normals(mesh_input, dataMask, sculpt_dyntopo, mesh_final); + mesh_calc_modifier_final_normals(mesh_input, &final_datamask, sculpt_dyntopo, mesh_final); mesh_calc_finalize(mesh_input, mesh_final); runtime->mesh_eval = mesh_final; } @@ -1643,14 +1644,14 @@ bool editbmesh_modifier_is_enabled(Scene *scene, ModifierData *md, bool has_prev } static void editbmesh_calc_modifier_final_normals(const Mesh *mesh_input, - const CustomData_MeshMasks *dataMask, + const CustomData_MeshMasks *final_datamask, Mesh *mesh_final) { const bool do_loop_normals = ((mesh_input->flag & ME_AUTOSMOOTH) != 0 || - (dataMask->lmask & CD_MASK_NORMAL) != 0); + (final_datamask->lmask & CD_MASK_NORMAL) != 0); /* Some modifiers may need this info from their target (other) object, * simpler to generate it here as well. */ - const bool do_poly_normals = ((dataMask->pmask & CD_MASK_NORMAL) != 0); + const bool do_poly_normals = ((final_datamask->pmask & CD_MASK_NORMAL) != 0); if (do_loop_normals) { /* In case we also need poly normals, add the layer here, @@ -1669,7 +1670,7 @@ static void editbmesh_calc_modifier_final_normals(const Mesh *mesh_input, * but don't recalculate if the last modifier in the stack gives us tessfaces * check if the derived meshes are DM_TYPE_EDITBMESH before calling, this isn't essential * but quiets annoying error messages since tessfaces wont be created. */ - if (dataMask->fmask & CD_MASK_MFACE) { + if (final_datamask->fmask & CD_MASK_MFACE) { if (mesh_final->edit_mesh == NULL) { BKE_mesh_tessface_ensure(mesh_final); } @@ -1724,13 +1725,6 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph, const ModifierEvalContext mectx = {depsgraph, ob, MOD_APPLY_USECACHE}; const ModifierEvalContext mectx_orco = {depsgraph, ob, MOD_APPLY_ORCO}; - /* Evaluate modifiers up to certain index to get the mesh cage. */ - int cageIndex = modifiers_getCageIndex(scene, ob, NULL, 1); - if (r_cage && cageIndex == -1) { - mesh_cage = BKE_mesh_from_editmesh_with_coords_thin_wrap(em_input, dataMask, NULL); - mesh_copy_autosmooth(mesh_cage, mesh_input); - } - /* Get effective list of modifiers to execute. Some effects like shape keys * are added as virtual modifiers before the user created modifiers. */ VirtualModifierData virtualModifierData; @@ -1740,11 +1734,19 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph, * this fine grained so that for example vertex groups are preserved up to * an armature modifier, but not through a following subsurf modifier where * subdividing them is expensive. */ + CustomData_MeshMasks final_datamask = *dataMask; CDMaskLink *datamasks = modifiers_calcDataMasks( - scene, ob, md, dataMask, required_mode, NULL, NULL); + scene, ob, md, &final_datamask, required_mode, NULL, NULL); CDMaskLink *md_datamask = datamasks; CustomData_MeshMasks append_mask = CD_MASK_BAREMESH; + /* Evaluate modifiers up to certain index to get the mesh cage. */ + int cageIndex = modifiers_getCageIndex(scene, ob, NULL, 1); + if (r_cage && cageIndex == -1) { + mesh_cage = BKE_mesh_from_editmesh_with_coords_thin_wrap(em_input, &final_datamask, NULL); + mesh_copy_autosmooth(mesh_cage, mesh_input); + } + /* Clear errors before evaluation. */ modifiers_clearErrors(ob); @@ -1755,8 +1757,8 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph, continue; } - /* Add an orco layer if needed by this modifier. */ - if (mesh_final && mti->requiredDataMask) { + /* Add an orco mesh as layer if needed by this modifier. */ + if (mesh_final && mesh_orco && mti->requiredDataMask) { CustomData_MeshMasks mask = {0}; mti->requiredDataMask(ob, md, &mask); if (mask.vmask & CD_MASK_ORCO) { @@ -1903,7 +1905,7 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph, me_orig->runtime.edit_data->vertexCos = MEM_dupallocN(deformed_verts); } mesh_cage = BKE_mesh_from_editmesh_with_coords_thin_wrap( - em_input, dataMask, deformed_verts ? MEM_dupallocN(deformed_verts) : NULL); + em_input, &final_datamask, deformed_verts ? MEM_dupallocN(deformed_verts) : NULL); mesh_copy_autosmooth(mesh_cage, mesh_input); } } @@ -1937,7 +1939,8 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph, } else { /* this is just a copy of the editmesh, no need to calc normals */ - mesh_final = BKE_mesh_from_editmesh_with_coords_thin_wrap(em_input, dataMask, deformed_verts); + mesh_final = BKE_mesh_from_editmesh_with_coords_thin_wrap( + em_input, &final_datamask, deformed_verts); deformed_verts = NULL; mesh_copy_autosmooth(mesh_final, mesh_input); @@ -1953,7 +1956,7 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph, } /* Add orco coordinates to final and deformed mesh if requested. */ - if (dataMask->vmask & CD_MASK_ORCO) { + if (final_datamask.vmask & CD_MASK_ORCO) { add_orco_mesh(ob, em_input, mesh_final, mesh_orco, CD_ORCO); } @@ -1962,9 +1965,9 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph, } /* Compute normals. */ - editbmesh_calc_modifier_final_normals(mesh_input, dataMask, mesh_final); + editbmesh_calc_modifier_final_normals(mesh_input, &final_datamask, mesh_final); if (mesh_cage && (mesh_cage != mesh_final)) { - editbmesh_calc_modifier_final_normals(mesh_input, dataMask, mesh_cage); + editbmesh_calc_modifier_final_normals(mesh_input, &final_datamask, mesh_cage); } /* Return final mesh. */ diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index ee9041c5c18..5766e84f960 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -2363,7 +2363,7 @@ static void armdef_accumulate_bone(bConstraintTarget *ct, /* The target is a B-Bone: * FIRST: find the segment (see b_bone_deform in armature.c) - * Need to transform co back to bonespace, only need y. */ + * Need to transform co back to bone-space, only need y. */ float y = iamat[0][1] * co[0] + iamat[1][1] * co[1] + iamat[2][1] * co[2] + iamat[3][1]; /* Blend the matrix. */ @@ -5100,7 +5100,7 @@ static bConstraint *add_new_constraint_internal(const char *name, short type) /* Set up a generic constraint data-block. */ con->type = type; - con->flag |= CONSTRAINT_EXPAND | CONSTRAINT_STATICOVERRIDE_LOCAL; + con->flag |= CONSTRAINT_EXPAND | CONSTRAINT_OVERRIDE_LIBRARY_LOCAL; con->enforce = 1.0f; /* Determine a basic name, and info */ @@ -5238,14 +5238,16 @@ static void con_extern_cb(bConstraint *UNUSED(con), } } -/* helper for BKE_constraints_copy(), - * to be used for making sure that usercounts of copied ID's are fixed up */ +/** + * Helper for #BKE_constraints_copy(), + * to be used for making sure that user-counts of copied ID's are fixed up. + */ static void con_fix_copied_refs_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *UNUSED(userData)) { - /* increment usercount if this is a reference type */ + /* Increment user-count if this is a reference type. */ if ((*idpoin) && (is_reference)) { id_us_plus(*idpoin); } diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 1bc1c0e1257..c7fb4b90212 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -1797,33 +1797,15 @@ float BKE_gpencil_multiframe_falloff_calc( return value; } -/* remove strokes using a material */ -void BKE_gpencil_material_index_remove(bGPdata *gpd, int index) +/* reassign strokes using a material */ +void BKE_gpencil_material_index_reassign(bGPdata *gpd, int totcol, int index) { - bGPDstroke *gps, *gpsn; - for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) { for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) { - for (gps = gpf->strokes.first; gps; gps = gpsn) { - gpsn = gps->next; - if (gps->mat_nr == index) { - if (gps->points) { - MEM_freeN(gps->points); - } - if (gps->dvert) { - BKE_gpencil_free_stroke_weights(gps); - MEM_freeN(gps->dvert); - } - if (gps->triangles) { - MEM_freeN(gps->triangles); - } - BLI_freelinkN(&gpf->strokes, gps); - } - else { - /* reassign strokes */ - if (gps->mat_nr > index) { - gps->mat_nr--; - } + for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) { + /* reassign strokes */ + if ((gps->mat_nr > index) || (gps->mat_nr > totcol - 1)) { + gps->mat_nr--; } } } diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c index c8a45a92758..2b27854ba82 100644 --- a/source/blender/blenkernel/intern/gpencil_modifier.c +++ b/source/blender/blenkernel/intern/gpencil_modifier.c @@ -551,7 +551,7 @@ GpencilModifierData *BKE_gpencil_modifier_new(int type) md->type = type; md->mode = eGpencilModifierMode_Realtime | eGpencilModifierMode_Render | eGpencilModifierMode_Expanded; - md->flag = eGpencilModifierFlag_StaticOverride_Local; + md->flag = eGpencilModifierFlag_OverrideLibrary_Local; if (mti->flags & eGpencilModifierTypeFlag_EnableInEditmode) { md->mode |= eGpencilModifierMode_Editmode; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 14b6bc953b2..d94ede0e69e 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -247,7 +247,7 @@ void BKE_image_free_buffers_ex(Image *ima, bool do_lock) } if (!G.background) { - /* Background mode doesn't use opnegl, + /* Background mode doesn't use OpenGL, * so we can avoid freeing GPU images and save some * time by skipping mutex lock. */ diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 2a32c215d2a..5e54344c80e 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -2281,7 +2281,7 @@ void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const ID *id) */ void BKE_id_full_name_ui_prefix_get(char name[MAX_ID_FULL_NAME_UI], const ID *id) { - name[0] = id->lib ? (ID_MISSING(id) ? 'M' : 'L') : ID_IS_STATIC_OVERRIDE(id) ? 'O' : ' '; + name[0] = id->lib ? (ID_MISSING(id) ? 'M' : 'L') : ID_IS_OVERRIDE_LIBRARY(id) ? 'O' : ' '; name[1] = (id->flag & LIB_FAKEUSER) ? 'F' : ((id->us == 0) ? '0' : ' '); name[2] = ' '; diff --git a/source/blender/blenkernel/intern/library_override.c b/source/blender/blenkernel/intern/library_override.c index 231e0b8ee60..fed90ad8982 100644 --- a/source/blender/blenkernel/intern/library_override.c +++ b/source/blender/blenkernel/intern/library_override.c @@ -47,108 +47,108 @@ #define OVERRIDE_AUTO_CHECK_DELAY 0.2 /* 200ms between auto-override checks. */ -static void bke_override_property_copy(IDOverrideStaticProperty *op_dst, - IDOverrideStaticProperty *op_src); -static void bke_override_property_operation_copy(IDOverrideStaticPropertyOperation *opop_dst, - IDOverrideStaticPropertyOperation *opop_src); +static void bke_override_property_copy(IDOverrideLibraryProperty *op_dst, + IDOverrideLibraryProperty *op_src); +static void bke_override_property_operation_copy(IDOverrideLibraryPropertyOperation *opop_dst, + IDOverrideLibraryPropertyOperation *opop_src); -static void bke_override_property_clear(IDOverrideStaticProperty *op); -static void bke_override_property_operation_clear(IDOverrideStaticPropertyOperation *opop); +static void bke_override_property_clear(IDOverrideLibraryProperty *op); +static void bke_override_property_operation_clear(IDOverrideLibraryPropertyOperation *opop); -/* Temp, for until static override is ready and tested enough to go 'public', +/* Temp, for until library override is ready and tested enough to go 'public', * we hide it by default in UI and such. */ -static bool _override_static_enabled = false; +static bool _override_library_enabled = false; -void BKE_override_static_enable(const bool do_enable) +void BKE_override_library_enable(const bool do_enable) { - _override_static_enabled = do_enable; + _override_library_enabled = do_enable; } -bool BKE_override_static_is_enabled() +bool BKE_override_library_is_enabled() { - return _override_static_enabled; + return _override_library_enabled; } /** Initialize empty overriding of \a reference_id by \a local_id. */ -IDOverrideStatic *BKE_override_static_init(ID *local_id, ID *reference_id) +IDOverrideLibrary *BKE_override_library_init(ID *local_id, ID *reference_id) { /* If reference_id is NULL, we are creating an override template for purely local data. * Else, reference *must* be linked data. */ BLI_assert(reference_id == NULL || reference_id->lib != NULL); - BLI_assert(local_id->override_static == NULL); + BLI_assert(local_id->override_library == NULL); ID *ancestor_id; - for (ancestor_id = reference_id; ancestor_id != NULL && ancestor_id->override_static != NULL && - ancestor_id->override_static->reference != NULL; - ancestor_id = ancestor_id->override_static->reference) { + for (ancestor_id = reference_id; ancestor_id != NULL && ancestor_id->override_library != NULL && + ancestor_id->override_library->reference != NULL; + ancestor_id = ancestor_id->override_library->reference) { /* pass */ } - if (ancestor_id != NULL && ancestor_id->override_static != NULL) { + if (ancestor_id != NULL && ancestor_id->override_library != NULL) { /* Original ID has a template, use it! */ - BKE_override_static_copy(local_id, ancestor_id); - if (local_id->override_static->reference != reference_id) { - id_us_min(local_id->override_static->reference); - local_id->override_static->reference = reference_id; - id_us_plus(local_id->override_static->reference); + BKE_override_library_copy(local_id, ancestor_id); + if (local_id->override_library->reference != reference_id) { + id_us_min(local_id->override_library->reference); + local_id->override_library->reference = reference_id; + id_us_plus(local_id->override_library->reference); } - return local_id->override_static; + return local_id->override_library; } /* Else, generate new empty override. */ - local_id->override_static = MEM_callocN(sizeof(*local_id->override_static), __func__); - local_id->override_static->reference = reference_id; - id_us_plus(local_id->override_static->reference); - local_id->tag &= ~LIB_TAG_OVERRIDESTATIC_REFOK; + local_id->override_library = MEM_callocN(sizeof(*local_id->override_library), __func__); + local_id->override_library->reference = reference_id; + id_us_plus(local_id->override_library->reference); + local_id->tag &= ~LIB_TAG_OVERRIDE_LIBRARY_REFOK; /* TODO do we want to add tag or flag to referee to mark it as such? */ - return local_id->override_static; + return local_id->override_library; } /** Deep copy of a whole override from \a src_id to \a dst_id. */ -void BKE_override_static_copy(ID *dst_id, const ID *src_id) +void BKE_override_library_copy(ID *dst_id, const ID *src_id) { - BLI_assert(src_id->override_static != NULL); + BLI_assert(src_id->override_library != NULL); - if (dst_id->override_static != NULL) { - if (src_id->override_static == NULL) { - BKE_override_static_free(&dst_id->override_static); + if (dst_id->override_library != NULL) { + if (src_id->override_library == NULL) { + BKE_override_library_free(&dst_id->override_library); return; } else { - BKE_override_static_clear(dst_id->override_static); + BKE_override_library_clear(dst_id->override_library); } } - else if (src_id->override_static == NULL) { + else if (src_id->override_library == NULL) { return; } else { - BKE_override_static_init(dst_id, NULL); + BKE_override_library_init(dst_id, NULL); } /* Source is already overriding data, we copy it but reuse its reference for dest ID. * otherwise, source is only an override template, it then becomes reference of dest ID. */ - dst_id->override_static->reference = src_id->override_static->reference ? - src_id->override_static->reference : - (ID *)src_id; - id_us_plus(dst_id->override_static->reference); - - BLI_duplicatelist(&dst_id->override_static->properties, &src_id->override_static->properties); - for (IDOverrideStaticProperty *op_dst = dst_id->override_static->properties.first, - *op_src = src_id->override_static->properties.first; + dst_id->override_library->reference = src_id->override_library->reference ? + src_id->override_library->reference : + (ID *)src_id; + id_us_plus(dst_id->override_library->reference); + + BLI_duplicatelist(&dst_id->override_library->properties, &src_id->override_library->properties); + for (IDOverrideLibraryProperty *op_dst = dst_id->override_library->properties.first, + *op_src = src_id->override_library->properties.first; op_dst; op_dst = op_dst->next, op_src = op_src->next) { bke_override_property_copy(op_dst, op_src); } - dst_id->tag &= ~LIB_TAG_OVERRIDESTATIC_REFOK; + dst_id->tag &= ~LIB_TAG_OVERRIDE_LIBRARY_REFOK; } /** Clear any overriding data from given \a override. */ -void BKE_override_static_clear(IDOverrideStatic *override) +void BKE_override_library_clear(IDOverrideLibrary *override) { BLI_assert(override != NULL); - for (IDOverrideStaticProperty *op = override->properties.first; op; op = op->next) { + for (IDOverrideLibraryProperty *op = override->properties.first; op; op = op->next) { bke_override_property_clear(op); } BLI_freelistN(&override->properties); @@ -158,16 +158,16 @@ void BKE_override_static_clear(IDOverrideStatic *override) } /** Free given \a override. */ -void BKE_override_static_free(struct IDOverrideStatic **override) +void BKE_override_library_free(struct IDOverrideLibrary **override) { BLI_assert(*override != NULL); - BKE_override_static_clear(*override); + BKE_override_library_clear(*override); MEM_freeN(*override); *override = NULL; } -static ID *override_static_create_from(Main *bmain, ID *reference_id) +static ID *override_library_create_from(Main *bmain, ID *reference_id) { ID *local_id; @@ -176,24 +176,26 @@ static ID *override_static_create_from(Main *bmain, ID *reference_id) } id_us_min(local_id); - BKE_override_static_init(local_id, reference_id); - local_id->override_static->flag |= STATICOVERRIDE_AUTO; + BKE_override_library_init(local_id, reference_id); + local_id->override_library->flag |= OVERRIDE_LIBRARY_AUTO; return local_id; } /** Create an overridden local copy of linked reference. */ -ID *BKE_override_static_create_from_id(Main *bmain, ID *reference_id) +ID *BKE_override_library_create_from_id(Main *bmain, ID *reference_id) { BLI_assert(reference_id != NULL); BLI_assert(reference_id->lib != NULL); - ID *local_id = override_static_create_from(bmain, reference_id); + ID *local_id = override_library_create_from(bmain, reference_id); /* Remapping, we obviously only want to affect local data * (and not our own reference pointer to overridden ID). */ - BKE_libblock_remap( - bmain, reference_id, local_id, ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_STATIC_OVERRIDE); + BKE_libblock_remap(bmain, + reference_id, + local_id, + ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_OVERRIDE_LIBRARY); return local_id; } @@ -205,14 +207,14 @@ ID *BKE_override_static_create_from_id(Main *bmain, ID *reference_id) * * \return \a true on success, \a false otherwise. */ -bool BKE_override_static_create_from_tag(Main *bmain) +bool BKE_override_library_create_from_tag(Main *bmain) { ID *reference_id; bool ret = true; FOREACH_MAIN_ID_BEGIN (bmain, reference_id) { if ((reference_id->tag & LIB_TAG_DOIT) != 0 && reference_id->lib != NULL) { - if ((reference_id->newid = override_static_create_from(bmain, reference_id)) == NULL) { + if ((reference_id->newid = override_library_create_from(bmain, reference_id)) == NULL) { ret = false; } } @@ -226,7 +228,7 @@ bool BKE_override_static_create_from_tag(Main *bmain) BKE_libblock_remap(bmain, reference_id, local_id, - ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_STATIC_OVERRIDE); + ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_OVERRIDE_LIBRARY); } } FOREACH_MAIN_ID_END; @@ -237,26 +239,26 @@ bool BKE_override_static_create_from_tag(Main *bmain) /** * Find override property from given RNA path, if it exists. */ -IDOverrideStaticProperty *BKE_override_static_property_find(IDOverrideStatic *override, - const char *rna_path) +IDOverrideLibraryProperty *BKE_override_library_property_find(IDOverrideLibrary *override, + const char *rna_path) { /* XXX TODO we'll most likely want a runtime ghash to store that mapping at some point. */ return BLI_findstring_ptr( - &override->properties, rna_path, offsetof(IDOverrideStaticProperty, rna_path)); + &override->properties, rna_path, offsetof(IDOverrideLibraryProperty, rna_path)); } /** * Find override property from given RNA path, or create it if it does not exist. */ -IDOverrideStaticProperty *BKE_override_static_property_get(IDOverrideStatic *override, - const char *rna_path, - bool *r_created) +IDOverrideLibraryProperty *BKE_override_library_property_get(IDOverrideLibrary *override, + const char *rna_path, + bool *r_created) { /* XXX TODO we'll most likely want a runtime ghash to store that mapping at some point. */ - IDOverrideStaticProperty *op = BKE_override_static_property_find(override, rna_path); + IDOverrideLibraryProperty *op = BKE_override_library_property_find(override, rna_path); if (op == NULL) { - op = MEM_callocN(sizeof(IDOverrideStaticProperty), __func__); + op = MEM_callocN(sizeof(IDOverrideLibraryProperty), __func__); op->rna_path = BLI_strdup(rna_path); BLI_addtail(&override->properties, op); @@ -271,26 +273,27 @@ IDOverrideStaticProperty *BKE_override_static_property_get(IDOverrideStatic *ove return op; } -void bke_override_property_copy(IDOverrideStaticProperty *op_dst, IDOverrideStaticProperty *op_src) +void bke_override_property_copy(IDOverrideLibraryProperty *op_dst, + IDOverrideLibraryProperty *op_src) { op_dst->rna_path = BLI_strdup(op_src->rna_path); BLI_duplicatelist(&op_dst->operations, &op_src->operations); - for (IDOverrideStaticPropertyOperation *opop_dst = op_dst->operations.first, - *opop_src = op_src->operations.first; + for (IDOverrideLibraryPropertyOperation *opop_dst = op_dst->operations.first, + *opop_src = op_src->operations.first; opop_dst; opop_dst = opop_dst->next, opop_src = opop_src->next) { bke_override_property_operation_copy(opop_dst, opop_src); } } -void bke_override_property_clear(IDOverrideStaticProperty *op) +void bke_override_property_clear(IDOverrideLibraryProperty *op) { BLI_assert(op->rna_path != NULL); MEM_freeN(op->rna_path); - for (IDOverrideStaticPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { + for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { bke_override_property_operation_clear(opop); } BLI_freelistN(&op->operations); @@ -299,8 +302,8 @@ void bke_override_property_clear(IDOverrideStaticProperty *op) /** * Remove and free given \a override_property from given ID \a override. */ -void BKE_override_static_property_delete(IDOverrideStatic *override, - IDOverrideStaticProperty *override_property) +void BKE_override_library_property_delete(IDOverrideLibrary *override, + IDOverrideLibraryProperty *override_property) { bke_override_property_clear(override_property); BLI_freelinkN(&override->properties, override_property); @@ -309,8 +312,8 @@ void BKE_override_static_property_delete(IDOverrideStatic *override, /** * Find override property operation from given sub-item(s), if it exists. */ -IDOverrideStaticPropertyOperation *BKE_override_static_property_operation_find( - IDOverrideStaticProperty *override_property, +IDOverrideLibraryPropertyOperation *BKE_override_library_property_operation_find( + IDOverrideLibraryProperty *override_property, const char *subitem_refname, const char *subitem_locname, const int subitem_refindex, @@ -318,7 +321,7 @@ IDOverrideStaticPropertyOperation *BKE_override_static_property_operation_find( const bool strict, bool *r_strict) { - IDOverrideStaticPropertyOperation *opop; + IDOverrideLibraryPropertyOperation *opop; const int subitem_defindex = -1; if (r_strict) { @@ -328,7 +331,7 @@ IDOverrideStaticPropertyOperation *BKE_override_static_property_operation_find( if (subitem_locname != NULL) { opop = BLI_findstring_ptr(&override_property->operations, subitem_locname, - offsetof(IDOverrideStaticPropertyOperation, subitem_local_name)); + offsetof(IDOverrideLibraryPropertyOperation, subitem_local_name)); if (opop == NULL) { return NULL; @@ -344,9 +347,10 @@ IDOverrideStaticPropertyOperation *BKE_override_static_property_operation_find( } if (subitem_refname != NULL) { - opop = BLI_findstring_ptr(&override_property->operations, - subitem_refname, - offsetof(IDOverrideStaticPropertyOperation, subitem_reference_name)); + opop = BLI_findstring_ptr( + &override_property->operations, + subitem_refname, + offsetof(IDOverrideLibraryPropertyOperation, subitem_reference_name)); if (opop == NULL) { return NULL; @@ -365,7 +369,7 @@ IDOverrideStaticPropertyOperation *BKE_override_static_property_operation_find( &override_property->operations, &subitem_locindex, sizeof(subitem_locindex), - offsetof(IDOverrideStaticPropertyOperation, subitem_local_index)))) { + offsetof(IDOverrideLibraryPropertyOperation, subitem_local_index)))) { return ELEM(subitem_refindex, -1, opop->subitem_reference_index) ? opop : NULL; } @@ -373,7 +377,7 @@ IDOverrideStaticPropertyOperation *BKE_override_static_property_operation_find( &override_property->operations, &subitem_refindex, sizeof(subitem_refindex), - offsetof(IDOverrideStaticPropertyOperation, subitem_reference_index)))) { + offsetof(IDOverrideLibraryPropertyOperation, subitem_reference_index)))) { return ELEM(subitem_locindex, -1, opop->subitem_local_index) ? opop : NULL; } @@ -383,7 +387,7 @@ IDOverrideStaticPropertyOperation *BKE_override_static_property_operation_find( &override_property->operations, &subitem_defindex, sizeof(subitem_defindex), - offsetof(IDOverrideStaticPropertyOperation, subitem_local_index)))) { + offsetof(IDOverrideLibraryPropertyOperation, subitem_local_index)))) { if (r_strict) { *r_strict = false; } @@ -396,8 +400,8 @@ IDOverrideStaticPropertyOperation *BKE_override_static_property_operation_find( /** * Find override property operation from given sub-item(s), or create it if it does not exist. */ -IDOverrideStaticPropertyOperation *BKE_override_static_property_operation_get( - IDOverrideStaticProperty *override_property, +IDOverrideLibraryPropertyOperation *BKE_override_library_property_operation_get( + IDOverrideLibraryProperty *override_property, const short operation, const char *subitem_refname, const char *subitem_locname, @@ -407,7 +411,7 @@ IDOverrideStaticPropertyOperation *BKE_override_static_property_operation_get( bool *r_strict, bool *r_created) { - IDOverrideStaticPropertyOperation *opop = BKE_override_static_property_operation_find( + IDOverrideLibraryPropertyOperation *opop = BKE_override_library_property_operation_find( override_property, subitem_refname, subitem_locname, @@ -417,7 +421,7 @@ IDOverrideStaticPropertyOperation *BKE_override_static_property_operation_get( r_strict); if (opop == NULL) { - opop = MEM_callocN(sizeof(IDOverrideStaticPropertyOperation), __func__); + opop = MEM_callocN(sizeof(IDOverrideLibraryPropertyOperation), __func__); opop->operation = operation; if (subitem_locname) { opop->subitem_local_name = BLI_strdup(subitem_locname); @@ -441,8 +445,8 @@ IDOverrideStaticPropertyOperation *BKE_override_static_property_operation_get( return opop; } -void bke_override_property_operation_copy(IDOverrideStaticPropertyOperation *opop_dst, - IDOverrideStaticPropertyOperation *opop_src) +void bke_override_property_operation_copy(IDOverrideLibraryPropertyOperation *opop_dst, + IDOverrideLibraryPropertyOperation *opop_src) { if (opop_src->subitem_reference_name) { opop_dst->subitem_reference_name = BLI_strdup(opop_src->subitem_reference_name); @@ -452,7 +456,7 @@ void bke_override_property_operation_copy(IDOverrideStaticPropertyOperation *opo } } -void bke_override_property_operation_clear(IDOverrideStaticPropertyOperation *opop) +void bke_override_property_operation_clear(IDOverrideLibraryPropertyOperation *opop) { if (opop->subitem_reference_name) { MEM_freeN(opop->subitem_reference_name); @@ -465,9 +469,9 @@ void bke_override_property_operation_clear(IDOverrideStaticPropertyOperation *op /** * Remove and free given \a override_property_operation from given ID \a override_property. */ -void BKE_override_static_property_operation_delete( - IDOverrideStaticProperty *override_property, - IDOverrideStaticPropertyOperation *override_property_operation) +void BKE_override_library_property_operation_delete( + IDOverrideLibraryProperty *override_property, + IDOverrideLibraryPropertyOperation *override_property_operation) { bke_override_property_operation_clear(override_property_operation); BLI_freelinkN(&override_property->operations, override_property_operation); @@ -483,11 +487,11 @@ void BKE_override_static_property_operation_delete( * #IDOverrideProperty (of #IDOverridePropertyOperation) has to be added. * * \return true if status is OK, false otherwise. */ -bool BKE_override_static_status_check_local(Main *bmain, ID *local) +bool BKE_override_library_status_check_local(Main *bmain, ID *local) { - BLI_assert(local->override_static != NULL); + BLI_assert(local->override_library != NULL); - ID *reference = local->override_static->reference; + ID *reference = local->override_library->reference; if (reference == NULL) { /* This is an override template, local status is always OK! */ @@ -506,11 +510,11 @@ bool BKE_override_static_status_check_local(Main *bmain, ID *local) &rnaptr_local, &rnaptr_reference, NULL, - local->override_static, + local->override_library, RNA_OVERRIDE_COMPARE_IGNORE_NON_OVERRIDABLE | RNA_OVERRIDE_COMPARE_IGNORE_OVERRIDDEN, NULL)) { - local->tag &= ~LIB_TAG_OVERRIDESTATIC_REFOK; + local->tag &= ~LIB_TAG_OVERRIDE_LIBRARY_REFOK; return false; } @@ -527,11 +531,11 @@ bool BKE_override_static_status_check_local(Main *bmain, ID *local) * needs to be updated against it. * * \return true if status is OK, false otherwise. */ -bool BKE_override_static_status_check_reference(Main *bmain, ID *local) +bool BKE_override_library_status_check_reference(Main *bmain, ID *local) { - BLI_assert(local->override_static != NULL); + BLI_assert(local->override_library != NULL); - ID *reference = local->override_static->reference; + ID *reference = local->override_library->reference; if (reference == NULL) { /* This is an override template, reference is virtual, so its status is always OK! */ @@ -540,12 +544,12 @@ bool BKE_override_static_status_check_reference(Main *bmain, ID *local) BLI_assert(GS(local->name) == GS(reference->name)); - if (reference->override_static && (reference->tag & LIB_TAG_OVERRIDESTATIC_REFOK) == 0) { - if (!BKE_override_static_status_check_reference(bmain, reference)) { + if (reference->override_library && (reference->tag & LIB_TAG_OVERRIDE_LIBRARY_REFOK) == 0) { + if (!BKE_override_library_status_check_reference(bmain, reference)) { /* If reference is also override of another data-block, and its status is not OK, * then this override is not OK either. * Note that this should only happen when reloading libraries... */ - local->tag &= ~LIB_TAG_OVERRIDESTATIC_REFOK; + local->tag &= ~LIB_TAG_OVERRIDE_LIBRARY_REFOK; return false; } } @@ -558,10 +562,10 @@ bool BKE_override_static_status_check_reference(Main *bmain, ID *local) &rnaptr_local, &rnaptr_reference, NULL, - local->override_static, + local->override_library, RNA_OVERRIDE_COMPARE_IGNORE_OVERRIDDEN, NULL)) { - local->tag &= ~LIB_TAG_OVERRIDESTATIC_REFOK; + local->tag &= ~LIB_TAG_OVERRIDE_LIBRARY_REFOK; return false; } @@ -581,23 +585,23 @@ bool BKE_override_static_status_check_reference(Main *bmain, ID *local) * Generating diff values and applying overrides are much cheaper. * * \return true if new overriding op was created, or some local data was reset. */ -bool BKE_override_static_operations_create(Main *bmain, ID *local, const bool force_auto) +bool BKE_override_library_operations_create(Main *bmain, ID *local, const bool force_auto) { - BLI_assert(local->override_static != NULL); - const bool is_template = (local->override_static->reference == NULL); + BLI_assert(local->override_library != NULL); + const bool is_template = (local->override_library->reference == NULL); bool ret = false; - if (!is_template && (force_auto || local->override_static->flag & STATICOVERRIDE_AUTO)) { + if (!is_template && (force_auto || local->override_library->flag & OVERRIDE_LIBRARY_AUTO)) { PointerRNA rnaptr_local, rnaptr_reference; RNA_id_pointer_create(local, &rnaptr_local); - RNA_id_pointer_create(local->override_static->reference, &rnaptr_reference); + RNA_id_pointer_create(local->override_library->reference, &rnaptr_reference); eRNAOverrideMatchResult report_flags = 0; RNA_struct_override_matches(bmain, &rnaptr_local, &rnaptr_reference, NULL, - local->override_static, + local->override_library, RNA_OVERRIDE_COMPARE_CREATE | RNA_OVERRIDE_COMPARE_RESTORE, &report_flags); if (report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) { @@ -608,10 +612,10 @@ bool BKE_override_static_operations_create(Main *bmain, ID *local, const bool fo printf("We did restore some properties of %s from its reference.\n", local->name); } if (ret) { - printf("We did generate static override rules for %s\n", local->name); + printf("We did generate library override rules for %s\n", local->name); } else { - printf("No new static override rules for %s\n", local->name); + printf("No new library override rules for %s\n", local->name); } #endif } @@ -619,31 +623,31 @@ bool BKE_override_static_operations_create(Main *bmain, ID *local, const bool fo } /** Check all overrides from given \a bmain and create/update overriding operations as needed. */ -void BKE_main_override_static_operations_create(Main *bmain, const bool force_auto) +void BKE_main_override_library_operations_create(Main *bmain, const bool force_auto) { ID *id; FOREACH_MAIN_ID_BEGIN (bmain, id) { if (force_auto || - (ID_IS_STATIC_OVERRIDE_AUTO(id) && (id->tag & LIB_TAG_OVERRIDESTATIC_AUTOREFRESH))) { - BKE_override_static_operations_create(bmain, id, force_auto); - id->tag &= ~LIB_TAG_OVERRIDESTATIC_AUTOREFRESH; + (ID_IS_OVERRIDE_LIBRARY_AUTO(id) && (id->tag & LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH))) { + BKE_override_library_operations_create(bmain, id, force_auto); + id->tag &= ~LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH; } } FOREACH_MAIN_ID_END; } /** Update given override from its reference (re-applying overridden properties). */ -void BKE_override_static_update(Main *bmain, ID *local) +void BKE_override_library_update(Main *bmain, ID *local) { - if (local->override_static == NULL || local->override_static->reference == NULL) { + if (local->override_library == NULL || local->override_library->reference == NULL) { return; } /* Recursively do 'ancestors' overrides first, if any. */ - if (local->override_static->reference->override_static && - (local->override_static->reference->tag & LIB_TAG_OVERRIDESTATIC_REFOK) == 0) { - BKE_override_static_update(bmain, local->override_static->reference); + if (local->override_library->reference->override_library && + (local->override_library->reference->tag & LIB_TAG_OVERRIDE_LIBRARY_REFOK) == 0) { + BKE_override_library_update(bmain, local->override_library->reference); } /* We want to avoid having to remap here, however creating up-to-date override is much simpler @@ -656,13 +660,13 @@ void BKE_override_static_update(Main *bmain, ID *local) * Actually, maybe not! Since we are swapping with original ID's local content, we want to * keep user-count in correct state when freeing tmp_id * (and that user-counts of IDs used by 'new' local data also remain correct). */ - /* This would imply change in handling of usercout all over RNA + /* This would imply change in handling of user-count all over RNA * (and possibly all over Blender code). * Not impossible to do, but would rather see first if extra useless usual user handling * is actually a (performances) issue here. */ ID *tmp_id; - BKE_id_copy(bmain, local->override_static->reference, &tmp_id); + BKE_id_copy(bmain, local->override_library->reference, &tmp_id); if (tmp_id == NULL) { return; @@ -671,13 +675,13 @@ void BKE_override_static_update(Main *bmain, ID *local) PointerRNA rnaptr_src, rnaptr_dst, rnaptr_storage_stack, *rnaptr_storage = NULL; RNA_id_pointer_create(local, &rnaptr_src); RNA_id_pointer_create(tmp_id, &rnaptr_dst); - if (local->override_static->storage) { + if (local->override_library->storage) { rnaptr_storage = &rnaptr_storage_stack; - RNA_id_pointer_create(local->override_static->storage, rnaptr_storage); + RNA_id_pointer_create(local->override_library->storage, rnaptr_storage); } RNA_struct_override_apply( - bmain, &rnaptr_dst, &rnaptr_src, rnaptr_storage, local->override_static); + bmain, &rnaptr_dst, &rnaptr_src, rnaptr_storage, local->override_library); /* This also transfers all pointers (memory) owned by local to tmp_id, and vice-versa. * So when we'll free tmp_id, we'll actually free old, outdated data from local. */ @@ -688,15 +692,15 @@ void BKE_override_static_update(Main *bmain, ID *local) /* XXX And crashing in complex cases (e.g. because depsgraph uses same data...). */ BKE_id_free_ex(bmain, tmp_id, LIB_ID_FREE_NO_UI_USER, true); - if (local->override_static->storage) { + if (local->override_library->storage) { /* We know this datablock is not used anywhere besides local->override->storage. */ /* XXX For until we get fully shadow copies, we still need to ensure storage releases * its usage of any ID pointers it may have. */ - BKE_id_free_ex(bmain, local->override_static->storage, LIB_ID_FREE_NO_UI_USER, true); - local->override_static->storage = NULL; + BKE_id_free_ex(bmain, local->override_library->storage, LIB_ID_FREE_NO_UI_USER, true); + local->override_library->storage = NULL; } - local->tag |= LIB_TAG_OVERRIDESTATIC_REFOK; + local->tag |= LIB_TAG_OVERRIDE_LIBRARY_REFOK; /* Full rebuild of Depsgraph! */ DEG_on_visible_update( @@ -705,13 +709,13 @@ void BKE_override_static_update(Main *bmain, ID *local) } /** Update all overrides from given \a bmain. */ -void BKE_main_override_static_update(Main *bmain) +void BKE_main_override_library_update(Main *bmain) { ID *id; FOREACH_MAIN_ID_BEGIN (bmain, id) { - if (id->override_static != NULL && id->lib == NULL) { - BKE_override_static_update(bmain, id); + if (id->override_library != NULL && id->lib == NULL) { + BKE_override_library_update(bmain, id); } } FOREACH_MAIN_ID_END; @@ -729,13 +733,13 @@ void BKE_main_override_static_update(Main *bmain) * where we only define values that need differential data. * * This avoids us having to modify 'real' data-block at write time (and restoring it afterwards), - * which is inneficient, and potentially dangerous (in case of concurrent access...), while not + * which is inefficient, and potentially dangerous (in case of concurrent access...), while not * using much extra memory in typical cases. It also ensures stored data-block always contains * exact same data as "desired" ones (kind of "baked" data-blocks). */ /** Initialize an override storage. */ -OverrideStaticStorage *BKE_override_static_operations_store_initialize(void) +OverrideLibraryStorage *BKE_override_library_operations_store_initialize(void) { return BKE_main_new(); } @@ -745,13 +749,13 @@ OverrideStaticStorage *BKE_override_static_operations_store_initialize(void) * * Note that \a local ID is no more modified by this call, * all extra data are stored in its temp \a storage_id copy. */ -ID *BKE_override_static_operations_store_start(Main *bmain, - OverrideStaticStorage *override_storage, - ID *local) +ID *BKE_override_library_operations_store_start(Main *bmain, + OverrideLibraryStorage *override_storage, + ID *local) { - BLI_assert(local->override_static != NULL); + BLI_assert(local->override_library != NULL); BLI_assert(override_storage != NULL); - const bool is_template = (local->override_static->reference == NULL); + const bool is_template = (local->override_library->reference == NULL); if (is_template) { /* This is actually purely local data with an override template, nothing to do here! */ @@ -759,7 +763,7 @@ ID *BKE_override_static_operations_store_start(Main *bmain, } /* Forcefully ensure we know about all needed override operations. */ - BKE_override_static_operations_create(bmain, local, false); + BKE_override_library_operations_create(bmain, local, false); ID *storage_id; #ifdef DEBUG_OVERRIDE_TIMEIT @@ -777,18 +781,18 @@ ID *BKE_override_static_operations_store_start(Main *bmain, if (storage_id != NULL) { PointerRNA rnaptr_reference, rnaptr_final, rnaptr_storage; - RNA_id_pointer_create(local->override_static->reference, &rnaptr_reference); + RNA_id_pointer_create(local->override_library->reference, &rnaptr_reference); RNA_id_pointer_create(local, &rnaptr_final); RNA_id_pointer_create(storage_id, &rnaptr_storage); if (!RNA_struct_override_store( - bmain, &rnaptr_final, &rnaptr_reference, &rnaptr_storage, local->override_static)) { + bmain, &rnaptr_final, &rnaptr_reference, &rnaptr_storage, local->override_library)) { BKE_id_free_ex(override_storage, storage_id, LIB_ID_FREE_NO_UI_USER, true); storage_id = NULL; } } - local->override_static->storage = storage_id; + local->override_library->storage = storage_id; #ifdef DEBUG_OVERRIDE_TIMEIT TIMEIT_END_AVERAGED(BKE_override_operations_store_start); @@ -797,17 +801,17 @@ ID *BKE_override_static_operations_store_start(Main *bmain, } /** Restore given ID modified by \a BKE_override_operations_store_start, to its original state. */ -void BKE_override_static_operations_store_end(OverrideStaticStorage *UNUSED(override_storage), - ID *local) +void BKE_override_library_operations_store_end(OverrideLibraryStorage *UNUSED(override_storage), + ID *local) { - BLI_assert(local->override_static != NULL); + BLI_assert(local->override_library != NULL); /* Nothing else to do here really, we need to keep all temp override storage data-blocks in * memory until whole file is written anyway (otherwise we'd get mem pointers overlap...). */ - local->override_static->storage = NULL; + local->override_library->storage = NULL; } -void BKE_override_static_operations_store_finalize(OverrideStaticStorage *override_storage) +void BKE_override_library_operations_store_finalize(OverrideLibraryStorage *override_storage) { /* We cannot just call BKE_main_free(override_storage), not until we have option to make 'ghost' * copies of IDs without increasing usercount of used data-blocks. */ diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c index 2b8973ff873..8bbc0bb8ae1 100644 --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@ -428,11 +428,11 @@ static void library_foreach_ID_link(Main *bmain, continue; } - if (id->override_static != NULL) { - CALLBACK_INVOKE_ID(id->override_static->reference, - IDWALK_CB_USER | IDWALK_CB_STATIC_OVERRIDE_REFERENCE); - CALLBACK_INVOKE_ID(id->override_static->storage, - IDWALK_CB_USER | IDWALK_CB_STATIC_OVERRIDE_REFERENCE); + if (id->override_library != NULL) { + CALLBACK_INVOKE_ID(id->override_library->reference, + IDWALK_CB_USER | IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE); + CALLBACK_INVOKE_ID(id->override_library->storage, + IDWALK_CB_USER | IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE); } library_foreach_idproperty_ID_link(&data, id->properties, IDWALK_CB_USER); diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index fb457c9f678..8fe2552c03f 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -191,7 +191,7 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id new_id = NULL; } - const bool is_reference = (cb_flag & IDWALK_CB_STATIC_OVERRIDE_REFERENCE) != 0; + const bool is_reference = (cb_flag & IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE) != 0; const bool is_indirect = (cb_flag & IDWALK_CB_INDIRECT_USAGE) != 0; const bool skip_indirect = (id_remap_data->flag & ID_REMAP_SKIP_INDIRECT_USAGE) != 0; /* Note: proxy usage implies LIB_TAG_EXTERN, so on this aspect it is direct, @@ -202,7 +202,7 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id const bool is_obj_editmode = (is_obj && BKE_object_is_in_editmode((Object *)id)); const bool is_never_null = ((cb_flag & IDWALK_CB_NEVER_NULL) && (new_id == NULL) && (id_remap_data->flag & ID_REMAP_FORCE_NEVER_NULL_USAGE) == 0); - const bool skip_reference = (id_remap_data->flag & ID_REMAP_SKIP_STATIC_OVERRIDE) != 0; + const bool skip_reference = (id_remap_data->flag & ID_REMAP_SKIP_OVERRIDE_LIBRARY) != 0; const bool skip_never_null = (id_remap_data->flag & ID_REMAP_SKIP_NEVER_NULL_USAGE) != 0; #ifdef DEBUG_PRINT @@ -484,7 +484,7 @@ static void libblock_remap_data( FOREACH_MAIN_ID_END; } - /* XXX We may not want to always 'transfer' fakeuser from old to new id... + /* XXX We may not want to always 'transfer' fake-user from old to new id... * Think for now it's desired behavior though, * we can always add an option (flag) to control this later if needed. */ if (old_id && (old_id->flag & LIB_FAKEUSER)) { @@ -756,8 +756,8 @@ void BKE_libblock_free_data(ID *id, const bool do_id_user) MEM_freeN(id->properties); } - if (id->override_static) { - BKE_override_static_free(&id->override_static); + if (id->override_library) { + BKE_override_library_free(&id->override_library); } /* XXX TODO remove animdata handling from each type's freeing func, diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 1e5a2d53bfa..e845271d802 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -361,9 +361,6 @@ static void material_data_index_remove_id(ID *id, short index) case ID_MB: /* meta-elems don't have materials atm */ break; - case ID_GD: - BKE_gpencil_material_index_remove((bGPdata *)id, index); - break; default: break; } @@ -1050,12 +1047,20 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob) } /* check indices from mesh */ - if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_GPENCIL)) { + if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT)) { material_data_index_remove_id((ID *)ob->data, actcol - 1); if (ob->runtime.curve_cache) { BKE_displist_free(&ob->runtime.curve_cache->disp); } } + /* check indices from gpencil */ + else if (ob->type == OB_GPENCIL) { + /* need one color */ + if (ob->totcol == 0) { + BKE_gpencil_object_material_ensure_from_active_input_material(bmain, ob); + } + BKE_gpencil_material_index_reassign((bGPdata *)ob->data, ob->totcol, actcol - 1); + } return true; } diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index f0fd1203cae..f53700fbfb0 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -1387,9 +1387,11 @@ static void loop_split_worker(TaskPool *__restrict pool, void *taskdata, int UNU #endif } -/* Check whether gievn loop is part of an unknown-so-far cyclic smooth fan, or not. +/** + * Check whether given loop is part of an unknown-so-far cyclic smooth fan, or not. * Needed because cyclic smooth fans have no obvious 'entry point', - * and yet we need to walk them once, and only once. */ + * and yet we need to walk them once, and only once. + */ static bool loop_split_generator_check_cyclic_smooth_fan(const MLoop *mloops, const MPoly *mpolys, const int (*edge_to_loops)[2], diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 43a5e1d6592..2254207e545 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -128,7 +128,7 @@ ModifierData *modifier_new(int type) md->type = type; md->mode = eModifierMode_Realtime | eModifierMode_Render | eModifierMode_Expanded; - md->flag = eModifierFlag_StaticOverride_Local; + md->flag = eModifierFlag_OverrideLibrary_Local; if (mti->flags & eModifierTypeFlag_EnableInEditmode) { md->mode |= eModifierMode_Editmode; @@ -530,13 +530,14 @@ bool modifier_isEnabled(const struct Scene *scene, ModifierData *md, int require CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierData *md, - const CustomData_MeshMasks *dataMask, + CustomData_MeshMasks *final_datamask, int required_mode, ModifierData *previewmd, const CustomData_MeshMasks *previewmask) { CDMaskLink *dataMasks = NULL; CDMaskLink *curr, *prev; + bool have_deform_modifier = false; /* build a list of modifier data requirements in reverse order */ for (; md; md = md->next) { @@ -545,6 +546,10 @@ CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, curr = MEM_callocN(sizeof(CDMaskLink), "CDMaskLink"); if (modifier_isEnabled(scene, md, required_mode)) { + if (mti->type == eModifierTypeType_OnlyDeform) { + have_deform_modifier = true; + } + if (mti->requiredDataMask) { mti->requiredDataMask(ob, md, &curr->mask); } @@ -554,11 +559,21 @@ CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, } } + if (!have_deform_modifier) { + /* Don't create orco layer when there is no deformation, we fall + * back to regular vertex coordinates */ + curr->mask.vmask &= ~CD_MASK_ORCO; + } + /* prepend new datamask */ curr->next = dataMasks; dataMasks = curr; } + if (!have_deform_modifier) { + final_datamask->vmask &= ~CD_MASK_ORCO; + } + /* build the list of required data masks - each mask in the list must * include all elements of the masks that follow it * @@ -570,7 +585,7 @@ CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, CustomData_MeshMasks_update(&curr->mask, &prev->mask); } else { - CustomData_MeshMasks_update(&curr->mask, dataMask); + CustomData_MeshMasks_update(&curr->mask, final_datamask); } } diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 6f5eb69e80f..c377223d14b 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -148,9 +148,8 @@ static void get_sequence_fname(const MovieClip *clip, const int framenr, char *n BLI_strncpy(name, clip->name, sizeof(clip->name)); BLI_stringdec(name, head, tail, &numlen); - /* movieclips always points to first image from sequence, - * autoguess offset for now. could be something smarter in the future - */ + /* Movie-clips always points to first image from sequence, auto-guess offset for now. + * Could be something smarter in the future. */ offset = sequence_guess_offset(clip->name, strlen(head), numlen); if (numlen) { diff --git a/source/blender/blenkernel/intern/multires_reshape.c b/source/blender/blenkernel/intern/multires_reshape.c index 2af55b1b0bc..749cedb5388 100644 --- a/source/blender/blenkernel/intern/multires_reshape.c +++ b/source/blender/blenkernel/intern/multires_reshape.c @@ -812,7 +812,7 @@ static bool multires_reshape_from_vertcos(struct Depsgraph *depsgraph, Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); Mesh *coarse_mesh = object->data; MDisps *mdisps = CustomData_get_layer(&coarse_mesh->ldata, CD_MDISPS); - /* Pick maximum between multires level and dispalcement level. + /* Pick maximum between multires level and displacement level. * This is because mesh can be used by objects with multires at different * levels. * @@ -1017,7 +1017,7 @@ bool multiresModifier_reshapeFromCCG(const int tot_level, Mesh *coarse_mesh, Sub } GridPaintMask *grid_paint_mask = CustomData_get_layer(&coarse_mesh->ldata, CD_GRID_PAINT_MASK); Subdiv *subdiv = subdiv_ccg->subdiv; - /* Pick maximum between multires level and dispalcement level. + /* Pick maximum between multires level and displacement level. * This is because mesh can be used by objects with multires at different * levels. * diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 2a66edc8d42..e74b2b0f671 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -497,12 +497,13 @@ void BKE_object_free_caches(Object *object) for (md = object->modifiers.first; md != NULL; md = md->next) { if (md->type == eModifierType_ParticleSystem) { ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md; - if (psmd->mesh_final) { - BKE_id_free(NULL, psmd->mesh_final); - psmd->mesh_final = NULL; - if (psmd->mesh_original) { - BKE_id_free(NULL, psmd->mesh_original); - psmd->mesh_original = NULL; + ParticleSystemModifierDataRuntime *psmd_runtime = BKE_particle_modifier_runtime_ensure(psmd); + if (psmd_runtime->mesh_final) { + BKE_id_free(NULL, psmd_runtime->mesh_final); + psmd_runtime->mesh_final = NULL; + if (psmd_runtime->mesh_original) { + BKE_id_free(NULL, psmd_runtime->mesh_original); + psmd_runtime->mesh_original = NULL; } psmd->flag |= eParticleSystemFlag_file_loaded; update_flag |= ID_RECALC_GEOMETRY; diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index 84e46f1ef70..6a6adb82225 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -168,13 +168,16 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o CustomData_MeshMasks cddata_masks = scene->customdata_mask; CustomData_MeshMasks_update(&cddata_masks, &CD_MASK_BAREMESH); + if (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER) { + /* Make sure Freestyle edge/face marks appear in DM for render (see T40315). */ #ifdef WITH_FREESTYLE - /* make sure Freestyle edge/face marks appear in DM for render (see T40315) */ - if (DEG_get_mode(depsgraph) != DAG_EVAL_VIEWPORT) { cddata_masks.emask |= CD_MASK_FREESTYLE_EDGE; cddata_masks.pmask |= CD_MASK_FREESTYLE_FACE; - } #endif + /* Always compute UVs, vertex colors as orcos for render. */ + cddata_masks.lmask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL; + cddata_masks.vmask |= CD_MASK_ORCO; + } if (em) { makeDerivedMesh(depsgraph, scene, ob, em, &cddata_masks); /* was CD_MASK_BAREMESH */ } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 13649eaf096..61ee5685451 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1889,7 +1889,8 @@ void psys_particle_on_emitter(ParticleSystemModifierData *psmd, float vtan[3], float orco[3]) { - if (psmd && psmd->mesh_final) { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); + if (psmd && mesh_final) { if (psmd->psys->part->distr == PART_DISTR_GRID && psmd->psys->part->from != PART_FROM_VERT) { if (vec) { copy_v3_v3(vec, fuv); @@ -1902,7 +1903,7 @@ void psys_particle_on_emitter(ParticleSystemModifierData *psmd, } /* we cant use the num_dmcache */ psys_particle_on_dm( - psmd->mesh_final, from, index, index_dmcache, fuv, foffset, vec, nor, utan, vtan, orco); + mesh_final, from, index, index_dmcache, fuv, foffset, vec, nor, utan, vtan, orco); } else { psys_particle_on_shape(from, index, fuv, vec, nor, utan, vtan, orco); @@ -2253,13 +2254,15 @@ void psys_find_parents(ParticleSimulationData *sim, const bool use_render_params tree = BLI_kdtree_3d_new(totparent); + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(sim->psmd); + for (p = 0, cpa = sim->psys->child; p < totparent; p++, cpa++) { psys_particle_on_emitter( sim->psmd, from, cpa->num, DMCACHE_ISCHILD, cpa->fuv, cpa->foffset, co, 0, 0, 0, orco); /* Check if particle doesn't exist because of texture influence. * Insert only existing particles into kdtree. */ - get_cpa_texture(sim->psmd->mesh_final, + get_cpa_texture(mesh_final, psys, part, psys->particles + cpa->pa[0], @@ -2427,6 +2430,8 @@ static void psys_thread_create_path(ParticleTask *task, return; } + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(ctx->sim.psmd); + if (ctx->between) { ParticleData *pa = psys->particles + cpa->pa[0]; int w, needupdate; @@ -2531,7 +2536,7 @@ static void psys_thread_create_path(ParticleTask *task, sub_v3_v3v3(off1[w], co, key[w]->co); } - psys_mat_hair_to_global(ob, ctx->sim.psmd->mesh_final, psys->part->from, pa, hairmat); + psys_mat_hair_to_global(ob, mesh_final, psys->part->from, pa, hairmat); } else { ParticleData *pa = psys->particles + cpa->parent; @@ -2562,7 +2567,7 @@ static void psys_thread_create_path(ParticleTask *task, pa->num_dmcache; /* XXX hack to avoid messed up particle num and subsequent crash (#40733) */ - if (cpa_num > ctx->sim.psmd->mesh_final->totface) { + if (cpa_num > mesh_final->totface) { cpa_num = 0; } cpa_fuv = pa->fuv; @@ -2579,7 +2584,7 @@ static void psys_thread_create_path(ParticleTask *task, 0, orco); - psys_mat_hair_to_global(ob, ctx->sim.psmd->mesh_final, psys->part->from, pa, hairmat); + psys_mat_hair_to_global(ob, mesh_final, psys->part->from, pa, hairmat); } child_keys->segments = ctx->segments; @@ -2925,19 +2930,21 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re copy_v3_v3(col, &ma->r); } + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); + if ((psys->flag & PSYS_GLOBAL_HAIR) == 0) { if ((psys->part->flag & PART_CHILD_EFFECT) == 0) { - vg_effector = psys_cache_vgroup(psmd->mesh_final, psys, PSYS_VG_EFFECTOR); + vg_effector = psys_cache_vgroup(mesh_final, psys, PSYS_VG_EFFECTOR); } if (!psys->totchild) { - vg_length = psys_cache_vgroup(psmd->mesh_final, psys, PSYS_VG_LENGTH); + vg_length = psys_cache_vgroup(mesh_final, psys, PSYS_VG_LENGTH); } } /* ensure we have tessfaces to be used for mapping */ if (part->from != PART_FROM_VERT) { - BKE_mesh_tessface_ensure(psmd->mesh_final); + BKE_mesh_tessface_ensure(mesh_final); } /*---first main loop: create all actual particles' paths---*/ @@ -2947,7 +2954,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re psys_get_texture(sim, pa, &ptex, PAMAP_LENGTH, 0.f); pa_length = ptex.length * (1.0f - part->randlength * psys_frand(psys, psys->seed + p)); if (vg_length) { - pa_length *= psys_particle_value_from_verts(psmd->mesh_final, part->from, pa, vg_length); + pa_length *= psys_particle_value_from_verts(mesh_final, part->from, pa, vg_length); } } @@ -2965,7 +2972,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re init_particle_interpolation(sim->ob, sim->psys, pa, &pind); /* hairmat is needed for for non-hair particle too so we get proper rotations */ - psys_mat_hair_to_global(sim->ob, psmd->mesh_final, psys->part->from, pa, hairmat); + psys_mat_hair_to_global(sim->ob, mesh_final, psys->part->from, pa, hairmat); copy_v3_v3(rotmat[0], hairmat[2]); copy_v3_v3(rotmat[1], hairmat[1]); copy_v3_v3(rotmat[2], hairmat[0]); @@ -3023,7 +3030,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re float effector = 1.0f; if (vg_effector) { effector *= psys_particle_value_from_verts( - psmd->mesh_final, psys->part->from, pa, vg_effector); + mesh_final, psys->part->from, pa, vg_effector); } sub_v3_v3v3(vec, (cache[p] + 1)->co, cache[p]->co); @@ -3158,7 +3165,8 @@ static void psys_cache_edit_paths_iter(void *__restrict iter_data_v, init_particle_interpolation(ob, psys, pa, &pind); if (psys) { - psys_mat_hair_to_global(ob, psmd->mesh_final, psys->part->from, pa, hairmat); + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); + psys_mat_hair_to_global(ob, mesh_final, psys->part->from, pa, hairmat); copy_v3_v3(rotmat[0], hairmat[2]); copy_v3_v3(rotmat[1], hairmat[1]); copy_v3_v3(rotmat[2], hairmat[0]); @@ -4038,8 +4046,9 @@ void psys_get_texture( mul_m4_v3(mtex->object->imat, texvec); } break; - case TEXCO_UV: - if (get_particle_uv(sim->psmd->mesh_final, + case TEXCO_UV: { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(sim->psmd); + if (get_particle_uv(mesh_final, pa, 0, pa->fuv, @@ -4050,6 +4059,7 @@ void psys_get_texture( } /* no break, failed to get uv's, so let's try orco's */ ATTR_FALLTHROUGH; + } case TEXCO_ORCO: psys_particle_on_emitter(sim->psmd, sim->psys->part->from, @@ -4323,7 +4333,8 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, } else if (!keyed && !cached && !(psys->flag & PSYS_GLOBAL_HAIR)) { if ((pa->flag & PARS_REKEY) == 0) { - psys_mat_hair_to_global(sim->ob, sim->psmd->mesh_final, part->from, pa, hairmat); + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(sim->psmd); + psys_mat_hair_to_global(sim->ob, mesh_final, part->from, pa, hairmat); mul_m4_v3(hairmat, state->co); mul_mat3_m4_v3(hairmat, state->vel); @@ -4405,7 +4416,8 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, 0, par_orco); if (part->type == PART_HAIR) { - psys_mat_hair_to_global(sim->ob, sim->psmd->mesh_final, psys->part->from, pa, hairmat); + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); + psys_mat_hair_to_global(sim->ob, mesh_final, psys->part->from, pa, hairmat); } else { unit_m4(hairmat); @@ -4437,9 +4449,10 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, 0, par_orco); if (part->type == PART_HAIR) { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); psys_particle_on_emitter( psmd, cpa_from, cpa_num, DMCACHE_ISCHILD, cpa_fuv, pa->foffset, co, 0, 0, 0, orco); - psys_mat_hair_to_global(sim->ob, sim->psmd->mesh_final, psys->part->from, pa, hairmat); + psys_mat_hair_to_global(sim->ob, mesh_final, psys->part->from, pa, hairmat); } else { copy_v3_v3(orco, cpa->fuv); @@ -4450,7 +4463,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, /* get different child parameters from textures & vgroups */ memset(&ctx, 0, sizeof(ParticleThreadContext)); ctx.sim = *sim; - ctx.mesh = psmd->mesh_final; + ctx.mesh = BKE_particle_modifier_mesh_final_get(psmd); ctx.ma = ma; /* TODO: assign vertex groups */ get_child_modifier_parameters(part, &ctx, cpa, cpa_from, cpa_num, cpa_fuv, orco, &ptex); @@ -4715,14 +4728,16 @@ void psys_get_dupli_texture(ParticleSystem *psys, /* Grid distribution doesn't support UV or emit from vertex mode */ bool is_grid = (part->distr == PART_DISTR_GRID && part->from != PART_FROM_VERT); + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); + if (cpa) { - if ((part->childtype == PART_CHILD_FACES) && (psmd->mesh_final != NULL)) { - CustomData *mtf_data = &psmd->mesh_final->fdata; + if ((part->childtype == PART_CHILD_FACES) && (mesh_final != NULL)) { + CustomData *mtf_data = &mesh_final->fdata; const int uv_idx = CustomData_get_render_layer(mtf_data, CD_MTFACE); mtface = CustomData_get_layer_n(mtf_data, CD_MTFACE, uv_idx); if (mtface && !is_grid) { - mface = CustomData_get(&psmd->mesh_final->fdata, cpa->num, CD_MFACE); + mface = CustomData_get(&mesh_final->fdata, cpa->num, CD_MFACE); mtface += cpa->num; psys_interpolate_uvs(mtface, mface->v4, cpa->fuv, uv); } @@ -4745,8 +4760,8 @@ void psys_get_dupli_texture(ParticleSystem *psys, } } - if ((part->from == PART_FROM_FACE) && (psmd->mesh_final != NULL) && !is_grid) { - CustomData *mtf_data = &psmd->mesh_final->fdata; + if ((part->from == PART_FROM_FACE) && (mesh_final != NULL) && !is_grid) { + CustomData *mtf_data = &mesh_final->fdata; const int uv_idx = CustomData_get_render_layer(mtf_data, CD_MTFACE); mtface = CustomData_get_layer_n(mtf_data, CD_MTFACE, uv_idx); @@ -4756,14 +4771,14 @@ void psys_get_dupli_texture(ParticleSystem *psys, num = pa->num; } - if (num >= psmd->mesh_final->totface) { + if (num >= mesh_final->totface) { /* happens when simplify is enabled * gives invalid coords but would crash otherwise */ num = DMCACHE_NOTFOUND; } if (mtface && !ELEM(num, DMCACHE_NOTFOUND, DMCACHE_ISCHILD)) { - mface = CustomData_get(&psmd->mesh_final->fdata, num, CD_MFACE); + mface = CustomData_get(&mesh_final->fdata, num, CD_MFACE); mtface += num; psys_interpolate_uvs(mtface, mface->v4, pa->fuv, uv); } @@ -4884,8 +4899,10 @@ void psys_apply_hair_lattice(Depsgraph *depsgraph, Scene *scene, Object *ob, Par int p, h; float hairmat[4][4], imat[4][4]; + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(sim.psmd); + for (p = 0; p < psys->totpart; p++, pa++) { - psys_mat_hair_to_global(sim.ob, sim.psmd->mesh_final, psys->part->from, pa, hairmat); + psys_mat_hair_to_global(sim.ob, mesh_final, psys->part->from, pa, hairmat); invert_m4_m4(imat, hairmat); hkey = pa->hair; @@ -4920,3 +4937,40 @@ void BKE_particle_batch_cache_free(ParticleSystem *psys) BKE_particle_batch_cache_free_cb(psys); } } + +/* **** Particle system modifier helpers. **** */ + +Mesh *BKE_particle_modifier_mesh_final_get(ParticleSystemModifierData *psmd) +{ + if (psmd == NULL) { + return NULL; + } + ParticleSystemModifierDataRuntime *runtime = psmd->modifier.runtime; + if (runtime == NULL) { + return NULL; + } + return runtime->mesh_final; +} + +Mesh *BKE_particle_modifier_mesh_original_get(ParticleSystemModifierData *psmd) +{ + if (psmd == NULL) { + return NULL; + } + ParticleSystemModifierDataRuntime *runtime = psmd->modifier.runtime; + if (runtime == NULL) { + return NULL; + } + return runtime->mesh_original; +} + +ParticleSystemModifierDataRuntime *BKE_particle_modifier_runtime_ensure( + ParticleSystemModifierData *psmd) +{ + BLI_assert(psmd != NULL); + if (psmd->modifier.runtime == NULL) { + psmd->modifier.runtime = MEM_callocN(sizeof(ParticleSystemModifierDataRuntime), + "psmd runtime"); + } + return psmd->modifier.runtime; +} diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c index 070c3c7a566..7bb2daeab23 100644 --- a/source/blender/blenkernel/intern/particle_distribute.c +++ b/source/blender/blenkernel/intern/particle_distribute.c @@ -878,7 +878,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, int from) { Scene *scene = sim->scene; - Mesh *final_mesh = sim->psmd->mesh_final; + Mesh *final_mesh = BKE_particle_modifier_mesh_final_get(sim->psmd); Object *ob = sim->ob; ParticleSystem *psys = sim->psys; ParticleData *pa = 0, *tpars = 0; @@ -926,8 +926,8 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, if (from == PART_FROM_CHILD) { /* Simple children */ if (part->childtype != PART_CHILD_FACES) { - distribute_simple_children( - scene, ob, final_mesh, sim->psmd->mesh_original, psys, use_render_params); + Mesh *mesh_original = BKE_particle_modifier_mesh_original_get(sim->psmd); + distribute_simple_children(scene, ob, final_mesh, mesh_original, psys, use_render_params); return 0; } } @@ -1318,7 +1318,7 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from) TaskPool *task_pool; ParticleThreadContext ctx; ParticleTask *tasks; - Mesh *final_mesh = sim->psmd->mesh_final; + Mesh *final_mesh = BKE_particle_modifier_mesh_final_get(sim->psmd); int i, totpart, numtasks; /* create a task pool for distribution tasks */ @@ -1346,7 +1346,8 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from) BLI_task_pool_free(task_pool); - psys_calc_dmcache(sim->ob, final_mesh, sim->psmd->mesh_original, sim->psys); + Mesh *mesh_original = BKE_particle_modifier_mesh_original_get(sim->psmd); + psys_calc_dmcache(sim->ob, final_mesh, mesh_original, sim->psys); if (ctx.mesh != final_mesh) { BKE_id_free(NULL, ctx.mesh); @@ -1371,7 +1372,8 @@ void distribute_particles(ParticleSimulationData *sim, int from) int distr_error = 0; if (psmd) { - if (psmd->mesh_final) { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); + if (mesh_final) { distribute_particles_on_dm(sim, from); } else { diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 27722aab2d9..1b0655c6734 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -467,7 +467,7 @@ void psys_thread_context_init(ParticleThreadContext *ctx, ParticleSimulationData { memset(ctx, 0, sizeof(ParticleThreadContext)); ctx->sim = *sim; - ctx->mesh = ctx->sim.psmd->mesh_final; + ctx->mesh = BKE_particle_modifier_mesh_final_get(ctx->sim.psmd); ctx->ma = give_current_material(sim->ob, sim->psys->part->omat); } @@ -3348,6 +3348,7 @@ static void hair_create_input_mesh(ParticleSimulationData *sim, /* make vgroup for pin roots etc.. */ hair_index = 1; + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(sim->psmd); LOOP_PARTICLES { if (!(pa->flag & PARS_UNEXIST)) { @@ -3358,7 +3359,7 @@ static void hair_create_input_mesh(ParticleSimulationData *sim, pa->hair_index = hair_index; use_hair = psys_hair_use_simulation(pa, max_length); - psys_mat_hair_to_object(sim->ob, sim->psmd->mesh_final, psys->part->from, pa, hairmat); + psys_mat_hair_to_object(sim->ob, mesh_final, psys->part->from, pa, hairmat); mul_m4_m4m4(root_mat, sim->ob->obmat, hairmat); normalize_m4(root_mat); @@ -3524,7 +3525,9 @@ static void hair_step(ParticleSimulationData *sim, float cfra, const bool use_re if (psys->recalc & ID_RECALC_PSYS_RESET) { /* need this for changing subsurf levels */ - psys_calc_dmcache(sim->ob, sim->psmd->mesh_final, sim->psmd->mesh_original, psys); + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(sim->psmd); + Mesh *mesh_original = BKE_particle_modifier_mesh_original_get(sim->psmd); + psys_calc_dmcache(sim->ob, mesh_final, mesh_original, psys); if (psys->clmd) { cloth_free_modifier(psys->clmd); @@ -3576,7 +3579,8 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra)) if (pa->totkey) { sub_v3_v3(key->co, root->co); - psys_vec_rot_to_face(sim->psmd->mesh_final, pa, key->co); + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(sim->psmd); + psys_vec_rot_to_face(mesh_final, pa, key->co); } key->time = pa->state.time; @@ -4610,12 +4614,13 @@ void particle_system_update(struct Depsgraph *depsgraph, } } - if (!sim.psmd->mesh_final) { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(sim.psmd); + if (!mesh_final) { return; } if (part->from != PART_FROM_VERT) { - BKE_mesh_tessface_ensure(sim.psmd->mesh_final); + BKE_mesh_tessface_ensure(mesh_final); } /* to verify if we need to restore object afterwards */ diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index ad15214c3b8..d4d753eb685 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1326,6 +1326,15 @@ void BKE_rigidbody_remove_object(struct Main *bmain, Scene *scene, Object *ob) } FOREACH_COLLECTION_OBJECT_RECURSIVE_END; } + + /* Relying on usercount of the object should be OK, and it is much cheaper than looping in all + * collections to check whether the object is already in another one... */ + if (ID_REAL_USERS(&ob->id) == 1) { + /* Some users seems to find it funny to use a view-layer instancing collection + * as RBW collection... Despite this being a bad (ab)use of the system, avoid losing objects + * when we remove them from RB simulation. */ + BKE_collection_object_add(bmain, BKE_collection_master(scene), ob); + } BKE_collection_object_remove(bmain, rbw->group, ob, false); } diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 3ff8b6ff18c..86fec1ee754 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -839,7 +839,7 @@ void BKE_screen_view3d_shading_init(View3DShading *shading) shading->type = OB_SOLID; shading->prev_type = OB_SOLID; - shading->flag = V3D_SHADING_SPECULAR_HIGHLIGHT | V3D_SHADING_XRAY_BONE; + shading->flag = V3D_SHADING_SPECULAR_HIGHLIGHT | V3D_SHADING_XRAY_WIREFRAME; shading->light = V3D_LIGHTING_STUDIO; shading->shadow_intensity = 0.5f; shading->xray_alpha = 0.5f; diff --git a/source/blender/blenkernel/intern/shader_fx.c b/source/blender/blenkernel/intern/shader_fx.c index 75503b8ca10..c999e1ad14e 100644 --- a/source/blender/blenkernel/intern/shader_fx.c +++ b/source/blender/blenkernel/intern/shader_fx.c @@ -83,7 +83,7 @@ ShaderFxData *BKE_shaderfx_new(int type) fx->type = type; fx->mode = eShaderFxMode_Realtime | eShaderFxMode_Render | eShaderFxMode_Expanded; - fx->flag = eShaderFxFlag_StaticOverride_Local; + fx->flag = eShaderFxFlag_OverrideLibrary_Local; if (fxi->flags & eShaderFxTypeFlag_EnableInEditmode) { fx->mode |= eShaderFxMode_Editmode; diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 038fc603364..007614b4b95 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -83,7 +83,8 @@ BLI_INLINE void sound_verify_evaluated_id(ID *id) * Additionally, we also allow data-blocks outside of main database. Those can not be "original" * and could be used as a temporary evaluated result during operations like baking. * - * NOTE: We conder ID evaluated if ANY of those flags is set. We do NOT require ALL of them. */ + * NOTE: We consider ID evaluated if ANY of those flags is set. We do NOT require ALL of them. + */ BLI_assert(id->tag & (LIB_TAG_COPIED_ON_WRITE | LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT | LIB_TAG_NO_MAIN)); } diff --git a/source/blender/blenkernel/intern/subdiv_eval.c b/source/blender/blenkernel/intern/subdiv_eval.c index 34f0eeaab7b..cb042e087d5 100644 --- a/source/blender/blenkernel/intern/subdiv_eval.c +++ b/source/blender/blenkernel/intern/subdiv_eval.c @@ -104,11 +104,10 @@ static void set_face_varying_data_from_uv(Subdiv *subdiv, for (int face_index = 0; face_index < num_faces; ++face_index) { const int num_face_vertices = topology_refiner->getNumFaceVertices(topology_refiner, face_index); - const int *uv_indicies = topology_refiner->getFaceFVarValueIndices( + const int *uv_indices = topology_refiner->getFaceFVarValueIndices( topology_refiner, face_index, layer_index); for (int vertex_index = 0; vertex_index < num_face_vertices; vertex_index++, mluv++) { - evaluator->setFaceVaryingData( - evaluator, layer_index, mluv->uv, uv_indicies[vertex_index], 1); + evaluator->setFaceVaryingData(evaluator, layer_index, mluv->uv, uv_indices[vertex_index], 1); } } } diff --git a/source/blender/blenkernel/intern/subdiv_mesh.c b/source/blender/blenkernel/intern/subdiv_mesh.c index 885898d9a57..947f51b4ff9 100644 --- a/source/blender/blenkernel/intern/subdiv_mesh.c +++ b/source/blender/blenkernel/intern/subdiv_mesh.c @@ -63,7 +63,7 @@ typedef struct SubdivMeshContext { * Averaging is happening for vertices along the coarse edges and corners. * This is needed for both displacement and normals. * - * Displacement is being accumulated to a verticies coordinates, since those + * Displacement is being accumulated to a vertices coordinates, since those * are not needed during traversal of edge/corner vertices. * * For normals we are using dedicated array, since we can not use same @@ -169,7 +169,7 @@ static void loops_of_ptex_get(const SubdivMeshContext *ctx, typedef struct VerticesForInterpolation { /* This field points to a vertex data which is to be used for interpolation. * The idea is to avoid unnecessary allocations for regular faces, where - * we can simply use corner verticies. */ + * we can simply use corner vertices. */ const CustomData *vertex_data; /* Vertices data calculated for ptex corners. There are always 4 elements * in this custom data, aligned the following way: @@ -182,7 +182,7 @@ typedef struct VerticesForInterpolation { * Is allocated for non-regular faces (triangles and n-gons). */ CustomData vertex_data_storage; bool vertex_data_storage_allocated; - /* Infices within vertex_data to interpolate for. The indices are aligned + /* Indices within vertex_data to interpolate for. The indices are aligned * with uv coordinates in a similar way as indices in loop_data_storage. */ int vertex_indices[4]; } VerticesForInterpolation; @@ -302,7 +302,7 @@ static void vertex_interpolation_end(VerticesForInterpolation *vertex_interpolat typedef struct LoopsForInterpolation { /* This field points to a loop data which is to be used for interpolation. * The idea is to avoid unnecessary allocations for regular faces, where - * we can simply interpolate corner verticies. */ + * we can simply interpolate corner vertices. */ const CustomData *loop_data; /* Loops data calculated for ptex corners. There are always 4 elements * in this custom data, aligned the following way: @@ -1092,7 +1092,7 @@ static void setup_foreach_callbacks(const SubdivMeshContext *subdiv_context, memset(foreach_context, 0, sizeof(*foreach_context)); /* General information. */ foreach_context->topology_info = subdiv_mesh_topology_info; - /* Every boundary geometry. Used for dispalcement and normals averaging. */ + /* Every boundary geometry. Used for displacement and normals averaging. */ if (subdiv_context->can_evaluate_normals || subdiv_context->have_displacement) { foreach_context->vertex_every_corner = subdiv_mesh_vertex_every_corner; foreach_context->vertex_every_edge = subdiv_mesh_vertex_every_edge; diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c b/source/blender/blenkernel/intern/tracking_stabilize.c index 695f9b21559..88b81392189 100644 --- a/source/blender/blenkernel/intern/tracking_stabilize.c +++ b/source/blender/blenkernel/intern/tracking_stabilize.c @@ -496,7 +496,7 @@ static float rotation_contribution(TrackStabilizationBase *track_ref, * Currently, the public API functions do not support this flexibility. * Rather, rotation will always be applied around a fixed origin. * As a workaround, we shift the image after rotation to match the - * desired rotation centre. And since this offset needs to be applied + * desired rotation center. And since this offset needs to be applied * after the rotation and scaling, we can collapse it with the * translation compensation, which is also a lateral shift (offset). * The offset to apply is intended_pivot - rotated_pivot @@ -640,9 +640,9 @@ static bool average_track_contributions(StabContext *ctx, /* Calculate weight center of location tracks for given frame. * This function performs similar calculations as average_track_contributions(), - * but does not require the tracks to be initialized for stabilisation. Moreover, + * but does not require the tracks to be initialized for stabilization. Moreover, * when there is no usable tracking data for the given frame number, data from - * a neighbouring frame is used. Thus this function can be used to calculate + * a neighboring frame is used. Thus this function can be used to calculate * a starting point on initialization. */ static void average_marker_positions(StabContext *ctx, int framenr, float r_ref_pos[2]) diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c index caf88eb0fff..b33884e4f0e 100644 --- a/source/blender/blenkernel/intern/undo_system.c +++ b/source/blender/blenkernel/intern/undo_system.c @@ -505,8 +505,8 @@ bool BKE_undosys_step_push_with_type(UndoStack *ustack, /* Might not be final place for this to be called - probably only want to call it from some * undo handlers, not all of them? */ - if (BKE_override_static_is_enabled()) { - BKE_main_override_static_operations_create(G.main, false); + if (BKE_override_library_is_enabled()) { + BKE_main_override_library_operations_create(G.main, false); } /* Remove all undos after (also when 'ustack->step_active == NULL'). */ diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c index 387d4ec5773..dd2b182474e 100644 --- a/source/blender/blenkernel/intern/workspace.c +++ b/source/blender/blenkernel/intern/workspace.c @@ -118,7 +118,7 @@ static void *workspace_relation_get_data_matching_parent(const ListBase *relatio * Checks if \a screen is already used within any workspace. A screen should never be assigned to * multiple WorkSpaceLayouts, but that should be ensured outside of the BKE_workspace module * and without such checks. - * Hence, this should only be used as assert check before assigining a screen to a workspace. + * Hence, this should only be used as assert check before assigning a screen to a workspace. */ #ifndef NDEBUG static bool workspaces_is_screen_used diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index fb8bfa1dfd9..e31e7fb5b63 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -42,6 +42,7 @@ # include <AUD_Special.h> # endif +# include "BLI_math_base.h" # include "BLI_utildefines.h" # include "BKE_global.h" @@ -588,10 +589,17 @@ static AVStream *alloc_video_stream(FFMpegContext *context, c->time_base.den = rd->frs_sec; c->time_base.num = (int)rd->frs_sec_base; } + else if (compare_ff(rd->frs_sec_base, 1.001f, 0.000001f)) { + /* This converts xx/1.001 (which is used in presets) to xx000/1001 (which is used in the rest + * of the world, including FFmpeg). */ + c->time_base.den = (int)(rd->frs_sec * 1000); + c->time_base.num = (int)(rd->frs_sec_base * 1000); + } else { - // This calculates a fraction (DENUM_MAX / num) which approximates the scene - // frame rate (frs_sec / frs_sec_base). - const double DENUM_MAX = 2147483647; + /* This calculates a fraction (DENUM_MAX / num) which approximates the scene frame rate + * (frs_sec / frs_sec_base). It uses the maximum denominator allowed by FFmpeg. + */ + const double DENUM_MAX = (codec_id == AV_CODEC_ID_MPEG4) ? (1L << 16) - 1 : (1L << 31) - 1; const double num = (DENUM_MAX / (double)rd->frs_sec) * rd->frs_sec_base; c->time_base.den = (int)DENUM_MAX; diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 98e8a5ee425..f43f55a352b 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -210,8 +210,8 @@ MINLINE axis_t max_axis(axis_t a, axis_t b) #endif /** - * Introsort - * with permission deriven from the following Java code: + * Intro-sort + * with permission deriving from the following Java code: * http://ralphunden.net/content/tutorials/a-guide-to-introsort/ * and he derived it from the SUN STL */ @@ -603,7 +603,9 @@ static void build_implicit_tree_helper(const BVHTree *tree, BVHBuildHelper *data data->remain_leafs = remain + nnodes; } -// return the min index of all the leafs archivable with the given branch +/** + * Return the min index of all the leafs achievable with the given branch. + */ static int implicit_leafs_index(const BVHBuildHelper *data, const int depth, const int child_index) { int min_leaf_index = child_index * data->leafs_per_child[depth - 1]; @@ -623,14 +625,14 @@ static int implicit_leafs_index(const BVHBuildHelper *data, const int depth, con * Generalized implicit tree build * * An implicit tree is a tree where its structure is implied, - * thus there is no need to store child pointers or indexs. + * thus there is no need to store child pointers or indexes. * Its possible to find the position of the child or the parent with simple maths - * (multiplication and adittion). + * (multiplication and addition). * This type of tree is for example used on heaps.. - * where node N has its childs at indexs N*2 and N*2+1. + * where node N has its child at indices N*2 and N*2+1. * - * Although in this case the tree type is general.. and not know until runtime. - * tree_type stands for the maximum number of childs that a tree node can have. + * Although in this case the tree type is general.. and not know until run-time. + * tree_type stands for the maximum number of children that a tree node can have. * All tree types >= 2 are supported. * * Advantages of the used trees include: @@ -1792,7 +1794,7 @@ void BLI_bvhtree_ray_cast_all(BVHTree *tree, /* -------------------------------------------------------------------- */ /** \name BLI_bvhtree_range_query * - * Allocs and fills an array with the indexs of node that are on the given spherical range + * Allocates and fills an array with the indices of node that are on the given spherical range * (center, radius). * Returns the size of the array. * diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 6b231c4916d..5dbd2a52d07 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2532,7 +2532,7 @@ bool isect_sweeping_sphere_tri_v3(const float p1[3], } /*---test edges---*/ - sub_v3_v3v3(e3, v2, v1); /* wasnt yet calculated */ + sub_v3_v3v3(e3, v2, v1); /* wasn't yet calculated */ /*e1*/ sub_v3_v3v3(bv, v0, p1); diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index cf00e4d5f84..8769ed37d16 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -40,6 +40,7 @@ struct Scene; struct UserDef; struct View3D; struct ViewLayer; +struct WorkSpace; struct bContext; struct bScreen; struct wmWindowManager; @@ -166,6 +167,7 @@ void BLO_expand_main(void *fdhandle, struct Main *mainvar); /* Update defaults in startup.blend & userprefs.blend, without having to save and embed it */ void BLO_update_defaults_userpref_blend(void); void BLO_update_defaults_startup_blend(struct Main *mainvar, const char *app_template); +void BLO_update_defaults_workspace(struct WorkSpace *workspace, const char *app_template); /* Version patch user preferences. */ void BLO_version_defaults_userpref_blend(struct Main *mainvar, struct UserDef *userdef); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 949234ff4a4..9e9b25b1f51 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -578,7 +578,7 @@ void blo_split_main(ListBase *mainlist, Main *main) while (i--) { ID *id = lbarray[i]->first; if (id == NULL || GS(id->name) == ID_LI) { - /* No ID_LI datablock should ever be linked anyway, but just in case, better be explicit. */ + /* No ID_LI data-lock should ever be linked anyway, but just in case, better be explicit. */ continue; } split_libdata(lbarray[i], lib_main_array, lib_main_array_len); @@ -1723,7 +1723,7 @@ static void *newdataadr_no_us(FileData *fd, const void *adr) /* only direct data return oldnewmap_lookup_and_inc(fd->datamap, adr, false); } -static void *newglobadr(FileData *fd, const void *adr) /* direct datablocks with global linking */ +static void *newglobadr(FileData *fd, const void *adr) /* direct data-locks with global linking */ { return oldnewmap_lookup_and_inc(fd->globmap, adr, true); } @@ -2623,9 +2623,10 @@ static void lib_link_id(FileData *fd, Main *main) ID *id; for (id = lb->first; id; id = id->next) { - if (id->override_static) { - id->override_static->reference = newlibadr_us(fd, id->lib, id->override_static->reference); - id->override_static->storage = newlibadr_us(fd, id->lib, id->override_static->storage); + if (id->override_library) { + id->override_library->reference = newlibadr_us( + fd, id->lib, id->override_library->reference); + id->override_library->storage = newlibadr_us(fd, id->lib, id->override_library->storage); } } } @@ -2633,7 +2634,7 @@ static void lib_link_id(FileData *fd, Main *main) static void direct_link_id_override_property_operation_cb(FileData *fd, void *data) { - IDOverrideStaticPropertyOperation *opop = data; + IDOverrideLibraryPropertyOperation *opop = data; opop->subitem_reference_name = newdataadr(fd, opop->subitem_reference_name); opop->subitem_local_name = newdataadr(fd, opop->subitem_local_name); @@ -2641,7 +2642,7 @@ static void direct_link_id_override_property_operation_cb(FileData *fd, void *da static void direct_link_id_override_property_cb(FileData *fd, void *data) { - IDOverrideStaticProperty *op = data; + IDOverrideLibraryProperty *op = data; op->rna_path = newdataadr(fd, op->rna_path); link_list_ex(fd, &op->operations, direct_link_id_override_property_operation_cb); @@ -2657,15 +2658,15 @@ static void direct_link_id(FileData *fd, ID *id) } id->py_instance = NULL; - /* That way datablock reading not going through main read_libblock() + /* That way data-lock reading not going through main read_libblock() * function are still in a clear tag state. - * (glowering at certain nodetree fake datablock here...). */ + * (glowering at certain nodetree fake data-lock here...). */ id->tag = 0; /* Link direct data of overrides. */ - if (id->override_static) { - id->override_static = newdataadr(fd, id->override_static); - link_list_ex(fd, &id->override_static->properties, direct_link_id_override_property_cb); + if (id->override_library) { + id->override_library = newdataadr(fd, id->override_library); + link_list_ex(fd, &id->override_library->properties, direct_link_id_override_property_cb); } DrawDataList *drawdata = DRW_drawdatalist_from_id(id); @@ -3676,9 +3677,9 @@ static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist) /* own ipo, all constraints have it */ con->ipo = newlibadr_us(fd, id->lib, con->ipo); // XXX deprecated - old animation system - /* If linking from a library, clear 'local' static override flag. */ + /* If linking from a library, clear 'local' library override flag. */ if (id->lib != NULL) { - con->flag &= ~CONSTRAINT_STATICOVERRIDE_LOCAL; + con->flag &= ~CONSTRAINT_OVERRIDE_LIBRARY_LOCAL; } } @@ -5033,8 +5034,8 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) mesh->adt = newdataadr(fd, mesh->adt); direct_link_animdata(fd, mesh->adt); - /* normally direct_link_dverts should be called in direct_link_customdata, - * but for backwards compat in do_versions to work we do it here */ + /* Normally direct_link_dverts should be called in direct_link_customdata, + * but for backwards compatibility in do_versions to work we do it here. */ direct_link_dverts(fd, mesh->totvert, mesh->dvert); direct_link_customdata(fd, &mesh->vdata, mesh->totvert); @@ -5162,10 +5163,10 @@ static void lib_link_modifiers(FileData *fd, Object *ob) { modifiers_foreachIDLink(ob, lib_link_modifiers_common, fd); - /* If linking from a library, clear 'local' static override flag. */ + /* If linking from a library, clear 'local' library override flag. */ if (ob->id.lib != NULL) { for (ModifierData *mod = ob->modifiers.first; mod != NULL; mod = mod->next) { - mod->flag &= ~eModifierFlag_StaticOverride_Local; + mod->flag &= ~eModifierFlag_OverrideLibrary_Local; } } } @@ -5174,11 +5175,11 @@ static void lib_link_gpencil_modifiers(FileData *fd, Object *ob) { BKE_gpencil_modifiers_foreachIDLink(ob, lib_link_modifiers_common, fd); - /* If linking from a library, clear 'local' static override flag. */ + /* If linking from a library, clear 'local' library override flag. */ if (ob->id.lib != NULL) { for (GpencilModifierData *mod = ob->greasepencil_modifiers.first; mod != NULL; mod = mod->next) { - mod->flag &= ~eGpencilModifierFlag_StaticOverride_Local; + mod->flag &= ~eGpencilModifierFlag_OverrideLibrary_Local; } } } @@ -5187,10 +5188,10 @@ static void lib_link_shaderfxs(FileData *fd, Object *ob) { BKE_shaderfx_foreachIDLink(ob, lib_link_modifiers_common, fd); - /* If linking from a library, clear 'local' static override flag. */ + /* If linking from a library, clear 'local' library override flag. */ if (ob->id.lib != NULL) { for (ShaderFxData *fx = ob->shader_fx.first; fx != NULL; fx = fx->next) { - fx->flag &= ~eShaderFxFlag_StaticOverride_Local; + fx->flag &= ~eShaderFxFlag_OverrideLibrary_Local; } } } @@ -5664,8 +5665,6 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) else if (md->type == eModifierType_ParticleSystem) { ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md; - psmd->mesh_final = NULL; - psmd->mesh_original = NULL; psmd->psys = newdataadr(fd, psmd->psys); psmd->flag &= ~eParticleSystemFlag_psys_updated; psmd->flag |= eParticleSystemFlag_file_loaded; @@ -6085,7 +6084,7 @@ static void direct_link_layer_collections(FileData *fd, ListBase *lb, bool maste lc->scene_collection = newdataadr(fd, lc->scene_collection); #endif - /* Master collection is not a real datablock. */ + /* Master collection is not a real data-lock. */ if (master) { lc->collection = newdataadr(fd, lc->collection); } @@ -6119,7 +6118,7 @@ static void lib_link_layer_collection(FileData *fd, LayerCollection *layer_collection, bool master) { - /* Master collection is not a real datablock. */ + /* Master collection is not a real data-lock. */ if (!master) { layer_collection->collection = newlibadr(fd, lib, layer_collection->collection); } @@ -7008,7 +7007,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) /* relink's grease pencil data's refs */ static void lib_link_gpencil(FileData *fd, Main *main) { - /* Relink all datablock linked by GP datablock */ + /* Relink all data-lock linked by GP data-lock */ for (bGPdata *gpd = main->gpencils.first; gpd; gpd = gpd->id.next) { if (gpd->id.tag & LIB_TAG_NEED_LINK) { /* Layers */ @@ -7017,7 +7016,7 @@ static void lib_link_gpencil(FileData *fd, Main *main) gpl->parent = newlibadr(fd, gpd->id.lib, gpl->parent); } - /* Datablock Stuff */ + /* Data-block Stuff */ IDP_LibLinkProperty(gpd->id.properties, fd); lib_link_animdata(fd, &gpd->id, gpd->adt); @@ -9150,7 +9149,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const int ta /* this case cannot be direct_linked: it's just the ID part */ if (bhead->code == ID_LINK_PLACEHOLDER) { - /* That way, we know which datablock needs do_versions (required currently for linking). */ + /* That way, we know which data-lock needs do_versions (required currently for linking). */ id->tag = tag | LIB_TAG_NEED_LINK | LIB_TAG_NEW; return blo_bhead_next(fd, bhead); @@ -9165,7 +9164,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const int ta /* init pointers direct data */ direct_link_id(fd, id); - /* That way, we know which datablock needs do_versions (required currently for linking). */ + /* That way, we know which data-lock needs do_versions (required currently for linking). */ /* Note: doing this after driect_link_id(), which resets that field. */ id->tag = tag | LIB_TAG_NEED_LINK | LIB_TAG_NEW; @@ -9767,7 +9766,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) * we can re-generate overrides from their references. */ if (fd->memfile == NULL) { /* Do not apply in undo case! */ - BKE_main_override_static_update(bfd->main); + BKE_main_override_library_update(bfd->main); } BKE_collections_after_lib_link(bfd->main); @@ -9945,7 +9944,7 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old) } if (bhead->code == ID_LINK_PLACEHOLDER) { - /* Placeholder link to datablock in another library. */ + /* Placeholder link to data-lock in another library. */ BHead *bheadlib = find_previous_lib(fd, bhead); if (bheadlib == NULL) { return; @@ -9991,7 +9990,7 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old) */ oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code); - /* If "id" is a real datablock and not a placeholder, we need to + /* If "id" is a real data-lock and not a placeholder, we need to * update fd->libmap to replace ID_LINK_PLACEHOLDER with the real * ID_* code. * @@ -10011,7 +10010,7 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old) MEM_freeN(lib); } else { - /* Datablock in same library. */ + /* Data-block in same library. */ /* In 2.50+ file identifier for screens is patched, forward compatibility. */ if (bhead->code == ID_SCRN) { bhead->code = ID_SCR; @@ -10056,9 +10055,9 @@ static void expand_constraint_channels(FileData *fd, Main *mainvar, ListBase *ch static void expand_id(FileData *fd, Main *mainvar, ID *id) { - if (id->override_static) { - expand_doit(fd, mainvar, id->override_static->reference); - expand_doit(fd, mainvar, id->override_static->storage); + if (id->override_library) { + expand_doit(fd, mainvar, id->override_library->reference); + expand_doit(fd, mainvar, id->override_library->storage); } } @@ -11852,11 +11851,11 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) do_it = true; } - /* Read linked datablocks for each link placeholder, and replace - * the placeholder with the real datablock. */ + /* Read linked data-locks for each link placeholder, and replace + * the placeholder with the real data-lock. */ read_library_linked_ids(basefd, fd, mainlist, mainptr); - /* Test if linked datablocks need to read further linked datablocks + /* Test if linked data-locks need to read further linked data-locks * and create link placeholders for them. */ BLO_expand_main(fd, mainptr); } @@ -11865,7 +11864,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) Main *main_newid = BKE_main_new(); for (Main *mainptr = mainl->next; mainptr; mainptr = mainptr->next) { - /* Do versioning for newly added linked datablocks. If no datablocks + /* Do versioning for newly added linked data-locks. If no data-locks * were read from a library versionfile will still be zero and we can * skip it. */ if (mainptr->versionfile) { diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index 7b239105251..17facb3ae20 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -1659,8 +1659,8 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) } for (tex = bmain->textures.first; tex; tex = tex->id.next) { - /* if youre picky, this isn't correct until we do a version bump - * since you could set saturation to be 0.0*/ + /* If you're picky, this isn't correct until we do a version bump + * since you could set saturation to be 0.0. */ if (tex->saturation == 0.0f) { tex->saturation = 1.0f; } @@ -2030,8 +2030,8 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) } } - /* Externl group node socket need to adjust their own_index to point at - * associated ntree inputs/outputs internal sockets. This happens in + /* External group node socket need to adjust their own_index to point at + * associated 'ntree' inputs/outputs internal sockets. This happens in * do_versions_after_linking_250, after lib linking. */ } } diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 57891279ae1..65ab20af831 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -2379,7 +2379,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_VIEW3D) { View3D *v3d = (View3D *)sl; - v3d->shading.flag |= V3D_SHADING_XRAY_BONE; + v3d->shading.flag |= V3D_SHADING_XRAY_WIREFRAME; } } } diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index 5b241d613e3..c259592bc32 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -55,7 +55,7 @@ #include "BLO_readfile.h" /** - * Override values in in-memory startup.blend, avoids resaving for small changes. + * Override values in in-memory startup.blend, avoids re-saving for small changes. */ void BLO_update_defaults_userpref_blend(void) { @@ -152,315 +152,285 @@ static ID *rename_id_for_versioning(Main *bmain, return id; } -/** - * Update defaults in startup.blend, without having to save and embed the file. - * This function can be emptied each time the startup.blend is updated. */ -void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template) +static bool blo_is_builtin_template(const char *app_template) { /* For all builtin templates shipped with Blender. */ - const bool builtin_template = - (!app_template || - STR_ELEM(app_template, "2D_Animation", "Sculpting", "VFX", "Video_Editing")); - - /* For all startup.blend files. */ - for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - if (builtin_template) { - /* Remove all stored panels, we want to use defaults - * (order, open/closed) as defined by UI code here! */ - BKE_area_region_panels_free(&ar->panels); - BLI_freelistN(&ar->panels_category_active); - - /* Reset size so it uses consistent defaults from the region types. */ - ar->sizex = 0; - ar->sizey = 0; - } + return (!app_template || + STR_ELEM(app_template, "2D_Animation", "Sculpting", "VFX", "Video_Editing")); +} - /* some toolbars have been saved as initialized, - * we don't want them to have odd zoom-level or scrolling set, see: T47047 */ - if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) { - ar->v2d.flag &= ~V2D_IS_INITIALISED; - } +static void blo_update_defaults_screen(bScreen *screen, + const char *app_template, + const char *workspace_name) +{ + /* For all app templates. */ + for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { + for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { + /* Some toolbars have been saved as initialized, + * we don't want them to have odd zoom-level or scrolling set, see: T47047 */ + if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) { + ar->v2d.flag &= ~V2D_IS_INITIALISED; } + } - for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { - switch (sl->spacetype) { - case SPACE_VIEW3D: { - View3D *v3d = (View3D *)sl; - v3d->overlay.texture_paint_mode_opacity = 1.0f; - v3d->overlay.weight_paint_mode_opacity = 1.0f; - v3d->overlay.vertex_paint_mode_opacity = 1.0f; - /* Use dimmed selected edges. */ - v3d->overlay.edit_flag &= ~V3D_OVERLAY_EDIT_EDGES; - /* grease pencil settings */ - v3d->vertex_opacity = 1.0f; - v3d->gp_flag |= V3D_GP_SHOW_EDIT_LINES; - /* Remove dither pattern in wireframe mode. */ - v3d->shading.xray_alpha_wire = 0.0f; - /* Skip startups that use the viewport color by default. */ - if (v3d->shading.background_type != V3D_SHADING_BACKGROUND_VIEWPORT) { - copy_v3_fl(v3d->shading.background_color, 0.05f); - } - break; - } - case SPACE_FILE: { - SpaceFile *sfile = (SpaceFile *)sl; - if (sfile->params) { - const char *dir_default = BKE_appdir_folder_default(); - if (dir_default) { - STRNCPY(sfile->params->dir, dir_default); - sfile->params->file[0] = '\0'; - } - } - break; + /* Set default folder. */ + for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { + if (sl->spacetype == SPACE_FILE) { + SpaceFile *sfile = (SpaceFile *)sl; + if (sfile->params) { + const char *dir_default = BKE_appdir_folder_default(); + if (dir_default) { + STRNCPY(sfile->params->dir, dir_default); + sfile->params->file[0] = '\0'; } } } } } - if (builtin_template) { - /* Name all screens by their workspaces (avoids 'Default.###' names). */ - /* Default only has one window. */ - wmWindow *win = ((wmWindowManager *)bmain->wm.first)->windows.first; - for (WorkSpace *workspace = bmain->workspaces.first; workspace; - workspace = workspace->id.next) { - WorkSpaceLayout *layout = BKE_workspace_hook_layout_for_workspace_get(win->workspace_hook, - workspace); - bScreen *screen = layout->screen; - BLI_strncpy(screen->id.name + 2, workspace->id.name + 2, sizeof(screen->id.name) - 2); - BLI_libblock_ensure_unique_name(bmain, screen->id.name); - } + /* For builtin templates only. */ + if (!blo_is_builtin_template(app_template)) { + return; } - if (app_template == NULL) { - /* 'UV Editing' should use UV mode. */ - bScreen *screen = BLI_findstring(&bmain->screens, "UV Editing", offsetof(ID, name) + 2); - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { - if (sl->spacetype == SPACE_IMAGE) { - SpaceImage *sima = (SpaceImage *)sl; - if (sima->mode == SI_MODE_VIEW) { - sima->mode = SI_MODE_UV; - } + for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { + for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { + /* Remove all stored panels, we want to use defaults + * (order, open/closed) as defined by UI code here! */ + BKE_area_region_panels_free(&ar->panels); + BLI_freelistN(&ar->panels_category_active); + + /* Reset size so it uses consistent defaults from the region types. */ + ar->sizex = 0; + ar->sizey = 0; + } + + if (sa->spacetype == SPACE_IMAGE) { + if (STREQ(workspace_name, "UV Editing")) { + SpaceImage *sima = sa->spacedata.first; + if (sima->mode == SI_MODE_VIEW) { + sima->mode = SI_MODE_UV; } } } - } + else if (sa->spacetype == SPACE_ACTION) { + /* Show marker lines, hide channels and collapse summary in timelines. */ + SpaceAction *saction = sa->spacedata.first; + saction->flag |= SACTION_SHOW_MARKER_LINES; - /* For 2D animation template. */ - if (app_template && STREQ(app_template, "2D_Animation")) { - for (WorkSpace *workspace = bmain->workspaces.first; workspace; - workspace = workspace->id.next) { - const char *name = workspace->id.name + 2; + if (saction->mode == SACTCONT_TIMELINE) { + saction->ads.flag |= ADS_FLAG_SUMMARY_COLLAPSED; - if (STREQ(name, "Drawing")) { - workspace->object_mode = OB_MODE_PAINT_GPENCIL; + for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { + if (ar->regiontype == RGN_TYPE_CHANNELS) { + ar->flag |= RGN_FLAG_HIDDEN; + } + } } } - /* set object in drawing mode */ - for (Object *object = bmain->objects.first; object; object = object->id.next) { - if (object->type == OB_GPENCIL) { - bGPdata *gpd = (bGPdata *)object->data; - object->mode = OB_MODE_PAINT_GPENCIL; - gpd->flag |= GP_DATA_STROKE_PAINTMODE; - break; - } + else if (sa->spacetype == SPACE_GRAPH) { + SpaceGraph *sipo = sa->spacedata.first; + sipo->flag |= SIPO_MARKER_LINES; } - - /* Be sure curfalloff and primitive are initializated */ - for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) { - ToolSettings *ts = scene->toolsettings; - if (ts->gp_sculpt.cur_falloff == NULL) { - ts->gp_sculpt.cur_falloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); - CurveMapping *gp_falloff_curve = ts->gp_sculpt.cur_falloff; - curvemapping_initialize(gp_falloff_curve); - curvemap_reset(gp_falloff_curve->cm, - &gp_falloff_curve->clipr, - CURVE_PRESET_GAUSS, - CURVEMAP_SLOPE_POSITIVE); - } - if (ts->gp_sculpt.cur_primitive == NULL) { - ts->gp_sculpt.cur_primitive = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); - CurveMapping *gp_primitive_curve = ts->gp_sculpt.cur_primitive; - curvemapping_initialize(gp_primitive_curve); - curvemap_reset(gp_primitive_curve->cm, - &gp_primitive_curve->clipr, - CURVE_PRESET_BELL, - CURVEMAP_SLOPE_POSITIVE); + else if (sa->spacetype == SPACE_NLA) { + SpaceNla *snla = sa->spacedata.first; + snla->flag |= SNLA_SHOW_MARKER_LINES; + } + else if (sa->spacetype == SPACE_TEXT) { + /* Show syntax and line numbers in Script workspace text editor. */ + SpaceText *stext = sa->spacedata.first; + stext->showsyntax = true; + stext->showlinenrs = true; + } + else if (sa->spacetype == SPACE_VIEW3D) { + View3D *v3d = sa->spacedata.first; + /* Screen space cavity by default for faster performance. */ + v3d->shading.cavity_type = V3D_SHADING_CAVITY_CURVATURE; + v3d->shading.flag |= V3D_SHADING_SPECULAR_HIGHLIGHT; + v3d->overlay.texture_paint_mode_opacity = 1.0f; + v3d->overlay.weight_paint_mode_opacity = 1.0f; + v3d->overlay.vertex_paint_mode_opacity = 1.0f; + /* Use dimmed selected edges. */ + v3d->overlay.edit_flag &= ~V3D_OVERLAY_EDIT_EDGES; + /* grease pencil settings */ + v3d->vertex_opacity = 1.0f; + v3d->gp_flag |= V3D_GP_SHOW_EDIT_LINES; + /* Remove dither pattern in wireframe mode. */ + v3d->shading.xray_alpha_wire = 0.0f; + /* Skip startups that use the viewport color by default. */ + if (v3d->shading.background_type != V3D_SHADING_BACKGROUND_VIEWPORT) { + copy_v3_fl(v3d->shading.background_color, 0.05f); } } + else if (sa->spacetype == SPACE_CLIP) { + SpaceClip *sclip = sa->spacedata.first; + sclip->around = V3D_AROUND_CENTER_MEDIAN; + } } - if (builtin_template) { - /* Clear all tools to use default options instead, ignore the tool saved in the file. */ - for (WorkSpace *workspace = bmain->workspaces.first; workspace; - workspace = workspace->id.next) { - while (!BLI_listbase_is_empty(&workspace->tools)) { - BKE_workspace_tool_remove(workspace, workspace->tools.first); - } - } + /* Show toopbar for sculpt/paint modes. */ + const bool show_tool_header = STR_ELEM( + workspace_name, "Sculpting", "Texture Paint", "2D Animation", "2D Full Canvas"); - for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - if (sa->spacetype == SPACE_ACTION) { - /* Show marker lines, hide channels and collapse summary in timelines. */ - SpaceAction *saction = sa->spacedata.first; - saction->flag |= SACTION_SHOW_MARKER_LINES; - - if (saction->mode == SACTCONT_TIMELINE) { - saction->ads.flag |= ADS_FLAG_SUMMARY_COLLAPSED; - - for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->regiontype == RGN_TYPE_CHANNELS) { - ar->flag |= RGN_FLAG_HIDDEN; - } - } + if (show_tool_header) { + for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { + for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { + ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase; + for (ARegion *ar = regionbase->first; ar; ar = ar->next) { + if (ar->regiontype == RGN_TYPE_TOOL_HEADER) { + ar->flag &= ~(RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER); } } - else if (sa->spacetype == SPACE_GRAPH) { - SpaceGraph *sipo = sa->spacedata.first; - sipo->flag |= SIPO_MARKER_LINES; - } - else if (sa->spacetype == SPACE_NLA) { - SpaceNla *snla = sa->spacedata.first; - snla->flag |= SNLA_SHOW_MARKER_LINES; - } - else if (sa->spacetype == SPACE_TEXT) { - /* Show syntax and line numbers in Script workspace text editor. */ - SpaceText *stext = sa->spacedata.first; - stext->showsyntax = true; - stext->showlinenrs = true; - } - else if (sa->spacetype == SPACE_VIEW3D) { - /* Screen space cavity by default for faster performance. */ - View3D *v3d = sa->spacedata.first; - v3d->shading.cavity_type = V3D_SHADING_CAVITY_CURVATURE; - } - else if (sa->spacetype == SPACE_CLIP) { - SpaceClip *sclip = sa->spacedata.first; - sclip->around = V3D_AROUND_CENTER_MEDIAN; - } } } + } +} - /* Show toopbar for sculpt/paint modes. */ - for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { - bool show_tool_header = false; - if (app_template == NULL) { - if (STR_ELEM(screen->id.name + 2, "Sculpting", "Texture Paint")) { - show_tool_header = true; - } - } - else if (STREQ(app_template, "2D_Animation")) { - if (STR_ELEM(screen->id.name + 2, "2D Animation", "2D Full Canvas")) { - show_tool_header = true; - } - } - else if (STREQ(app_template, "Sculpting")) { - if (STR_ELEM(screen->id.name + 2, "Sculpting")) { - show_tool_header = true; - } - } +void BLO_update_defaults_workspace(WorkSpace *workspace, const char *app_template) +{ + ListBase *layouts = BKE_workspace_layouts_get(workspace); + for (WorkSpaceLayout *layout = layouts->first; layout; layout = layout->next) { + if (layout->screen) { + blo_update_defaults_screen(layout->screen, app_template, workspace->id.name + 2); + } + } - if (show_tool_header) { - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { - ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase; - for (ARegion *ar = regionbase->first; ar; ar = ar->next) { - if (ar->regiontype == RGN_TYPE_TOOL_HEADER) { - ar->flag &= ~(RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER); - } - } - } - } - } + if (blo_is_builtin_template(app_template)) { + /* Clear all tools to use default options instead, ignore the tool saved in the file. */ + while (!BLI_listbase_is_empty(&workspace->tools)) { + BKE_workspace_tool_remove(workspace, workspace->tools.first); } - for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) { - BLI_strncpy(scene->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(scene->r.engine)); + /* For 2D animation template. */ + if (STREQ(workspace->id.name + 2, "Drawing")) { + workspace->object_mode = OB_MODE_PAINT_GPENCIL; + } + } +} - scene->r.cfra = 1.0f; - scene->r.displaymode = R_OUTPUT_WINDOW; +static void blo_update_defaults_scene(Main *bmain, Scene *scene) +{ + BLI_strncpy(scene->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(scene->r.engine)); - if (app_template && STREQ(app_template, "Video_Editing")) { - /* Filmic is too slow, use standard until it is optimized. */ - STRNCPY(scene->view_settings.view_transform, "Standard"); - STRNCPY(scene->view_settings.look, "None"); - } - else { - /* AV Sync break physics sim caching, disable until that is fixed. */ - scene->audio.flag &= ~AUDIO_SYNC; - scene->flag &= ~SCE_FRAME_DROP; - } + scene->r.cfra = 1.0f; + scene->r.displaymode = R_OUTPUT_WINDOW; - /* Don't enable compositing nodes. */ - if (scene->nodetree) { - ntreeFreeNestedTree(scene->nodetree); - MEM_freeN(scene->nodetree); - scene->nodetree = NULL; - scene->use_nodes = false; - } + /* Don't enable compositing nodes. */ + if (scene->nodetree) { + ntreeFreeNestedTree(scene->nodetree); + MEM_freeN(scene->nodetree); + scene->nodetree = NULL; + scene->use_nodes = false; + } - /* Rename render layers. */ - BKE_view_layer_rename(bmain, scene, scene->view_layers.first, "View Layer"); + /* Rename render layers. */ + BKE_view_layer_rename(bmain, scene, scene->view_layers.first, "View Layer"); + + /* New EEVEE defaults. */ + scene->eevee.bloom_intensity = 0.05f; + scene->eevee.bloom_clamp = 0.0f; + scene->eevee.motion_blur_shutter = 0.5f; + + copy_v3_v3(scene->display.light_direction, (float[3]){M_SQRT1_3, M_SQRT1_3, M_SQRT1_3}); + copy_v2_fl2(scene->safe_areas.title, 0.1f, 0.05f); + copy_v2_fl2(scene->safe_areas.action, 0.035f, 0.035f); + + /* Change default cubemap quality. */ + scene->eevee.gi_filter_quality = 3.0f; + + /* Be sure curfalloff and primitive are initializated */ + ToolSettings *ts = scene->toolsettings; + if (ts->gp_sculpt.cur_falloff == NULL) { + ts->gp_sculpt.cur_falloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); + CurveMapping *gp_falloff_curve = ts->gp_sculpt.cur_falloff; + curvemapping_initialize(gp_falloff_curve); + curvemap_reset(gp_falloff_curve->cm, + &gp_falloff_curve->clipr, + CURVE_PRESET_GAUSS, + CURVEMAP_SLOPE_POSITIVE); + } + if (ts->gp_sculpt.cur_primitive == NULL) { + ts->gp_sculpt.cur_primitive = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); + CurveMapping *gp_primitive_curve = ts->gp_sculpt.cur_primitive; + curvemapping_initialize(gp_primitive_curve); + curvemap_reset(gp_primitive_curve->cm, + &gp_primitive_curve->clipr, + CURVE_PRESET_BELL, + CURVEMAP_SLOPE_POSITIVE); + } +} - /* New EEVEE defaults. */ - scene->eevee.bloom_intensity = 0.05f; - scene->eevee.bloom_clamp = 0.0f; - scene->eevee.motion_blur_shutter = 0.5f; - } +/** + * Update defaults in startup.blend, without having to save and embed the file. + * This function can be emptied each time the startup.blend is updated. */ +void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template) +{ + /* For all app templates. */ + for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = workspace->id.next) { + BLO_update_defaults_workspace(workspace, app_template); + } - /* Rename light objects. */ - rename_id_for_versioning(bmain, ID_OB, "Lamp", "Light"); - rename_id_for_versioning(bmain, ID_LA, "Lamp", "Light"); + /* For builtin templates only. */ + if (!blo_is_builtin_template(app_template)) { + return; + } - for (Mesh *mesh = bmain->meshes.first; mesh; mesh = mesh->id.next) { - /* Match default for new meshes. */ - mesh->smoothresh = DEG2RADF(30); - } + /* Workspaces. */ + wmWindow *win = ((wmWindowManager *)bmain->wm.first)->windows.first; + for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = workspace->id.next) { + WorkSpaceLayout *layout = BKE_workspace_hook_layout_for_workspace_get(win->workspace_hook, + workspace); - for (Camera *camera = bmain->cameras.first; camera; camera = camera->id.next) { - /* Initialize to a useful value. */ - camera->dof.focus_distance = 10.0f; - camera->dof.aperture_fstop = 2.8f; + /* Name all screens by their workspaces (avoids 'Default.###' names). */ + /* Default only has one window. */ + if (layout->screen) { + bScreen *screen = layout->screen; + BLI_strncpy(screen->id.name + 2, workspace->id.name + 2, sizeof(screen->id.name) - 2); + BLI_libblock_ensure_unique_name(bmain, screen->id.name); } + } - for (Material *ma = bmain->materials.first; ma; ma = ma->id.next) { - /* Update default material to be a bit more rough. */ - ma->roughness = 0.4f; + /* Scenes */ + for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) { + blo_update_defaults_scene(bmain, scene); - if (ma->nodetree) { - for (bNode *node = ma->nodetree->nodes.first; node; node = node->next) { - if (node->type == SH_NODE_BSDF_PRINCIPLED) { - bNodeSocket *roughness_socket = nodeFindSocket(node, SOCK_IN, "Roughness"); - bNodeSocketValueFloat *roughness_data = roughness_socket->default_value; - roughness_data->value = 0.4f; - } - } - } + if (app_template && STREQ(app_template, "Video_Editing")) { + /* Filmic is too slow, use standard until it is optimized. */ + STRNCPY(scene->view_settings.view_transform, "Standard"); + STRNCPY(scene->view_settings.look, "None"); + } + else { + /* AV Sync break physics sim caching, disable until that is fixed. */ + scene->audio.flag &= ~AUDIO_SYNC; + scene->flag &= ~SCE_FRAME_DROP; } } - for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) { - for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) { - for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { - if (sl->spacetype == SPACE_VIEW3D) { - View3D *v3d = (View3D *)sl; - v3d->shading.flag |= V3D_SHADING_SPECULAR_HIGHLIGHT; - } + /* Objects */ + rename_id_for_versioning(bmain, ID_OB, "Lamp", "Light"); + rename_id_for_versioning(bmain, ID_LA, "Lamp", "Light"); + + if (app_template && STREQ(app_template, "2D_Animation")) { + for (Object *object = bmain->objects.first; object; object = object->id.next) { + if (object->type == OB_GPENCIL) { + /* Set grease pencil object in drawing mode */ + bGPdata *gpd = (bGPdata *)object->data; + object->mode = OB_MODE_PAINT_GPENCIL; + gpd->flag |= GP_DATA_STROKE_PAINTMODE; + break; } } } - for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) { - copy_v3_v3(scene->display.light_direction, (float[3]){M_SQRT1_3, M_SQRT1_3, M_SQRT1_3}); - copy_v2_fl2(scene->safe_areas.title, 0.1f, 0.05f); - copy_v2_fl2(scene->safe_areas.action, 0.035f, 0.035f); + for (Mesh *mesh = bmain->meshes.first; mesh; mesh = mesh->id.next) { + /* Match default for new meshes. */ + mesh->smoothresh = DEG2RADF(30); + } - /* Change default cubemap quality. */ - scene->eevee.gi_filter_quality = 3.0f; + for (Camera *camera = bmain->cameras.first; camera; camera = camera->id.next) { + /* Initialize to a useful value. */ + camera->dof.focus_distance = 10.0f; + camera->dof.aperture_fstop = 2.8f; } for (Light *light = bmain->lights.first; light; light = light->id.next) { @@ -469,11 +439,30 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template) light->att_dist = 40.0f; } - if (app_template == NULL) { + /* Materials */ + for (Material *ma = bmain->materials.first; ma; ma = ma->id.next) { + /* Update default material to be a bit more rough. */ + ma->roughness = 0.4f; + + if (ma->nodetree) { + for (bNode *node = ma->nodetree->nodes.first; node; node = node->next) { + if (node->type == SH_NODE_BSDF_PRINCIPLED) { + bNodeSocket *roughness_socket = nodeFindSocket(node, SOCK_IN, "Roughness"); + bNodeSocketValueFloat *roughness_data = roughness_socket->default_value; + roughness_data->value = 0.4f; + } + } + } + } + + /* Brushes */ + { /* Enable for UV sculpt (other brush types will be created as needed), * without this the grab brush will be active but not selectable from the list. */ Brush *brush = BLI_findstring(&bmain->brushes, "Grab", offsetof(ID, name) + 2); - brush->ob_mode |= OB_MODE_EDIT; + if (brush) { + brush->ob_mode |= OB_MODE_EDIT; + } } for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) { diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 3c44f082ac0..d6c8909e4b0 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -709,15 +709,16 @@ static void write_iddata(void *wd, const ID *id) IDP_WriteProperty(id->properties, wd); } - if (id->override_static) { - writestruct(wd, DATA, IDOverrideStatic, 1, id->override_static); + if (id->override_library) { + writestruct(wd, DATA, IDOverrideLibrary, 1, id->override_library); - writelist(wd, DATA, IDOverrideStaticProperty, &id->override_static->properties); - for (IDOverrideStaticProperty *op = id->override_static->properties.first; op; op = op->next) { + writelist(wd, DATA, IDOverrideLibraryProperty, &id->override_library->properties); + for (IDOverrideLibraryProperty *op = id->override_library->properties.first; op; + op = op->next) { writedata(wd, DATA, strlen(op->rna_path) + 1, op->rna_path); - writelist(wd, DATA, IDOverrideStaticPropertyOperation, &op->operations); - for (IDOverrideStaticPropertyOperation *opop = op->operations.first; opop; + writelist(wd, DATA, IDOverrideLibraryPropertyOperation, &op->operations); + for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { if (opop->subitem_reference_name) { writedata( @@ -1040,7 +1041,7 @@ static void write_nodetree_nolib(WriteData *wd, bNodeTree *ntree) /* pass */ } else if ((ntree->type == NTREE_COMPOSIT) && (node->type == CMP_NODE_GLARE)) { - /* Simple forward compat for fix for T50736. + /* Simple forward compatibility for fix for T50736. * Not ideal (there is no ideal solution here), but should do for now. */ NodeGlare *ndg = node->storage; /* Not in undo case. */ @@ -3784,9 +3785,8 @@ static bool write_file_handle(Main *mainvar, * avoid thumbnail detecting changes because of this. */ mywrite_flush(wd); - OverrideStaticStorage *override_storage = wd->use_memfile ? - NULL : - BKE_override_static_operations_store_initialize(); + OverrideLibraryStorage *override_storage = + wd->use_memfile ? NULL : BKE_override_library_operations_store_initialize(); /* This outer loop allows to save first data-blocks from real mainvar, * then the temp ones from override process, @@ -3808,10 +3808,10 @@ static bool write_file_handle(Main *mainvar, BLI_assert( (id->tag & (LIB_TAG_NO_MAIN | LIB_TAG_NO_USER_REFCOUNT | LIB_TAG_NOT_ALLOCATED)) == 0); - const bool do_override = !ELEM(override_storage, NULL, bmain) && id->override_static; + const bool do_override = !ELEM(override_storage, NULL, bmain) && id->override_library; if (do_override) { - BKE_override_static_operations_store_start(bmain, override_storage, id); + BKE_override_library_operations_store_start(bmain, override_storage, id); } switch ((ID_Type)GS(id->name)) { @@ -3931,7 +3931,7 @@ static bool write_file_handle(Main *mainvar, } if (do_override) { - BKE_override_static_operations_store_end(override_storage, id); + BKE_override_library_operations_store_end(override_storage, id); } } @@ -3940,7 +3940,7 @@ static bool write_file_handle(Main *mainvar, } while ((bmain != override_storage) && (bmain = override_storage)); if (override_storage) { - BKE_override_static_operations_store_finalize(override_storage); + BKE_override_library_operations_store_finalize(override_storage); override_storage = NULL; } diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index dc42d86d800..09a39c05565 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -1395,32 +1395,49 @@ void BM_lnorspace_err(BMesh *bm) static void bm_loop_normal_mark_indiv_do_loop(BMLoop *l, BLI_bitmap *loops, MLoopNorSpaceArray *lnor_spacearr, - int *totloopsel) + int *totloopsel, + const bool do_all_loops_of_vert) { if (l != NULL) { const int l_idx = BM_elem_index_get(l); - if (!BLI_BITMAP_TEST(loops, BM_elem_index_get(l))) { + if (!BLI_BITMAP_TEST(loops, l_idx)) { /* If vert and face selected share a loop, mark it for editing. */ BLI_BITMAP_ENABLE(loops, l_idx); (*totloopsel)++; - /* Mark all loops in same loop normal space (aka smooth fan). */ - if ((lnor_spacearr->lspacearr[l_idx]->flags & MLNOR_SPACE_IS_SINGLE) == 0) { - for (LinkNode *node = lnor_spacearr->lspacearr[l_idx]->loops; node; node = node->next) { - const int lfan_idx = BM_elem_index_get((BMLoop *)node->link); + if (do_all_loops_of_vert) { + /* If required, also mark all loops shared by that vertex. + * This is needed when loop spaces may change + * (i.e. when some faces or edges might change of smooth/sharp status). */ + BMIter liter; + BMLoop *lfan; + BM_ITER_ELEM (lfan, &liter, l->v, BM_LOOPS_OF_VERT) { + const int lfan_idx = BM_elem_index_get(lfan); if (!BLI_BITMAP_TEST(loops, lfan_idx)) { BLI_BITMAP_ENABLE(loops, lfan_idx); (*totloopsel)++; } } } + else { + /* Mark all loops in same loop normal space (aka smooth fan). */ + if ((lnor_spacearr->lspacearr[l_idx]->flags & MLNOR_SPACE_IS_SINGLE) == 0) { + for (LinkNode *node = lnor_spacearr->lspacearr[l_idx]->loops; node; node = node->next) { + const int lfan_idx = BM_elem_index_get((BMLoop *)node->link); + if (!BLI_BITMAP_TEST(loops, lfan_idx)) { + BLI_BITMAP_ENABLE(loops, lfan_idx); + (*totloopsel)++; + } + } + } + } } } } /* Mark the individual clnors to be edited, if multiple selection methods are used. */ -static int bm_loop_normal_mark_indiv(BMesh *bm, BLI_bitmap *loops) +static int bm_loop_normal_mark_indiv(BMesh *bm, BLI_bitmap *loops, const bool do_all_loops_of_vert) { BMEditSelection *ese, *ese_prev; int totloopsel = 0; @@ -1451,19 +1468,22 @@ static int bm_loop_normal_mark_indiv(BMesh *bm, BLI_bitmap *loops) BM_face_vert_share_loop((BMFace *)ese->ele, (BMVert *)ese_prev->ele), loops, bm->lnor_spacearr, - &totloopsel); + &totloopsel, + do_all_loops_of_vert); } else if (ese_prev->htype == BM_EDGE) { BMEdge *e = (BMEdge *)ese_prev->ele; bm_loop_normal_mark_indiv_do_loop(BM_face_vert_share_loop((BMFace *)ese->ele, e->v1), loops, bm->lnor_spacearr, - &totloopsel); + &totloopsel, + do_all_loops_of_vert); bm_loop_normal_mark_indiv_do_loop(BM_face_vert_share_loop((BMFace *)ese->ele, e->v2), loops, bm->lnor_spacearr, - &totloopsel); + &totloopsel, + do_all_loops_of_vert); } } } @@ -1478,7 +1498,8 @@ static int bm_loop_normal_mark_indiv(BMesh *bm, BLI_bitmap *loops) BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(f, BM_ELEM_SELECT)) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { - bm_loop_normal_mark_indiv_do_loop(l, loops, bm->lnor_spacearr, &totloopsel); + bm_loop_normal_mark_indiv_do_loop( + l, loops, bm->lnor_spacearr, &totloopsel, do_all_loops_of_vert); } } } @@ -1491,15 +1512,18 @@ static int bm_loop_normal_mark_indiv(BMesh *bm, BLI_bitmap *loops) BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { if (BM_elem_flag_test(e, BM_ELEM_SELECT)) { BM_ITER_ELEM (l, &liter, e, BM_LOOPS_OF_EDGE) { - bm_loop_normal_mark_indiv_do_loop(l, loops, bm->lnor_spacearr, &totloopsel); + bm_loop_normal_mark_indiv_do_loop( + l, loops, bm->lnor_spacearr, &totloopsel, do_all_loops_of_vert); /* Loops actually 'have' two edges, or said otherwise, a selected edge actually selects * *two* loops in each of its faces. We have to find the other one too. */ if (BM_vert_in_edge(e, l->next->v)) { - bm_loop_normal_mark_indiv_do_loop(l->next, loops, bm->lnor_spacearr, &totloopsel); + bm_loop_normal_mark_indiv_do_loop( + l->next, loops, bm->lnor_spacearr, &totloopsel, do_all_loops_of_vert); } else { BLI_assert(BM_vert_in_edge(e, l->prev->v)); - bm_loop_normal_mark_indiv_do_loop(l->prev, loops, bm->lnor_spacearr, &totloopsel); + bm_loop_normal_mark_indiv_do_loop( + l->prev, loops, bm->lnor_spacearr, &totloopsel, do_all_loops_of_vert); } } } @@ -1513,7 +1537,8 @@ static int bm_loop_normal_mark_indiv(BMesh *bm, BLI_bitmap *loops) BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(v, BM_ELEM_SELECT)) { BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) { - bm_loop_normal_mark_indiv_do_loop(l, loops, bm->lnor_spacearr, &totloopsel); + bm_loop_normal_mark_indiv_do_loop( + l, loops, bm->lnor_spacearr, &totloopsel, do_all_loops_of_vert); } } } @@ -1546,7 +1571,8 @@ static void loop_normal_editdata_init( lnor_ed->loc = v->co; } -BMLoopNorEditDataArray *BM_loop_normal_editdata_array_init(BMesh *bm) +BMLoopNorEditDataArray *BM_loop_normal_editdata_array_init(BMesh *bm, + const bool do_all_loops_of_vert) { BMLoop *l; BMVert *v; @@ -1570,7 +1596,7 @@ BMLoopNorEditDataArray *BM_loop_normal_editdata_array_init(BMesh *bm) BLI_bitmap *loops = BLI_BITMAP_NEW(bm->totloop, __func__); /* This function define loop normals to edit, based on selection modes and history. */ - totloopsel = bm_loop_normal_mark_indiv(bm, loops); + totloopsel = bm_loop_normal_mark_indiv(bm, loops, do_all_loops_of_vert); if (totloopsel) { BMLoopNorEditData *lnor_ed = lnors_ed_arr->lnor_editdata = MEM_mallocN( diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h index d0cf50a7894..83575552acc 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.h +++ b/source/blender/bmesh/intern/bmesh_mesh.h @@ -67,7 +67,8 @@ void BM_lnorspace_err(BMesh *bm); #endif /* Loop Generics */ -struct BMLoopNorEditDataArray *BM_loop_normal_editdata_array_init(BMesh *bm); +struct BMLoopNorEditDataArray *BM_loop_normal_editdata_array_init(BMesh *bm, + const bool do_all_loops_of_vert); void BM_loop_normal_editdata_array_free(struct BMLoopNorEditDataArray *lnors_ed_arr); int BM_total_loop_select(BMesh *bm); diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index e0ac390fda4..c8338081443 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -3055,7 +3055,7 @@ static void adjust_the_cycle_or_chain(BoundVert *vstart, bool iscycle) * on loop slide edges, the widths at each end could be different. * * It turns out that the dependent offsets either form chains or - * cycles, and we can process each of those separatey. + * cycles, and we can process each of those separately. */ static void adjust_offsets(BevelParams *bp, BMesh *bm) { diff --git a/source/blender/collada/BCAnimationCurve.cpp b/source/blender/collada/BCAnimationCurve.cpp index 1ea63508965..b494c749fe3 100644 --- a/source/blender/collada/BCAnimationCurve.cpp +++ b/source/blender/collada/BCAnimationCurve.cpp @@ -398,7 +398,7 @@ bool BCAnimationCurve::add_value_from_matrix(const BCSample &sample, const int f { int array_index = curve_key.get_array_index(); - /* transformation curves are feeded directly from the transformation matrix + /* transformation curves are fed directly from the transformation matrix * to resolve parent inverse matrix issues with object hierarchies. * Maybe this can be unified with the */ diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp index a0ad3740e45..394c79bb988 100644 --- a/source/blender/collada/EffectExporter.cpp +++ b/source/blender/collada/EffectExporter.cpp @@ -274,7 +274,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob) int i = im_samp_map[key]; std::string uvname = strlen(t->uvname) ? t->uvname : active_uv; COLLADASW::Sampler *sampler = (COLLADASW::Sampler *) - samp_surf[i]; // possibly uninitialised memory ... + samp_surf[i]; // possibly uninitialized memory ... writeTextures(ep, key, sampler, t, ima, uvname); } #endif diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h index 2912b315276..c23e33df76d 100644 --- a/source/blender/collada/collada_utils.h +++ b/source/blender/collada/collada_utils.h @@ -369,7 +369,7 @@ class BoneExtended { typedef std::map<std::string, BoneExtended *> BoneExtensionMap; /* - * A class to organise bone extendion data for multiple Armatures. + * A class to organize bone extension data for multiple Armatures. * this is needed for the case where a Collada file contains 2 or more * separate armatures. */ diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp index f3b090287ad..84c41134b89 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp @@ -134,7 +134,8 @@ float *BlurBaseOperation::make_dist_fac_inverse(float rad, int size, int falloff val = val * (2.0f - val); break; case PROP_LIN: - /* fall-through */ + /* nothing to do */ + break; #ifndef NDEBUG case -1: /* uninitialized! */ diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h index effcece6e00..ee2d4b7be54 100644 --- a/source/blender/depsgraph/DEG_depsgraph_build.h +++ b/source/blender/depsgraph/DEG_depsgraph_build.h @@ -33,7 +33,6 @@ struct Depsgraph; /* ------------------------------------------------ */ -struct bNodeTree; struct CacheFile; struct Collection; struct CustomData_MeshMasks; @@ -44,6 +43,7 @@ struct ModifierData; struct Object; struct Scene; struct ViewLayer; +struct bNodeTree; #ifdef __cplusplus extern "C" { @@ -125,11 +125,11 @@ typedef enum eDepsObjectComponentType { /* Geometry Component (Mesh/Displist) */ DEG_OB_COMP_GEOMETRY, - /* Evaluation-Related Outer Types (with Subdata) */ + /* Evaluation-Related Outer Types (with Sub-data) */ /* Pose Component - Owner/Container of Bones Eval */ DEG_OB_COMP_EVAL_POSE, - /* Bone Component - Child/Subcomponent of Pose */ + /* Bone Component - Child/Sub-component of Pose */ DEG_OB_COMP_BONE, /* Material Shading Component */ @@ -162,7 +162,7 @@ void DEG_add_generic_id_relation(struct DepsNodeHandle *node_handle, const char *description); /* Special function which is used from modifiers' updateDepsgraph() callback - * to indicate that the modifietr needs to know transformation of the object + * to indicate that the modifier needs to know transformation of the object * which that modifier belongs to. * This function will take care of checking which operation is required to * have transformation for the modifier, taking into account possible simulation diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h index bd59ebcd869..00bb02d7205 100644 --- a/source/blender/depsgraph/DEG_depsgraph_query.h +++ b/source/blender/depsgraph/DEG_depsgraph_query.h @@ -92,7 +92,7 @@ struct Scene *DEG_get_evaluated_scene(const struct Depsgraph *graph); * * Use in exceptional case if it's absolutely must to. * - * Allows to pass depsgraph == NULL, wil lreturn NULL in that case. */ + * Allows to pass depsgraph == NULL, will return NULL in that case. */ struct Scene *DEG_get_evaluated_scene_if_exists(const struct Depsgraph *graph); /* Get view layer at its evaluated state. diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc index ef73de517e8..6f28228f632 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc @@ -55,7 +55,7 @@ void DepsgraphNodeBuilder::build_scene_parameters(Scene *scene) add_operation_node(&scene->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL); /* NOTE: This is a bit overkill and can potentially pull a bit too much into the graph, but: * - * - We definitely need an ID node for the scene's compositor, othetrwise re-mapping will no + * - We definitely need an ID node for the scene's compositor, otherwise re-mapping will no * happen correct and we will risk remapping pointers in the main database. * - Alternatively, we should discard compositor tree, but this might cause other headache like * drivers which are coming from the tree. diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 524a6c16a39..4079ab5b66d 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -867,7 +867,7 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) if (object->type == OB_MBALL && parent->transflag & OB_DUPLI) { ComponentKey parent_geometry_key(parent_id, NodeType::GEOMETRY); /* NOTE: Metaballs are evaluating geometry only after their transform, - * so we onl;y hook up to transform channel here. */ + * so we only hook up to transform channel here. */ add_relation(parent_geometry_key, ob_key, "Parent"); } @@ -1587,8 +1587,7 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene) &object->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_TRANSFORM_COPY); /* Rigid body synchronization depends on the actual simulation. */ add_relation(rb_simulate_key, rb_transform_copy_key, "Rigidbody Sim Eval -> RBO Sync"); - /* Simulation uses object transformation after parenting and solving - * contraints. */ + /* Simulation uses object transformation after parenting and solving constraints. */ OperationKey object_transform_simulation_init_key( &object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_SIMULATION_INIT); OperationKey object_transform_eval_key( @@ -2124,15 +2123,25 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) ID_Type id_type = GS(id->name); if (id_type == ID_MA) { build_material((Material *)bnode->id); + ComponentKey material_key(id, NodeType::SHADING); + add_relation(material_key, shading_key, "Material -> Node"); } else if (id_type == ID_TE) { build_texture((Tex *)bnode->id); + ComponentKey texture_key(id, NodeType::GENERIC_DATABLOCK); + add_relation(texture_key, shading_key, "Texture -> Node"); } else if (id_type == ID_IM) { build_image((Image *)bnode->id); + ComponentKey image_key(id, NodeType::GENERIC_DATABLOCK); + add_relation(image_key, shading_key, "Image -> Node"); } else if (id_type == ID_OB) { build_object(NULL, (Object *)id); + ComponentKey object_transform_key(id, NodeType::TRANSFORM); + ComponentKey object_geometry_key(id, NodeType::GEOMETRY); + add_relation(object_transform_key, shading_key, "Object Transform -> Node"); + add_relation(object_geometry_key, shading_key, "Object Geometry -> Node"); } else if (id_type == ID_SCE) { Scene *node_scene = (Scene *)id; @@ -2150,9 +2159,13 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) } else if (id_type == ID_MSK) { build_mask((Mask *)id); + OperationKey mask_key(id, NodeType::PARAMETERS, OperationCode::MASK_EVAL); + add_relation(mask_key, shading_key, "Mask -> Node"); } else if (id_type == ID_MC) { build_movieclip((MovieClip *)id); + OperationKey clip_key(id, NodeType::PARAMETERS, OperationCode::MOVIECLIP_EVAL); + add_relation(clip_key, shading_key, "Clip -> Node"); } else if (ELEM(bnode->type, NODE_GROUP, NODE_CUSTOM_GROUP)) { bNodeTree *group_ntree = (bNodeTree *)id; diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc index 132b13d989b..83fcf4c6ea1 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc @@ -265,8 +265,8 @@ void flush_editors_id_update(Depsgraph *graph, const DEGEditorUpdateContext *upd deg_editors_id_update(update_ctx, id_orig); } /* ID may need to get its auto-override operations refreshed. */ - if (ID_IS_STATIC_OVERRIDE_AUTO(id_orig)) { - id_orig->tag |= LIB_TAG_OVERRIDESTATIC_AUTOREFRESH; + if (ID_IS_OVERRIDE_LIBRARY_AUTO(id_orig)) { + id_orig->tag |= LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH; } /* Inform draw engines that something was changed. */ flush_engine_data_update(id_cow); diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index cb2b3763c74..99be7ec631c 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -60,6 +60,7 @@ static void eevee_engine_init(void *ved) stl->g_data->background_alpha = DRW_state_draw_background() ? 1.0f : 0.0f; stl->g_data->valid_double_buffer = (txl->color_double_buffer != NULL); stl->g_data->valid_taa_history = (txl->taa_history != NULL); + stl->g_data->queued_shaders_count = 0; /* Main Buffer */ DRW_texture_ensure_fullscreen_2d(&txl->color, GPU_RGBA16F, DRW_TEX_FILTER | DRW_TEX_MIPMAP); @@ -145,6 +146,7 @@ void EEVEE_cache_populate(void *vedata, Object *ob) static void eevee_cache_finish(void *vedata) { EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure(); + EEVEE_PrivateData *g_data = ((EEVEE_Data *)vedata)->stl->g_data; EEVEE_volumes_cache_finish(sldata, vedata); EEVEE_materials_cache_finish(sldata, vedata); @@ -153,6 +155,13 @@ static void eevee_cache_finish(void *vedata) EEVEE_effects_draw_init(sldata, vedata); EEVEE_volumes_draw_init(sldata, vedata); + + /* Restart taa if a shader has finish compiling. */ + /* HACK We should use notification of some sort from the compilation job instead. */ + if (g_data->queued_shaders_count != g_data->queued_shaders_count_prev) { + g_data->queued_shaders_count_prev = g_data->queued_shaders_count; + EEVEE_temporal_sampling_reset(vedata); + } } /* As renders in an HDR offscreen buffer, we need draw everything once diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 848634f311e..ddc5eae768e 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -344,6 +344,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat if (wo->use_nodes && wo->nodetree) { static float error_col[3] = {1.0f, 0.0f, 1.0f}; + static float queue_col[3] = {0.5f, 0.5f, 0.5f}; struct GPUMaterial *gpumat = EEVEE_material_world_lightprobe_get(scene, wo); eGPUMaterialStatus status = GPU_material_status(gpumat); @@ -361,6 +362,10 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat DRW_shgroup_uniform_block(grp, "shadow_block", sldata->shadow_ubo); DRW_shgroup_call(grp, geom, NULL); break; + case GPU_MAT_QUEUED: + stl->g_data->queued_shaders_count++; + col = queue_col; + break; default: col = error_col; break; diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index 97b0f079500..5ac4545d223 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -1000,6 +1000,7 @@ void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) break; case GPU_MAT_QUEUED: /* TODO Bypass probe compilation. */ + stl->g_data->queued_shaders_count++; col = compile_col; break; case GPU_MAT_FAILED: @@ -1352,6 +1353,7 @@ static void material_opaque(Material *ma, break; } case GPU_MAT_QUEUED: { + stl->g_data->queued_shaders_count++; color_p = compile_col; metal_p = spec_p = rough_p = ½ break; @@ -1458,6 +1460,7 @@ static void material_transparent(Material *ma, } case GPU_MAT_QUEUED: { /* TODO Bypass probe compilation. */ + stl->g_data->queued_shaders_count++; color_p = compile_col; metal_p = spec_p = rough_p = ½ break; @@ -1785,6 +1788,7 @@ void EEVEE_hair_cache_populate(EEVEE_Data *vedata, break; } case GPU_MAT_QUEUED: { + stl->g_data->queued_shaders_count++; color_p = compile_col; metal_p = spec_p = rough_p = ½ break; diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index fbbd5bc4ab3..166e8ac7473 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -840,6 +840,10 @@ typedef struct EEVEE_PrivateData { /* Color Management */ bool use_color_render_settings; + /* Compiling shaders count. This is to track if a shader has finished compiling. */ + int queued_shaders_count; + int queued_shaders_count_prev; + /* LookDev Settings */ int studiolight_index; float studiolight_rot_z; diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index e3afa91a5a9..9162a604d7c 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -394,9 +394,13 @@ void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata, } struct GPUMaterial *mat = EEVEE_material_mesh_volume_get(scene, ma); + eGPUMaterialStatus status = GPU_material_status(mat); + if (status == GPU_MAT_QUEUED) { + vedata->stl->g_data->queued_shaders_count++; + } /* If shader failed to compile or is currently compiling. */ - if (GPU_material_status(mat) != GPU_MAT_SUCCESS) { + if (status != GPU_MAT_SUCCESS) { return; } @@ -571,10 +575,6 @@ void EEVEE_volumes_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->volume_scatter_history), GPU_ATTACHMENT_TEXTURE(txl->volume_transmit_history)}); - - /* Usage happens after buffer have been swapped. */ - effects->volume_scatter = txl->volume_scatter_history; - effects->volume_transmit = txl->volume_transmit_history; } else { DRW_TEXTURE_FREE_SAFE(txl->volume_prop_scattering); @@ -588,10 +588,10 @@ void EEVEE_volumes_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) GPU_FRAMEBUFFER_FREE_SAFE(fbl->volumetric_fb); GPU_FRAMEBUFFER_FREE_SAFE(fbl->volumetric_scat_fb); GPU_FRAMEBUFFER_FREE_SAFE(fbl->volumetric_integ_fb); - - effects->volume_scatter = e_data.dummy_scatter; - effects->volume_transmit = e_data.dummy_transmit; } + + effects->volume_scatter = e_data.dummy_scatter; + effects->volume_transmit = e_data.dummy_transmit; } void EEVEE_volumes_compute(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) @@ -618,6 +618,9 @@ void EEVEE_volumes_compute(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda SWAP(GPUTexture *, txl->volume_scatter, txl->volume_scatter_history); SWAP(GPUTexture *, txl->volume_transmit, txl->volume_transmit_history); + effects->volume_scatter = txl->volume_scatter; + effects->volume_transmit = txl->volume_transmit; + /* Restore */ GPU_framebuffer_bind(fbl->main_fb); diff --git a/source/blender/draw/engines/eevee/shaders/lights_lib.glsl b/source/blender/draw/engines/eevee/shaders/lights_lib.glsl index e0a273a9c2e..2d14f52d7e6 100644 --- a/source/blender/draw/engines/eevee/shaders/lights_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/lights_lib.glsl @@ -227,11 +227,12 @@ float light_visibility(LightData ld, vec3 ray_ori = viewPosition; - // vN = (gl_FrontFacing) ? vN : -vN; + /* Fix translucency shadowed by contact shadows. */ + vN = (gl_FrontFacing) ? vN : -vN; - // if (dot(vN, ray_dir) <= 0.0) { - // return vis; - // } + if (dot(vN, ray_dir) <= 0.0) { + return vis; + } float bias = 0.5; /* Constant Bias */ bias += 1.0 - abs(dot(vN, ray_dir)); /* Angle dependent bias */ diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index 49cad084a5f..3c2c9e2ec23 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -467,8 +467,8 @@ void GPENCIL_cache_init(void *vedata) DRW_shgroup_uniform_int(mix_shgrp, "do_select", &stl->storage->do_select_outline, 1); DRW_shgroup_uniform_vec4(mix_shgrp, "select_color", stl->storage->select_color, 1); - /* mix pass no blend used to copy between passes. A separated pass is required - * because if mix_pass is used, the acumulation of blend degrade the colors. + /* Mix pass no blend used to copy between passes. A separated pass is required + * because if mix_pass is used, the accumulation of blend degrade the colors. * * This pass is used too to take the snapshot used for background_pass. This image * will be used as the background while the user is drawing. @@ -535,7 +535,6 @@ void GPENCIL_cache_init(void *vedata) DRW_shgroup_uniform_texture_ref(blend_shgrp, "blendDepth", &e_data.temp_depth_tx_fx); DRW_shgroup_uniform_int(blend_shgrp, "mode", &stl->storage->blend_mode, 1); DRW_shgroup_uniform_int(blend_shgrp, "clamp_layer", &stl->storage->clamp_layer, 1); - DRW_shgroup_uniform_float(blend_shgrp, "blend_opacity", &stl->storage->blend_opacity, 1); DRW_shgroup_uniform_int(mix_shgrp, "tonemapping", &stl->storage->tonemapping, 1); /* create effects passes */ @@ -975,7 +974,6 @@ void GPENCIL_draw_scene(void *ved) GPU_framebuffer_clear_color_depth(fbl->temp_fb_b, clearcol, 1.0f); stl->storage->blend_mode = array_elm->mode; stl->storage->clamp_layer = (int)array_elm->clamp_layer; - stl->storage->blend_opacity = array_elm->blend_opacity; stl->storage->tonemapping = DRW_state_do_color_management() ? 0 : 1; DRW_draw_pass(psl->blend_pass); stl->storage->tonemapping = 0; diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h index a7e4c9d58d6..94a57c7f5d6 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.h +++ b/source/blender/draw/engines/gpencil/gpencil_engine.h @@ -174,7 +174,6 @@ typedef struct GPENCIL_Storage { int blend_mode; int clamp_layer; - float blend_opacity; /* simplify settings*/ bool simplify_fill; diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl index 4a6025fcd24..b70a55b51fa 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl @@ -8,7 +8,6 @@ uniform sampler2D blendColor; uniform sampler2D blendDepth; uniform int mode; uniform int clamp_layer; -uniform float blend_opacity; uniform int tonemapping; #define ON 1 @@ -34,46 +33,67 @@ float overlay_color(float a, float b) return rtn; } -vec4 get_blend_color(int mode, vec4 src_color, vec4 blend_color) +vec4 get_blend_color(int mode, vec4 src_color, vec4 mix_color) { - vec4 mix_color = blend_color; vec4 outcolor; if (mix_color.a == 0) { - outcolor = src_color; - } - else if (mode == MODE_OVERLAY) { - mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a * blend_opacity); - outcolor.r = overlay_color(src_color.r, mix_color.r); - outcolor.g = overlay_color(src_color.g, mix_color.g); - outcolor.b = overlay_color(src_color.b, mix_color.b); - outcolor.a = src_color.a; - } - else if (mode == MODE_ADD) { - mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a * blend_opacity); - outcolor = src_color + mix_color; - outcolor.a = src_color.a; - } - else if (mode == MODE_SUB) { - mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a * blend_opacity); - outcolor = src_color - mix_color; - outcolor.a = clamp(src_color.a - (mix_color.a * blend_opacity), 0.0, 1.0); - } - else if (mode == MODE_MULTIPLY) { - mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a * blend_opacity); - outcolor = src_color * mix_color; - outcolor.a = src_color.a; - } - else if (mode == MODE_DIVIDE) { - mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a * blend_opacity); - outcolor = src_color / mix_color; - outcolor.a = src_color.a; - } - else { - outcolor = mix_color * blend_opacity; - outcolor.a = src_color.a; + return src_color; } + switch (mode) { + case MODE_REGULAR: { + /* premult */ + src_color = vec4(vec3(src_color.rgb / src_color.a), src_color.a); + mix_color = vec4(vec3(mix_color.rgb / mix_color.a), mix_color.a); + + outcolor = vec4(mix(src_color.rgb, mix_color.rgb, mix_color.a), src_color.a); + break; + } + case MODE_OVERLAY: { + src_color = vec4(vec3(src_color.rgb / src_color.a), src_color.a); + mix_color = vec4(vec3(mix_color.rgb / mix_color.a), mix_color.a); + + mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a); + outcolor.r = overlay_color(src_color.r, mix_color.r); + outcolor.g = overlay_color(src_color.g, mix_color.g); + outcolor.b = overlay_color(src_color.b, mix_color.b); + outcolor.a = src_color.a; + break; + } + case MODE_ADD: { + mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a); + outcolor = src_color + mix_color; + outcolor.a = src_color.a; + break; + } + case MODE_SUB: { + mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a); + outcolor = src_color - mix_color; + outcolor.a = clamp(src_color.a - mix_color.a, 0.0, 1.0); + break; + } + case MODE_MULTIPLY: { + src_color = vec4(vec3(src_color.rgb / src_color.a), src_color.a); + mix_color = vec4(vec3(mix_color.rgb / mix_color.a), mix_color.a); + + mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a); + outcolor = src_color * mix_color; + outcolor.a = src_color.a; + break; + } + case MODE_DIVIDE: { + mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a); + outcolor = src_color / mix_color; + outcolor.a = src_color.a; + break; + } + default: { + outcolor = mix_color; + outcolor.a = src_color.a; + break; + } + } return clamp(outcolor, 0.0, 1.0); } @@ -111,40 +131,27 @@ void main() vec4 mix_color = texelFetch(blendColor, uv, 0).rgba; float mix_depth = texelFetch(blendDepth, uv, 0).r; - /* Default mode */ - if (mode == MODE_REGULAR) { - if (stroke_color.a > 0) { - if (mix_color.a > 0) { - FragColor = vec4(mix(stroke_color.rgb, mix_color.rgb, mix_color.a * blend_opacity), - stroke_color.a); - gl_FragDepth = mix_depth; - } - else { - FragColor = stroke_color; - gl_FragDepth = stroke_depth; - } + if (stroke_color.a > 0) { + if (mix_color.a > 0) { + /* apply blend mode */ + FragColor = get_blend_color(mode, stroke_color, mix_color); } else { - if (clamp_layer == ON) { - discard; - } - else { - FragColor = mix_color; - gl_FragDepth = mix_depth; - } + FragColor = stroke_color; } - FragColor = tone(FragColor); - return; + gl_FragDepth = min(stroke_depth, mix_depth); } - - /* if not using mask, return mix color */ - if ((stroke_color.a == 0) && (clamp_layer == OFF)) { - FragColor = tone(mix_color); - gl_FragDepth = mix_depth; - return; + else { + if (clamp_layer == ON) { + discard; + } + else { + /* if not using mask, return mix color */ + FragColor = mix_color; + gl_FragDepth = mix_depth; + } } - /* apply blend mode */ - FragColor = tone(get_blend_color(mode, stroke_color, mix_color)); - gl_FragDepth = stroke_depth; + /* apply tone mapping */ + FragColor = tone(FragColor); } diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index 3dbdd1cce61..28ac6d0c274 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -809,7 +809,7 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata) } /** - * Order Independant Transparency. + * Order Independent Transparency. * Similar to workbench forward. Duplicated code to avoid * spaghetti with workbench forward. It would be great if we unify * this in a clean way. diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 058528f4b59..319071b3fbe 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -81,9 +81,9 @@ struct rcti; typedef struct DRWInterface DRWInterface; typedef struct DRWPass DRWPass; -typedef struct DRWView DRWView; typedef struct DRWShadingGroup DRWShadingGroup; typedef struct DRWUniform DRWUniform; +typedef struct DRWView DRWView; /* Opaque type to avoid usage as a DRWCall but it is exactly the same thing. */ typedef struct DRWCallBuffer DRWCallBuffer; diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 17c680bbcde..961602625f0 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -4931,10 +4931,9 @@ void DRW_mesh_batch_cache_create_requested( } if (batch_requested & (MBC_SURFACE | MBC_SURF_PER_MAT | MBC_WIRE_LOOPS_UVS)) { - /* Optimization : Only create orco layer if mesh is deformed. */ + /* Modifiers will only generate an orco layer if the mesh is deformed. */ if (cache->cd_needed.orco != 0) { - CustomData *cd_vdata = (me->edit_mesh) ? &me->edit_mesh->bm->vdata : &me->vdata; - if (CustomData_get_layer(cd_vdata, CD_ORCO) != NULL && ob->modifiers.first != NULL) { + if (CustomData_get_layer(&me->vdata, CD_ORCO) != NULL) { /* Orco layer is needed. */ } else if (cache->cd_needed.tan_orco == 0) { diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c index 5b1916447a6..467626bf2c8 100644 --- a/source/blender/draw/intern/draw_cache_impl_particles.c +++ b/source/blender/draw/intern/draw_cache_impl_particles.c @@ -301,14 +301,15 @@ static void particle_calculate_parent_uvs(ParticleSystem *psys, return; } ParticleData *particle = &psys->particles[parent_index]; + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); int num = particle->num_dmcache; if (num == DMCACHE_NOTFOUND || num == DMCACHE_ISCHILD) { - if (particle->num < psmd->mesh_final->totface) { + if (particle->num < mesh_final->totface) { num = particle->num; } } if (num != DMCACHE_NOTFOUND && num != DMCACHE_ISCHILD) { - MFace *mface = &psmd->mesh_final->mface[num]; + MFace *mface = &mesh_final->mface[num]; for (int j = 0; j < num_uv_layers; j++) { psys_interpolate_uvs(mtfaces[j] + num, mface->v4, particle->fuv, r_uv[j]); } @@ -317,7 +318,7 @@ static void particle_calculate_parent_uvs(ParticleSystem *psys, static void particle_calculate_parent_mcol(ParticleSystem *psys, ParticleSystemModifierData *psmd, - const int num_uv_layers, + const int num_col_layers, const int parent_index, /*const*/ MCol **mcols, MCol *r_mcol) @@ -330,16 +331,17 @@ static void particle_calculate_parent_mcol(ParticleSystem *psys, return; } ParticleData *particle = &psys->particles[parent_index]; + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); int num = particle->num_dmcache; if (num == DMCACHE_NOTFOUND || num == DMCACHE_ISCHILD) { - if (particle->num < psmd->mesh_final->totface) { + if (particle->num < mesh_final->totface) { num = particle->num; } } if (num != DMCACHE_NOTFOUND && num != DMCACHE_ISCHILD) { - MFace *mface = &psmd->mesh_final->mface[num]; - for (int j = 0; j < num_uv_layers; j++) { - psys_interpolate_mcol(mcols[j] + num, mface->v4, particle->fuv, &r_mcol[j]); + MFace *mface = &mesh_final->mface[num]; + for (int j = 0; j < num_col_layers; j++) { + psys_interpolate_mcol(mcols[j] + num * 4, mface->v4, particle->fuv, &r_mcol[j]); } } } @@ -361,8 +363,9 @@ static void particle_interpolate_children_uvs(ParticleSystem *psys, } ChildParticle *particle = &psys->child[child_index]; int num = particle->num; + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); if (num != DMCACHE_NOTFOUND) { - MFace *mface = &psmd->mesh_final->mface[num]; + MFace *mface = &mesh_final->mface[num]; for (int j = 0; j < num_uv_layers; j++) { psys_interpolate_uvs(mtfaces[j] + num, mface->v4, particle->fuv, r_uv[j]); } @@ -384,11 +387,12 @@ static void particle_interpolate_children_mcol(ParticleSystem *psys, return; } ChildParticle *particle = &psys->child[child_index]; + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); int num = particle->num; if (num != DMCACHE_NOTFOUND) { - MFace *mface = &psmd->mesh_final->mface[num]; + MFace *mface = &mesh_final->mface[num]; for (int j = 0; j < num_col_layers; j++) { - psys_interpolate_mcol(mcols[j] + num, mface->v4, particle->fuv, &r_mcol[j]); + psys_interpolate_mcol(mcols[j] + num * 4, mface->v4, particle->fuv, &r_mcol[j]); } } } @@ -838,15 +842,16 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit int active_col = 0; ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md; + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); - if (psmd != NULL && psmd->mesh_final != NULL) { - if (CustomData_has_layer(&psmd->mesh_final->ldata, CD_MLOOPUV)) { - cache->num_uv_layers = CustomData_number_of_layers(&psmd->mesh_final->ldata, CD_MLOOPUV); - active_uv = CustomData_get_active_layer(&psmd->mesh_final->ldata, CD_MLOOPUV); + if (psmd != NULL && mesh_final != NULL) { + if (CustomData_has_layer(&mesh_final->ldata, CD_MLOOPUV)) { + cache->num_uv_layers = CustomData_number_of_layers(&mesh_final->ldata, CD_MLOOPUV); + active_uv = CustomData_get_active_layer(&mesh_final->ldata, CD_MLOOPUV); } - if (CustomData_has_layer(&psmd->mesh_final->ldata, CD_MLOOPCOL)) { - cache->num_col_layers = CustomData_number_of_layers(&psmd->mesh_final->ldata, CD_MLOOPCOL); - active_col = CustomData_get_active_layer(&psmd->mesh_final->ldata, CD_MLOOPCOL); + if (CustomData_has_layer(&mesh_final->ldata, CD_MLOOPCOL)) { + cache->num_col_layers = CustomData_number_of_layers(&mesh_final->ldata, CD_MLOOPCOL); + active_col = CustomData_get_active_layer(&mesh_final->ldata, CD_MLOOPCOL); } } @@ -890,7 +895,7 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit GPU_vertbuf_data_alloc(cache->proc_uv_buf[i], cache->strands_len); GPU_vertbuf_attr_get_raw_data(cache->proc_uv_buf[i], uv_id, &uv_step[i]); - const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPUV, i); + const char *name = CustomData_get_layer_name(&mesh_final->ldata, CD_MLOOPUV, i); uint hash = BLI_ghashutil_strhash_p(name); int n = 0; BLI_snprintf(cache->uv_layer_names[i][n++], MAX_LAYER_NAME_LEN, "u%u", hash); @@ -906,13 +911,13 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit GPU_vertbuf_data_alloc(cache->proc_col_buf[i], cache->strands_len); GPU_vertbuf_attr_get_raw_data(cache->proc_col_buf[i], col_id, &col_step[i]); - const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPCOL, i); + const char *name = CustomData_get_layer_name(&mesh_final->ldata, CD_MLOOPCOL, i); uint hash = BLI_ghashutil_strhash_p(name); int n = 0; BLI_snprintf(cache->col_layer_names[i][n++], MAX_LAYER_NAME_LEN, "c%u", hash); /* We only do vcols auto name that are not overridden by uvs */ - if (CustomData_get_named_layer_index(&psmd->mesh_final->ldata, CD_MLOOPUV, name) == -1) { + if (CustomData_get_named_layer_index(&mesh_final->ldata, CD_MLOOPUV, name) == -1) { BLI_snprintf(cache->col_layer_names[i][n++], MAX_LAYER_NAME_LEN, "a%u", hash); } @@ -922,15 +927,15 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit } if (cache->num_uv_layers || cache->num_col_layers) { - BKE_mesh_tessface_ensure(psmd->mesh_final); + BKE_mesh_tessface_ensure(mesh_final); if (cache->num_uv_layers) { for (int j = 0; j < cache->num_uv_layers; j++) { - mtfaces[j] = (MTFace *)CustomData_get_layer_n(&psmd->mesh_final->fdata, CD_MTFACE, j); + mtfaces[j] = (MTFace *)CustomData_get_layer_n(&mesh_final->fdata, CD_MTFACE, j); } } if (cache->num_col_layers) { for (int j = 0; j < cache->num_col_layers; j++) { - mcols[j] = (MCol *)CustomData_get_layer_n(&psmd->mesh_final->fdata, CD_MCOL, j); + mcols[j] = (MCol *)CustomData_get_layer_n(&mesh_final->fdata, CD_MCOL, j); } } } @@ -1143,14 +1148,16 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, float(**parent_uvs)[2] = NULL; MCol **parent_mcol = NULL; + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); + if (psmd != NULL) { - if (CustomData_has_layer(&psmd->mesh_final->ldata, CD_MLOOPUV)) { - num_uv_layers = CustomData_number_of_layers(&psmd->mesh_final->ldata, CD_MLOOPUV); - active_uv = CustomData_get_active_layer(&psmd->mesh_final->ldata, CD_MLOOPUV); + if (CustomData_has_layer(&mesh_final->ldata, CD_MLOOPUV)) { + num_uv_layers = CustomData_number_of_layers(&mesh_final->ldata, CD_MLOOPUV); + active_uv = CustomData_get_active_layer(&mesh_final->ldata, CD_MLOOPUV); } - if (CustomData_has_layer(&psmd->mesh_final->ldata, CD_MLOOPCOL)) { - num_col_layers = CustomData_number_of_layers(&psmd->mesh_final->ldata, CD_MLOOPCOL); - active_col = CustomData_get_active_layer(&psmd->mesh_final->ldata, CD_MLOOPCOL); + if (CustomData_has_layer(&mesh_final->ldata, CD_MLOOPCOL)) { + num_col_layers = CustomData_number_of_layers(&mesh_final->ldata, CD_MLOOPCOL); + active_col = CustomData_get_active_layer(&mesh_final->ldata, CD_MLOOPCOL); } } @@ -1166,7 +1173,7 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, col_id = MEM_mallocN(sizeof(*col_id) * num_col_layers, "Col attr format"); for (int i = 0; i < num_uv_layers; i++) { - const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPUV, i); + const char *name = CustomData_get_layer_name(&mesh_final->ldata, CD_MLOOPUV, i); char uuid[32]; BLI_snprintf(uuid, sizeof(uuid), "u%u", BLI_ghashutil_strhash_p(name)); @@ -1178,7 +1185,7 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, } for (int i = 0; i < num_uv_layers; i++) { - const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPUV, i); + const char *name = CustomData_get_layer_name(&mesh_final->ldata, CD_MLOOPUV, i); char uuid[32]; BLI_snprintf(uuid, sizeof(uuid), "c%u", BLI_ghashutil_strhash_p(name)); @@ -1197,17 +1204,17 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, GPU_indexbuf_init_ex(&elb, GPU_PRIM_LINE_STRIP, hair_cache->elems_len, hair_cache->point_len); if (num_uv_layers || num_col_layers) { - BKE_mesh_tessface_ensure(psmd->mesh_final); + BKE_mesh_tessface_ensure(mesh_final); if (num_uv_layers) { mtfaces = MEM_mallocN(sizeof(*mtfaces) * num_uv_layers, "Faces UV layers"); for (int i = 0; i < num_uv_layers; i++) { - mtfaces[i] = (MTFace *)CustomData_get_layer_n(&psmd->mesh_final->fdata, CD_MTFACE, i); + mtfaces[i] = (MTFace *)CustomData_get_layer_n(&mesh_final->fdata, CD_MTFACE, i); } } if (num_col_layers) { mcols = MEM_mallocN(sizeof(*mcols) * num_col_layers, "Color layers"); for (int i = 0; i < num_col_layers; i++) { - mcols[i] = (MCol *)CustomData_get_layer_n(&psmd->mesh_final->fdata, CD_MCOL, i); + mcols[i] = (MCol *)CustomData_get_layer_n(&mesh_final->fdata, CD_MCOL, i); } } } diff --git a/source/blender/draw/intern/draw_instance_data.c b/source/blender/draw/intern/draw_instance_data.c index e7a41ee3e43..3e5dfb53fc7 100644 --- a/source/blender/draw/intern/draw_instance_data.c +++ b/source/blender/draw/intern/draw_instance_data.c @@ -141,7 +141,7 @@ 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) && - (batch->phase == GPU_BATCH_READY_TO_DRAW); + (buf->vbo_id != 0) && (batch->phase == GPU_BATCH_READY_TO_DRAW); for (int i = 0; i < GPU_BATCH_VBO_MAX_LEN && is_compatible; i++) { if (batch->verts[i] != geom->verts[i]) { is_compatible = false; @@ -167,7 +167,7 @@ GPUBatch *DRW_temp_batch_request(DRWInstanceDataList *idatalist, GPUPrimType prim_type) { GPUBatch *batch = BLI_memblock_alloc(idatalist->pool_batching); - bool is_compatible = (batch->verts[0] == buf) && + bool is_compatible = (batch->verts[0] == buf) && (buf->vbo_id != 0) && (batch->gl_prim_type == convert_prim_type_to_gl(prim_type)); if (!is_compatible) { GPU_batch_clear(batch); diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c index 8365a7f1b72..eca60c291fe 100644 --- a/source/blender/draw/modes/edit_mesh_mode.c +++ b/source/blender/draw/modes/edit_mesh_mode.c @@ -226,9 +226,9 @@ static void EDIT_MESH_engine_init(void *vedata) datatoc_common_globals_lib_glsl, datatoc_common_view_lib_glsl, datatoc_edit_mesh_overlay_common_lib_glsl); - /* Use geometry shader to draw edge wireframe. This ensure us - * the same result accross platforms and more flexibility. But - * we pay the cost of running a geometry shader. + /* Use geometry shader to draw edge wire-frame. This ensure us + * the same result across platforms and more flexibility. + * But we pay the cost of running a geometry shader. * In the future we might consider using only the vertex shader * and loading data manually with buffer textures. */ const bool use_geom_shader = true; diff --git a/source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl b/source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl index 9022456abb2..722f62d9b6d 100644 --- a/source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl +++ b/source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl @@ -29,16 +29,14 @@ flat out float edgeSharpness; void main() { - mat4 projmat = ProjectionMatrix; - - vec4 wpos = ModelMatrix * vec4(pos, 1.0); - gl_Position = projmat * (ViewMatrix * wpos); + vec3 wpos = point_object_to_world(pos); + gl_Position = point_world_to_ndc(wpos); vec3 wnor = normalize(normal_object_to_world(nor)); facing_g = dot(wnor, ViewMatrixInverse[2].xyz); edgeSharpness_g = get_edge_sharpness(wd); #ifdef USE_WORLD_CLIP_PLANES - world_clip_planes_calc_clip_distance(wpos.xyz); + world_clip_planes_calc_clip_distance(wpos); #endif } diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 718e85c0e27..8d30076103b 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -113,7 +113,7 @@ static void animedit_get_yscale_factor(bAnimContext *ac) */ ac->yscale_fac = btheme->space_action.keyframe_scale_fac; - /* clamp to avoid problems with uninitialised values... */ + /* clamp to avoid problems with uninitialized values... */ if (ac->yscale_fac < 0.1f) { ac->yscale_fac = 1.0f; } diff --git a/source/blender/editors/animation/anim_motion_paths.c b/source/blender/editors/animation/anim_motion_paths.c index e3c4e2a8cfb..d3c6109afcd 100644 --- a/source/blender/editors/animation/anim_motion_paths.c +++ b/source/blender/editors/animation/anim_motion_paths.c @@ -250,8 +250,20 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph, /* get copies of objects/bones to get the calculated results from * (for copy-on-write evaluation), so that we actually get some results */ - // TODO: Create a copy of background depsgraph that only contain these entities, - // and only evaluates them. + + /* TODO: Create a copy of background depsgraph that only contain these entities, + * and only evaluates them. + * + * For until that is done we force dependency graph to not be active, so we don't loose unkeyed + * changes during updating the motion path. + * This still doesn't include unkeyed changes to the path itself, but allows to have updates in + * an environment when auto-keying and pose paste is used. */ + + const bool is_active_depsgraph = DEG_is_active(depsgraph); + if (is_active_depsgraph) { + DEG_make_inactive(depsgraph); + } + for (MPathTarget *mpt = targets->first; mpt; mpt = mpt->next) { mpt->ob_eval = DEG_get_evaluated_object(depsgraph, mpt->ob); @@ -317,6 +329,10 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph, motionpaths_calc_update_scene(bmain, depsgraph); } + if (is_active_depsgraph) { + DEG_make_active(depsgraph); + } + /* clear recalc flags from targets */ for (MPathTarget *mpt = targets->first; mpt; mpt = mpt->next) { bAnimVizSettings *avs; diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index 365414b4884..325e6eaee2a 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -694,7 +694,9 @@ static int pose_copy_exec(bContext *C, wmOperator *op) */ Main *temp_bmain = BKE_main_new(); Object ob_copy = *ob; + ob_copy.adt = NULL; bArmature arm_copy = *((bArmature *)ob->data); + arm_copy.adt = NULL; ob_copy.data = &arm_copy; BLI_addtail(&temp_bmain->objects, &ob_copy); BLI_addtail(&temp_bmain->armatures, &arm_copy); diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c index a853e2bcc9a..e8f97290173 100644 --- a/source/blender/editors/gpencil/annotate_draw.c +++ b/source/blender/editors/gpencil/annotate_draw.c @@ -667,7 +667,7 @@ static void annotation_draw_strokes_edit(bGPdata *gpd, continue; } - /* Optimisation: only draw points for selected strokes + /* Optimization: only draw points for selected strokes * We assume that selected points can only occur in * strokes that are selected too. */ diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index df27198922c..d914cdea442 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -446,7 +446,7 @@ static void get_pixel(const ImBuf *ibuf, const int idx, float r_col[4]) } else { /* XXX: This case probably doesn't happen, as we only write to the float buffer, - * but we get compiler warnings about uninitialised vars otherwise + * but we get compiler warnings about uninitialized vars otherwise */ BLI_assert(!"gpencil_fill.c - get_pixel() non-float case is used!"); zero_v4(r_col); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 041704d8473..c5e91bd2cab 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -2392,6 +2392,10 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op) WM_cursor_modal_restore(CTX_wm_window(C)); } else { + /* or restore paint if 3D view */ + if ((p) && (p->paintmode == GP_PAINTMODE_ERASER)) { + WM_cursor_modal_set(p->win, CURSOR_STD); + } /* drawing batch cache is dirty now */ bGPdata *gpd = CTX_data_gpencil_data(C); @@ -2405,6 +2409,8 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op) gpencil_undo_finish(); /* cleanup */ + WM_cursor_modal_set(p->win, CURSOR_STD); + gp_paint_cleanup(p); gp_session_cleanup(p); ED_gpencil_toggle_brush_cursor(C, true, NULL); @@ -2469,6 +2475,18 @@ static int gpencil_draw_init(bContext *C, wmOperator *op, const wmEvent *event) /* ------------------------------- */ +/* ensure that the correct cursor icon is set */ +static void gpencil_draw_cursor_set(tGPsdata *p) +{ + Brush *brush = p->brush; + if ((p->paintmode == GP_PAINTMODE_ERASER) || (brush->gpencil_tool == GPAINT_TOOL_ERASE)) { + WM_cursor_modal_set(p->win, BC_CROSSCURSOR); /* XXX need a better cursor */ + } + else { + WM_cursor_modal_set(p->win, CURSOR_NONE); + } +} + /* update UI indicators of status, including cursor and header prints */ static void gpencil_draw_status_indicators(bContext *C, tGPsdata *p) { @@ -3183,6 +3201,11 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event else { ED_gpencil_toggle_brush_cursor(C, true, NULL); } + /* set cursor + * NOTE: This may change later (i.e. intentionally via brush toggle, + * or unintentionally if the user scrolls outside the area)... + */ + gpencil_draw_cursor_set(p); /* only start drawing immediately if we're allowed to do so... */ if (RNA_boolean_get(op->ptr, "wait_for_input") == false) { @@ -3749,6 +3772,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) else { /* update status indicators - cursor, header, etc. */ gpencil_draw_status_indicators(C, p); + gpencil_draw_cursor_set(p); /* cursor may have changed outside our control - T44084 */ } /* process last operations before exiting */ diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 0a8304f3f8a..5d8038d0b28 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -142,22 +142,6 @@ bool BMBVH_EdgeVisible(struct BMBVHTree *tree, void ED_mesh_undosys_type(struct UndoType *ut); /* editmesh_select.c */ -struct EDBMSelectID_Context; -struct EDBMSelectID_Context *EDBM_select_id_context_create(struct ViewContext *vc, - struct Base **bases, - const uint bases_len, - short select_mode); -void EDBM_select_id_context_destroy(struct EDBMSelectID_Context *sel_id_ctx); -struct BMElem *EDBM_select_id_bm_elem_get(struct EDBMSelectID_Context *sel_id_ctx, - const uint sel_id, - uint *r_base_index); - -uint EDBM_select_id_context_offset_for_object_elem(const struct EDBMSelectID_Context *sel_id_ctx, - int base_index, - char htype); - -uint EDBM_select_id_context_elem_len(const struct EDBMSelectID_Context *sel_id_ctx); - void EDBM_select_mirrored( struct BMEditMesh *em, const int axis, const bool extend, int *r_totmirr, int *r_totfail); void EDBM_automerge(struct Scene *scene, struct Object *ob, bool update, const char hflag); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 5ce9133a531..21a18a0b387 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -512,6 +512,23 @@ int view3d_opengl_select(struct ViewContext *vc, eV3DSelectObjectFilter select_filter); /* view3d_select.c */ +struct EDSelectID_Context; +struct EDSelectID_Context *ED_view3d_select_id_context_create(struct ViewContext *vc, + struct Base **bases, + const uint bases_len, + short select_mode); + +void ED_view3d_select_id_context_destroy(struct EDSelectID_Context *sel_id_ctx); +uint ED_view3d_select_id_context_offset_for_object_elem( + const struct EDSelectID_Context *sel_id_ctx, int base_index, char elem_type); + +uint ED_view3d_select_id_context_elem_len(const struct EDSelectID_Context *sel_id_ctx); +bool ED_view3d_select_id_elem_get(struct EDSelectID_Context *sel_id_ctx, + const uint sel_id, + uint *r_elem, + uint *r_base_index, + char *r_elem_type); + float ED_view3d_select_dist_px(void); void ED_view3d_viewcontext_init(struct bContext *C, struct ViewContext *vc); void ED_view3d_viewcontext_init_object(struct ViewContext *vc, struct Object *obact); @@ -701,7 +718,7 @@ void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrAr #define XRAY_ALPHA(v3d) \ (((v3d)->shading.type == OB_WIRE) ? (v3d)->shading.xray_alpha_wire : (v3d)->shading.xray_alpha) #define XRAY_FLAG(v3d) \ - (((v3d)->shading.type == OB_WIRE) ? V3D_SHADING_XRAY_BONE : V3D_SHADING_XRAY) + (((v3d)->shading.type == OB_WIRE) ? V3D_SHADING_XRAY_WIREFRAME : V3D_SHADING_XRAY) #define XRAY_FLAG_ENABLED(v3d) (((v3d)->shading.flag & XRAY_FLAG(v3d)) != 0) #define XRAY_ENABLED(v3d) (XRAY_FLAG_ENABLED(v3d) && (XRAY_ALPHA(v3d) < 1.0f)) #define XRAY_ACTIVE(v3d) (XRAY_ENABLED(v3d) && ((v3d)->shading.type < OB_MATERIAL)) diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h index f9e9e342ee5..340b0f70987 100644 --- a/source/blender/editors/include/UI_icons.h +++ b/source/blender/editors/include/UI_icons.h @@ -338,7 +338,7 @@ DEF_ICON_OBJECT_DATA(OUTLINER_DATA_FONT) DEF_ICON_OBJECT_DATA(OUTLINER_DATA_SURFACE) DEF_ICON_OBJECT_DATA(OUTLINER_DATA_SPEAKER) DEF_ICON_OBJECT_DATA(OUTLINER_DATA_LIGHTPROBE) -DEF_ICON_BLANK(345) +DEF_ICON_OBJECT_DATA(OUTLINER_DATA_GP_LAYER) DEF_ICON_OBJECT_DATA(OUTLINER_DATA_GREASEPENCIL) DEF_ICON(GP_SELECT_POINTS) DEF_ICON(GP_SELECT_STROKES) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 2154ac4a7f6..32e70f173f4 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1378,7 +1378,7 @@ static bool ui_but_event_property_operator_string(const bContext *C, * * but it's actually quite logical. It's designed to be 'upwards compatible' * for muscle memory so that the menu item locations are fixed and don't move - * as new items are added to the menu later on. It also optimises efficiency - + * as new items are added to the menu later on. It also optimizes efficiency - * a radial menu is best kept symmetrical, with as large an angle between * items as possible, so that the gestural mouse movements can be fast and inexact. * @@ -1462,7 +1462,7 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) void ui_but_override_flag(uiBut *but) { - const int override_status = RNA_property_static_override_status( + const int override_status = RNA_property_override_library_status( &but->rnapoin, but->rnaprop, but->rnaindex); if (override_status & RNA_OVERRIDE_STATUS_OVERRIDDEN) { diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index 71026e79f60..36e197a0591 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -524,7 +524,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) const bool is_array = RNA_property_array_length(&but->rnapoin, but->rnaprop) != 0; const bool is_array_component = (is_array && but->rnaindex != -1); - const int override_status = RNA_property_static_override_status(ptr, prop, -1); + const int override_status = RNA_property_override_library_status(ptr, prop, -1); const bool is_overridable = (override_status & RNA_OVERRIDE_STATUS_OVERRIDABLE) != 0; /* Set the (button_pointer, button_prop) diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index d4d7af3a374..af992a89caa 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -278,9 +278,9 @@ static int ui_layout_vary_direction(uiLayout *layout) static bool ui_layout_variable_size(uiLayout *layout) { - /* Note that this code is probably a bit flacky, we'd probably want to know whether it's + /* Note that this code is probably a bit flakey, we'd probably want to know whether it's * variable in X and/or Y, etc. But for now it mimics previous one, - * with addition of variable flag set for children of gridflow layouts. */ + * with addition of variable flag set for children of grid-flow layouts. */ return ui_layout_vary_direction(layout) == UI_ITEM_VARY_X || layout->variable_size; } diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 768cc32aeb5..aa7e7f97478 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -430,7 +430,7 @@ static bool override_type_set_button_poll(bContext *C) UI_context_active_but_prop_get(C, &ptr, &prop, &index); - const int override_status = RNA_property_static_override_status(&ptr, prop, index); + const int override_status = RNA_property_override_library_status(&ptr, prop, index); return (ptr.data && prop && (override_status & RNA_OVERRIDE_STATUS_OVERRIDABLE)); } @@ -448,20 +448,20 @@ static int override_type_set_button_exec(bContext *C, wmOperator *op) switch (op_type) { case UIOverride_Type_NOOP: - operation = IDOVERRIDESTATIC_OP_NOOP; + operation = IDOVERRIDE_LIBRARY_OP_NOOP; break; case UIOverride_Type_Replace: - operation = IDOVERRIDESTATIC_OP_REPLACE; + operation = IDOVERRIDE_LIBRARY_OP_REPLACE; break; case UIOverride_Type_Difference: /* override code will automatically switch to subtract if needed. */ - operation = IDOVERRIDESTATIC_OP_ADD; + operation = IDOVERRIDE_LIBRARY_OP_ADD; break; case UIOverride_Type_Factor: - operation = IDOVERRIDESTATIC_OP_MULTIPLY; + operation = IDOVERRIDE_LIBRARY_OP_MULTIPLY; break; default: - operation = IDOVERRIDESTATIC_OP_REPLACE; + operation = IDOVERRIDE_LIBRARY_OP_REPLACE; BLI_assert(0); break; } @@ -475,7 +475,7 @@ static int override_type_set_button_exec(bContext *C, wmOperator *op) index = -1; } - IDOverrideStaticPropertyOperation *opop = RNA_property_override_property_operation_get( + IDOverrideLibraryPropertyOperation *opop = RNA_property_override_property_operation_get( &ptr, prop, operation, index, true, NULL, &created); if (!created) { opop->operation = operation; @@ -491,7 +491,7 @@ static int override_type_set_button_invoke(bContext *C, #if 0 /* Disabled for now */ return WM_menu_invoke_ex(C, op, WM_OP_INVOKE_DEFAULT); #else - RNA_enum_set(op->ptr, "type", IDOVERRIDESTATIC_OP_REPLACE); + RNA_enum_set(op->ptr, "type", IDOVERRIDE_LIBRARY_OP_REPLACE); return override_type_set_button_exec(C, op); #endif } @@ -530,7 +530,7 @@ static bool override_remove_button_poll(bContext *C) UI_context_active_but_prop_get(C, &ptr, &prop, &index); - const int override_status = RNA_property_static_override_status(&ptr, prop, index); + const int override_status = RNA_property_override_library_status(&ptr, prop, index); return (ptr.data && ptr.id.data && prop && (override_status & RNA_OVERRIDE_STATUS_OVERRIDDEN)); } @@ -547,16 +547,16 @@ static int override_remove_button_exec(bContext *C, wmOperator *op) UI_context_active_but_prop_get(C, &ptr, &prop, &index); ID *id = ptr.id.data; - IDOverrideStaticProperty *oprop = RNA_property_override_property_find(&ptr, prop); + IDOverrideLibraryProperty *oprop = RNA_property_override_property_find(&ptr, prop); BLI_assert(oprop != NULL); - BLI_assert(id != NULL && id->override_static != NULL); + BLI_assert(id != NULL && id->override_library != NULL); - const bool is_template = (id->override_static->reference == NULL); + const bool is_template = (id->override_library->reference == NULL); /* We need source (i.e. linked data) to restore values of deleted overrides... * If this is an override template, we obviously do not need to restore anything. */ if (!is_template) { - RNA_id_pointer_create(id->override_static->reference, &id_refptr); + RNA_id_pointer_create(id->override_library->reference, &id_refptr); if (!RNA_path_resolve(&id_refptr, oprop->rna_path, &src, NULL)) { BLI_assert(0 && "Failed to create matching source (linked data) RNA pointer"); } @@ -566,7 +566,7 @@ static int override_remove_button_exec(bContext *C, wmOperator *op) bool is_strict_find; /* Remove override operation for given item, * add singular operations for the other items as needed. */ - IDOverrideStaticPropertyOperation *opop = BKE_override_static_property_operation_find( + IDOverrideLibraryPropertyOperation *opop = BKE_override_library_property_operation_find( oprop, NULL, NULL, index, index, false, &is_strict_find); BLI_assert(opop != NULL); if (!is_strict_find) { @@ -575,22 +575,22 @@ static int override_remove_button_exec(bContext *C, wmOperator *op) * before removing generic one. */ for (int idx = RNA_property_array_length(&ptr, prop); idx--;) { if (idx != index) { - BKE_override_static_property_operation_get( + BKE_override_library_property_operation_get( oprop, opop->operation, NULL, NULL, idx, idx, true, NULL, NULL); } } } - BKE_override_static_property_operation_delete(oprop, opop); + BKE_override_library_property_operation_delete(oprop, opop); if (!is_template) { RNA_property_copy(bmain, &ptr, &src, prop, index); } if (BLI_listbase_is_empty(&oprop->operations)) { - BKE_override_static_property_delete(id->override_static, oprop); + BKE_override_library_property_delete(id->override_library, oprop); } } else { /* Just remove whole generic override operation of this property. */ - BKE_override_static_property_delete(id->override_static, oprop); + BKE_override_library_property_delete(id->override_library, oprop); if (!is_template) { RNA_property_copy(bmain, &ptr, &src, prop, -1); } @@ -1504,7 +1504,7 @@ static void UI_OT_reloadtranslation(wmOperatorType *ot) /** \} */ /* -------------------------------------------------------------------- */ -/** \name Prese Button Operator +/** \name Press Button Operator * \{ */ static ARegion *region_event_inside_for_screen(bContext *C, const int xy[2]) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 4efa024ac77..5d3ef5c625e 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -515,8 +515,8 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) case UI_ID_LOCAL: if (id) { Main *bmain = CTX_data_main(C); - if (BKE_override_static_is_enabled() && CTX_wm_window(C)->eventstate->shift) { - ID *override_id = BKE_override_static_create_from_id(bmain, id); + if (BKE_override_library_is_enabled() && CTX_wm_window(C)->eventstate->shift) { + ID *override_id = BKE_override_library_create_from_id(bmain, id); if (override_id != NULL) { BKE_main_id_clear_newpoins(bmain); @@ -537,8 +537,8 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) } break; case UI_ID_OVERRIDE: - if (id && id->override_static) { - BKE_override_static_free(&id->override_static); + if (id && id->override_library) { + BKE_override_library_free(&id->override_library); /* reassign to get get proper updates/notifiers */ idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop); RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, NULL); @@ -856,9 +856,9 @@ static void template_ID(bContext *C, 0, 0, 0, - BKE_override_static_is_enabled() ? + BKE_override_library_is_enabled() ? TIP_("Direct linked library data-block, click to make local, " - "Shift + Click to create a static override") : + "Shift + Click to create a library override") : TIP_("Direct linked library data-block, click to make local")); if (disabled) { UI_but_flag_enable(but, UI_BUT_DISABLED); @@ -869,22 +869,21 @@ static void template_ID(bContext *C, } } } - else if (ID_IS_STATIC_OVERRIDE(id)) { - but = uiDefIconBut( - block, - UI_BTYPE_BUT, - 0, - ICON_LIBRARY_DATA_OVERRIDE, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - NULL, - 0, - 0, - 0, - 0, - TIP_("Static override of linked library data-block, click to make fully local")); + else if (ID_IS_OVERRIDE_LIBRARY(id)) { + but = uiDefIconBut(block, + UI_BTYPE_BUT, + 0, + ICON_LIBRARY_DATA_OVERRIDE, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + NULL, + 0, + 0, + 0, + 0, + TIP_("Library override of linked data-block, click to make fully local")); UI_but_funcN_set( but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_OVERRIDE)); } @@ -6451,7 +6450,7 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title, flow = uiLayoutColumnFlow(layout, 2, false); - RNA_STRUCT_BEGIN (ptr, prop) { + RNA_STRUCT_BEGIN_SKIP_RNA_TYPE (ptr, prop) { const bool is_set = RNA_property_is_set(ptr, prop); uiBut *but; diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index 9a779db4812..57bf67e825e 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -23,7 +23,6 @@ set(INC ../../blentranslation ../../bmesh ../../depsgraph - ../../draw ../../gpu ../../imbuf ../../makesdna diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 75d685fb9c6..7b770f055b4 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -68,8 +68,6 @@ #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" -#include "DRW_engine.h" - #include "mesh_intern.h" /* own include */ /* use bmesh operator flags for a few operators */ @@ -199,177 +197,34 @@ void EDBM_automerge(Scene *scene, Object *obedit, bool update, const char hflag) /** \name Back-Buffer OpenGL Selection * \{ */ -struct EDBMBaseOffset { - /* For convenience only. */ - union { - uint offset; - uint face_start; - }; - union { - uint face; - uint edge_start; - }; - union { - uint edge; - uint vert_start; - }; - uint vert; -}; - -struct EDBMSelectID_Context { - struct EDBMBaseOffset *base_array_index_offsets; - /** Borrow from caller (not freed). */ - struct Base **bases; - uint bases_len; - /** Total number of items `base_array_index_offsets[bases_len - 1].vert`. */ - uint base_array_index_len; -}; - -static bool check_ob_drawface_dot(short select_mode, const View3D *v3d, char dt) +static BMElem *EDBM_select_id_bm_elem_get(struct EDSelectID_Context *sel_id_ctx, + Base **bases, + const uint sel_id, + uint *r_base_index) { - if (select_mode & SCE_SELECT_FACE) { - if ((dt < OB_SOLID) || XRAY_FLAG_ENABLED(v3d)) { - return true; - } - if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) { - return true; - } - if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGES) == 0) { - /* Since we can't deduce face selection when edges aren't visible - show dots. */ - return true; - } - } - return false; -} - -static void edbm_select_pick_draw_bases(struct EDBMSelectID_Context *sel_id_ctx, - ViewContext *vc, - short select_mode) -{ - Scene *scene_eval = (Scene *)DEG_get_evaluated_id(vc->depsgraph, &vc->scene->id); - DRW_framebuffer_select_id_setup(vc->ar, true); - - uint offset = 1; - for (uint base_index = 0; base_index < sel_id_ctx->bases_len; base_index++) { - Object *ob_eval = DEG_get_evaluated_object(vc->depsgraph, - sel_id_ctx->bases[base_index]->object); - - struct EDBMBaseOffset *base_ofs = &sel_id_ctx->base_array_index_offsets[base_index]; - bool draw_facedot = check_ob_drawface_dot(select_mode, vc->v3d, ob_eval->dt); - - DRW_draw_select_id_object(scene_eval, - vc->rv3d, - ob_eval, - select_mode, - draw_facedot, - offset, - &base_ofs->vert, - &base_ofs->edge, - &base_ofs->face); - - base_ofs->offset = offset; - offset = base_ofs->vert; - } - - sel_id_ctx->base_array_index_len = offset; - - DRW_framebuffer_select_id_release(vc->ar); -} - -BMElem *EDBM_select_id_bm_elem_get(struct EDBMSelectID_Context *sel_id_ctx, - const uint sel_id, - uint *r_base_index) -{ - char elem_type = 0; uint elem_id; - uint base_index = 0; - for (; base_index < sel_id_ctx->bases_len; base_index++) { - struct EDBMBaseOffset *base_ofs = &sel_id_ctx->base_array_index_offsets[base_index]; - if (base_ofs->face > sel_id) { - elem_id = sel_id - base_ofs->face_start; - elem_type = BM_FACE; - break; - } - if (base_ofs->edge > sel_id) { - elem_id = sel_id - base_ofs->edge_start; - elem_type = BM_EDGE; - break; - } - if (base_ofs->vert > sel_id) { - elem_id = sel_id - base_ofs->vert_start; - elem_type = BM_VERT; - break; - } - } - - if (base_index >= sel_id_ctx->bases_len) { - BLI_assert(0); - return NULL; - } - - if (r_base_index) { - *r_base_index = base_index; - } - - Object *obedit = sel_id_ctx->bases[base_index]->object; - BMEditMesh *em = BKE_editmesh_from_object(obedit); + char elem_type = 0; + bool success = ED_view3d_select_id_elem_get( + sel_id_ctx, sel_id, &elem_id, r_base_index, &elem_type); - switch (elem_type) { - case BM_FACE: - return (BMElem *)BM_face_at_index_find_or_table(em->bm, elem_id); - case BM_EDGE: - return (BMElem *)BM_edge_at_index_find_or_table(em->bm, elem_id); - case BM_VERT: - return (BMElem *)BM_vert_at_index_find_or_table(em->bm, elem_id); - default: - BLI_assert(0); - return NULL; - } -} + if (success) { + Object *obedit = bases[*r_base_index]->object; + BMEditMesh *em = BKE_editmesh_from_object(obedit); -uint EDBM_select_id_context_offset_for_object_elem(const struct EDBMSelectID_Context *sel_id_ctx, - int base_index, - char htype) -{ - struct EDBMBaseOffset *base_ofs = &sel_id_ctx->base_array_index_offsets[base_index]; - if (htype == BM_VERT) { - return base_ofs->vert_start - 1; - } - if (htype == BM_EDGE) { - return base_ofs->edge_start - 1; - } - if (htype == BM_FACE) { - return base_ofs->face_start - 1; + switch (elem_type) { + case SCE_SELECT_FACE: + return (BMElem *)BM_face_at_index_find_or_table(em->bm, elem_id); + case SCE_SELECT_EDGE: + return (BMElem *)BM_edge_at_index_find_or_table(em->bm, elem_id); + case SCE_SELECT_VERTEX: + return (BMElem *)BM_vert_at_index_find_or_table(em->bm, elem_id); + default: + BLI_assert(0); + return NULL; + } } - BLI_assert(0); - return 0; -} -uint EDBM_select_id_context_elem_len(const struct EDBMSelectID_Context *sel_id_ctx) -{ - return sel_id_ctx->base_array_index_len; -} - -struct EDBMSelectID_Context *EDBM_select_id_context_create(ViewContext *vc, - Base **bases, - const uint bases_len, - short select_mode) -{ - struct EDBMSelectID_Context *sel_id_ctx = MEM_mallocN(sizeof(*sel_id_ctx), __func__); - sel_id_ctx->base_array_index_offsets = MEM_mallocN(sizeof(struct EDBMBaseOffset) * bases_len, - __func__); - sel_id_ctx->bases = bases; - sel_id_ctx->bases_len = bases_len; - - edbm_select_pick_draw_bases(sel_id_ctx, vc, select_mode); - - return sel_id_ctx; -} - -void EDBM_select_id_context_destroy(struct EDBMSelectID_Context *sel_id_ctx) -{ - MEM_freeN(sel_id_ctx->base_array_index_offsets); - MEM_freeN(sel_id_ctx); + return NULL; } /** \} */ @@ -480,19 +335,19 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc, { FAKE_SELECT_MODE_BEGIN(vc, fake_select_mode, select_mode, SCE_SELECT_VERTEX); - struct EDBMSelectID_Context *sel_id_ctx = EDBM_select_id_context_create( + struct EDSelectID_Context *sel_id_ctx = ED_view3d_select_id_context_create( vc, bases, bases_len, select_mode); index = ED_select_buffer_find_nearest_to_point(vc->mval, 1, UINT_MAX, &dist_px); if (index) { - eve = (BMVert *)EDBM_select_id_bm_elem_get(sel_id_ctx, index, &base_index); + eve = (BMVert *)EDBM_select_id_bm_elem_get(sel_id_ctx, bases, index, &base_index); } else { eve = NULL; } - EDBM_select_id_context_destroy(sel_id_ctx); + ED_view3d_select_id_context_destroy(sel_id_ctx); FAKE_SELECT_MODE_END(vc, fake_select_mode); } @@ -709,19 +564,19 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc, { FAKE_SELECT_MODE_BEGIN(vc, fake_select_mode, select_mode, SCE_SELECT_EDGE); - struct EDBMSelectID_Context *sel_id_ctx = EDBM_select_id_context_create( + struct EDSelectID_Context *sel_id_ctx = ED_view3d_select_id_context_create( vc, bases, bases_len, select_mode); index = ED_select_buffer_find_nearest_to_point(vc->mval, 1, UINT_MAX, &dist_px); if (index) { - eed = (BMEdge *)EDBM_select_id_bm_elem_get(sel_id_ctx, index, &base_index); + eed = (BMEdge *)EDBM_select_id_bm_elem_get(sel_id_ctx, bases, index, &base_index); } else { eed = NULL; } - EDBM_select_id_context_destroy(sel_id_ctx); + ED_view3d_select_id_context_destroy(sel_id_ctx); FAKE_SELECT_MODE_END(vc, fake_select_mode); } @@ -922,19 +777,19 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc, { FAKE_SELECT_MODE_BEGIN(vc, fake_select_mode, select_mode, SCE_SELECT_FACE); - struct EDBMSelectID_Context *sel_id_ctx = EDBM_select_id_context_create( + struct EDSelectID_Context *sel_id_ctx = ED_view3d_select_id_context_create( vc, bases, bases_len, select_mode); index = ED_select_buffer_sample_point(vc->mval); if (index) { - efa = (BMFace *)EDBM_select_id_bm_elem_get(sel_id_ctx, index, &base_index); + efa = (BMFace *)EDBM_select_id_bm_elem_get(sel_id_ctx, bases, index, &base_index); } else { efa = NULL; } - EDBM_select_id_context_destroy(sel_id_ctx); + ED_view3d_select_id_context_destroy(sel_id_ctx); FAKE_SELECT_MODE_END(vc, fake_select_mode); } diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 97bdb3a7a5d..60de26e6ddc 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -7690,7 +7690,7 @@ static int point_normals_init(bContext *C, wmOperator *op, const wmEvent *UNUSED BKE_editmesh_ensure_autosmooth(em); BKE_editmesh_lnorspace_update(em); - BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm); + BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm, false); op->customdata = lnors_ed_arr; @@ -8247,7 +8247,10 @@ static int normals_split_merge(bContext *C, const bool do_merge) BKE_editmesh_ensure_autosmooth(em); BKE_editmesh_lnorspace_update(em); - BMLoopNorEditDataArray *lnors_ed_arr = do_merge ? BM_loop_normal_editdata_array_init(bm) : NULL; + /* Note that we need temp lnor editing data for all loops of all affected vertices, since by + * setting some faces/edges as smooth we are going to change clnors spaces... See also T65809. */ + BMLoopNorEditDataArray *lnors_ed_arr = do_merge ? BM_loop_normal_editdata_array_init(bm, true) : + NULL; mesh_set_smooth_faces(em, do_merge); @@ -8574,7 +8577,7 @@ static int edbm_normals_tools_exec(bContext *C, wmOperator *op) BKE_editmesh_ensure_autosmooth(em); BKE_editmesh_lnorspace_update(em); - BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm); + BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm, false); BMLoopNorEditData *lnor_ed = lnors_ed_arr->lnor_editdata; float *normal_vector = scene->toolsettings->normal_vector; @@ -8868,7 +8871,7 @@ static int edbm_smoothen_normals_exec(bContext *C, wmOperator *op) BKE_editmesh_ensure_autosmooth(em); BKE_editmesh_lnorspace_update(em); - BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm); + BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm, false); float(*smooth_normal)[3] = MEM_callocN(sizeof(*smooth_normal) * lnors_ed_arr->totloop, __func__); diff --git a/source/blender/editors/mesh/mesh_mirror.c b/source/blender/editors/mesh/mesh_mirror.c index eec0c4a57fa..d76801a2500 100644 --- a/source/blender/editors/mesh/mesh_mirror.c +++ b/source/blender/editors/mesh/mesh_mirror.c @@ -322,7 +322,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, BMVert **vtable = em->bm->vtable; for (a = 1; a <= totvert; a++) { // printf("I %d %ld %d\n", - // (a - last), MirrTopoPairs[a].hash, MirrTopoPairs[a].v_indexs); + // (a - last), MirrTopoPairs[a].hash, MirrTopoPairs[a].v_index); if ((a == totvert) || (topo_pairs[a - 1].hash != topo_pairs[a].hash)) { const int match_count = a - last; if (match_count == 2) { diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index e424d2cc5bf..53bc037c736 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -651,9 +651,9 @@ static bool edit_constraint_poll_generic(bContext *C, StructRNA *rna_type) return 0; } - if (ID_IS_STATIC_OVERRIDE(ob)) { - CTX_wm_operator_poll_msg_set(C, "Cannot edit constraints coming from static override"); - return (((bConstraint *)ptr.data)->flag & CONSTRAINT_STATICOVERRIDE_LOCAL) != 0; + if (ID_IS_OVERRIDE_LIBRARY(ob)) { + CTX_wm_operator_poll_msg_set(C, "Cannot edit constraints coming from library override"); + return (((bConstraint *)ptr.data)->flag & CONSTRAINT_OVERRIDE_LIBRARY_LOCAL) != 0; } return 1; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 8ccd35051c6..4f1154c02e3 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1604,6 +1604,7 @@ static void move_to_collection_menu_create(bContext *UNUSED(C), uiLayout *layout MoveToCollectionData *menu = menu_v; const char *name = BKE_collection_ui_name_get(menu->collection); + UI_block_flag_enable(uiLayoutGetBlock(layout), UI_BLOCK_IS_FLIP); uiItemIntO(layout, name, ICON_NONE, menu->ot->idname, "collection_index", menu->index); uiItemS(layout); diff --git a/source/blender/editors/object/object_gpencil_modifier.c b/source/blender/editors/object/object_gpencil_modifier.c index 383974270f4..5c4fa5aeee6 100644 --- a/source/blender/editors/object/object_gpencil_modifier.c +++ b/source/blender/editors/object/object_gpencil_modifier.c @@ -402,10 +402,10 @@ static int gpencil_edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, return 0; } - if (ID_IS_STATIC_OVERRIDE(ob)) { - CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from static override"); - return (((GpencilModifierData *)ptr.data)->flag & eGpencilModifierFlag_StaticOverride_Local) != - 0; + if (ID_IS_OVERRIDE_LIBRARY(ob)) { + CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from library override"); + return (((GpencilModifierData *)ptr.data)->flag & + eGpencilModifierFlag_OverrideLibrary_Local) != 0; } return 1; diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index d17b6515dbb..b9350052093 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -59,7 +59,7 @@ void OBJECT_OT_vertex_parent_set(struct wmOperatorType *ot); void OBJECT_OT_track_set(struct wmOperatorType *ot); void OBJECT_OT_track_clear(struct wmOperatorType *ot); void OBJECT_OT_make_local(struct wmOperatorType *ot); -void OBJECT_OT_make_override_static(struct wmOperatorType *ot); +void OBJECT_OT_make_override_library(struct wmOperatorType *ot); void OBJECT_OT_make_single_user(struct wmOperatorType *ot); void OBJECT_OT_make_links_scene(struct wmOperatorType *ot); void OBJECT_OT_make_links_data(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 42f819b9f42..08012842c37 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -927,9 +927,9 @@ bool edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_fla return 0; } - if (ID_IS_STATIC_OVERRIDE(ob)) { - CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from static override"); - return (((ModifierData *)ptr.data)->flag & eModifierFlag_StaticOverride_Local) != 0; + if (ID_IS_OVERRIDE_LIBRARY(ob)) { + CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from library override"); + return (((ModifierData *)ptr.data)->flag & eModifierFlag_OverrideLibrary_Local) != 0; } return 1; diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index afc0297cb01..b653c7fa70c 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -78,7 +78,7 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_track_set); WM_operatortype_append(OBJECT_OT_track_clear); WM_operatortype_append(OBJECT_OT_make_local); - WM_operatortype_append(OBJECT_OT_make_override_static); + WM_operatortype_append(OBJECT_OT_make_override_library); WM_operatortype_append(OBJECT_OT_make_single_user); WM_operatortype_append(OBJECT_OT_make_links_scene); WM_operatortype_append(OBJECT_OT_make_links_data); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 1446ea23bb8..42b27d1d255 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -405,7 +405,7 @@ static int make_proxy_exec(bContext *C, wmOperator *op) * will depend on order of bases. * * TODO(sergey): We really need to get rid of this bi-directional links - * in proxies with something like static overrides. + * in proxies with something like library overrides. */ newob->proxy->proxy_from = newob; @@ -2320,7 +2320,7 @@ void OBJECT_OT_make_local(wmOperatorType *ot) ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", ""); } -static void make_override_static_tag_object(Object *obact, Object *ob) +static void make_override_library_tag_object(Object *obact, Object *ob) { if (ob == obact) { return; @@ -2354,17 +2354,17 @@ static void make_override_static_tag_object(Object *obact, Object *ob) } } -static void make_override_static_tag_collections(Collection *collection) +static void make_override_library_tag_collections(Collection *collection) { collection->id.tag |= LIB_TAG_DOIT; for (CollectionChild *coll_child = collection->children.first; coll_child != NULL; coll_child = coll_child->next) { - make_override_static_tag_collections(coll_child->collection); + make_override_library_tag_collections(coll_child->collection); } } /* Set the object to override. */ -static int make_override_static_invoke(bContext *C, wmOperator *op, const wmEvent *event) +static int make_override_library_invoke(bContext *C, wmOperator *op, const wmEvent *event) { Scene *scene = CTX_data_scene(C); Object *obact = ED_object_active_context(C); @@ -2400,12 +2400,12 @@ static int make_override_static_invoke(bContext *C, wmOperator *op, const wmEven /* Error.. cannot continue. */ BKE_report(op->reports, RPT_ERROR, - "Can only make static override for a referenced object or collection"); + "Can only make library override for a referenced object or collection"); return OPERATOR_CANCELLED; } } -static int make_override_static_exec(bContext *C, wmOperator *op) +static int make_override_library_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Object *obact = CTX_data_active_object(C); @@ -2421,10 +2421,10 @@ static int make_override_static_exec(bContext *C, wmOperator *op) Base *base = BLI_findlink(&dup_collection_objects, RNA_enum_get(op->ptr, "object")); obact = base->object; - /* First, we make a static override of the linked collection itself, and all its children. */ - make_override_static_tag_collections(collection); + /* First, we make a library override of the linked collection itself, and all its children. */ + make_override_library_tag_collections(collection); - /* Then, we make static override of the whole set of objects in the Collection. */ + /* Then, we make library override of the whole set of objects in the Collection. */ FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (collection, ob) { ob->id.tag |= LIB_TAG_DOIT; } @@ -2443,7 +2443,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op) } FOREACH_COLLECTION_OBJECT_RECURSIVE_END; - success = BKE_override_static_create_from_tag(bmain); + success = BKE_override_library_create_from_tag(bmain); /* Instantiate our newly overridden objects in scene, if not yet done. */ Scene *scene = CTX_data_scene(C); @@ -2452,7 +2452,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op) BKE_collection_child_add(bmain, scene->master_collection, new_collection); FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (new_collection, new_ob) { - if (new_ob != NULL && new_ob->id.override_static != NULL) { + if (new_ob != NULL && new_ob->id.override_library != NULL) { if ((base = BKE_view_layer_base_find(view_layer, new_ob)) == NULL) { BKE_collection_object_add_from(bmain, scene, obcollection, new_ob); base = BKE_view_layer_base_find(view_layer, new_ob); @@ -2468,10 +2468,10 @@ static int make_override_static_exec(bContext *C, wmOperator *op) } else { /* Disable auto-override tags for non-active objects, will help with performaces... */ - new_ob->id.override_static->flag &= ~STATICOVERRIDE_AUTO; + new_ob->id.override_library->flag &= ~OVERRIDE_LIBRARY_AUTO; } /* We still want to store all objects' current override status (i.e. change of parent). */ - BKE_override_static_operations_create(bmain, &new_ob->id, true); + BKE_override_library_operations_create(bmain, &new_ob->id, true); } } FOREACH_COLLECTION_OBJECT_RECURSIVE_END; @@ -2496,10 +2496,10 @@ static int make_override_static_exec(bContext *C, wmOperator *op) obact->id.tag |= LIB_TAG_DOIT; for (Object *ob = bmain->objects.first; ob != NULL; ob = ob->id.next) { - make_override_static_tag_object(obact, ob); + make_override_library_tag_object(obact, ob); } - success = BKE_override_static_create_from_tag(bmain); + success = BKE_override_library_create_from_tag(bmain); /* Also, we'd likely want to lock by default things like * transformations of implicitly overridden objects? */ @@ -2510,7 +2510,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op) } /* TODO: probably more cases where we want to do automated smart things in the future! */ else { - success = (BKE_override_static_create_from_id(bmain, &obact->id) != NULL); + success = (BKE_override_library_create_from_id(bmain, &obact->id) != NULL); } WM_event_add_notifier(C, NC_WINDOW, NULL); @@ -2518,28 +2518,28 @@ static int make_override_static_exec(bContext *C, wmOperator *op) return success ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } -static bool make_override_static_poll(bContext *C) +static bool make_override_library_poll(bContext *C) { Object *obact = CTX_data_active_object(C); /* Object must be directly linked to be overridable. */ - return (BKE_override_static_is_enabled() && ED_operator_objectmode(C) && obact != NULL && + return (BKE_override_library_is_enabled() && ED_operator_objectmode(C) && obact != NULL && ((ID_IS_LINKED(obact) && obact->id.tag & LIB_TAG_EXTERN) || (!ID_IS_LINKED(obact) && obact->instance_collection != NULL && ID_IS_LINKED(obact->instance_collection)))); } -void OBJECT_OT_make_override_static(wmOperatorType *ot) +void OBJECT_OT_make_override_library(wmOperatorType *ot) { /* identifiers */ - ot->name = "Make Static Override"; - ot->description = "Make local override of this library linked data-block"; - ot->idname = "OBJECT_OT_make_override_static"; + ot->name = "Make Library Override"; + ot->description = "Make a local override of this library linked data-block"; + ot->idname = "OBJECT_OT_make_override_library"; /* api callbacks */ - ot->invoke = make_override_static_invoke; - ot->exec = make_override_static_exec; - ot->poll = make_override_static_poll; + ot->invoke = make_override_library_invoke; + ot->exec = make_override_library_exec; + ot->poll = make_override_library_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/object/object_shader_fx.c b/source/blender/editors/object/object_shader_fx.c index f4f944459f7..6212269c099 100644 --- a/source/blender/editors/object/object_shader_fx.c +++ b/source/blender/editors/object/object_shader_fx.c @@ -310,9 +310,9 @@ static bool edit_shaderfx_poll_generic(bContext *C, StructRNA *rna_type, int obt return 0; } - if (ID_IS_STATIC_OVERRIDE(ob)) { - CTX_wm_operator_poll_msg_set(C, "Cannot edit shaderfxs coming from static override"); - return (((ShaderFxData *)ptr.data)->flag & eShaderFxFlag_StaticOverride_Local) != 0; + if (ID_IS_OVERRIDE_LIBRARY(ob)) { + CTX_wm_operator_poll_msg_set(C, "Cannot edit shaderfxs coming from library override"); + return (((ShaderFxData *)ptr.data)->flag & eShaderFxFlag_OverrideLibrary_Local) != 0; } return 1; diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 2e958385a60..678f6f50096 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -59,6 +59,7 @@ #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" +#include "DEG_depsgraph_query.h" #include "DNA_armature_types.h" #include "RNA_access.h" @@ -1314,7 +1315,7 @@ static void getVerticalAndHorizontalChange(const float norm[3], * coord is a point on the plane */ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph, - Scene *scene, + Scene *UNUSED(scene), Object *ob, Mesh *me, int index, @@ -1325,10 +1326,15 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph, float strength, float cp) { + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + Object *object_eval = DEG_get_evaluated_object(depsgraph, ob); + Mesh *mesh_eval = (Mesh *)object_eval->data; + Mesh *me_deform; - MDeformWeight *dw; + MDeformWeight *dw, *dw_eval; MVert m; MDeformVert *dvert = me->dvert + index; + MDeformVert *dvert_eval = mesh_eval->dvert + index; int totweight = dvert->totweight; float oldw = 0; float oldPos[3] = {0}; @@ -1349,7 +1355,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph, float originalDistToBe = distToBe; do { wasChange = false; - me_deform = mesh_get_eval_deform(depsgraph, scene, ob, &CD_MASK_BAREMESH); + me_deform = mesh_get_eval_deform(depsgraph, scene_eval, object_eval, &CD_MASK_BAREMESH); m = me_deform->mvert[index]; copy_v3_v3(oldPos, m.co); distToStart = dot_v3v3(norm, oldPos) + d; @@ -1360,6 +1366,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph, for (i = 0; i < totweight; i++) { dwIndices[i] = i; dw = (dvert->dw + i); + dw_eval = (dvert_eval->dw + i); vc = hc = 0; if (!dw->weight) { changes[i][0] = 0; @@ -1371,7 +1378,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph, if (me_deform) { /* DO NOT try to do own cleanup here, this is call for dramatic failures and bugs! * Better to over-free and recompute a bit. */ - BKE_object_free_derived_caches(ob); + BKE_object_free_derived_caches(object_eval); } oldw = dw->weight; if (k) { @@ -1389,11 +1396,13 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph, if (dw->weight > 1) { dw->weight = 1; } - me_deform = mesh_get_eval_deform(depsgraph, scene, ob, &CD_MASK_BAREMESH); + dw_eval->weight = dw->weight; + me_deform = mesh_get_eval_deform(depsgraph, scene_eval, object_eval, &CD_MASK_BAREMESH); m = me_deform->mvert[index]; getVerticalAndHorizontalChange( norm, d, coord, oldPos, distToStart, m.co, changes, dists, i); dw->weight = oldw; + dw_eval->weight = oldw; if (!k) { vc = changes[i][0]; hc = changes[i][1]; @@ -1488,7 +1497,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph, if (me_deform) { /* DO NOT try to do own cleanup here, this is call for dramatic failures and bugs! * Better to over-free and recompute a bit. */ - BKE_object_free_derived_caches(ob); + BKE_object_free_derived_caches(object_eval); } } } while (wasChange && ((distToStart - distToBe) / fabsf(distToStart - distToBe) == @@ -1503,9 +1512,11 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph, /* this is used to try to smooth a surface by only adjusting the nonzero weights of a vertex * but it could be used to raise or lower an existing 'bump.' */ static void vgroup_fix( - const bContext *C, Scene *scene, Object *ob, float distToBe, float strength, float cp) + const bContext *C, Scene *UNUSED(scene), Object *ob, float distToBe, float strength, float cp) { Depsgraph *depsgraph = CTX_data_depsgraph(C); + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + Object *object_eval = DEG_get_evaluated_object(depsgraph, ob); int i; Mesh *me = ob->data; @@ -1522,7 +1533,8 @@ static void vgroup_fix( MVert *p = MEM_callocN(sizeof(MVert) * (count), "deformedPoints"); int k; - Mesh *me_deform = mesh_get_eval_deform(depsgraph, scene, ob, &CD_MASK_BAREMESH); + Mesh *me_deform = mesh_get_eval_deform( + depsgraph, scene_eval, object_eval, &CD_MASK_BAREMESH); k = count; while (k--) { p[k] = me_deform->mvert[verts[k]]; @@ -1540,7 +1552,7 @@ static void vgroup_fix( d = -dot_v3v3(norm, coord); /* dist = (dot_v3v3(norm, m.co) + d); */ /* UNUSED */ moveCloserToDistanceFromPlane( - depsgraph, scene, ob, me, i, norm, coord, d, distToBe, strength, cp); + depsgraph, scene_eval, object_eval, me, i, norm, coord, d, distToBe, strength, cp); } } diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index dc634865a0a..7506ad37908 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -778,6 +778,7 @@ static void foreach_mouse_hit_key_iter(void *__restrict iter_data_v, } ParticleSystem *psys = edit->psys; ParticleSystemModifierData *psmd_eval = iter_data->edit->psmd_eval; + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); ParticleEditSettings *pset = PE_settings(data->scene); const int selected = iter_data->selected; float mat[4][4], imat[4][4]; @@ -793,7 +794,7 @@ static void foreach_mouse_hit_key_iter(void *__restrict iter_data_v, if (key_inside_circle(data, data->rad, KEY_WCO, &mouse_distance)) { if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) { psys_mat_hair_to_global( - data->ob, psmd_eval->mesh_final, psys->part->from, psys->particles + iter, mat); + data->ob, mesh_final, psys->part->from, psys->particles + iter, mat); invert_m4_m4(imat, mat); } iter_data->func(data, mat, imat, iter, point->totkey - 1, key, mouse_distance); @@ -812,7 +813,7 @@ static void foreach_mouse_hit_key_iter(void *__restrict iter_data_v, if (key_inside_circle(data, data->rad, KEY_WCO, &mouse_distance)) { if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) { psys_mat_hair_to_global( - data->ob, psmd_eval->mesh_final, psys->part->from, psys->particles + iter, mat); + data->ob, mesh_final, psys->part->from, psys->particles + iter, mat); invert_m4_m4(imat, mat); } iter_data->func(data, mat, imat, iter, k, key, mouse_distance); @@ -927,7 +928,9 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys) psmd_eval = edit->psmd_eval; totpart = psys->totpart; - if (!psmd_eval->mesh_final) { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); + + if (!mesh_final) { return; } @@ -937,7 +940,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys) LOOP_PARTICLES { key = pa->hair; - psys_mat_hair_to_orco(ob, psmd_eval->mesh_final, psys->part->from, pa, mat); + psys_mat_hair_to_orco(ob, mesh_final, psys->part->from, pa, mat); copy_v3_v3(co, key->co); mul_m4_v3(mat, co); BLI_kdtree_3d_insert(tree, p, co); @@ -953,7 +956,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys) LOOP_PARTICLES { key = pa->hair; - psys_mat_hair_to_orco(ob, psmd_eval->mesh_final, psys->part->from, pa, mat); + psys_mat_hair_to_orco(ob, mesh_final, psys->part->from, pa, mat); copy_v3_v3(co, key->co); mul_m4_v3(mat, co); co[0] = -co[0]; @@ -1084,8 +1087,9 @@ static void PE_apply_mirror(Object *ob, ParticleSystem *psys) edit = psys->edit; psmd_eval = edit->psmd_eval; + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); - if (!psmd_eval->mesh_final) { + if (!mesh_final) { return; } @@ -1102,7 +1106,7 @@ static void PE_apply_mirror(Object *ob, ParticleSystem *psys) LOOP_POINTS { if (point->flag & PEP_EDIT_RECALC) { - PE_mirror_particle(ob, psmd_eval->mesh_final, psys, psys->particles + p, NULL); + PE_mirror_particle(ob, mesh_final, psys, psys->particles + p, NULL); if (edit->mirror_cache[p] != -1) { edit->points[edit->mirror_cache[p]].flag &= ~PEP_EDIT_RECALC; @@ -1152,8 +1156,8 @@ static void deflect_emitter_iter(void *__restrict iter_data_v, float *vec, *nor, dvec[3], dot, dist_1st = 0.0f; const float dist = iter_data->dist; const float emitterdist = iter_data->emitterdist; - psys_mat_hair_to_object( - object, psmd_eval->mesh_final, psys->part->from, psys->particles + iter, hairmat); + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); + psys_mat_hair_to_object(object, mesh_final, psys->part->from, psys->particles + iter, hairmat); LOOP_KEYS { @@ -1217,7 +1221,8 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit) psys = edit->psys; - if (!edit->psmd_eval->mesh_final) { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(edit->psmd_eval); + if (!mesh_final) { return; } @@ -1382,7 +1387,7 @@ void recalc_lengths(PTCacheEdit *edit) void recalc_emitter_field(Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), ParticleSystem *psys) { PTCacheEdit *edit = psys->edit; - Mesh *mesh = edit->psmd_eval->mesh_final; + Mesh *mesh = BKE_particle_modifier_mesh_final_get(edit->psmd_eval); float *vec, *nor; int i, totface /*, totvert*/; @@ -1489,15 +1494,16 @@ void update_world_cos(Depsgraph *UNUSED(depsgraph), Object *ob, PTCacheEdit *edi KEY_K; float hairmat[4][4]; - if (psys == 0 || psys->edit == 0 || psmd_eval->mesh_final == NULL) { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); + + if (psys == 0 || psys->edit == 0 || mesh_final == NULL) { return; } LOOP_POINTS { if (!(psys->flag & PSYS_GLOBAL_HAIR)) { - psys_mat_hair_to_global( - ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, hairmat); + psys_mat_hair_to_global(ob, mesh_final, psys->part->from, psys->particles + p, hairmat); } LOOP_KEYS @@ -2269,11 +2275,12 @@ int PE_lasso_select(bContext *C, const int mcords[][2], const short moves, const data.is_changed |= PE_deselect_all_visible_ex(edit); } + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); + LOOP_VISIBLE_POINTS { if (edit->psys && !(psys->flag & PSYS_GLOBAL_HAIR)) { - psys_mat_hair_to_global( - ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, mat); + psys_mat_hair_to_global(ob, mesh_final, psys->part->from, psys->particles + p, mat); } if (pset->selectmode == SCE_SELECT_POINT) { @@ -2739,10 +2746,11 @@ static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror) if (mirror) { /* mirror tags */ psmd_eval = edit->psmd_eval; + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); LOOP_TAGGED_POINTS { - PE_mirror_particle(ob, psmd_eval->mesh_final, psys, psys->particles + p, NULL); + PE_mirror_particle(ob, mesh_final, psys, psys->particles + p, NULL); } } @@ -2831,12 +2839,13 @@ static void remove_tagged_keys(Depsgraph *depsgraph, Object *ob, ParticleSystem ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys); ParticleSystemModifierData *psmd_eval = (ParticleSystemModifierData *)modifier_get_evaluated( depsgraph, ob, &psmd->modifier); + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); LOOP_POINTS { LOOP_TAGGED_KEYS { - PE_mirror_particle(ob, psmd_eval->mesh_final, psys, psys->particles + p, NULL); + PE_mirror_particle(ob, mesh_final, psys, psys->particles + p, NULL); break; } } @@ -3063,6 +3072,8 @@ static int remove_doubles_exec(bContext *C, wmOperator *op) psmd_eval = edit->psmd_eval; totremoved = 0; + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); + do { removed = 0; @@ -3071,8 +3082,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op) /* insert particles into kd tree */ LOOP_SELECTED_POINTS { - psys_mat_hair_to_object( - ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, mat); + psys_mat_hair_to_object(ob, mesh_final, psys->part->from, psys->particles + p, mat); copy_v3_v3(co, point->keys->co); mul_m4_v3(mat, co); BLI_kdtree_3d_insert(tree, p, co); @@ -3083,8 +3093,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op) /* tag particles to be removed */ LOOP_SELECTED_POINTS { - psys_mat_hair_to_object( - ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, mat); + psys_mat_hair_to_object(ob, mesh_final, psys->part->from, psys->particles + p, mat); copy_v3_v3(co, point->keys->co); mul_m4_v3(mat, co); @@ -3347,20 +3356,22 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged) } psmd_eval = edit->psmd_eval; - if (!psmd_eval->mesh_final) { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); + Mesh *mesh_original = BKE_particle_modifier_mesh_original_get(psmd_eval); + + if (!mesh_final) { return; } const bool use_dm_final_indices = (psys->part->use_modifier_stack && - !psmd_eval->mesh_final->runtime.deformed_only); + !mesh_final->runtime.deformed_only); /* NOTE: this is not nice to use tessfaces but hard to avoid since pa->num uses tessfaces */ BKE_mesh_tessface_ensure(me); /* NOTE: In case psys uses Mesh tessface indices, we mirror final Mesh itself, not orig mesh. * Avoids an (impossible) mesh -> orig -> mesh tessface indices conversion. */ - mirrorfaces = mesh_get_x_mirror_faces( - ob, NULL, use_dm_final_indices ? psmd_eval->mesh_final : NULL); + mirrorfaces = mesh_get_x_mirror_faces(ob, NULL, use_dm_final_indices ? mesh_final : NULL); if (!edit->mirror_cache) { PE_update_mirror_cache(ob, psys); @@ -3376,7 +3387,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged) if (point_is_selected(point)) { if (edit->mirror_cache[p] != -1) { /* already has a mirror, don't need to duplicate */ - PE_mirror_particle(ob, psmd_eval->mesh_final, psys, pa, NULL); + PE_mirror_particle(ob, mesh_final, psys, pa, NULL); continue; } else { @@ -3391,7 +3402,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged) } if (newtotpart != psys->totpart) { - MFace *mtessface = use_dm_final_indices ? psmd_eval->mesh_final->mface : me->mface; + MFace *mtessface = use_dm_final_indices ? mesh_final->mface : me->mface; /* allocate new arrays and copy existing */ new_pars = MEM_callocN(newtotpart * sizeof(ParticleData), "ParticleData new"); @@ -3467,7 +3478,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged) } else { newpa->num_dmcache = psys_particle_dm_face_lookup( - psmd_eval->mesh_final, psmd_eval->mesh_original, newpa->num, newpa->fuv, NULL); + mesh_final, mesh_original, newpa->num, newpa->fuv, NULL); } /* update edit key pointers */ @@ -3478,7 +3489,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged) } /* map key positions as mirror over x axis */ - PE_mirror_particle(ob, psmd_eval->mesh_final, psys, pa, newpa); + PE_mirror_particle(ob, mesh_final, psys, pa, newpa); newpa++; newpoint++; @@ -4157,19 +4168,18 @@ static void brush_add_count_iter(void *__restrict iter_data_v, 0, 0, 0)) { - if (psys->part->use_modifier_stack && !psmd_eval->mesh_final->runtime.deformed_only) { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); + Mesh *mesh_original = BKE_particle_modifier_mesh_original_get(psmd_eval); + if (psys->part->use_modifier_stack && !mesh_final->runtime.deformed_only) { add_pars[iter].num = add_pars[iter].num_dmcache; add_pars[iter].num_dmcache = DMCACHE_ISCHILD; } - else if (iter_data->mesh == psmd_eval->mesh_original) { + else if (iter_data->mesh == mesh_original) { /* Final DM is not same topology as orig mesh, * we have to map num_dmcache to real final dm. */ add_pars[iter].num = add_pars[iter].num_dmcache; - add_pars[iter].num_dmcache = psys_particle_dm_face_lookup(psmd_eval->mesh_final, - psmd_eval->mesh_original, - add_pars[iter].num, - add_pars[iter].fuv, - NULL); + add_pars[iter].num_dmcache = psys_particle_dm_face_lookup( + mesh_final, mesh_original, add_pars[iter].num, add_pars[iter].fuv, NULL); } else { add_pars[iter].num = add_pars[iter].num_dmcache; @@ -4227,11 +4237,12 @@ static int brush_add(const bContext *C, PEData *data, short number) timestep = psys_get_timestep(&sim); - if (psys->part->use_modifier_stack || psmd_eval->mesh_final->runtime.deformed_only) { - mesh = psmd_eval->mesh_final; + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); + if (psys->part->use_modifier_stack || mesh_final->runtime.deformed_only) { + mesh = mesh_final; } else { - mesh = psmd_eval->mesh_original; + mesh = BKE_particle_modifier_mesh_original_get(psmd_eval); } BLI_assert(mesh); @@ -4315,7 +4326,7 @@ static int brush_add(const bContext *C, PEData *data, short number) tree = BLI_kdtree_3d_new(psys->totpart); for (i = 0, pa = psys->particles; i < totpart; i++, pa++) { - psys_particle_on_dm(psmd_eval->mesh_final, + psys_particle_on_dm(mesh_final, psys->part->from, pa->num, pa->num_dmcache, @@ -4372,7 +4383,7 @@ static int brush_add(const bContext *C, PEData *data, short number) int w, maxw; float maxd, totw = 0.0, weight[3]; - psys_particle_on_dm(psmd_eval->mesh_final, + psys_particle_on_dm(mesh_final, psys->part->from, pa->num, pa->num_dmcache, @@ -4450,7 +4461,7 @@ static int brush_add(const bContext *C, PEData *data, short number) } } for (k = 0, hkey = pa->hair; k < pset->totaddkey; k++, hkey++) { - psys_mat_hair_to_global(ob, psmd_eval->mesh_final, psys->part->from, pa, hairmat); + psys_mat_hair_to_global(ob, mesh_final, psys->part->from, pa, hairmat); invert_m4_m4(imat, hairmat); mul_m4_v3(imat, hkey->co); } @@ -4651,7 +4662,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) } case PE_BRUSH_PUFF: { if (edit->psys) { - data.mesh = psmd_eval->mesh_final; + data.mesh = BKE_particle_modifier_mesh_final_get(psmd_eval); data.mval = mval; data.rad = pe_brush_size_get(scene, brush); data.select = selected; @@ -4708,7 +4719,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) } case PE_BRUSH_WEIGHT: { if (edit->psys) { - data.mesh = psmd_eval->mesh_final; + data.mesh = BKE_particle_modifier_mesh_final_get(psmd_eval); data.mval = mval; data.rad = pe_brush_size_get(scene, brush); @@ -5082,8 +5093,8 @@ int PE_minmax(Scene *scene, ViewLayer *view_layer, float min[3], float max[3]) LOOP_VISIBLE_POINTS { if (psys) { - psys_mat_hair_to_global( - ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, mat); + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); + psys_mat_hair_to_global(ob, mesh_final, psys->part->from, psys->particles + p, mat); } LOOP_SELECTED_KEYS @@ -5124,7 +5135,8 @@ void PE_create_particle_edit( } /* no psmd->dm happens in case particle system modifier is not enabled */ - if (!(psys && psmd && psmd_eval->mesh_final) && !cache) { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); + if (!(psys && psmd && mesh_final) && !cache) { return; } diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index b03ec56c7e4..d85bf72851d 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -620,6 +620,7 @@ static void disconnect_hair(Depsgraph *depsgraph, Scene *scene, Object *ob, Part edit = psys->edit; point = edit ? edit->points : NULL; + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); for (i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) { if (point) { @@ -627,7 +628,7 @@ static void disconnect_hair(Depsgraph *depsgraph, Scene *scene, Object *ob, Part point++; } - psys_mat_hair_to_global(ob, psmd_eval->mesh_final, psys->part->from, pa, hairmat); + psys_mat_hair_to_global(ob, mesh_final, psys->part->from, pa, hairmat); for (k = 0, key = pa->hair; k < pa->totkey; k++, key++) { mul_m4_v3(hairmat, key->co); @@ -725,7 +726,8 @@ static bool remap_hair_emitter(Depsgraph *depsgraph, float from_ob_imat[4][4], to_ob_imat[4][4]; float from_imat[4][4], to_imat[4][4]; - if (!target_psmd->mesh_final) { + Mesh *target_mesh_final = BKE_particle_modifier_mesh_final_get(target_psmd); + if (!target_mesh_final) { return false; } if (!psys->part || psys->part->type != PART_HAIR) { @@ -742,14 +744,14 @@ static bool remap_hair_emitter(Depsgraph *depsgraph, invert_m4_m4(from_imat, from_mat); invert_m4_m4(to_imat, to_mat); - if (target_psmd->mesh_final->runtime.deformed_only) { + if (target_mesh_final->runtime.deformed_only) { /* we don't want to mess up target_psmd->dm when converting to global coordinates below */ - mesh = target_psmd->mesh_final; + mesh = target_mesh_final; } else { - mesh = target_psmd->mesh_original; + mesh = BKE_particle_modifier_mesh_original_get(target_psmd); } - target_mesh = target_psmd->mesh_final; + target_mesh = target_mesh_final; if (mesh == NULL) { return false; } @@ -1155,10 +1157,13 @@ static bool copy_particle_systems_to_object(const bContext *C, modifier_unique_name(&ob_to->modifiers, (ModifierData *)psmd); psmd->psys = psys; - BKE_id_copy_ex(NULL, &final_mesh->id, (ID **)&psmd->mesh_final, LIB_ID_COPY_LOCALIZE); - BKE_mesh_calc_normals(psmd->mesh_final); - BKE_mesh_tessface_ensure(psmd->mesh_final); + /* TODO(sergey): This should probably be accessing evaluated psmd. */ + ParticleSystemModifierDataRuntime *runtime = BKE_particle_modifier_runtime_ensure(psmd); + BKE_id_copy_ex(NULL, &final_mesh->id, (ID **)&runtime->mesh_final, LIB_ID_COPY_LOCALIZE); + + BKE_mesh_calc_normals(runtime->mesh_final); + BKE_mesh_tessface_ensure(runtime->mesh_final); if (psys_from->edit) { copy_particle_edit(depsgraph, scene, ob_to, psys, psys_from); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 110dc7aaaf1..72e6c6fdf03 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -331,6 +331,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f); GPU_clear(GPU_COLOR_BIT | GPU_DEPTH_BIT); + GPU_matrix_reset(); wmOrtho2(0, scene->r.xsch, 0, scene->r.ysch); GPU_matrix_translate_2f(scene->r.xsch / 2, scene->r.ysch / 2); diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 6a5df8a3776..2eb7f732534 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -104,7 +104,11 @@ const char *screen_context_dir[] = { "active_gpencil_layer", "active_gpencil_frame", "active_operator", + "visible_fcurves", + "editable_fcurves", + "selected_visible_fcurves", "selected_editable_fcurves", + "active_editable_fcurve", NULL, }; @@ -654,23 +658,31 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult return 1; } } - else if (CTX_data_equals(member, "selected_editable_fcurves")) { + else if (CTX_data_equals(member, "editable_fcurves") || + CTX_data_equals(member, "visible_fcurves") || + CTX_data_equals(member, "selected_editable_fcurves") || + CTX_data_equals(member, "selected_visible_fcurves")) { bAnimContext ac; if (ANIM_animdata_get_context(C, &ac) && ELEM(ac.spacetype, SPACE_ACTION, SPACE_GRAPH)) { - bAnimListElem *ale; ListBase anim_data = {NULL, NULL}; - int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS | - ANIMFILTER_SEL) | + int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_NODUPLIS) | (ac.spacetype == SPACE_GRAPH ? ANIMFILTER_CURVE_VISIBLE : ANIMFILTER_LIST_VISIBLE); + if (strstr(member, "editable_")) { + filter |= ANIMFILTER_FOREDIT; + } + if (STRPREFIX(member, "selected_")) { + filter |= ANIMFILTER_SEL; + } + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); - for (ale = anim_data.first; ale; ale = ale->next) { - if (ale->type == ANIMTYPE_FCURVE) { - CTX_data_list_add(result, ale->id, &RNA_FCurve, ale->data); + for (bAnimListElem *ale = anim_data.first; ale; ale = ale->next) { + if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) { + CTX_data_list_add(result, ale->fcurve_owner_id, &RNA_FCurve, ale->data); } } @@ -680,6 +692,28 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult return 1; } } + else if (CTX_data_equals(member, "active_editable_fcurve")) { + bAnimContext ac; + + if (ANIM_animdata_get_context(C, &ac) && ELEM(ac.spacetype, SPACE_GRAPH)) { + ListBase anim_data = {NULL, NULL}; + + int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ACTIVE | ANIMFILTER_FOREDIT | + ANIMFILTER_CURVE_VISIBLE); + + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + for (bAnimListElem *ale = anim_data.first; ale; ale = ale->next) { + if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) { + CTX_data_pointer_set(result, ale->fcurve_owner_id, &RNA_FCurve, ale->data); + break; + } + } + + ANIM_animdata_freelist(&anim_data); + return 1; + } + } else { return 0; /* not found */ } diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c index 9fcd0e5295c..6030b6fded5 100644 --- a/source/blender/editors/screen/workspace_edit.c +++ b/source/blender/editors/screen/workspace_edit.c @@ -376,6 +376,9 @@ static int workspace_append_activate_exec(bContext *C, wmOperator *op) BLI_assert(appended_workspace != NULL); if (appended_workspace) { + /* Set defaults. */ + BLO_update_defaults_workspace(appended_workspace, NULL); + /* Reorder to last position. */ BKE_id_reorder(&bmain->workspaces, &appended_workspace->id, NULL, true); diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 4287feed92c..e66e1c49685 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -33,8 +33,8 @@ #include "BKE_pbvh.h" -struct Main; struct KeyBlock; +struct Main; struct Object; struct SculptOrigVertData; struct SculptUndoNode; diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 9b0150d731d..129f249d7d0 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -510,7 +510,7 @@ static void buttons_area_listener(wmWindow *UNUSED(win), case NC_GPENCIL: switch (wmn->data) { case ND_DATA: - if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED)) { + if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED, NA_SELECTED)) { ED_area_tag_redraw(sa); } break; diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 6b3baa1e766..9bdea13276b 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -478,7 +478,14 @@ static void file_draw_preview(uiBlock *block, GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); if (icon) { - UI_icon_draw_ex((float)xco, (float)yco, icon, icon_aspect, 1.0f, 0.0f, NULL, false); + UI_icon_draw_ex((float)xco + (7 * UI_DPI_FAC), + (float)yco + (7 * UI_DPI_FAC), + icon, + icon_aspect, + 1.0f, + 0.0f, + NULL, + false); } /* border */ diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index fab3cfbb69d..faaecd975a3 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -786,8 +786,10 @@ void ED_fileselect_exit(wmWindowManager *wm, ScrArea *sa, SpaceFile *sfile) } } -/** Helper used by both main update code, and smoothscroll timer, - * to try to enable rename editing from #FileSelectParams.renamefile name. */ +/** + * Helper used by both main update code, and smooth-scroll timer, + * to try to enable rename editing from #FileSelectParams.renamefile name. + */ void file_params_renamefile_activate(SpaceFile *sfile, FileSelectParams *params) { BLI_assert(params->rename_flag != 0); diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index cdb5e672f4a..c727c5225c9 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -904,7 +904,7 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, DriverVar *dvar; PointerRNA driver_ptr; - uiLayout *col, *row; + uiLayout *col, *row, *row_outer; uiBlock *block; uiBut *but; @@ -957,7 +957,7 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, else if (!BKE_driver_has_simple_expression(driver)) { if ((G.f & G_FLAG_SCRIPT_AUTOEXEC) == 0) { /* TODO: Add button to enable? */ - uiItemL(col, TIP_("WARNING: Python expressions limited for security"), ICON_ERROR); + uiItemL(col, TIP_("Python restricted for security"), ICON_ERROR); } else { uiItemL(col, TIP_("Slow Python expression"), ICON_INFO); @@ -1005,61 +1005,41 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, uiItemS(layout); /* add/copy/paste driver variables */ - if (is_popover) { - /* add driver variable - add blank */ - row = uiLayoutRow(layout, true); - block = uiLayoutGetBlock(row); - but = uiDefIconTextBut( - block, - UI_BTYPE_BUT, - B_IPO_DEPCHANGE, - ICON_ADD, - IFACE_("Add Input Variable"), - 0, - 0, - 10 * UI_UNIT_X, - UI_UNIT_Y, - NULL, - 0.0, - 0.0, - 0, - 0, - TIP_("Add a Driver Variable to keep track an input used by the driver")); - UI_but_func_set(but, driver_add_var_cb, driver, NULL); + row_outer = uiLayoutRow(layout, false); + /* add driver variable - add blank */ + row = uiLayoutRow(row_outer, true); + block = uiLayoutGetBlock(row); + but = uiDefIconTextBut( + block, + UI_BTYPE_BUT, + B_IPO_DEPCHANGE, + ICON_ADD, + IFACE_("Add Input Variable"), + 0, + 0, + 10 * UI_UNIT_X, + UI_UNIT_Y, + NULL, + 0.0, + 0.0, + 0, + 0, + TIP_("Add a Driver Variable to keep track of an input used by the driver")); + UI_but_func_set(but, driver_add_var_cb, driver, NULL); + + if (is_popover) { /* add driver variable - add using eyedropper */ /* XXX: will this operator work like this? */ uiItemO(row, "", ICON_EYEDROPPER, "UI_OT_eyedropper_driver"); } - else { - /* add driver variable */ - row = uiLayoutRow(layout, false); - block = uiLayoutGetBlock(row); - but = uiDefIconTextBut(block, - UI_BTYPE_BUT, - B_IPO_DEPCHANGE, - ICON_ADD, - IFACE_("Add Input Variable"), - 0, - 0, - 10 * UI_UNIT_X, - UI_UNIT_Y, - NULL, - 0.0, - 0.0, - 0, - 0, - TIP_("Driver variables ensure that all dependencies will be accounted " - "for, ensuring that drivers will update correctly")); - UI_but_func_set(but, driver_add_var_cb, driver, NULL); - /* copy/paste (as sub-row) */ - row = uiLayoutRow(row, true); - block = uiLayoutGetBlock(row); + /* copy/paste (as sub-row) */ + row = uiLayoutRow(row_outer, true); + block = uiLayoutGetBlock(row); - uiItemO(row, "", ICON_COPYDOWN, "GRAPH_OT_driver_variables_copy"); - uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_driver_variables_paste"); - } + uiItemO(row, "", ICON_COPYDOWN, "GRAPH_OT_driver_variables_copy"); + uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_driver_variables_paste"); /* loop over targets, drawing them */ for (dvar = driver->variables.first; dvar; dvar = dvar->next) { @@ -1280,6 +1260,10 @@ static void graph_panel_drivers_popover(const bContext *C, Panel *pa) if (fcu && fcu->driver) { ID *id = ptr.id.data; + PointerRNA ptr_fcurve; + RNA_pointer_create(id, &RNA_FCurve, fcu, &ptr_fcurve); + uiLayoutSetContextPointer(layout, "active_editable_fcurve", &ptr_fcurve); + /* Driven Property Settings */ uiItemL(layout, IFACE_("Driven Property:"), ICON_NONE); graph_draw_driven_property_panel(pa->layout, id, fcu); diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index b68efdc0ea0..dc5837e3fd1 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -2995,29 +2995,15 @@ void GRAPH_OT_fmodifier_paste(wmOperatorType *ot) static int graph_driver_vars_copy_exec(bContext *C, wmOperator *op) { - bAnimContext ac; - bAnimListElem *ale; bool ok = false; - /* get editor data */ - if (ANIM_animdata_get_context(C, &ac) == 0) { - return OPERATOR_CANCELLED; - } - - /* clear buffer first */ - ANIM_driver_vars_copybuf_free(); - - /* get the active F-Curve */ - ale = get_active_fcurve_channel(&ac); + PointerRNA ptr = CTX_data_pointer_get_type(C, "active_editable_fcurve", &RNA_FCurve); /* if this exists, call the copy driver vars API function */ - if (ale && ale->data) { - FCurve *fcu = (FCurve *)ale->data; + FCurve *fcu = (FCurve *)ptr.data; + if (fcu) { ok = ANIM_driver_vars_copy(op->reports, fcu); - - /* free temp data now */ - MEM_freeN(ale); } /* successful or not? */ @@ -3034,11 +3020,11 @@ void GRAPH_OT_driver_variables_copy(wmOperatorType *ot) /* identifiers */ ot->name = "Copy Driver Variables"; ot->idname = "GRAPH_OT_driver_variables_copy"; - ot->description = "Copy the driver variables of the active F-Curve"; + ot->description = "Copy the driver variables of the active driver"; /* api callbacks */ ot->exec = graph_driver_vars_copy_exec; - ot->poll = graphop_active_fcurve_poll; + ot->poll = graphop_active_editable_fcurve_ctx_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -3048,34 +3034,18 @@ void GRAPH_OT_driver_variables_copy(wmOperatorType *ot) static int graph_driver_vars_paste_exec(bContext *C, wmOperator *op) { - bAnimContext ac; - - ListBase anim_data = {NULL, NULL}; - bAnimListElem *ale; - int filter; - const bool replace = RNA_boolean_get(op->ptr, "replace"); bool ok = false; - /* get editor data */ - if (ANIM_animdata_get_context(C, &ac) == 0) { - return OPERATOR_CANCELLED; - } + PointerRNA ptr = CTX_data_pointer_get_type(C, "active_editable_fcurve", &RNA_FCurve); - /* filter data */ - filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ACTIVE | ANIMFILTER_FOREDIT | - ANIMFILTER_NODUPLIS); - ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + /* if this exists, call the paste driver vars API function */ + FCurve *fcu = (FCurve *)ptr.data; - /* paste variables */ - for (ale = anim_data.first; ale; ale = ale->next) { - FCurve *fcu = (FCurve *)ale->data; - ok |= ANIM_driver_vars_paste(op->reports, fcu, replace); + if (fcu) { + ok = ANIM_driver_vars_paste(op->reports, fcu, replace); } - /* cleanup */ - ANIM_animdata_freelist(&anim_data); - /* successful or not? */ if (ok) { /* rebuild depsgraph, now that there are extra deps here */ @@ -3100,7 +3070,7 @@ void GRAPH_OT_driver_variables_paste(wmOperatorType *ot) /* api callbacks */ ot->exec = graph_driver_vars_paste_exec; - ot->poll = graphop_active_fcurve_poll; + ot->poll = graphop_active_editable_fcurve_ctx_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h index 6ec8e54dce9..168c38b66a4 100644 --- a/source/blender/editors/space_graph/graph_intern.h +++ b/source/blender/editors/space_graph/graph_intern.h @@ -168,6 +168,7 @@ struct bAnimListElem *get_active_fcurve_channel(struct bAnimContext *ac); bool graphop_visible_keyframes_poll(struct bContext *C); bool graphop_editable_keyframes_poll(struct bContext *C); bool graphop_active_fcurve_poll(struct bContext *C); +bool graphop_active_editable_fcurve_ctx_poll(struct bContext *C); bool graphop_selected_fcurve_poll(struct bContext *C); /* ***************************************** */ diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c index d582ac557fa..b95ab48189c 100644 --- a/source/blender/editors/space_graph/graph_utils.c +++ b/source/blender/editors/space_graph/graph_utils.c @@ -44,6 +44,8 @@ #include "ED_screen.h" #include "UI_interface.h" +#include "RNA_access.h" + #include "graph_intern.h" // own include /* ************************************************************** */ @@ -278,6 +280,14 @@ bool graphop_active_fcurve_poll(bContext *C) return has_fcurve; } +/* has active F-Curve in the context that's editable */ +bool graphop_active_editable_fcurve_ctx_poll(bContext *C) +{ + PointerRNA ptr = CTX_data_pointer_get_type(C, "active_editable_fcurve", &RNA_FCurve); + + return ptr.data != NULL; +} + /* has selected F-Curve that's editable */ bool graphop_selected_fcurve_poll(bContext *C) { diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index feff1dc5f4a..fed56f3d452 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -116,6 +116,12 @@ static void outliner_tree_dimensions(SpaceOutliner *soops, int *r_width, int *r_ static bool is_object_data_in_editmode(const ID *id, const Object *obact) { const short id_type = GS(id->name); + + if (id_type == ID_GD && obact && obact->data == id) { + bGPdata *gpd = (bGPdata *)id; + return GPENCIL_EDIT_MODE(gpd); + } + return ((obact && (obact->mode & OB_MODE_EDIT)) && (id && OB_DATA_SUPPORT_EDITMODE(id_type)) && (GS(((ID *)obact->data)->name) == id_type) && BKE_object_data_is_in_editmode(id)); } @@ -800,7 +806,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) BLI_uniquename( &gpd->layers, gpl, "GP Layer", '.', offsetof(bGPDlayer, info), sizeof(gpl->info)); - WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, gpd); + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_SELECTED, gpd); break; } case TSE_R_LAYER: { @@ -2145,17 +2151,8 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te) data.icon = ICON_GROUP; break; } - /* Removed the icons from outliner. - * Need a better structure with Layers, Palettes and Colors. */ case TSE_GP_LAYER: { - /* indicate whether layer is active */ - bGPDlayer *gpl = te->directdata; - if (gpl->flag & GP_LAYER_ACTIVE) { - data.icon = ICON_GREASEPENCIL; - } - else { - data.icon = ICON_DOT; - } + data.icon = ICON_OUTLINER_DATA_GP_LAYER; break; } default: @@ -2635,12 +2632,16 @@ static void outliner_draw_iconrow(bContext *C, active = tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NONE, false); } } + else if (tselem->type == TSE_GP_LAYER) { + bGPDlayer *gpl = te->directdata; + active = (gpl->flag & GP_LAYER_ACTIVE) ? OL_DRAWSEL_ACTIVE : OL_DRAWSEL_NONE; + } else { active = tree_element_type_active( C, scene, view_layer, soops, te, tselem, OL_SETSEL_NONE, false); } - if (!ELEM(tselem->type, 0, TSE_LAYER_COLLECTION, TSE_R_LAYER)) { + if (!ELEM(tselem->type, 0, TSE_LAYER_COLLECTION, TSE_R_LAYER, TSE_GP_LAYER)) { outliner_draw_iconrow_doit(block, te, fstyle, xmax, offsx, ys, alpha_fac, active, 1); } else { @@ -2802,6 +2803,13 @@ static void outliner_draw_tree_element(bContext *C, } } } + else if (tselem->type == TSE_GP_LAYER) { + /* Active grease pencil layer. */ + if (((bGPDlayer *)te->directdata)->flag & GP_LAYER_ACTIVE) { + icon_bgcolor[3] = 0.2f; + active = OL_DRAWSEL_ACTIVE; + } + } else { active = tree_element_type_active( C, scene, view_layer, soops, te, tselem, OL_SETSEL_NONE, false); @@ -2895,7 +2903,7 @@ static void outliner_draw_tree_element(bContext *C, } offsx += UI_UNIT_X + 4 * ufac; } - else if (ELEM(tselem->type, 0, TSE_LAYER_COLLECTION) && ID_IS_STATIC_OVERRIDE(tselem->id)) { + else if (ELEM(tselem->type, 0, TSE_LAYER_COLLECTION) && ID_IS_OVERRIDE_LIBRARY(tselem->id)) { UI_icon_draw_alpha((float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_OVERRIDE, diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 7e5638e48ea..d8057a0ea28 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -557,17 +557,17 @@ static void id_local_cb(bContext *C, } } -static void id_static_override_cb(bContext *C, - ReportList *UNUSED(reports), - Scene *UNUSED(scene), - TreeElement *UNUSED(te), - TreeStoreElem *UNUSED(tsep), - TreeStoreElem *tselem, - void *UNUSED(user_data)) +static void id_override_library_cb(bContext *C, + ReportList *UNUSED(reports), + Scene *UNUSED(scene), + TreeElement *UNUSED(te), + TreeStoreElem *UNUSED(tsep), + TreeStoreElem *tselem, + void *UNUSED(user_data)) { if (ID_IS_LINKED(tselem->id) && (tselem->id->tag & LIB_TAG_EXTERN)) { Main *bmain = CTX_data_main(C); - ID *override_id = BKE_override_static_create_from_id(bmain, tselem->id); + ID *override_id = BKE_override_library_create_from_id(bmain, tselem->id); if (override_id != NULL) { BKE_main_id_clear_newpoins(bmain); } @@ -1337,7 +1337,7 @@ typedef enum eOutlinerIdOpTypes { OUTLINER_IDOP_UNLINK, OUTLINER_IDOP_LOCAL, - OUTLINER_IDOP_STATIC_OVERRIDE, + OUTLINER_IDOP_OVERRIDE_LIBRARY, OUTLINER_IDOP_SINGLE, OUTLINER_IDOP_DELETE, OUTLINER_IDOP_REMAP, @@ -1356,11 +1356,11 @@ typedef enum eOutlinerIdOpTypes { static const EnumPropertyItem prop_id_op_types[] = { {OUTLINER_IDOP_UNLINK, "UNLINK", 0, "Unlink", ""}, {OUTLINER_IDOP_LOCAL, "LOCAL", 0, "Make Local", ""}, - {OUTLINER_IDOP_STATIC_OVERRIDE, - "STATIC_OVERRIDE", + {OUTLINER_IDOP_OVERRIDE_LIBRARY, + "OVERRIDE_LIBRARY", 0, - "Add Static Override", - "Add a local static override of this data-block"}, + "Add Library Override", + "Add a local override of this linked data-block"}, {OUTLINER_IDOP_SINGLE, "SINGLE", 0, "Make Single User", ""}, {OUTLINER_IDOP_DELETE, "DELETE", ICON_X, "Delete", ""}, {OUTLINER_IDOP_REMAP, @@ -1389,7 +1389,7 @@ static const EnumPropertyItem *outliner_id_operation_itemf(bContext *UNUSED(C), PropertyRNA *UNUSED(prop), bool *r_free) { - if (BKE_override_static_is_enabled()) { + if (BKE_override_library_is_enabled()) { *r_free = false; return prop_id_op_types; } @@ -1398,7 +1398,7 @@ static const EnumPropertyItem *outliner_id_operation_itemf(bContext *UNUSED(C), int totitem = 0; for (const EnumPropertyItem *it = prop_id_op_types; it->identifier != NULL; it++) { - if (it->value == OUTLINER_IDOP_STATIC_OVERRIDE) { + if (it->value == OUTLINER_IDOP_OVERRIDE_LIBRARY) { continue; } RNA_enum_item_add(&items, &totitem, it); @@ -1485,11 +1485,11 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) ED_undo_push(C, "Localized Data"); break; } - case OUTLINER_IDOP_STATIC_OVERRIDE: { - if (BKE_override_static_is_enabled()) { + case OUTLINER_IDOP_OVERRIDE_LIBRARY: { + if (BKE_override_library_is_enabled()) { /* make local */ outliner_do_libdata_operation( - C, op->reports, scene, soops, &soops->tree, id_static_override_cb, NULL); + C, op->reports, scene, soops, &soops->tree, id_override_library_cb, NULL); ED_undo_push(C, "Overridden Data"); } break; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 5510b981899..c3e683b5f59 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -3439,10 +3439,6 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) } } - for (iseq = nseqbase.first; iseq; iseq = iseq->next) { - BKE_sequence_sound_init(scene, iseq); - } - iseq_first = nseqbase.first; BLI_movelisttolist(ed->seqbasep, &nseqbase); @@ -3459,6 +3455,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) } } + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index cc76c151a29..38e8d285c77 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -50,14 +50,6 @@ #include "view3d_intern.h" /* bad level include */ -int view3d_effective_drawtype(const struct View3D *v3d) -{ - if (v3d->shading.type == OB_RENDER) { - return v3d->shading.prev_type; - } - return v3d->shading.type; -} - /* OpenGL Circle Drawing - Tables for Optimized Drawing Speed */ /* 32 values of sin function (still same result!) */ #define CIRCLE_RESOL 32 diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index 755852a2e18..dd97a023825 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -771,14 +771,9 @@ void ED_view3d_datamask(const bContext *C, const View3D *v3d, CustomData_MeshMasks *r_cddata_masks) { - const int drawtype = view3d_effective_drawtype(v3d); - - if (ELEM(drawtype, OB_TEXTURE, OB_MATERIAL)) { + if (ELEM(v3d->shading.type, OB_TEXTURE, OB_MATERIAL, OB_RENDER)) { r_cddata_masks->lmask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL; - - if (drawtype == OB_MATERIAL) { - r_cddata_masks->vmask |= CD_MASK_ORCO; - } + r_cddata_masks->vmask |= CD_MASK_ORCO; } if ((CTX_data_mode_enum(C) == CTX_MODE_EDIT_MESH) && diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 1ee572211c0..6e12091cf75 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -5204,7 +5204,7 @@ static int toggle_xray_exec(bContext *C, wmOperator *op) ELEM(v3d->shading.type, OB_WIRE, OB_SOLID)); if (v3d->shading.type == OB_WIRE) { - v3d->shading.flag ^= V3D_SHADING_XRAY_BONE; + v3d->shading.flag ^= V3D_SHADING_XRAY_WIREFRAME; } else { v3d->shading.flag ^= V3D_SHADING_XRAY; diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index e499672acc1..3a6825aacb4 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -126,9 +126,6 @@ void VIEW3D_OT_fly(struct wmOperatorType *ot); /* view3d_walk.c */ void VIEW3D_OT_walk(struct wmOperatorType *ot); -/* drawobject.c */ -int view3d_effective_drawtype(const struct View3D *v3d); - /* view3d_draw.c */ void view3d_main_region_draw(const struct bContext *C, struct ARegion *ar); void view3d_draw_region_info(const struct bContext *C, struct ARegion *ar); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 6d741d39aae..c1b5b553c21 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -101,11 +101,190 @@ #include "GPU_glew.h" #include "GPU_matrix.h" +#include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" + +#include "DRW_engine.h" + #include "view3d_intern.h" /* own include */ // #include "PIL_time_utildefines.h" /* -------------------------------------------------------------------- */ +/** \name Selection Utilities + * \{ */ + +struct EDBaseOffset { + /* For convenience only. */ + union { + uint offset; + uint face_start; + }; + union { + uint face; + uint edge_start; + }; + union { + uint edge; + uint vert_start; + }; + uint vert; +}; + +struct EDSelectID_Context { + struct EDBaseOffset *base_array_index_offsets; + /** Borrow from caller (not freed). */ + struct Base **bases; + uint bases_len; + /** Total number of items `base_array_index_offsets[bases_len - 1].vert`. */ + uint base_array_index_len; +}; + +static bool check_ob_drawface_dot(short select_mode, const View3D *v3d, char dt) +{ + if (select_mode & SCE_SELECT_FACE) { + if ((dt < OB_SOLID) || XRAY_FLAG_ENABLED(v3d)) { + return true; + } + if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) { + return true; + } + if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGES) == 0) { + /* Since we can't deduce face selection when edges aren't visible - show dots. */ + return true; + } + } + return false; +} + +static void ed_select_id_draw_bases(struct EDSelectID_Context *sel_id_ctx, + ViewContext *vc, + short select_mode) +{ + Scene *scene_eval = (Scene *)DEG_get_evaluated_id(vc->depsgraph, &vc->scene->id); + DRW_framebuffer_select_id_setup(vc->ar, true); + + uint offset = 1; + for (uint base_index = 0; base_index < sel_id_ctx->bases_len; base_index++) { + Object *ob_eval = DEG_get_evaluated_object(vc->depsgraph, + sel_id_ctx->bases[base_index]->object); + + struct EDBaseOffset *base_ofs = &sel_id_ctx->base_array_index_offsets[base_index]; + bool draw_facedot = check_ob_drawface_dot(select_mode, vc->v3d, ob_eval->dt); + + DRW_draw_select_id_object(scene_eval, + vc->rv3d, + ob_eval, + select_mode, + draw_facedot, + offset, + &base_ofs->vert, + &base_ofs->edge, + &base_ofs->face); + + base_ofs->offset = offset; + offset = base_ofs->vert; + } + + sel_id_ctx->base_array_index_len = offset; + + DRW_framebuffer_select_id_release(vc->ar); +} + +uint ED_view3d_select_id_context_offset_for_object_elem( + const struct EDSelectID_Context *sel_id_ctx, int base_index, char elem_type) +{ + struct EDBaseOffset *base_ofs = &sel_id_ctx->base_array_index_offsets[base_index]; + if (elem_type == SCE_SELECT_VERTEX) { + return base_ofs->vert_start - 1; + } + if (elem_type == SCE_SELECT_EDGE) { + return base_ofs->edge_start - 1; + } + if (elem_type == SCE_SELECT_FACE) { + return base_ofs->face_start - 1; + } + BLI_assert(0); + return 0; +} + +uint ED_view3d_select_id_context_elem_len(const struct EDSelectID_Context *sel_id_ctx) +{ + return sel_id_ctx->base_array_index_len; +} + +struct EDSelectID_Context *ED_view3d_select_id_context_create(ViewContext *vc, + Base **bases, + const uint bases_len, + short select_mode) +{ + struct EDSelectID_Context *sel_id_ctx = MEM_mallocN(sizeof(*sel_id_ctx), __func__); + sel_id_ctx->base_array_index_offsets = MEM_mallocN(sizeof(struct EDBaseOffset) * bases_len, + __func__); + sel_id_ctx->bases = bases; + sel_id_ctx->bases_len = bases_len; + + ed_select_id_draw_bases(sel_id_ctx, vc, select_mode); + + return sel_id_ctx; +} + +void ED_view3d_select_id_context_destroy(struct EDSelectID_Context *sel_id_ctx) +{ + MEM_freeN(sel_id_ctx->base_array_index_offsets); + MEM_freeN(sel_id_ctx); +} + +bool ED_view3d_select_id_elem_get(struct EDSelectID_Context *sel_id_ctx, + const uint sel_id, + uint *r_elem, + uint *r_base_index, + char *r_elem_type) +{ + char elem_type = 0; + uint elem_id; + uint base_index = 0; + + while (true) { + struct EDBaseOffset *base_ofs = &sel_id_ctx->base_array_index_offsets[base_index]; + if (base_ofs->face > sel_id) { + elem_id = sel_id - base_ofs->face_start; + elem_type = SCE_SELECT_FACE; + break; + } + if (base_ofs->edge > sel_id) { + elem_id = sel_id - base_ofs->edge_start; + elem_type = SCE_SELECT_EDGE; + break; + } + if (base_ofs->vert > sel_id) { + elem_id = sel_id - base_ofs->vert_start; + elem_type = SCE_SELECT_VERTEX; + break; + } + + base_index++; + if (base_index >= sel_id_ctx->bases_len) { + return false; + } + } + + *r_elem = elem_id; + + if (r_base_index) { + *r_base_index = base_index; + } + + if (r_elem_type) { + *r_elem_type = elem_type; + } + + return true; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ /** \name Public Utilities * \{ */ @@ -194,7 +373,7 @@ static bool object_deselect_all_except(ViewLayer *view_layer, Base *b) struct EditSelectBuf_Cache { Base **bases; uint bases_len; - struct EDBMSelectID_Context *sel_id_ctx; + struct EDSelectID_Context *sel_id_ctx; BLI_bitmap *select_bitmap; }; @@ -216,7 +395,7 @@ static void editselect_buf_cache_init(struct EditSelectBuf_Cache *esel, ViewCont esel->bases_len = 0; } } - esel->sel_id_ctx = EDBM_select_id_context_create( + esel->sel_id_ctx = ED_view3d_select_id_context_create( vc, esel->bases, esel->bases_len, vc->scene->toolsettings->selectmode); for (int i = 0; i < esel->bases_len; i++) { esel->bases[i]->object->runtime.select_id = i; @@ -226,7 +405,7 @@ static void editselect_buf_cache_init(struct EditSelectBuf_Cache *esel, ViewCont static void editselect_buf_cache_free(struct EditSelectBuf_Cache *esel) { if (esel->sel_id_ctx) { - EDBM_select_id_context_destroy(esel->sel_id_ctx); + ED_view3d_select_id_context_destroy(esel->sel_id_ctx); } MEM_SAFE_FREE(esel->select_bitmap); MEM_SAFE_FREE(esel->bases); @@ -264,8 +443,8 @@ static bool edbm_backbuf_check_and_select_verts(struct EditSelectBuf_Cache *esel bool changed = false; const BLI_bitmap *select_bitmap = esel->select_bitmap; - uint index = EDBM_select_id_context_offset_for_object_elem( - esel->sel_id_ctx, ob->runtime.select_id, BM_VERT); + uint index = ED_view3d_select_id_context_offset_for_object_elem( + esel->sel_id_ctx, ob->runtime.select_id, SCE_SELECT_VERTEX); BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { @@ -292,8 +471,8 @@ static bool edbm_backbuf_check_and_select_edges(struct EditSelectBuf_Cache *esel bool changed = false; const BLI_bitmap *select_bitmap = esel->select_bitmap; - uint index = EDBM_select_id_context_offset_for_object_elem( - esel->sel_id_ctx, ob->runtime.select_id, BM_EDGE); + uint index = ED_view3d_select_id_context_offset_for_object_elem( + esel->sel_id_ctx, ob->runtime.select_id, SCE_SELECT_EDGE); BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { @@ -320,8 +499,8 @@ static bool edbm_backbuf_check_and_select_faces(struct EditSelectBuf_Cache *esel bool changed = false; const BLI_bitmap *select_bitmap = esel->select_bitmap; - uint index = EDBM_select_id_context_offset_for_object_elem( - esel->sel_id_ctx, ob->runtime.select_id, BM_FACE); + uint index = ED_view3d_select_id_context_offset_for_object_elem( + esel->sel_id_ctx, ob->runtime.select_id, SCE_SELECT_FACE); BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) { @@ -826,7 +1005,7 @@ static bool do_lasso_select_mesh(ViewContext *vc, if (wm_userdata->data == NULL) { editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc); esel = wm_userdata->data; - const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx); + const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx); esel->select_bitmap = ED_select_buffer_bitmap_from_poly(buffer_len, mcords, moves, &rect); } } @@ -845,10 +1024,11 @@ static bool do_lasso_select_mesh(ViewContext *vc, struct LassoSelectUserData_ForMeshEdge data_for_edge = { .data = &data, .esel = use_zbuf ? esel : NULL, - .backbuf_offset = use_zbuf ? - EDBM_select_id_context_offset_for_object_elem( - esel->sel_id_ctx, vc->obedit->runtime.select_id, BM_EDGE) : - 0, + .backbuf_offset = use_zbuf ? ED_view3d_select_id_context_offset_for_object_elem( + esel->sel_id_ctx, + vc->obedit->runtime.select_id, + SCE_SELECT_EDGE) : + 0, }; mesh_foreachScreenEdge( vc, do_lasso_select_mesh__doSelectEdge_pass0, &data_for_edge, V3D_PROJ_TEST_CLIP_NEAR); @@ -1135,7 +1315,7 @@ static bool do_lasso_select_paintvert(ViewContext *vc, if (wm_userdata->data == NULL) { editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc); esel = wm_userdata->data; - const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx); + const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx); esel->select_bitmap = ED_select_buffer_bitmap_from_poly(buffer_len, mcords, moves, &rect); } } @@ -1194,7 +1374,7 @@ static bool do_lasso_select_paintface(ViewContext *vc, if (esel == NULL) { editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc); esel = wm_userdata->data; - const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx); + const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx); esel->select_bitmap = ED_select_buffer_bitmap_from_poly(buffer_len, mcords, moves, &rect); } @@ -2500,7 +2680,7 @@ static bool do_paintvert_box_select(ViewContext *vc, if (wm_userdata->data == NULL) { editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc); esel = wm_userdata->data; - const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx); + const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx); esel->select_bitmap = ED_select_buffer_bitmap_from_rect(buffer_len, rect); } if (esel->select_bitmap != NULL) { @@ -2555,7 +2735,7 @@ static bool do_paintface_box_select(ViewContext *vc, if (wm_userdata->data == NULL) { editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc); esel = wm_userdata->data; - const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx); + const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx); esel->select_bitmap = ED_select_buffer_bitmap_from_rect(buffer_len, rect); } if (esel->select_bitmap != NULL) { @@ -2753,7 +2933,7 @@ static bool do_mesh_box_select(ViewContext *vc, if (wm_userdata->data == NULL) { editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc); esel = wm_userdata->data; - const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx); + const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx); esel->select_bitmap = ED_select_buffer_bitmap_from_rect(buffer_len, rect); } } @@ -2772,10 +2952,11 @@ static bool do_mesh_box_select(ViewContext *vc, struct BoxSelectUserData_ForMeshEdge cb_data = { .data = &data, .esel = use_zbuf ? esel : NULL, - .backbuf_offset = use_zbuf ? - EDBM_select_id_context_offset_for_object_elem( - esel->sel_id_ctx, vc->obedit->runtime.select_id, BM_EDGE) : - 0, + .backbuf_offset = use_zbuf ? ED_view3d_select_id_context_offset_for_object_elem( + esel->sel_id_ctx, + vc->obedit->runtime.select_id, + SCE_SELECT_EDGE) : + 0, }; mesh_foreachScreenEdge( vc, do_mesh_box_select__doSelectEdge_pass0, &cb_data, V3D_PROJ_TEST_CLIP_NEAR); @@ -3339,7 +3520,7 @@ static bool mesh_circle_select(ViewContext *vc, struct EditSelectBuf_Cache *esel = wm_userdata->data; if (use_zbuf) { - const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx); + const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx); esel->select_bitmap = ED_select_buffer_bitmap_from_circle(buffer_len, mval, (int)(rad + 1.0f)); } @@ -3416,7 +3597,7 @@ static bool paint_facesel_circle_select(ViewContext *vc, { struct EditSelectBuf_Cache *esel = wm_userdata->data; - const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx); + const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx); esel->select_bitmap = ED_select_buffer_bitmap_from_circle(buffer_len, mval, (int)(rad + 1.0f)); if (esel->select_bitmap != NULL) { changed |= edbm_backbuf_check_and_select_faces_obmode(me, esel, sel_op); @@ -3471,7 +3652,7 @@ static bool paint_vertsel_circle_select(ViewContext *vc, if (use_zbuf) { struct EditSelectBuf_Cache *esel = wm_userdata->data; - const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx); + const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx); esel->select_bitmap = ED_select_buffer_bitmap_from_circle(buffer_len, mval, (int)(rad + 1.0f)); if (esel->select_bitmap != NULL) { changed |= edbm_backbuf_check_and_select_verts_obmode(me, esel, sel_op); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 9019b21997f..5b3f7d85b43 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4784,7 +4784,7 @@ static void applyTrackball(TransInfo *t, const int UNUSED(mval[2])) static void storeCustomLNorValue(TransDataContainer *tc, BMesh *bm) { - BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm); + BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm, false); // BMLoopNorEditData *lnor_ed = lnors_ed_arr->lnor_editdata; tc->custom.mode.data = lnors_ed_arr; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 2dad3aef320..a9acdcd001c 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1835,7 +1835,12 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail) } else if (td_near) { float dist; - dist = len_v3v3(td_near->center, td->center); + float vec[3]; + + sub_v3_v3v3(vec, td_near->center, td->center); + mul_m3_v3(head->mtx, vec); + dist = len_v3(vec); + if (dist < (td - 1)->dist) { td->dist = (td - 1)->dist; } @@ -1856,7 +1861,12 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail) } else if (td_near) { float dist; - dist = len_v3v3(td_near->center, td->center); + float vec[3]; + + sub_v3_v3v3(vec, td_near->center, td->center); + mul_m3_v3(head->mtx, vec); + dist = len_v3(vec); + if (td->flag & TD_NOTCONNECTED || dist < td->dist || (td + 1)->dist < td->dist) { td->flag &= ~TD_NOTCONNECTED; if (dist < (td + 1)->dist) { @@ -2414,8 +2424,8 @@ static void createTransParticleVerts(bContext *C, TransInfo *t) if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) { ParticleSystemModifierData *psmd_eval = edit->psmd_eval; - psys_mat_hair_to_global( - ob, psmd_eval->mesh_final, psys->part->from, psys->particles + i, mat); + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); + psys_mat_hair_to_global(ob, mesh_final, psys->part->from, psys->particles + i, mat); } for (k = 0, key = point->keys; k < point->totkey; k++, key++) { @@ -2506,8 +2516,8 @@ void flushTransParticles(TransInfo *t) if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) { ParticleSystemModifierData *psmd_eval = edit->psmd_eval; - psys_mat_hair_to_global( - ob, psmd_eval->mesh_final, psys->part->from, psys->particles + i, mat); + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); + psys_mat_hair_to_global(ob, mesh_final, psys->part->from, psys->particles + i, mat); invert_m4_m4(imat, mat); for (k = 0, key = point->keys; k < point->totkey; k++, key++) { diff --git a/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp b/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp index 8e90ec4fb86..f4bc84c0e43 100644 --- a/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp +++ b/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp @@ -16,7 +16,7 @@ /** \file * \ingroup freestyle - * \brief Class to define the represenation of a triangle + * \brief Class to define the representation of a triangle */ #include "TriangleRep.h" diff --git a/source/blender/freestyle/intern/scene_graph/TriangleRep.h b/source/blender/freestyle/intern/scene_graph/TriangleRep.h index 5385ae941cd..e4190faae6f 100644 --- a/source/blender/freestyle/intern/scene_graph/TriangleRep.h +++ b/source/blender/freestyle/intern/scene_graph/TriangleRep.h @@ -19,7 +19,7 @@ /** \file * \ingroup freestyle - * \brief Class to define the represenation of a triangle + * \brief Class to define the representation of a triangle */ //! inherits from class Rep diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h index 8f05db28194..5209839a8e1 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h +++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h @@ -104,7 +104,7 @@ class SpatialNoiseShader : public StrokeShader { * Smoothes the stroke. * (Moves the vertices to make the stroke smoother). * Uses curvature flow to converge towards a curve of constant curvature. The diffusion method we - * use is anisotropic to prevent the diffusion accross corners. \see \htmlonly <a + * use is anisotropic to prevent the diffusion across corners. \see \htmlonly <a * href=/smoothing/smoothing.html>smoothing/smoothing.html</a> \endhtmlonly */ class SmoothingShader : public StrokeShader { diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h index e25048c0300..5e9edd234ef 100644 --- a/source/blender/freestyle/intern/view_map/Silhouette.h +++ b/source/blender/freestyle/intern/view_map/Silhouette.h @@ -471,7 +471,7 @@ class ViewEdge; * This FEdge can represent a silhouette, a crease, a ridge/valley, a border or a suggestive * contour. For silhouettes, the FEdge is oriented such as, the visible face lies on the left of * the edge. For borders, the FEdge is oriented such as, the face lies on the left of the edge. An - * FEdge can represent an initial edge of the mesh or runs accross a face of the initial mesh + * FEdge can represent an initial edge of the mesh or runs across a face of the initial mesh * depending on the smoothness or sharpness of the mesh. This class is specialized into a smooth * and a sharp version since their properties slightly vary from one to the other. */ @@ -1363,19 +1363,19 @@ class FEdgeSmooth : public FEdge { return _FaceMark; } - /*! Returns the normal to the Face it is running accross. */ + /*! Returns the normal to the Face it is running across. */ inline const Vec3r &normal() { return _Normal; } - /*! Returns the index of the material of the face it is running accross. */ + /*! Returns the index of the material of the face it is running across. */ inline unsigned frs_materialIndex() const { return _FrsMaterialIndex; } - /*! Returns the material of the face it is running accross. */ + /*! Returns the material of the face it is running across. */ const FrsMaterial &frs_material() const; inline void setFace(void *iFace) @@ -1389,13 +1389,13 @@ class FEdgeSmooth : public FEdge { _FaceMark = iFaceMark; } - /*! Sets the normal to the Face it is running accross. */ + /*! Sets the normal to the Face it is running across. */ inline void setNormal(const Vec3r &iNormal) { _Normal = iNormal; } - /*! Sets the index of the material of the face it is running accross. */ + /*! Sets the index of the material of the face it is running across. */ inline void setFrsMaterialIndex(unsigned i) { _FrsMaterialIndex = i; diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index e4d083947b4..5950027a103 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -801,12 +801,55 @@ void GPU_framebuffer_recursive_downsample(GPUFrameBuffer *fb, /* GPUOffScreen */ +#define MAX_CTX_FB_LEN 3 + struct GPUOffScreen { - GPUFrameBuffer *fb; + struct { + GPUContext *ctx; + GPUFrameBuffer *fb; + } framebuffers[MAX_CTX_FB_LEN]; + GPUTexture *color; GPUTexture *depth; }; +/* Returns the correct framebuffer for the current context. */ +static GPUFrameBuffer *gpu_offscreen_fb_get(GPUOffScreen *ofs) +{ + GPUContext *ctx = GPU_context_active_get(); + BLI_assert(ctx); + + for (int i = 0; i < MAX_CTX_FB_LEN; i++) { + if (ofs->framebuffers[i].fb == NULL) { + ofs->framebuffers[i].ctx = ctx; + GPU_framebuffer_ensure_config( + &ofs->framebuffers[i].fb, + {GPU_ATTACHMENT_TEXTURE(ofs->depth), GPU_ATTACHMENT_TEXTURE(ofs->color)}); + } + + if (ofs->framebuffers[i].ctx == ctx) { + return ofs->framebuffers[i].fb; + } + } + + /* List is full, this should never happen or + * it might just slow things down if it happens + * regulary. In this case we just empty the list + * and start over. This is most likely never going + * to happen under normal usage. */ + BLI_assert(0); + printf( + "Warning: GPUOffscreen used in more than 3 GPUContext. " + "This may create performance drop.\n"); + + for (int i = 0; i < MAX_CTX_FB_LEN; i++) { + GPU_framebuffer_free(ofs->framebuffers[i].fb); + ofs->framebuffers[i].fb = NULL; + } + + return gpu_offscreen_fb_get(ofs); +} + GPUOffScreen *GPU_offscreen_create( int width, int height, int samples, bool depth, bool high_bitdepth, char err_out[256]) { @@ -834,11 +877,10 @@ GPUOffScreen *GPU_offscreen_create( gpuPushAttr(GPU_VIEWPORT_BIT); - GPU_framebuffer_ensure_config( - &ofs->fb, {GPU_ATTACHMENT_TEXTURE(ofs->depth), GPU_ATTACHMENT_TEXTURE(ofs->color)}); + GPUFrameBuffer *fb = gpu_offscreen_fb_get(ofs); /* check validity at the very end! */ - if (!GPU_framebuffer_check_valid(ofs->fb, err_out)) { + if (!GPU_framebuffer_check_valid(fb, err_out)) { GPU_offscreen_free(ofs); gpuPopAttr(); return NULL; @@ -853,8 +895,10 @@ GPUOffScreen *GPU_offscreen_create( void GPU_offscreen_free(GPUOffScreen *ofs) { - if (ofs->fb) { - GPU_framebuffer_free(ofs->fb); + for (int i = 0; i < MAX_CTX_FB_LEN; i++) { + if (ofs->framebuffers[i].fb) { + GPU_framebuffer_free(ofs->framebuffers[i].fb); + } } if (ofs->color) { GPU_texture_free(ofs->color); @@ -874,7 +918,8 @@ void GPU_offscreen_bind(GPUOffScreen *ofs, bool save) gpuPushFrameBuffer(fb); } glDisable(GL_SCISSOR_TEST); - GPU_framebuffer_bind(ofs->fb); + GPUFrameBuffer *ofs_fb = gpu_offscreen_fb_get(ofs); + GPU_framebuffer_bind(ofs_fb); } void GPU_offscreen_unbind(GPUOffScreen *UNUSED(ofs), bool restore) @@ -899,7 +944,9 @@ void GPU_offscreen_draw_to_screen(GPUOffScreen *ofs, int x, int y) const int w = GPU_texture_width(ofs->color); const int h = GPU_texture_height(ofs->color); - glBindFramebuffer(GL_READ_FRAMEBUFFER, ofs->fb->object); + GPUFrameBuffer *ofs_fb = gpu_offscreen_fb_get(ofs); + + glBindFramebuffer(GL_READ_FRAMEBUFFER, ofs_fb->object); GLenum status = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER); if (status == GL_FRAMEBUFFER_COMPLETE) { @@ -950,7 +997,8 @@ void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels) glReadPixels(0, 0, w, h, GL_RGBA, type, pixels); /* restore the original frame-bufer */ - glBindFramebuffer(GL_FRAMEBUFFER, ofs->fb->object); + GPUFrameBuffer *ofs_fb = gpu_offscreen_fb_get(ofs); + glBindFramebuffer(GL_FRAMEBUFFER, ofs_fb->object); finally: /* cleanup */ @@ -983,7 +1031,7 @@ void GPU_offscreen_viewport_data_get(GPUOffScreen *ofs, GPUTexture **r_color, GPUTexture **r_depth) { - *r_fb = ofs->fb; + *r_fb = gpu_offscreen_fb_get(ofs); *r_color = ofs->color; *r_depth = ofs->depth; } diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 11d2cb54ec5..52d8db95054 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -729,7 +729,7 @@ static void ffmpeg_postprocess(struct anim *anim) return; } - /* This means the data wasnt read properly, + /* This means the data wasn't read properly, * this check stops crashing */ if (input->data[0] == 0 && input->data[1] == 0 && input->data[2] == 0 && input->data[3] == 0) { fprintf(stderr, diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index 77c04fd3358..a8902baa54a 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -137,7 +137,7 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon if (ibuf->rect_float != NULL && bitspersample != 8) { /* don't use the float buffer to save 8 bpp picture to prevent color banding - * (there's no dithering algorithm behing the logImageSetDataRGBA function) */ + * (there's no dithering algorithm behind the logImageSetDataRGBA function) */ fbuf = (float *)MEM_mallocN(ibuf->x * ibuf->y * 4 * sizeof(float), "fbuf in imb_save_dpx_cineon"); diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index 4e2d8897ff8..8fa6b1722ad 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -356,7 +356,7 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo, int fla /* * Because JPEG format don't support the * pair "key/value" like PNG, we store the - * stampinfo in a single "encode" string: + * stamp-info in a single "encode" string: * "Blender:key:value" * * That is why we need split it to the diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index f06fcd7a727..2eace6d07d5 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -133,7 +133,7 @@ enum { enum { /** This IDProp may be statically overridden. * Should only be used/be relevant for custom properties. */ - IDP_FLAG_OVERRIDABLE_STATIC = 1 << 0, + IDP_FLAG_OVERRIDABLE_LIBRARY = 1 << 0, /** This means the property is set but RNA will return false when checking * 'RNA_property_is_set', currently this is a runtime flag */ @@ -144,8 +144,8 @@ enum { /* Static ID override structs. */ -typedef struct IDOverrideStaticPropertyOperation { - struct IDOverrideStaticPropertyOperation *next, *prev; +typedef struct IDOverrideLibraryPropertyOperation { + struct IDOverrideLibraryPropertyOperation *next, *prev; /* Type of override. */ short operation; @@ -162,39 +162,39 @@ typedef struct IDOverrideStaticPropertyOperation { char *subitem_local_name; int subitem_reference_index; int subitem_local_index; -} IDOverrideStaticPropertyOperation; +} IDOverrideLibraryPropertyOperation; /* IDOverridePropertyOperation->operation. */ enum { /* Basic operations. */ - IDOVERRIDESTATIC_OP_NOOP = 0, /* Special value, forbids any overriding. */ + IDOVERRIDE_LIBRARY_OP_NOOP = 0, /* Special value, forbids any overriding. */ - IDOVERRIDESTATIC_OP_REPLACE = 1, /* Fully replace local value by reference one. */ + IDOVERRIDE_LIBRARY_OP_REPLACE = 1, /* Fully replace local value by reference one. */ /* Numeric-only operations. */ - IDOVERRIDESTATIC_OP_ADD = 101, /* Add local value to reference one. */ + IDOVERRIDE_LIBRARY_OP_ADD = 101, /* Add local value to reference one. */ /* Subtract local value from reference one (needed due to unsigned values etc.). */ - IDOVERRIDESTATIC_OP_SUBTRACT = 102, + IDOVERRIDE_LIBRARY_OP_SUBTRACT = 102, /* Multiply reference value by local one (more useful than diff for scales and the like). */ - IDOVERRIDESTATIC_OP_MULTIPLY = 103, + IDOVERRIDE_LIBRARY_OP_MULTIPLY = 103, /* Collection-only operations. */ - IDOVERRIDESTATIC_OP_INSERT_AFTER = 201, /* Insert after given reference's subitem. */ - IDOVERRIDESTATIC_OP_INSERT_BEFORE = 202, /* Insert before given reference's subitem. */ + IDOVERRIDE_LIBRARY_OP_INSERT_AFTER = 201, /* Insert after given reference's subitem. */ + IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE = 202, /* Insert before given reference's subitem. */ /* We can add more if needed (move, delete, ...). */ }; /* IDOverridePropertyOperation->flag. */ enum { /** User cannot remove that override operation. */ - IDOVERRIDESTATIC_FLAG_MANDATORY = 1 << 0, + IDOVERRIDE_LIBRARY_FLAG_MANDATORY = 1 << 0, /** User cannot change that override operation. */ - IDOVERRIDESTATIC_FLAG_LOCKED = 1 << 1, + IDOVERRIDE_LIBRARY_FLAG_LOCKED = 1 << 1, }; /** A single overridden property, contain all operations on this one. */ -typedef struct IDOverrideStaticProperty { - struct IDOverrideStaticProperty *next, *prev; +typedef struct IDOverrideLibraryProperty { + struct IDOverrideLibraryProperty *next, *prev; /** * Path from ID to overridden property. @@ -204,10 +204,10 @@ typedef struct IDOverrideStaticProperty { /** List of overriding operations (IDOverridePropertyOperation) applied to this property. */ ListBase operations; -} IDOverrideStaticProperty; +} IDOverrideLibraryProperty; /* Main container for all overriding data info of a data-block. */ -typedef struct IDOverrideStatic { +typedef struct IDOverrideLibrary { /** Reference linked ID which this one overrides. */ struct ID *reference; /** List of IDOverrideProperty structs. */ @@ -220,10 +220,10 @@ typedef struct IDOverrideStatic { /* Temp ID storing extra override data (used for differential operations only currently). * Always NULL outside of read/write context. */ struct ID *storage; -} IDOverrideStatic; +} IDOverrideLibrary; -enum eStaticOverride_Flag { - STATICOVERRIDE_AUTO = 1 << 0, /* Allow automatic generation of overriding rules. */ +enum eOverrideLibrary_Flag { + OVERRIDE_LIBRARY_AUTO = 1 << 0, /* Allow automatic generation of overriding rules. */ }; /* watch it: Sequence has identical beginning. */ @@ -259,7 +259,7 @@ typedef struct ID { IDProperty *properties; /** Reference linked ID which this one overrides. */ - IDOverrideStatic *override_static; + IDOverrideLibrary *override_library; /** * Only set for data-blocks which are coming from copy-on-write, points to @@ -436,15 +436,15 @@ typedef enum ID_Type { #define ID_IS_LINKED(_id) (((ID *)(_id))->lib != NULL) -#define ID_IS_STATIC_OVERRIDE(_id) \ - (((ID *)(_id))->override_static != NULL && ((ID *)(_id))->override_static->reference != NULL) +#define ID_IS_OVERRIDE_LIBRARY(_id) \ + (((ID *)(_id))->override_library != NULL && ((ID *)(_id))->override_library->reference != NULL) -#define ID_IS_STATIC_OVERRIDE_TEMPLATE(_id) \ - (((ID *)(_id))->override_static != NULL && ((ID *)(_id))->override_static->reference == NULL) +#define ID_IS_OVERRIDE_LIBRARY_TEMPLATE(_id) \ + (((ID *)(_id))->override_library != NULL && ((ID *)(_id))->override_library->reference == NULL) -#define ID_IS_STATIC_OVERRIDE_AUTO(_id) \ - (!ID_IS_LINKED((_id)) && ID_IS_STATIC_OVERRIDE((_id)) && \ - (((ID *)(_id))->override_static->flag & STATICOVERRIDE_AUTO)) +#define ID_IS_OVERRIDE_LIBRARY_AUTO(_id) \ + (!ID_IS_LINKED((_id)) && ID_IS_OVERRIDE_LIBRARY((_id)) && \ + (((ID *)(_id))->override_library->flag & OVERRIDE_LIBRARY_AUTO)) /* No copy-on-write for these types. * Keep in sync with check_datablocks_copy_on_writable and deg_copy_on_write_is_needed */ @@ -492,7 +492,7 @@ enum { * but is used (linked) directly by current .blend file. */ LIB_TAG_EXTERN = 1 << 0, /* RESET_NEVER Datablock is from a library, - * and is only used (linked) inderectly through other libraries. */ + * and is only used (linked) indirectly through other libraries. */ LIB_TAG_INDIRECT = 1 << 1, /* RESET_AFTER_USE Flag used internally in readfile.c, @@ -509,9 +509,9 @@ enum { LIB_TAG_MISSING = 1 << 6, /* RESET_NEVER tag data-block as being up-to-date regarding its reference. */ - LIB_TAG_OVERRIDESTATIC_REFOK = 1 << 9, + LIB_TAG_OVERRIDE_LIBRARY_REFOK = 1 << 9, /* RESET_NEVER tag data-block as needing an auto-override execution, if enabled. */ - LIB_TAG_OVERRIDESTATIC_AUTOREFRESH = 1 << 17, + LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH = 1 << 17, /* tag data-block has having an extra user. */ LIB_TAG_EXTRAUSER = 1 << 2, @@ -585,7 +585,7 @@ typedef enum IDRecalcFlag { /* Selection of the ID itself or its components (for example, vertices) did * change, and all the drawing data is to eb updated. */ ID_RECALC_SELECT = (1 << 9), - /* Flags on the base did change, and is to be compied onto all the copies of + /* Flags on the base did change, and is to be copied onto all the copies of * corresponding objects. */ ID_RECALC_BASE_FLAGS = (1 << 10), ID_RECALC_POINT_CACHE = (1 << 11), diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index c09ea400f4c..396030445f3 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -691,7 +691,7 @@ typedef enum eBConstraint_Flags { /* use bbone curve shape when calculating headtail values (also used by dependency graph!) */ CONSTRAINT_BBONE_SHAPE = (1 << 10), /* That constraint has been inserted in local override (i.e. it can be fully edited!). */ - CONSTRAINT_STATICOVERRIDE_LOCAL = (1 << 11), + CONSTRAINT_OVERRIDE_LIBRARY_LOCAL = (1 << 11), /* use full transformation (not just segment locations) - only set at runtime */ CONSTRAINT_BBONE_SHAPE_FULL = (1 << 12), } eBConstraint_Flags; diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h index 1ea17589f3f..4e9c03468f1 100644 --- a/source/blender/makesdna/DNA_gpencil_modifier_types.h +++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h @@ -63,7 +63,7 @@ typedef enum GpencilModifierMode { typedef enum { /* This modifier has been inserted in local override, and hence can be fully edited. */ - eGpencilModifierFlag_StaticOverride_Local = (1 << 0), + eGpencilModifierFlag_OverrideLibrary_Local = (1 << 0), } GpencilModifierFlag; typedef struct GpencilModifierData { diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 0167e9bbafe..e3c17a2f1ac 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -123,7 +123,7 @@ typedef struct ModifierData { typedef enum { /* This modifier has been inserted in local override, and hence can be fully edited. */ - eModifierFlag_StaticOverride_Local = (1 << 0), + eModifierFlag_OverrideLibrary_Local = (1 << 0), /* This modifier does not own its caches, but instead shares them with another modifier. */ eModifierFlag_SharedCaches = (1 << 1), } ModifierFlag; @@ -884,17 +884,24 @@ enum { MOD_MDEF_SURFACE = 1, }; -typedef struct ParticleSystemModifierData { - ModifierData modifier; - - struct ParticleSystem *psys; +/* Is stored in ModifierData.runtime. */ +# +# +typedef struct ParticleSystemModifierDataRuntime { /** Final Mesh - its topology may differ from orig mesh. */ struct Mesh *mesh_final; /** Original mesh that particles are attached to. */ struct Mesh *mesh_original; int totdmvert, totdmedge, totdmface; +} ParticleSystemModifierDataRuntime; + +typedef struct ParticleSystemModifierData { + ModifierData modifier; + + struct ParticleSystem *psys; + void *_pad1; short flag; - char _pad[2]; + char _pad[6]; } ParticleSystemModifierData; typedef enum { diff --git a/source/blender/makesdna/DNA_movieclip_types.h b/source/blender/makesdna/DNA_movieclip_types.h index 38ef17f4545..c804a78eccb 100644 --- a/source/blender/makesdna/DNA_movieclip_types.h +++ b/source/blender/makesdna/DNA_movieclip_types.h @@ -100,7 +100,7 @@ typedef struct MovieClip { /** * Scene frame number footage starts playing at affects all data * which is associated with a clip such as motion tracking, - * camera reconstruciton and so. + * camera Reconstruction and so. */ int start_frame; /** diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index e248d60b69b..66e01cae37b 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -155,8 +155,10 @@ typedef struct Object_Runtime { * It has all modifiers applied. */ struct Mesh *mesh_eval; - /* Denotes whether the evaluated mesh is ownbed by this object or is referenced and owned by - * somebody else. */ + /** + * Denotes whether the evaluated mesh is owned by this object or is referenced and owned by + * somebody else. + */ int is_mesh_eval_owned; int _pad3[3]; /** diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index a2f63d4d040..4aaa1fe32f6 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -301,11 +301,11 @@ typedef struct ParticleSettings { } ParticleSettings; typedef struct ParticleSystem { - /* note1: make sure all (runtime) are NULL's in 'copy_particlesystem' XXX, - * this function is no more! - need to invstigate */ + /* note1: make sure all (run-time) are NULL's in 'copy_particlesystem' XXX, + * this function is no more! - need to investigate. */ /* note2: make sure any uses of this struct in DNA are - * accounted for in 'BKE_object_copy_particlesystems' */ + * accounted for in 'BKE_object_copy_particlesystems'. */ struct ParticleSystem *next, *prev; diff --git a/source/blender/makesdna/DNA_shader_fx_types.h b/source/blender/makesdna/DNA_shader_fx_types.h index c996b3bb829..6cda58a3279 100644 --- a/source/blender/makesdna/DNA_shader_fx_types.h +++ b/source/blender/makesdna/DNA_shader_fx_types.h @@ -54,7 +54,7 @@ typedef enum ShaderFxMode { typedef enum { /* This fx has been inserted in local override, and hence can be fully edited. */ - eShaderFxFlag_StaticOverride_Local = (1 << 0), + eShaderFxFlag_OverrideLibrary_Local = (1 << 0), } ShaderFxFlag; typedef struct ShaderFxData { diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 0170b27e15f..31ffb3efebd 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -419,7 +419,7 @@ enum { V3D_SHADING_CAVITY = (1 << 5), V3D_SHADING_MATCAP_FLIP_X = (1 << 6), V3D_SHADING_SCENE_WORLD = (1 << 7), - V3D_SHADING_XRAY_BONE = (1 << 8), + V3D_SHADING_XRAY_WIREFRAME = (1 << 8), V3D_SHADING_WORLD_ORIENTATION = (1 << 9), V3D_SHADING_BACKFACE_CULLING = (1 << 10), V3D_SHADING_DEPTH_OF_FIELD = (1 << 11), diff --git a/source/blender/makesdna/DNA_workspace_types.h b/source/blender/makesdna/DNA_workspace_types.h index 2b5d81d02a0..dbfb0cc6346 100644 --- a/source/blender/makesdna/DNA_workspace_types.h +++ b/source/blender/makesdna/DNA_workspace_types.h @@ -53,7 +53,7 @@ typedef struct bToolRef { /** #bToolKey (spacetype, mode), used in 'WM_api.h' */ short space_type; /** - * Value depends ont the 'space_type', object mode for 3D view, image editor has own mode too. + * Value depends on the 'space_type', object mode for 3D view, image editor has own mode too. * RNA needs to handle using item function. */ int mode; diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index df43797af78..f70033b20a6 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -32,9 +32,9 @@ extern "C" { #endif struct ID; -struct IDOverrideStatic; -struct IDOverrideStaticProperty; -struct IDOverrideStaticPropertyOperation; +struct IDOverrideLibrary; +struct IDOverrideLibraryProperty; +struct IDOverrideLibraryPropertyOperation; struct ListBase; struct Main; struct ReportList; @@ -287,8 +287,8 @@ extern StructRNA RNA_Histogram; extern StructRNA RNA_HookGpencilModifier; extern StructRNA RNA_HookModifier; extern StructRNA RNA_ID; -extern StructRNA RNA_IDOverrideStatic; -extern StructRNA RNA_IDOverrideStaticProperty; +extern StructRNA RNA_IDOverrideLibrary; +extern StructRNA RNA_IDOverrideLibraryProperty; extern StructRNA RNA_IKParam; extern StructRNA RNA_Image; extern StructRNA RNA_ImageFormatSettings; @@ -964,9 +964,9 @@ bool RNA_property_editable_flag(PointerRNA *ptr, bool RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop); bool RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop); bool RNA_property_overridable_get(PointerRNA *ptr, PropertyRNA *prop); -bool RNA_property_overridable_static_set(PointerRNA *ptr, - PropertyRNA *prop, - const bool is_overridable); +bool RNA_property_overridable_library_set(PointerRNA *ptr, + PropertyRNA *prop, + const bool is_overridable); bool RNA_property_overridden(PointerRNA *ptr, PropertyRNA *prop); bool RNA_property_comparable(PointerRNA *ptr, PropertyRNA *prop); bool RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop); /* slow, use with care */ @@ -1270,6 +1270,17 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name); RNA_property_collection_next(&rna_macro_iter)) { \ PropertyRNA *prop = (PropertyRNA *)rna_macro_iter.ptr.data; +#define RNA_STRUCT_BEGIN_SKIP_RNA_TYPE(sptr, prop) \ + { \ + CollectionPropertyIterator rna_macro_iter; \ + RNA_property_collection_begin( \ + sptr, RNA_struct_iterator_property((sptr)->type), &rna_macro_iter); \ + if (rna_macro_iter.valid) { \ + RNA_property_collection_next(&rna_macro_iter); \ + } \ + for (; rna_macro_iter.valid; RNA_property_collection_next(&rna_macro_iter)) { \ + PropertyRNA *prop = (PropertyRNA *)rna_macro_iter.ptr.data; + #define RNA_STRUCT_END \ } \ RNA_property_collection_end(&rna_macro_iter); \ @@ -1476,7 +1487,7 @@ bool RNA_struct_override_matches(struct Main *bmain, struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, const char *root_path, - struct IDOverrideStatic *override, + struct IDOverrideLibrary *override, const eRNAOverrideMatch flags, eRNAOverrideMatchResult *r_report_flags); @@ -1484,23 +1495,23 @@ bool RNA_struct_override_store(struct Main *bmain, struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, PointerRNA *ptr_storage, - struct IDOverrideStatic *override); + struct IDOverrideLibrary *override); void RNA_struct_override_apply(struct Main *bmain, struct PointerRNA *ptr_local, struct PointerRNA *ptr_override, struct PointerRNA *ptr_storage, - struct IDOverrideStatic *override); + struct IDOverrideLibrary *override); -struct IDOverrideStaticProperty *RNA_property_override_property_find(PointerRNA *ptr, - PropertyRNA *prop); -struct IDOverrideStaticProperty *RNA_property_override_property_get(PointerRNA *ptr, - PropertyRNA *prop, - bool *r_created); +struct IDOverrideLibraryProperty *RNA_property_override_property_find(PointerRNA *ptr, + PropertyRNA *prop); +struct IDOverrideLibraryProperty *RNA_property_override_property_get(PointerRNA *ptr, + PropertyRNA *prop, + bool *r_created); -struct IDOverrideStaticPropertyOperation *RNA_property_override_property_operation_find( +struct IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_find( PointerRNA *ptr, PropertyRNA *prop, const int index, const bool strict, bool *r_strict); -struct IDOverrideStaticPropertyOperation *RNA_property_override_property_operation_get( +struct IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_get( PointerRNA *ptr, PropertyRNA *prop, const short operation, @@ -1509,9 +1520,9 @@ struct IDOverrideStaticPropertyOperation *RNA_property_override_property_operati bool *r_strict, bool *r_created); -eRNAOverrideStatus RNA_property_static_override_status(PointerRNA *ptr, - PropertyRNA *prop, - const int index); +eRNAOverrideStatus RNA_property_override_library_status(PointerRNA *ptr, + PropertyRNA *prop, + const int index); void RNA_struct_state_owner_set(const char *name); const char *RNA_struct_state_owner_get(void); diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 1cc7d772ecc..aac42fb596b 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -216,7 +216,7 @@ typedef enum PropertyFlag { /* Pointers to data that is not owned by the struct. * Typical example: Bone.parent, Bone.child, etc., and nearly all ID pointers. * This is crucial information for processes that walk the whole data of an ID e.g. - * (like static override). + * (like library override). * Note that all ID pointers are enforced to this by default, * this probably will need to be rechecked (see ugly infamous NodeTrees of mat/tex/scene/etc.). */ @@ -259,7 +259,7 @@ typedef enum PropertyFlag { /* FREE FLAGS: 2, 3, 4, 5, 6, 7, 8, 9, 12 and above. */ typedef enum PropertyOverrideFlag { /* Means the property can be overridden by a local 'proxy' of some linked datablock. */ - PROPOVERRIDE_OVERRIDABLE_STATIC = (1 << 0), + PROPOVERRIDE_OVERRIDABLE_LIBRARY = (1 << 0), /* Forbid usage of this property in comparison (& hence override) code. * Useful e.g. for collections of data like mesh's geometry, particles, etc. */ @@ -268,7 +268,7 @@ typedef enum PropertyOverrideFlag { /*** Collections-related ***/ /* The property supports insertion (collections only). */ - PROPOVERRIDE_STATIC_INSERTION = (1 << 10), + PROPOVERRIDE_LIBRARY_INSERTION = (1 << 10), /* Only use indices to compare items in the property, never names (collections only). */ /* Useful when nameprop of the items is generated from other data diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index a1144378f09..57cdbbadeb8 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -103,27 +103,27 @@ const EnumPropertyItem rna_enum_id_type_items[] = { # include "WM_api.h" -void rna_ID_override_static_property_operation_refname_get(PointerRNA *ptr, char *value) +void rna_ID_override_library_property_operation_refname_get(PointerRNA *ptr, char *value) { - IDOverrideStaticPropertyOperation *opop = ptr->data; + IDOverrideLibraryPropertyOperation *opop = ptr->data; strcpy(value, (opop->subitem_reference_name == NULL) ? "" : opop->subitem_reference_name); } -int rna_ID_override_static_property_operation_refname_length(PointerRNA *ptr) +int rna_ID_override_library_property_operation_refname_length(PointerRNA *ptr) { - IDOverrideStaticPropertyOperation *opop = ptr->data; + IDOverrideLibraryPropertyOperation *opop = ptr->data; return (opop->subitem_reference_name == NULL) ? 0 : strlen(opop->subitem_reference_name); } -void rna_ID_override_static_property_operation_locname_get(PointerRNA *ptr, char *value) +void rna_ID_override_library_property_operation_locname_get(PointerRNA *ptr, char *value) { - IDOverrideStaticPropertyOperation *opop = ptr->data; + IDOverrideLibraryPropertyOperation *opop = ptr->data; strcpy(value, (opop->subitem_local_name == NULL) ? "" : opop->subitem_local_name); } -int rna_ID_override_static_property_operation_locname_length(PointerRNA *ptr) +int rna_ID_override_library_property_operation_locname_length(PointerRNA *ptr) { - IDOverrideStaticPropertyOperation *opop = ptr->data; + IDOverrideLibraryPropertyOperation *opop = ptr->data; return (opop->subitem_local_name == NULL) ? 0 : strlen(opop->subitem_local_name); } @@ -493,11 +493,11 @@ static ID *rna_ID_copy(ID *id, Main *bmain) static ID *rna_ID_override_create(ID *id, Main *bmain) { - if (!BKE_override_static_is_enabled() || id->lib == NULL) { + if (!BKE_override_library_is_enabled() || id->lib == NULL) { return NULL; } - return BKE_override_static_create_from_id(bmain, id); + return BKE_override_library_create_from_id(bmain, id); } static void rna_ID_update_tag(ID *id, Main *bmain, ReportList *reports, int flag) @@ -1220,44 +1220,44 @@ static void rna_def_image_preview(BlenderRNA *brna) RNA_def_function_ui_description(func, "Reload the preview from its source path"); } -static void rna_def_ID_override_static_property_operation(BlenderRNA *brna) +static void rna_def_ID_override_library_property_operation(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static const EnumPropertyItem static_override_property_operation_items[] = { - {IDOVERRIDESTATIC_OP_NOOP, + static const EnumPropertyItem override_library_property_operation_items[] = { + {IDOVERRIDE_LIBRARY_OP_NOOP, "NOOP", 0, "No-Op", "Does nothing, prevents adding actual overrides (NOT USED)"}, - {IDOVERRIDESTATIC_OP_REPLACE, + {IDOVERRIDE_LIBRARY_OP_REPLACE, "REPLACE", 0, "Replace", "Replace value of reference by overriding one"}, - {IDOVERRIDESTATIC_OP_ADD, + {IDOVERRIDE_LIBRARY_OP_ADD, "DIFF_ADD", 0, "Differential", "Stores and apply difference between reference and local value (NOT USED)"}, - {IDOVERRIDESTATIC_OP_SUBTRACT, + {IDOVERRIDE_LIBRARY_OP_SUBTRACT, "DIFF_SUB", 0, "Differential", "Stores and apply difference between reference and local value (NOT USED)"}, - {IDOVERRIDESTATIC_OP_MULTIPLY, + {IDOVERRIDE_LIBRARY_OP_MULTIPLY, "FACT_MULTIPLY", 0, "Factor", "Stores and apply multiplication factor between reference and local value (NOT USED)"}, - {IDOVERRIDESTATIC_OP_INSERT_AFTER, + {IDOVERRIDE_LIBRARY_OP_INSERT_AFTER, "INSERT_AFTER", 0, "Insert After", "Insert a new item into collection after the one referenced in subitem_reference_name or " "_index"}, - {IDOVERRIDESTATIC_OP_INSERT_BEFORE, + {IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE, "INSERT_BEFORE", 0, "Insert Before", @@ -1266,13 +1266,13 @@ static void rna_def_ID_override_static_property_operation(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; - static const EnumPropertyItem static_override_property_flag_items[] = { - {IDOVERRIDESTATIC_FLAG_MANDATORY, + static const EnumPropertyItem override_library_property_flag_items[] = { + {IDOVERRIDE_LIBRARY_FLAG_MANDATORY, "MANDATORY", 0, "Mandatory", "For templates, prevents the user from removing pre-defined operation (NOT USED)"}, - {IDOVERRIDESTATIC_FLAG_LOCKED, + {IDOVERRIDE_LIBRARY_FLAG_LOCKED, "LOCKED", 0, "Locked", @@ -1280,21 +1280,21 @@ static void rna_def_ID_override_static_property_operation(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; - srna = RNA_def_struct(brna, "IDOverrideStaticPropertyOperation", NULL); + srna = RNA_def_struct(brna, "IDOverrideLibraryPropertyOperation", NULL); RNA_def_struct_ui_text(srna, - "ID Static Override Property Operation", + "ID Library Override Property Operation", "Description of an override operation over an overridden property"); prop = RNA_def_enum(srna, "operation", - static_override_property_operation_items, - IDOVERRIDESTATIC_OP_REPLACE, + override_library_property_operation_items, + IDOVERRIDE_LIBRARY_OP_REPLACE, "Operation", "What override operation is performed"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ prop = RNA_def_enum( - srna, "flag", static_override_property_flag_items, 0, "Flags", "Optional flags (NOT USED)"); + srna, "flag", override_library_property_flag_items, 0, "Flags", "Optional flags (NOT USED)"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ prop = RNA_def_string(srna, @@ -1305,8 +1305,8 @@ static void rna_def_ID_override_static_property_operation(BlenderRNA *brna) "Used to handle insertions into collection"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ RNA_def_property_string_funcs(prop, - "rna_ID_override_static_property_operation_refname_get", - "rna_ID_override_static_property_operation_refname_length", + "rna_ID_override_library_property_operation_refname_get", + "rna_ID_override_library_property_operation_refname_length", NULL); prop = RNA_def_string(srna, @@ -1317,8 +1317,8 @@ static void rna_def_ID_override_static_property_operation(BlenderRNA *brna) "Used to handle insertions into collection"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ RNA_def_property_string_funcs(prop, - "rna_ID_override_static_property_operation_locname_get", - "rna_ID_override_static_property_operation_locname_length", + "rna_ID_override_library_property_operation_locname_get", + "rna_ID_override_library_property_operation_locname_length", NULL); prop = RNA_def_int(srna, @@ -1344,14 +1344,14 @@ static void rna_def_ID_override_static_property_operation(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ } -static void rna_def_ID_override_static_property(BlenderRNA *brna) +static void rna_def_ID_override_library_property(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - srna = RNA_def_struct(brna, "IDOverrideStaticProperty", NULL); + srna = RNA_def_struct(brna, "IDOverrideLibraryProperty", NULL); RNA_def_struct_ui_text( - srna, "ID Static Override Property", "Description of an overridden property"); + srna, "ID Library Override Property", "Description of an overridden property"); /* String pointer, we *should* add get/set/etc. * But NULL rna_path would be a nasty bug anyway. */ @@ -1365,21 +1365,21 @@ static void rna_def_ID_override_static_property(BlenderRNA *brna) RNA_def_collection(srna, "operations", - "IDOverrideStaticPropertyOperation", + "IDOverrideLibraryPropertyOperation", "Operations", "List of overriding operations for a property"); - rna_def_ID_override_static_property_operation(brna); + rna_def_ID_override_library_property_operation(brna); } -static void rna_def_ID_override_static(BlenderRNA *brna) +static void rna_def_ID_override_library(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - srna = RNA_def_struct(brna, "IDOverrideStatic", NULL); + srna = RNA_def_struct(brna, "IDOverrideLibrary", NULL); RNA_def_struct_ui_text( - srna, "ID Static Override", "Struct gathering all data needed by statically overridden IDs"); + srna, "ID Library Override", "Struct gathering all data needed by overridden linked IDs"); RNA_def_pointer( srna, "reference", "ID", "Reference ID", "Linked ID used as reference by this override"); @@ -1390,15 +1390,15 @@ static void rna_def_ID_override_static(BlenderRNA *brna) true, "Auto Generate Override", "Automatically generate overriding operations by detecting changes in properties"); - RNA_def_property_boolean_sdna(prop, NULL, "flag", STATICOVERRIDE_AUTO); + RNA_def_property_boolean_sdna(prop, NULL, "flag", OVERRIDE_LIBRARY_AUTO); RNA_def_collection(srna, "properties", - "IDOverrideStaticProperty", + "IDOverrideLibraryProperty", "Properties", "List of overridden properties"); - rna_def_ID_override_static_property(brna); + rna_def_ID_override_library_property(brna); } static void rna_def_ID(BlenderRNA *brna) @@ -1486,7 +1486,7 @@ static void rna_def_ID(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Library", "Library file the data-block is linked from"); prop = RNA_def_pointer( - srna, "override_static", "IDOverrideStatic", "Static Override", "Static override data"); + srna, "override_library", "IDOverrideLibrary", "Library Override", "Library override data"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_pointer( @@ -1659,7 +1659,7 @@ void RNA_def_ID(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Any Type", "RNA type used for pointers to any possible data"); rna_def_ID(brna); - rna_def_ID_override_static(brna); + rna_def_ID_override_library(brna); rna_def_image_preview(brna); rna_def_ID_properties(brna); rna_def_ID_materials(brna); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index a9ba1730216..3aa938ee713 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2053,7 +2053,7 @@ bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop) return ((flag & PROP_EDITABLE) && (flag & PROP_REGISTER) == 0 && (!id || ((!ID_IS_LINKED(id) || (prop->flag & PROP_LIB_EXCEPTION)) && - (!id->override_static || RNA_property_overridable_get(ptr, prop))))); + (!id->override_library || RNA_property_overridable_get(ptr, prop))))); } /** @@ -2087,7 +2087,7 @@ bool RNA_property_editable_info(PointerRNA *ptr, PropertyRNA *prop, const char * } return false; } - if (id->override_static != NULL && !RNA_property_overridable_get(ptr, prop)) { + if (id->override_library != NULL && !RNA_property_overridable_get(ptr, prop)) { if (!(*r_info)[0]) { *r_info = N_("Can't edit this property from an override data-block"); } @@ -2184,39 +2184,39 @@ bool RNA_property_overridable_get(PointerRNA *ptr, PropertyRNA *prop) * for now we can live with those special-cases handling I think. */ if (RNA_struct_is_a(ptr->type, &RNA_Constraint)) { bConstraint *con = ptr->data; - if (con->flag & CONSTRAINT_STATICOVERRIDE_LOCAL) { + if (con->flag & CONSTRAINT_OVERRIDE_LIBRARY_LOCAL) { return true; } } else if (RNA_struct_is_a(ptr->type, &RNA_Modifier)) { ModifierData *mod = ptr->data; - if (mod->flag & eModifierFlag_StaticOverride_Local) { + if (mod->flag & eModifierFlag_OverrideLibrary_Local) { return true; } } /* If this is a RNA-defined property (real or 'virtual' IDProp), * we want to use RNA prop flag. */ return !(prop->flag_override & PROPOVERRIDE_NO_COMPARISON) && - (prop->flag_override & PROPOVERRIDE_OVERRIDABLE_STATIC); + (prop->flag_override & PROPOVERRIDE_OVERRIDABLE_LIBRARY); } else { /* If this is a real 'pure' IDProp (aka custom property), we want to use the IDProp flag. */ return !(prop->flag_override & PROPOVERRIDE_NO_COMPARISON) && - (((IDProperty *)prop)->flag & IDP_FLAG_OVERRIDABLE_STATIC); + (((IDProperty *)prop)->flag & IDP_FLAG_OVERRIDABLE_LIBRARY); } } /* Should only be used for custom properties */ -bool RNA_property_overridable_static_set(PointerRNA *UNUSED(ptr), - PropertyRNA *prop, - const bool is_overridable) +bool RNA_property_overridable_library_set(PointerRNA *UNUSED(ptr), + PropertyRNA *prop, + const bool is_overridable) { /* Only works for pure custom properties IDProps. */ if (prop->magic != RNA_MAGIC) { IDProperty *idprop = (IDProperty *)prop; - idprop->flag = is_overridable ? (idprop->flag | IDP_FLAG_OVERRIDABLE_STATIC) : - (idprop->flag & ~IDP_FLAG_OVERRIDABLE_STATIC); + idprop->flag = is_overridable ? (idprop->flag | IDP_FLAG_OVERRIDABLE_LIBRARY) : + (idprop->flag & ~IDP_FLAG_OVERRIDABLE_LIBRARY); return true; } @@ -2228,11 +2228,11 @@ bool RNA_property_overridden(PointerRNA *ptr, PropertyRNA *prop) char *rna_path = RNA_path_from_ID_to_property(ptr, prop); ID *id = ptr->id.data; - if (rna_path == NULL || id == NULL || id->override_static == NULL) { + if (rna_path == NULL || id == NULL || id->override_library == NULL) { return false; } - return (BKE_override_static_property_find(id->override_static, rna_path) != NULL); + return (BKE_override_library_property_find(id->override_library, rna_path) != NULL); } bool RNA_property_comparable(PointerRNA *UNUSED(ptr), PropertyRNA *prop) @@ -6802,7 +6802,7 @@ static void *rna_array_as_string_alloc( static void rna_array_as_string_elem(int type, void **buf_p, int len, DynStr *dynstr) { - /* This will print a comma seperated string of the array elements from + /* This will print a comma separated string of the array elements from * buf start to len. We will add a comma if len == 1 to preserve tuples. */ const int end = len - 1; if (type == PROP_BOOLEAN) { @@ -8026,7 +8026,7 @@ static bool rna_property_override_operation_apply(Main *bmain, PointerRNA *ptr_item_local, PointerRNA *ptr_item_override, PointerRNA *ptr_item_storage, - IDOverrideStaticPropertyOperation *opop); + IDOverrideLibraryPropertyOperation *opop); bool RNA_property_copy( Main *bmain, PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index) @@ -8060,8 +8060,8 @@ bool RNA_property_copy( return false; } - IDOverrideStaticPropertyOperation opop = { - .operation = IDOVERRIDESTATIC_OP_REPLACE, + IDOverrideLibraryPropertyOperation opop = { + .operation = IDOVERRIDE_LIBRARY_OP_REPLACE, .subitem_reference_index = index, .subitem_local_index = index, }; @@ -8099,7 +8099,7 @@ static int rna_property_override_diff(Main *bmain, PropertyRNA *prop_b, const char *rna_path, eRNACompareMode mode, - IDOverrideStatic *override, + IDOverrideLibrary *override, const int flags, eRNAOverrideMatchResult *r_report_flags); @@ -8149,8 +8149,8 @@ bool RNA_struct_equals(Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACo /** Generic RNA property diff function. * * \note about \a prop and \a prop_a/prop_b parameters: - * the former is exptected to be an 'un-resolved' one, - * while the two laters are expected to be fully resolved ones + * the former is expected to be an 'un-resolved' one, + * while the two later are expected to be fully resolved ones * (i.e. to be the IDProps when they should be, etc.). * When \a prop is given, \a prop_a and \a prop_b should always be NULL, and vice-versa. * This is necessary, because we cannot perform 'set/unset' checks on resolved properties @@ -8167,7 +8167,7 @@ static int rna_property_override_diff(Main *bmain, PropertyRNA *prop_b, const char *rna_path, eRNACompareMode mode, - IDOverrideStatic *override, + IDOverrideLibrary *override, const int flags, eRNAOverrideMatchResult *r_report_flags) { @@ -8299,7 +8299,7 @@ static bool rna_property_override_operation_store(Main *bmain, PropertyRNA *prop_local, PropertyRNA *prop_reference, PropertyRNA *prop_storage, - IDOverrideStaticProperty *op) + IDOverrideLibraryProperty *op) { int len_local, len_reference, len_storage = 0; bool changed = false; @@ -8325,12 +8325,12 @@ static bool rna_property_override_operation_store(Main *bmain, (!ptr_storage || prop_local->override_store == prop_storage->override_store) && prop_local->override_store != NULL); - for (IDOverrideStaticPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { + for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { /* Only needed for diff operations. */ if (!ELEM(opop->operation, - IDOVERRIDESTATIC_OP_ADD, - IDOVERRIDESTATIC_OP_SUBTRACT, - IDOVERRIDESTATIC_OP_MULTIPLY)) { + IDOVERRIDE_LIBRARY_OP_ADD, + IDOVERRIDE_LIBRARY_OP_SUBTRACT, + IDOVERRIDE_LIBRARY_OP_MULTIPLY)) { continue; } @@ -8362,20 +8362,20 @@ static bool rna_property_override_operation_apply(Main *bmain, PointerRNA *ptr_item_local, PointerRNA *ptr_item_override, PointerRNA *ptr_item_storage, - IDOverrideStaticPropertyOperation *opop) + IDOverrideLibraryPropertyOperation *opop) { int len_local, len_reference, len_storage = 0; const short override_op = opop->operation; - if (override_op == IDOVERRIDESTATIC_OP_NOOP) { + if (override_op == IDOVERRIDE_LIBRARY_OP_NOOP) { return true; } if (ELEM(override_op, - IDOVERRIDESTATIC_OP_ADD, - IDOVERRIDESTATIC_OP_SUBTRACT, - IDOVERRIDESTATIC_OP_MULTIPLY) && + IDOVERRIDE_LIBRARY_OP_ADD, + IDOVERRIDE_LIBRARY_OP_SUBTRACT, + IDOVERRIDE_LIBRARY_OP_MULTIPLY) && !ptr_storage) { /* We cannot apply 'diff' override operations without some reference storage. * This should typically only happen at read time of .blend file... */ @@ -8383,9 +8383,9 @@ static bool rna_property_override_operation_apply(Main *bmain, } if (ELEM(override_op, - IDOVERRIDESTATIC_OP_ADD, - IDOVERRIDESTATIC_OP_SUBTRACT, - IDOVERRIDESTATIC_OP_MULTIPLY) && + IDOVERRIDE_LIBRARY_OP_ADD, + IDOVERRIDE_LIBRARY_OP_SUBTRACT, + IDOVERRIDE_LIBRARY_OP_MULTIPLY) && !prop_storage) { /* We cannot apply 'diff' override operations without some reference storage. * This should typically only happen at read time of .blend file... */ @@ -8471,7 +8471,7 @@ bool RNA_struct_override_matches(Main *bmain, PointerRNA *ptr_local, PointerRNA *ptr_reference, const char *root_path, - IDOverrideStatic *override, + IDOverrideLibrary *override, const eRNAOverrideMatch flags, eRNAOverrideMatchResult *r_report_flags) { @@ -8566,7 +8566,7 @@ bool RNA_struct_override_matches(Main *bmain, // printf("Override Checking %s\n", rna_path); - if (ignore_overridden && BKE_override_static_property_find(override, rna_path) != NULL) { + if (ignore_overridden && BKE_override_library_property_find(override, rna_path) != NULL) { RNA_PATH_FREE; continue; } @@ -8605,16 +8605,16 @@ bool RNA_struct_override_matches(Main *bmain, if (diff != 0) { /* XXX TODO: refine this for per-item overriding of arrays... */ - IDOverrideStaticProperty *op = BKE_override_static_property_find(override, rna_path); - IDOverrideStaticPropertyOperation *opop = op ? op->operations.first : NULL; + IDOverrideLibraryProperty *op = BKE_override_library_property_find(override, rna_path); + IDOverrideLibraryPropertyOperation *opop = op ? op->operations.first : NULL; if (do_restore && (report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) == 0) { /* We are allowed to restore to reference's values. */ - if (ELEM(NULL, op, opop) || opop->operation == IDOVERRIDESTATIC_OP_NOOP) { + if (ELEM(NULL, op, opop) || opop->operation == IDOVERRIDE_LIBRARY_OP_NOOP) { /* We should restore that property to its reference value */ if (RNA_property_editable(ptr_local, prop_local)) { - IDOverrideStaticPropertyOperation opop_tmp = { - .operation = IDOVERRIDESTATIC_OP_REPLACE, + IDOverrideLibraryPropertyOperation opop_tmp = { + .operation = IDOVERRIDE_LIBRARY_OP_REPLACE, .subitem_reference_index = -1, .subitem_local_index = -1, }; @@ -8697,14 +8697,14 @@ bool RNA_struct_override_store(Main *bmain, PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage, - IDOverrideStatic *override) + IDOverrideLibrary *override) { bool changed = false; #ifdef DEBUG_OVERRIDE_TIMEIT TIMEIT_START_AVERAGED(RNA_struct_override_store); #endif - for (IDOverrideStaticProperty *op = override->properties.first; op; op = op->next) { + for (IDOverrideLibraryProperty *op = override->properties.first; op; op = op->next) { /* Simplified for now! */ PointerRNA data_reference, data_local; PropertyRNA *prop_reference, *prop_local; @@ -8749,13 +8749,13 @@ static void rna_property_override_apply_ex(Main *bmain, PointerRNA *ptr_item_local, PointerRNA *ptr_item_override, PointerRNA *ptr_item_storage, - IDOverrideStaticProperty *op, + IDOverrideLibraryProperty *op, const bool do_insert) { - for (IDOverrideStaticPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { + for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { if (!do_insert != !ELEM(opop->operation, - IDOVERRIDESTATIC_OP_INSERT_AFTER, - IDOVERRIDESTATIC_OP_INSERT_BEFORE)) { + IDOVERRIDE_LIBRARY_OP_INSERT_AFTER, + IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE)) { if (!do_insert) { printf("Skipping insert override operations in first pass (%s)!\n", op->rna_path); } @@ -8785,18 +8785,18 @@ void RNA_struct_override_apply(Main *bmain, PointerRNA *ptr_local, PointerRNA *ptr_override, PointerRNA *ptr_storage, - IDOverrideStatic *override) + IDOverrideLibrary *override) { #ifdef DEBUG_OVERRIDE_TIMEIT TIMEIT_START_AVERAGED(RNA_struct_override_apply); #endif /* Note: Applying insert operations in a separate pass is mandatory. - * We could optimize this later, but for now, as inneficient as it is, + * We could optimize this later, but for now, as inefficient as it is, * don't think this is a critical point. */ bool do_insert = false; for (int i = 0; i < 2; i++, do_insert = true) { - for (IDOverrideStaticProperty *op = override->properties.first; op; op = op->next) { + for (IDOverrideLibraryProperty *op = override->properties.first; op; op = op->next) { /* Simplified for now! */ PointerRNA data_override, data_local; PointerRNA data_item_override, data_item_local; @@ -8832,7 +8832,7 @@ void RNA_struct_override_apply(Main *bmain, #ifndef NDEBUG else { printf( - "Failed to apply static override operation to '%s.%s' " + "Failed to apply library override operation to '%s.%s' " "(could not resolve some properties, local: %d, override: %d)\n", ((ID *)ptr_override->id.data)->name, op->rna_path, @@ -8847,58 +8847,58 @@ void RNA_struct_override_apply(Main *bmain, #endif } -IDOverrideStaticProperty *RNA_property_override_property_find(PointerRNA *ptr, PropertyRNA *prop) +IDOverrideLibraryProperty *RNA_property_override_property_find(PointerRNA *ptr, PropertyRNA *prop) { ID *id = ptr->id.data; - if (!id || !id->override_static) { + if (!id || !id->override_library) { return NULL; } char *rna_path = RNA_path_from_ID_to_property(ptr, prop); if (rna_path) { - IDOverrideStaticProperty *op = BKE_override_static_property_find(id->override_static, - rna_path); + IDOverrideLibraryProperty *op = BKE_override_library_property_find(id->override_library, + rna_path); MEM_freeN(rna_path); return op; } return NULL; } -IDOverrideStaticProperty *RNA_property_override_property_get(PointerRNA *ptr, - PropertyRNA *prop, - bool *r_created) +IDOverrideLibraryProperty *RNA_property_override_property_get(PointerRNA *ptr, + PropertyRNA *prop, + bool *r_created) { ID *id = ptr->id.data; - if (!id || !id->override_static) { + if (!id || !id->override_library) { return NULL; } char *rna_path = RNA_path_from_ID_to_property(ptr, prop); if (rna_path) { - IDOverrideStaticProperty *op = BKE_override_static_property_get( - id->override_static, rna_path, r_created); + IDOverrideLibraryProperty *op = BKE_override_library_property_get( + id->override_library, rna_path, r_created); MEM_freeN(rna_path); return op; } return NULL; } -IDOverrideStaticPropertyOperation *RNA_property_override_property_operation_find( +IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_find( PointerRNA *ptr, PropertyRNA *prop, const int index, const bool strict, bool *r_strict) { - IDOverrideStaticProperty *op = RNA_property_override_property_find(ptr, prop); + IDOverrideLibraryProperty *op = RNA_property_override_property_find(ptr, prop); if (!op) { return NULL; } - return BKE_override_static_property_operation_find( + return BKE_override_library_property_operation_find( op, NULL, NULL, index, index, strict, r_strict); } -IDOverrideStaticPropertyOperation *RNA_property_override_property_operation_get( +IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_get( PointerRNA *ptr, PropertyRNA *prop, const short operation, @@ -8907,27 +8907,27 @@ IDOverrideStaticPropertyOperation *RNA_property_override_property_operation_get( bool *r_strict, bool *r_created) { - IDOverrideStaticProperty *op = RNA_property_override_property_get(ptr, prop, NULL); + IDOverrideLibraryProperty *op = RNA_property_override_property_get(ptr, prop, NULL); if (!op) { return NULL; } - return BKE_override_static_property_operation_get( + return BKE_override_library_property_operation_get( op, operation, NULL, NULL, index, index, strict, r_strict, r_created); } -eRNAOverrideStatus RNA_property_static_override_status(PointerRNA *ptr, - PropertyRNA *prop, - const int index) +eRNAOverrideStatus RNA_property_override_library_status(PointerRNA *ptr, + PropertyRNA *prop, + const int index) { int override_status = 0; - if (!BKE_override_static_is_enabled()) { + if (!BKE_override_library_is_enabled()) { return override_status; } - if (!ptr || !prop || !ptr->id.data || !((ID *)ptr->id.data)->override_static) { + if (!ptr || !prop || !ptr->id.data || !((ID *)ptr->id.data)->override_library) { return override_status; } @@ -8935,14 +8935,14 @@ eRNAOverrideStatus RNA_property_static_override_status(PointerRNA *ptr, override_status |= RNA_OVERRIDE_STATUS_OVERRIDABLE; } - IDOverrideStaticPropertyOperation *opop = RNA_property_override_property_operation_find( + IDOverrideLibraryPropertyOperation *opop = RNA_property_override_property_operation_find( ptr, prop, index, false, NULL); if (opop != NULL) { override_status |= RNA_OVERRIDE_STATUS_OVERRIDDEN; - if (opop->flag & IDOVERRIDESTATIC_FLAG_MANDATORY) { + if (opop->flag & IDOVERRIDE_LIBRARY_FLAG_MANDATORY) { override_status |= RNA_OVERRIDE_STATUS_MANDATORY; } - if (opop->flag & IDOVERRIDESTATIC_FLAG_LOCKED) { + if (opop->flag & IDOVERRIDE_LIBRARY_FLAG_LOCKED) { override_status |= RNA_OVERRIDE_STATUS_LOCKED; } } diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 4db8ccce3ef..3d14616bcc9 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -714,10 +714,10 @@ bool rna_AnimaData_override_apply(Main *UNUSED(bmain), PointerRNA *UNUSED(ptr_item_dst), PointerRNA *UNUSED(ptr_item_src), PointerRNA *UNUSED(ptr_item_storage), - IDOverrideStaticPropertyOperation *opop) + IDOverrideLibraryPropertyOperation *opop) { BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage) && len_dst == 0); - BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_REPLACE && + BLI_assert(opop->operation == IDOVERRIDE_LIBRARY_OP_REPLACE && "Unsupported RNA override operation on animdata pointer"); UNUSED_VARS_NDEBUG(ptr_storage, len_dst, len_src, len_storage, opop); @@ -1239,7 +1239,7 @@ void rna_def_animdata_common(StructRNA *srna) prop = RNA_def_property(srna, "animation_data", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "adt"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_override_funcs(prop, NULL, NULL, "rna_AnimaData_override_apply"); RNA_def_property_ui_text(prop, "Animation Data", "Animation data for this data-block"); } @@ -1265,7 +1265,7 @@ static void rna_def_animdata(BlenderRNA *brna) prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); /* this flag as well as the dynamic test must be defined for this to be editable... */ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_pointer_funcs( prop, NULL, "rna_AnimData_action_set", NULL, "rna_Action_id_poll"); RNA_def_property_editable_func(prop, "rna_AnimData_action_editable"); @@ -1304,7 +1304,7 @@ static void rna_def_animdata(BlenderRNA *brna) prop = RNA_def_property(srna, "drivers", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "drivers", NULL); RNA_def_property_struct_type(prop, "FCurve"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Drivers", "The Drivers/Expressions for this data-block"); rna_api_animdata_drivers(brna, prop); diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index d20b99e93e1..fabbc7ca18b 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -1560,8 +1560,8 @@ static void rna_def_brush(BlenderRNA *brna) }; static const EnumPropertyItem brush_size_unit_items[] = { - {0, "VIEW", 0, "View", "Measure brush size relateve to the view"}, - {BRUSH_LOCK_SIZE, "SCENE", 0, "Scene", "Measure brush size relateve to the scene"}, + {0, "VIEW", 0, "View", "Measure brush size relative to the view"}, + {BRUSH_LOCK_SIZE, "SCENE", 0, "Scene", "Measure brush size relative to the scene"}, {0, NULL, 0, NULL, NULL}, }; diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c index 99606a929a9..5a37c4c0e6f 100644 --- a/source/blender/makesrna/intern/rna_collection.c +++ b/source/blender/makesrna/intern/rna_collection.c @@ -128,10 +128,10 @@ static bool rna_Collection_objects_override_apply(Main *bmain, PointerRNA *ptr_item_dst, PointerRNA *ptr_item_src, PointerRNA *UNUSED(ptr_item_storage), - IDOverrideStaticPropertyOperation *opop) + IDOverrideLibraryPropertyOperation *opop) { (void)opop; - BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_REPLACE && + BLI_assert(opop->operation == IDOVERRIDE_LIBRARY_OP_REPLACE && "Unsupported RNA override operation on collections' objects"); Collection *coll_dst = ptr_dst->id.data; @@ -231,10 +231,10 @@ static bool rna_Collection_children_override_apply(Main *bmain, PointerRNA *ptr_item_dst, PointerRNA *ptr_item_src, PointerRNA *UNUSED(ptr_item_storage), - IDOverrideStaticPropertyOperation *opop) + IDOverrideLibraryPropertyOperation *opop) { (void)opop; - BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_REPLACE && + BLI_assert(opop->operation == IDOVERRIDE_LIBRARY_OP_REPLACE && "Unsupported RNA override operation on collections' objects"); Collection *coll_dst = ptr_dst->id.data; @@ -385,7 +385,7 @@ void RNA_def_collections(BlenderRNA *brna) prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Collection_objects_override_apply"); RNA_def_property_ui_text(prop, "Objects", "Objects that are directly in this collection"); RNA_def_property_collection_funcs(prop, @@ -415,7 +415,7 @@ void RNA_def_collections(BlenderRNA *brna) prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Collection"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Collection_children_override_apply"); RNA_def_property_ui_text( prop, "Children", "Collections that are immediate children of this collection"); @@ -434,7 +434,7 @@ void RNA_def_collections(BlenderRNA *brna) prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_SELECT); RNA_def_property_boolean_funcs(prop, NULL, "rna_Collection_hide_select_set"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1); RNA_def_property_ui_text(prop, "Disable Selection", "Disable selection in viewport"); @@ -443,7 +443,7 @@ void RNA_def_collections(BlenderRNA *brna) prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_VIEWPORT); RNA_def_property_boolean_funcs(prop, NULL, "rna_Collection_hide_viewport_set"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1); RNA_def_property_ui_text(prop, "Disable in Viewports", "Globally disable in viewports"); @@ -452,7 +452,7 @@ void RNA_def_collections(BlenderRNA *brna) prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_RENDER); RNA_def_property_boolean_funcs(prop, NULL, "rna_Collection_hide_render_set"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1); RNA_def_property_ui_text(prop, "Disable in Renders", "Globally disable in renders"); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index cf2a9878a37..1724bf1652b 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -798,7 +798,7 @@ static void rna_def_constraint_target_common(StructRNA *srna) RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target object"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); @@ -821,7 +821,7 @@ static void rna_def_constrainttarget(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_ui_text(prop, "Target", "Target object"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update( prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update"); @@ -851,7 +851,7 @@ static void rna_def_constrainttarget_bone(BlenderRNA *brna) RNA_def_property_pointer_funcs( prop, NULL, "rna_ConstraintTargetBone_target_set", NULL, "rna_Armature_object_poll"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update( prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update"); @@ -1075,7 +1075,7 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "poletar"); RNA_def_property_ui_text(prop, "Pole Target", "Object for pole rotation"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop = RNA_def_property(srna, "pole_subtarget", PROP_STRING, PROP_NONE); @@ -1539,7 +1539,7 @@ static void rna_def_constraint_action(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Action_id_poll"); RNA_def_property_ui_text(prop, "Action", "The constraining action"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); prop = RNA_def_property(srna, "use_bone_object_action", PROP_BOOLEAN, PROP_NONE); @@ -1647,7 +1647,7 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll"); RNA_def_property_ui_text(prop, "Target", "Target Curve object"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TIME); @@ -1806,7 +1806,7 @@ static void rna_def_constraint_clamp_to(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll"); RNA_def_property_ui_text(prop, "Target", "Target Object (Curves only)"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop = RNA_def_property(srna, "main_axis", PROP_ENUM, PROP_NONE); @@ -2430,7 +2430,7 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll"); RNA_def_property_ui_text(prop, "Target", "Target Mesh object"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop = RNA_def_property(srna, "shrinkwrap_type", PROP_ENUM, PROP_NONE); @@ -2586,7 +2586,7 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll"); RNA_def_property_ui_text(prop, "Target", "Curve that controls this relationship"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE); @@ -2755,7 +2755,7 @@ static void rna_def_constraint_pivot(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Target", "Target Object, defining the position of the pivot when defined"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); @@ -2812,7 +2812,7 @@ static void rna_def_constraint_follow_track(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "clip"); RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update"); /* track */ @@ -2846,7 +2846,7 @@ static void rna_def_constraint_follow_track(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update"); RNA_def_property_pointer_funcs(prop, NULL, @@ -2862,7 +2862,7 @@ static void rna_def_constraint_follow_track(BlenderRNA *brna) "Depth Object", "Object used to define depth in camera space by projecting onto surface of this object"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update"); RNA_def_property_pointer_funcs(prop, NULL, @@ -2900,7 +2900,7 @@ static void rna_def_constraint_camera_solver(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "clip"); RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update"); /* use default clip */ @@ -2926,7 +2926,7 @@ static void rna_def_constraint_object_solver(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "clip"); RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update"); /* use default clip */ @@ -2947,7 +2947,7 @@ static void rna_def_constraint_object_solver(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update"); RNA_def_property_pointer_funcs(prop, NULL, @@ -2972,7 +2972,7 @@ static void rna_def_constraint_transform_cache(BlenderRNA *brna) RNA_def_property_struct_type(prop, "CacheFile"); RNA_def_property_ui_text(prop, "Cache File", ""); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, 0, "rna_Constraint_dependency_update"); prop = RNA_def_property(srna, "object_path", PROP_STRING, PROP_NONE); @@ -3028,14 +3028,14 @@ void RNA_def_constraint(BlenderRNA *brna) /* flags */ prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_OFF); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Disable", "Enable/Disable Constraint"); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_EXPAND); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Expanded", "Constraint's panel is expanded in UI"); RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1); diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index f7f18eeb005..222d2fc69da 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -1708,7 +1708,7 @@ static void rna_def_drivertarget(BlenderRNA *brna) prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "ID"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_editable_func(prop, "rna_DriverTarget_id_editable"); /* note: custom set function is ONLY to avoid rna setting a user for this. */ RNA_def_property_pointer_funcs( @@ -1814,7 +1814,7 @@ static void rna_def_drivervar(BlenderRNA *brna) prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "targets", "num_targets"); RNA_def_property_struct_type(prop, "DriverTarget"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Targets", "Sources of input data for evaluating this variable"); /* Name Validity Flags */ @@ -1892,7 +1892,7 @@ static void rna_def_channeldriver(BlenderRNA *brna) prop = RNA_def_property(srna, "variables", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "variables", NULL); RNA_def_property_struct_type(prop, "DriverVariable"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Variables", "Properties acting as inputs for this driver"); rna_def_channeldriver_variables(brna, prop); @@ -2252,7 +2252,7 @@ static void rna_def_fcurve(BlenderRNA *brna) /* Pointers */ prop = RNA_def_property(srna, "driver", PROP_POINTER, PROP_NONE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Driver", "Channel Driver (only set for Driver F-Curves)"); diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 2e2cb9c1054..3b7a0a5a275 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -1653,7 +1653,7 @@ static void rna_def_gpencil_data(BlenderRNA *brna) srna = RNA_def_struct(brna, "GreasePencil", "ID"); RNA_def_struct_sdna(srna, "bGPdata"); RNA_def_struct_ui_text(srna, "Grease Pencil", "Freehand annotation sketchbook"); - RNA_def_struct_ui_icon(srna, ICON_GREASEPENCIL); + RNA_def_struct_ui_icon(srna, ICON_OUTLINER_DATA_GREASEPENCIL); /* Layers */ prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c index 6a8cd3a9551..d35bad989e8 100644 --- a/source/blender/makesrna/intern/rna_gpencil_modifier.c +++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c @@ -1662,7 +1662,7 @@ static void rna_def_modifier_gpencilarmature(BlenderRNA *brna) RNA_def_property_pointer_funcs( prop, NULL, "rna_ArmatureGpencilModifier_object_set", NULL, "rna_Armature_object_poll"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE); @@ -1842,13 +1842,13 @@ void RNA_def_greasepencil_modifier(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "mode", eGpencilModifierMode_Realtime); RNA_def_property_ui_text(prop, "Realtime", "Display modifier in viewport"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_ON, 1); prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", eGpencilModifierMode_Render); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Render", "Use modifier during render"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_ON, 1); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL); @@ -1862,7 +1862,7 @@ void RNA_def_greasepencil_modifier(BlenderRNA *brna) prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE); RNA_def_property_boolean_sdna(prop, NULL, "mode", eGpencilModifierMode_Expanded); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface"); RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1); diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 2d8014b60d5..b6e737583fc 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -722,7 +722,7 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_struct_ui_icon(srna, ICON_IMAGE_DATA); prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update"); @@ -763,7 +763,7 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Packed Files", "Collection of packed images"); prop = RNA_def_property(srna, "use_view_as_render", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_VIEW_AS_RENDER); RNA_def_property_ui_text( prop, @@ -772,31 +772,31 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_DEINTERLACE); RNA_def_property_ui_text(prop, "Deinterlace", "Deinterlace movie file on load"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update"); prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_USE_VIEWS); RNA_def_property_ui_text(prop, "Use Multi-View", "Use Multiple Views (when available)"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update"); prop = RNA_def_property(srna, "is_stereo_3d", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_boolean_funcs(prop, "rna_Image_is_stereo_3d_get", NULL); RNA_def_property_ui_text(prop, "Stereo 3D", "Image has left and right views"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "is_multiview", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_boolean_funcs(prop, "rna_Image_is_multiview_get", NULL); RNA_def_property_ui_text(prop, "Multiple Views", "Image has more than one view"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_boolean_funcs(prop, "rna_Image_dirty_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Dirty", "Image has changed and is not saved"); @@ -839,7 +839,7 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_float_sdna(prop, NULL, "aspx"); RNA_def_property_array(prop, 2); RNA_def_property_range(prop, 0.1f, FLT_MAX); @@ -890,7 +890,7 @@ static void rna_def_image(BlenderRNA *brna) prop = RNA_def_float_vector( srna, "resolution", 2, NULL, 0, 0, "Resolution", "X/Y pixels per meter", 0, 0); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_float_funcs(prop, "rna_Image_resolution_get", "rna_Image_resolution_set", NULL); prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_UNSIGNED); @@ -926,7 +926,7 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings"); prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_enum_items(prop, alpha_mode_items); RNA_def_property_ui_text(prop, "Alpha Mode", @@ -936,7 +936,7 @@ static void rna_def_image(BlenderRNA *brna) /* multiview */ prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_enum_sdna(prop, NULL, "views_format"); RNA_def_property_enum_items(prop, rna_enum_views_format_items); RNA_def_property_ui_text(prop, "Views Format", "Mode to load image views"); diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 1ea35ed4029..96cdc06d901 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -32,9 +32,9 @@ struct Depsgraph; struct FreestyleSettings; struct ID; -struct IDOverrideStatic; -struct IDOverrideStaticProperty; -struct IDOverrideStaticPropertyOperation; +struct IDOverrideLibrary; +struct IDOverrideLibraryProperty; +struct IDOverrideLibraryPropertyOperation; struct IDProperty; struct Main; struct Mesh; @@ -222,7 +222,7 @@ bool rna_AnimaData_override_apply(struct Main *bmain, struct PointerRNA *ptr_item_local, struct PointerRNA *ptr_item_reference, struct PointerRNA *ptr_item_storage, - struct IDOverrideStaticPropertyOperation *opop); + struct IDOverrideLibraryPropertyOperation *opop); void rna_def_animviz_common(struct StructRNA *srna); void rna_def_motionpath_common(struct StructRNA *srna); @@ -479,7 +479,7 @@ int rna_property_override_diff_default(struct Main *bmain, const int len_a, const int len_b, const int mode, - struct IDOverrideStatic *override, + struct IDOverrideLibrary *override, const char *rna_path, const int flags, bool *r_override_changed); @@ -494,7 +494,7 @@ bool rna_property_override_store_default(struct Main *bmain, const int len_local, const int len_reference, const int len_storage, - struct IDOverrideStaticPropertyOperation *opop); + struct IDOverrideLibraryPropertyOperation *opop); bool rna_property_override_apply_default(struct Main *bmain, struct PointerRNA *ptr_dst, @@ -509,7 +509,7 @@ bool rna_property_override_apply_default(struct Main *bmain, struct PointerRNA *ptr_item_dst, struct PointerRNA *ptr_item_src, struct PointerRNA *ptr_item_storage, - struct IDOverrideStaticPropertyOperation *opop); + struct IDOverrideLibraryPropertyOperation *opop); /* Builtin Property Callbacks */ diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index ccead626bb6..60cf443383e 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -30,9 +30,9 @@ struct CollectionPropertyIterator; struct ContainerRNA; struct FunctionRNA; struct GHash; -struct IDOverrideStatic; -struct IDOverrideStaticProperty; -struct IDOverrideStaticPropertyOperation; +struct IDOverrideLibrary; +struct IDOverrideLibraryProperty; +struct IDOverrideLibraryPropertyOperation; struct IDProperty; struct Main; struct PointerRNA; @@ -175,7 +175,7 @@ typedef int (*RNAPropOverrideDiff)(struct Main *bmain, const int len_a, const int len_b, const int mode, - struct IDOverrideStatic *override, + struct IDOverrideLibrary *override, const char *rna_path, const int flags, bool *r_override_changed); @@ -200,7 +200,7 @@ typedef bool (*RNAPropOverrideStore)(struct Main *bmain, const int len_local, const int len_reference, const int len_storage, - struct IDOverrideStaticPropertyOperation *opop); + struct IDOverrideLibraryPropertyOperation *opop); /** * Apply given override operation from src to dst (using value from storage as second operand @@ -222,7 +222,7 @@ typedef bool (*RNAPropOverrideApply)(struct Main *bmain, struct PointerRNA *ptr_item_dst, struct PointerRNA *ptr_item_src, struct PointerRNA *ptr_item_storage, - struct IDOverrideStaticPropertyOperation *opop); + struct IDOverrideLibraryPropertyOperation *opop); /* Container - generic abstracted container of RNA properties */ typedef struct ContainerRNA { diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index 1a3b7ee7f63..003faed5b81 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -369,7 +369,7 @@ static void rna_def_layer_collection(BlenderRNA *brna) prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_HIDE); RNA_def_property_boolean_funcs(prop, NULL, "rna_LayerCollection_hide_viewport_set"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1); RNA_def_property_ui_text(prop, "Hide in Viewport", "Temporarily hide in viewport"); RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_update"); @@ -456,7 +456,7 @@ static void rna_def_object_base(BlenderRNA *brna) prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BASE_HIDDEN); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1); RNA_def_property_ui_text(prop, "Hide in Viewport", "Temporarily hide in viewport"); RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 18d65028396..1096b3380d0 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -2183,7 +2183,7 @@ static void rna_def_modifier_armature(BlenderRNA *brna) RNA_def_property_pointer_funcs( prop, NULL, "rna_ArmatureModifier_object_set", NULL, "rna_Armature_object_poll"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE); @@ -6108,13 +6108,13 @@ void RNA_def_modifier(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Realtime); RNA_def_property_ui_text(prop, "Realtime", "Display modifier in viewport"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, 0, "rna_Modifier_update"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_ON, 1); prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Render); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Render", "Use modifier during render"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_ON, 1); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL); @@ -6134,7 +6134,7 @@ void RNA_def_modifier(BlenderRNA *brna) prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE); RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Expanded); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface"); RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 774f82c3803..578097733f2 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1383,9 +1383,9 @@ bool rna_Object_constraints_override_apply(Main *UNUSED(bmain), PointerRNA *UNUSED(ptr_item_dst), PointerRNA *UNUSED(ptr_item_src), PointerRNA *UNUSED(ptr_item_storage), - IDOverrideStaticPropertyOperation *opop) + IDOverrideLibraryPropertyOperation *opop) { - BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_INSERT_AFTER && + BLI_assert(opop->operation == IDOVERRIDE_LIBRARY_OP_INSERT_AFTER && "Unsupported RNA override operation on constraints collection"); Object *ob_dst = (Object *)ptr_dst->id.data; @@ -1471,9 +1471,9 @@ bool rna_Object_modifiers_override_apply(Main *UNUSED(bmain), PointerRNA *UNUSED(ptr_item_dst), PointerRNA *UNUSED(ptr_item_src), PointerRNA *UNUSED(ptr_item_storage), - IDOverrideStaticPropertyOperation *opop) + IDOverrideLibraryPropertyOperation *opop) { - BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_INSERT_AFTER && + BLI_assert(opop->operation == IDOVERRIDE_LIBRARY_OP_INSERT_AFTER && "Unsupported RNA override operation on modifiers collection"); Object *ob_dst = (Object *)ptr_dst->id.data; @@ -1930,7 +1930,7 @@ static void rna_def_material_slot(BlenderRNA *brna) RNA_def_property_enum_items(prop, link_items); RNA_def_property_enum_funcs( prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update"); @@ -1938,7 +1938,7 @@ static void rna_def_material_slot(BlenderRNA *brna) RNA_def_property_struct_type(prop, "Material"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_editable_func(prop, "rna_MaterialSlot_material_editable"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set", @@ -2356,7 +2356,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_pointer_funcs( prop, NULL, "rna_Object_data_set", "rna_Object_data_typef", "rna_Object_data_poll"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Data", "Object data"); RNA_def_property_update(prop, 0, "rna_Object_internal_update_data"); @@ -2388,7 +2388,7 @@ static void rna_def_object(BlenderRNA *brna) prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_parent_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Parent", "Parent Object"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update"); @@ -2451,7 +2451,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol"); RNA_def_property_struct_type(prop, "MaterialSlot"); RNA_def_property_override_flag(prop, - PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_NO_PROP_NAME); + PROPOVERRIDE_OVERRIDABLE_LIBRARY | PROPOVERRIDE_NO_PROP_NAME); /* don't dereference pointer! */ RNA_def_property_collection_funcs( prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL); @@ -2465,7 +2465,7 @@ static void rna_def_object(BlenderRNA *brna) NULL, "rna_MaterialSlot_material_poll"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_editable_func(prop, "rna_Object_active_material_editable"); RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update"); @@ -2473,7 +2473,7 @@ static void rna_def_object(BlenderRNA *brna) prop = RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "actcol"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set", @@ -2485,7 +2485,7 @@ static void rna_def_object(BlenderRNA *brna) prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION); RNA_def_property_float_sdna(prop, NULL, "loc"); RNA_def_property_editable_array_func(prop, "rna_Object_location_editable"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Location", "Location of the object"); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update"); @@ -2493,7 +2493,7 @@ static void rna_def_object(BlenderRNA *brna) prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION); RNA_def_property_float_sdna(prop, NULL, "quat"); RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_float_array_default(prop, rna_default_quaternion); RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions"); RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update"); @@ -2507,7 +2507,7 @@ static void rna_def_object(BlenderRNA *brna) prop, "rna_Object_rotation_axis_angle_get", "rna_Object_rotation_axis_angle_set", NULL); RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable"); RNA_def_property_float_array_default(prop, rna_default_axis_angle); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation"); RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update"); @@ -2515,7 +2515,7 @@ static void rna_def_object(BlenderRNA *brna) prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER); RNA_def_property_float_sdna(prop, NULL, "rot"); RNA_def_property_editable_array_func(prop, "rna_Object_rotation_euler_editable"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers"); RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update"); @@ -2528,7 +2528,7 @@ static void rna_def_object(BlenderRNA *brna) prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ); RNA_def_property_flag(prop, PROP_PROPORTIONAL); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_editable_array_func(prop, "rna_Object_scale_editable"); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3); RNA_def_property_float_array_default(prop, rna_default_scale_3d); @@ -2680,8 +2680,8 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Modifiers", "Modifiers affecting the geometric data of the object"); RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_modifiers_override_apply"); - RNA_def_property_override_flag(prop, - PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_STATIC_INSERTION); + RNA_def_property_override_flag( + prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY | PROPOVERRIDE_LIBRARY_INSERTION); rna_def_object_modifiers(brna, prop); /* Grease Pencil modifiers. */ @@ -2702,8 +2702,8 @@ static void rna_def_object(BlenderRNA *brna) /* constraints */ prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Constraint"); - RNA_def_property_override_flag(prop, - PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_STATIC_INSERTION); + RNA_def_property_override_flag( + prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY | PROPOVERRIDE_LIBRARY_INSERTION); RNA_def_property_ui_text( prop, "Constraints", "Constraints affecting the transformation of the object"); RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_constraints_override_apply"); @@ -2850,7 +2850,7 @@ static void rna_def_object(BlenderRNA *brna) /* restrict */ prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEWPORT); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Disable in Viewports", "Globally disable in viewports"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update"); @@ -2858,14 +2858,14 @@ static void rna_def_object(BlenderRNA *brna) prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Disable Selection", "Disable selection in viewport"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update"); prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Disable in Renders", "Globally disable in renders"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update"); @@ -2985,7 +2985,7 @@ static void rna_def_object(BlenderRNA *brna) prop = RNA_def_property(srna, "pose", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "pose"); RNA_def_property_struct_type(prop, "Pose"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures"); /* shape keys */ diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index c1822b35f28..8112231ed16 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -173,7 +173,8 @@ static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, for (md = ob->modifiers.first; md; md = md->next) { if (md->type == eModifierType_ParticleSystem) { psmd = (ParticleSystemModifierData *)md; - if (psmd && psmd->mesh_final && psmd->psys) { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); + if (psmd && mesh_final && psmd->psys) { psys = psmd->psys; for (i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) { /* hairkeys are stored sequentially in memory, so we can @@ -208,7 +209,8 @@ static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *valu } else { float hairmat[4][4]; - psys_mat_hair_to_object(ob, psmd->mesh_final, psmd->psys->part->from, pa, hairmat); + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); + psys_mat_hair_to_object(ob, mesh_final, psmd->psys->part->from, pa, hairmat); copy_v3_v3(values, hkey->co); mul_m4_v3(hairmat, values); } @@ -238,7 +240,8 @@ static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float float hairmat[4][4]; float imat[4][4]; - psys_mat_hair_to_object(ob, psmd->mesh_final, psmd->psys->part->from, pa, hairmat); + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); + psys_mat_hair_to_object(ob, mesh_final, psmd->psys->part->from, pa, hairmat); invert_m4_m4(imat, hairmat); copy_v3_v3(hkey->co, values); mul_m4_v3(imat, hkey->co); @@ -265,8 +268,8 @@ static void rna_ParticleHairKey_co_object(HairKey *hairkey, } else { float hairmat[4][4]; - psys_mat_hair_to_object( - object, modifier->mesh_final, modifier->psys->part->from, particle, hairmat); + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(modifier); + psys_mat_hair_to_object(object, mesh_final, modifier->psys->part->from, particle, hairmat); copy_v3_v3(n_co, hairkey->co); mul_m4_v3(hairmat, n_co); } @@ -290,14 +293,15 @@ static void rna_Particle_uv_on_emitter(ParticleData *particle, int num = particle->num_dmcache; int from = modifier->psys->part->from; - if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPUV)) { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(modifier); + if (!CustomData_has_layer(&mesh_final->ldata, CD_MLOOPUV)) { BKE_report(reports, RPT_ERROR, "Mesh has no UV data"); return; } - BKE_mesh_tessface_ensure(modifier->mesh_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */ + BKE_mesh_tessface_ensure(mesh_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */ if (num == DMCACHE_NOTFOUND) { - if (particle->num < modifier->mesh_final->totface) { + if (particle->num < mesh_final->totface) { num = particle->num; } } @@ -309,8 +313,8 @@ static void rna_Particle_uv_on_emitter(ParticleData *particle, MFace *mface; MTFace *mtface; - mface = modifier->mesh_final->mface; - mtface = modifier->mesh_final->mtface; + mface = mesh_final->mface; + mtface = mesh_final->mtface; if (mface && mtface) { mtface += num; @@ -439,9 +443,10 @@ static int rna_ParticleSystem_tessfaceidx_on_emitter(ParticleSystem *particlesys int totvert; int num = -1; - BKE_mesh_tessface_ensure(modifier->mesh_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */ - totface = modifier->mesh_final->totface; - totvert = modifier->mesh_final->totvert; + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(modifier); + BKE_mesh_tessface_ensure(mesh_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */ + totface = mesh_final->totface; + totvert = mesh_final->totvert; /* 1. check that everything is ok & updated */ if (!particlesystem || !totface) { @@ -474,7 +479,7 @@ static int rna_ParticleSystem_tessfaceidx_on_emitter(ParticleSystem *particlesys } else if (part->from == PART_FROM_VERT) { if (num != DMCACHE_NOTFOUND && num < totvert) { - MFace *mface = modifier->mesh_final->mface; + MFace *mface = mesh_final->mface; *r_fuv = &particle->fuv; @@ -517,7 +522,7 @@ static int rna_ParticleSystem_tessfaceidx_on_emitter(ParticleSystem *particlesys } else if (part->from == PART_FROM_VERT) { if (num != DMCACHE_NOTFOUND && num < totvert) { - MFace *mface = modifier->mesh_final->mface; + MFace *mface = mesh_final->mface; *r_fuv = &parent->fuv; @@ -545,12 +550,13 @@ static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, int uv_no, float r_uv[2]) { - if (modifier->mesh_final == NULL) { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(modifier); + if (mesh_final == NULL) { BKE_report(reports, RPT_ERROR, "Object was not yet evaluated"); zero_v2(r_uv); return; } - if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPUV)) { + if (!CustomData_has_layer(&mesh_final->ldata, CD_MLOOPUV)) { BKE_report(reports, RPT_ERROR, "Mesh has no UV data"); zero_v2(r_uv); return; @@ -567,9 +573,8 @@ static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, zero_v2(r_uv); } else { - MFace *mface = &modifier->mesh_final->mface[num]; - MTFace *mtface = (MTFace *)CustomData_get_layer_n( - &modifier->mesh_final->fdata, CD_MTFACE, uv_no); + MFace *mface = &mesh_final->mface[num]; + MTFace *mtface = (MTFace *)CustomData_get_layer_n(&mesh_final->fdata, CD_MTFACE, uv_no); psys_interpolate_uvs(&mtface[num], mface->v4, *fuv, r_uv); } @@ -584,7 +589,8 @@ static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, int vcol_no, float r_mcol[3]) { - if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPCOL)) { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(modifier); + if (!CustomData_has_layer(&mesh_final->ldata, CD_MLOOPCOL)) { BKE_report(reports, RPT_ERROR, "Mesh has no VCol data"); zero_v3(r_mcol); return; @@ -601,8 +607,8 @@ static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, zero_v3(r_mcol); } else { - MFace *mface = &modifier->mesh_final->mface[num]; - MCol *mc = (MCol *)CustomData_get_layer_n(&modifier->mesh_final->fdata, CD_MCOL, vcol_no); + MFace *mface = &mesh_final->mface[num]; + MCol *mc = (MCol *)CustomData_get_layer_n(&mesh_final->fdata, CD_MCOL, vcol_no); MCol mcol; psys_interpolate_mcol(&mc[num * 4], mface->v4, *fuv, &mcol); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index b61b7a68963..8546702c377 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -614,9 +614,9 @@ bool rna_PoseChannel_constraints_override_apply(Main *UNUSED(bmain), PointerRNA *UNUSED(ptr_item_dst), PointerRNA *UNUSED(ptr_item_src), PointerRNA *UNUSED(ptr_item_storage), - IDOverrideStaticPropertyOperation *opop) + IDOverrideLibraryPropertyOperation *opop) { - BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_INSERT_AFTER && + BLI_assert(opop->operation == IDOVERRIDE_LIBRARY_OP_INSERT_AFTER && "Unsupported RNA override operation on constraints collection"); bPoseChannel *pchan_dst = (bPoseChannel *)ptr_dst->data; @@ -946,8 +946,8 @@ static void rna_def_pose_channel(BlenderRNA *brna) /* Bone Constraints */ prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Constraint"); - RNA_def_property_override_flag(prop, - PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_STATIC_INSERTION); + RNA_def_property_override_flag( + prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY | PROPOVERRIDE_LIBRARY_INSERTION); RNA_def_property_ui_text(prop, "Constraints", "Constraints that act on this PoseChannel"); RNA_def_property_override_funcs(prop, NULL, NULL, "rna_PoseChannel_constraints_override_apply"); @@ -987,7 +987,7 @@ static void rna_def_pose_channel(BlenderRNA *brna) /* Transformation settings */ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION); RNA_def_property_float_sdna(prop, NULL, "loc"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_editable_array_func(prop, "rna_PoseChannel_location_editable"); RNA_def_property_ui_text(prop, "Location", ""); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); @@ -996,7 +996,7 @@ static void rna_def_pose_channel(BlenderRNA *brna) prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "size"); RNA_def_property_flag(prop, PROP_PROPORTIONAL); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_editable_array_func(prop, "rna_PoseChannel_scale_editable"); RNA_def_property_float_array_default(prop, rna_default_scale_3d); RNA_def_property_ui_text(prop, "Scale", ""); @@ -1004,7 +1004,7 @@ static void rna_def_pose_channel(BlenderRNA *brna) prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION); RNA_def_property_float_sdna(prop, NULL, "quat"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable"); RNA_def_property_float_array_default(prop, rna_default_quaternion); RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions"); @@ -1014,7 +1014,7 @@ static void rna_def_pose_channel(BlenderRNA *brna) * having a single one is better for Keyframing and other property-management situations... */ prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_array(prop, 4); RNA_def_property_float_funcs(prop, "rna_PoseChannel_rotation_axis_angle_get", @@ -1028,7 +1028,7 @@ static void rna_def_pose_channel(BlenderRNA *brna) prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER); RNA_def_property_float_sdna(prop, NULL, "eul"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_euler_editable"); RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers"); RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update"); @@ -1277,7 +1277,7 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "custom_tx"); RNA_def_property_struct_type(prop, "PoseBone"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Custom Shape Transform", "Bone that defines the display transform of this custom shape"); @@ -1580,7 +1580,7 @@ static void rna_def_pose(BlenderRNA *brna) prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "chanbase", NULL); RNA_def_property_struct_type(prop, "PoseBone"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Pose Bones", "Individual pose bones for the armature"); /* can be removed, only for fast lookup */ RNA_def_property_collection_funcs( diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 5dad1218307..8c3e1a724cf 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -613,7 +613,7 @@ static bool rna_Property_overridable_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - return (prop->flag_override & PROPOVERRIDE_OVERRIDABLE_STATIC) != 0; + return (prop->flag_override & PROPOVERRIDE_OVERRIDABLE_LIBRARY) != 0; } static bool rna_Property_use_output_get(PointerRNA *ptr) @@ -1176,7 +1176,7 @@ static bool rna_property_override_diff_propptr_validate_diffing(PointerRNA *prop /* We do a generic quick first comparison checking for "name" and/or "type" properties. * We assume that is any of those are false, then we are not handling the same data. - * This helps a lot in static override case, especially to detect inserted items in collections. + * This helps a lot in library override case, especially to detect inserted items in collections. */ if (!no_prop_name && (is_valid_for_diffing || do_force_name)) { PropertyRNA *nameprop_a = RNA_struct_name_property(propptr_a->type); @@ -1239,7 +1239,7 @@ static int rna_property_override_diff_propptr(Main *bmain, eRNACompareMode mode, const bool no_ownership, const bool no_prop_name, - IDOverrideStatic *override, + IDOverrideLibrary *override, const char *rna_path, const int flags, bool *r_override_changed) @@ -1279,12 +1279,12 @@ static int rna_property_override_diff_propptr(Main *bmain, if (do_create && comp != 0) { bool created = false; - IDOverrideStaticProperty *op = BKE_override_static_property_get( + IDOverrideLibraryProperty *op = BKE_override_library_property_get( override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ - BKE_override_static_property_operation_get( - op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); + BKE_override_library_property_operation_get( + op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); if (r_override_changed) { *r_override_changed = created; } @@ -1325,7 +1325,7 @@ int rna_property_override_diff_default(Main *bmain, const int len_a, const int len_b, const int mode, - IDOverrideStatic *override, + IDOverrideLibrary *override, const char *rna_path, const int flags, bool *r_override_changed) @@ -1357,12 +1357,12 @@ int rna_property_override_diff_default(Main *bmain, if (do_create && comp != 0) { /* XXX TODO this will have to be refined to handle array items */ bool created = false; - IDOverrideStaticProperty *op = BKE_override_static_property_get( + IDOverrideLibraryProperty *op = BKE_override_library_property_get( override, rna_path, &created); if (op != NULL && created) { - BKE_override_static_property_operation_get( - op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); + BKE_override_library_property_operation_get( + op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); if (r_override_changed) { *r_override_changed = created; } @@ -1388,12 +1388,12 @@ int rna_property_override_diff_default(Main *bmain, if (do_create && comp != 0) { bool created = false; - IDOverrideStaticProperty *op = BKE_override_static_property_get( + IDOverrideLibraryProperty *op = BKE_override_library_property_get( override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ - BKE_override_static_property_operation_get( - op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); + BKE_override_library_property_operation_get( + op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); if (r_override_changed) { *r_override_changed = created; } @@ -1422,12 +1422,12 @@ int rna_property_override_diff_default(Main *bmain, if (do_create && comp != 0) { /* XXX TODO this will have to be refined to handle array items */ bool created = false; - IDOverrideStaticProperty *op = BKE_override_static_property_get( + IDOverrideLibraryProperty *op = BKE_override_library_property_get( override, rna_path, &created); if (op != NULL && created) { - BKE_override_static_property_operation_get( - op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); + BKE_override_library_property_operation_get( + op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); if (r_override_changed) { *r_override_changed = created; } @@ -1453,12 +1453,12 @@ int rna_property_override_diff_default(Main *bmain, if (do_create && comp != 0) { bool created = false; - IDOverrideStaticProperty *op = BKE_override_static_property_get( + IDOverrideLibraryProperty *op = BKE_override_library_property_get( override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ - BKE_override_static_property_operation_get( - op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); + BKE_override_library_property_operation_get( + op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); if (r_override_changed) { *r_override_changed = created; } @@ -1487,12 +1487,12 @@ int rna_property_override_diff_default(Main *bmain, if (do_create && comp != 0) { /* XXX TODO this will have to be refined to handle array items */ bool created = false; - IDOverrideStaticProperty *op = BKE_override_static_property_get( + IDOverrideLibraryProperty *op = BKE_override_library_property_get( override, rna_path, &created); if (op != NULL && created) { - BKE_override_static_property_operation_get( - op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); + BKE_override_library_property_operation_get( + op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); if (r_override_changed) { *r_override_changed = created; } @@ -1518,12 +1518,12 @@ int rna_property_override_diff_default(Main *bmain, if (do_create && comp != 0) { bool created = false; - IDOverrideStaticProperty *op = BKE_override_static_property_get( + IDOverrideLibraryProperty *op = BKE_override_library_property_get( override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ - BKE_override_static_property_operation_get( - op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); + BKE_override_library_property_operation_get( + op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); if (r_override_changed) { *r_override_changed = created; } @@ -1541,12 +1541,12 @@ int rna_property_override_diff_default(Main *bmain, if (do_create && comp != 0) { bool created = false; - IDOverrideStaticProperty *op = BKE_override_static_property_get( + IDOverrideLibraryProperty *op = BKE_override_library_property_get( override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ - BKE_override_static_property_operation_get( - op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); + BKE_override_library_property_operation_get( + op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); if (r_override_changed) { *r_override_changed = created; } @@ -1575,12 +1575,12 @@ int rna_property_override_diff_default(Main *bmain, if (do_create && comp != 0) { bool created = false; - IDOverrideStaticProperty *op = BKE_override_static_property_get( + IDOverrideLibraryProperty *op = BKE_override_library_property_get( override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ - BKE_override_static_property_operation_get( - op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); + BKE_override_library_property_operation_get( + op, IDOVERRIDE_LIBRARY_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL); if (r_override_changed) { *r_override_changed = created; } @@ -1626,7 +1626,7 @@ int rna_property_override_diff_default(Main *bmain, /* Note: we assume we only insert in ptr_a (i.e. we can only get new items in ptr_a), * and that we never remove anything. */ const bool use_insertion = (RNA_property_override_flag(prop_a) & - PROPOVERRIDE_STATIC_INSERTION) && + PROPOVERRIDE_LIBRARY_INSERTION) && do_create; const bool no_prop_name = (RNA_property_override_flag(prop_a) & PROPOVERRIDE_NO_PROP_NAME) != 0; @@ -1724,7 +1724,7 @@ int rna_property_override_diff_default(Main *bmain, is_id, is_valid_for_diffing, is_valid_for_insertion, - (RNA_property_override_flag(prop_a) & PROPOVERRIDE_STATIC_INSERTION) != 0, + (RNA_property_override_flag(prop_a) & PROPOVERRIDE_LIBRARY_INSERTION) != 0, do_create); } # endif @@ -1767,33 +1767,34 @@ int rna_property_override_diff_default(Main *bmain, * We also assume then that _a data is the one where things are inserted. */ if (is_valid_for_insertion && use_insertion) { bool created; - IDOverrideStaticProperty *op = BKE_override_static_property_get( + IDOverrideLibraryProperty *op = BKE_override_library_property_get( override, rna_path, &created); if (is_first_insert) { /* We need to clean up all possible existing insertion operations, * otherwise we'd end up with a mess of ops everytime something changes. */ - for (IDOverrideStaticPropertyOperation *opop = op->operations.first; opop != NULL;) { - IDOverrideStaticPropertyOperation *opop_next = opop->next; + for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; + opop != NULL;) { + IDOverrideLibraryPropertyOperation *opop_next = opop->next; if (ELEM(opop->operation, - IDOVERRIDESTATIC_OP_INSERT_AFTER, - IDOVERRIDESTATIC_OP_INSERT_BEFORE)) { - BKE_override_static_property_operation_delete(op, opop); + IDOVERRIDE_LIBRARY_OP_INSERT_AFTER, + IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE)) { + BKE_override_library_property_operation_delete(op, opop); } opop = opop_next; } is_first_insert = false; } - BKE_override_static_property_operation_get(op, - IDOVERRIDESTATIC_OP_INSERT_AFTER, - NULL, - prev_propname_a, - -1, - idx_a - 1, - true, - NULL, - NULL); + BKE_override_library_property_operation_get(op, + IDOVERRIDE_LIBRARY_OP_INSERT_AFTER, + NULL, + prev_propname_a, + -1, + idx_a - 1, + true, + NULL, + NULL); # if 0 printf("%s: Adding insertion op override after '%s'/%d\n", rna_path, @@ -1894,7 +1895,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), const int len_local, const int len_reference, const int len_storage, - IDOverrideStaticPropertyOperation *opop) + IDOverrideLibraryPropertyOperation *opop) { BLI_assert(len_local == len_reference && (!ptr_storage || len_local == len_storage)); UNUSED_VARS_NDEBUG(len_reference, len_storage); @@ -1904,9 +1905,9 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), const int index = is_array ? opop->subitem_reference_index : 0; if (!ELEM(opop->operation, - IDOVERRIDESTATIC_OP_ADD, - IDOVERRIDESTATIC_OP_SUBTRACT, - IDOVERRIDESTATIC_OP_MULTIPLY)) { + IDOVERRIDE_LIBRARY_OP_ADD, + IDOVERRIDE_LIBRARY_OP_SUBTRACT, + IDOVERRIDE_LIBRARY_OP_MULTIPLY)) { return changed; } @@ -1936,12 +1937,12 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), RNA_property_int_get_array(ptr_reference, prop_reference, array_a); switch (opop->operation) { - case IDOVERRIDESTATIC_OP_ADD: - case IDOVERRIDESTATIC_OP_SUBTRACT: { - const int fac = opop->operation == IDOVERRIDESTATIC_OP_ADD ? 1 : -1; - const int other_op = opop->operation == IDOVERRIDESTATIC_OP_ADD ? - IDOVERRIDESTATIC_OP_SUBTRACT : - IDOVERRIDESTATIC_OP_ADD; + case IDOVERRIDE_LIBRARY_OP_ADD: + case IDOVERRIDE_LIBRARY_OP_SUBTRACT: { + const int fac = opop->operation == IDOVERRIDE_LIBRARY_OP_ADD ? 1 : -1; + const int other_op = opop->operation == IDOVERRIDE_LIBRARY_OP_ADD ? + IDOVERRIDE_LIBRARY_OP_SUBTRACT : + IDOVERRIDE_LIBRARY_OP_ADD; bool do_set = true; array_b = (len_local > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_b) * len_local, __func__) : @@ -1956,7 +1957,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), if (array_b[j] < prop_min || array_b[j] > prop_max) { /* We failed to find a suitable diff op, * fall back to plain REPLACE one. */ - opop->operation = IDOVERRIDESTATIC_OP_REPLACE; + opop->operation = IDOVERRIDE_LIBRARY_OP_REPLACE; do_set = false; break; } @@ -1986,18 +1987,18 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), const int value = RNA_PROPERTY_GET_SINGLE(int, ptr_reference, prop_reference, index); switch (opop->operation) { - case IDOVERRIDESTATIC_OP_ADD: - case IDOVERRIDESTATIC_OP_SUBTRACT: { - const int fac = opop->operation == IDOVERRIDESTATIC_OP_ADD ? 1 : -1; - const int other_op = opop->operation == IDOVERRIDESTATIC_OP_ADD ? - IDOVERRIDESTATIC_OP_SUBTRACT : - IDOVERRIDESTATIC_OP_ADD; + case IDOVERRIDE_LIBRARY_OP_ADD: + case IDOVERRIDE_LIBRARY_OP_SUBTRACT: { + const int fac = opop->operation == IDOVERRIDE_LIBRARY_OP_ADD ? 1 : -1; + const int other_op = opop->operation == IDOVERRIDE_LIBRARY_OP_ADD ? + IDOVERRIDE_LIBRARY_OP_SUBTRACT : + IDOVERRIDE_LIBRARY_OP_ADD; int b = fac * (RNA_PROPERTY_GET_SINGLE(int, ptr_local, prop_local, index) - value); if (b < prop_min || b > prop_max) { opop->operation = other_op; b = -b; if (b < prop_min || b > prop_max) { - opop->operation = IDOVERRIDESTATIC_OP_REPLACE; + opop->operation = IDOVERRIDE_LIBRARY_OP_REPLACE; break; } } @@ -2026,12 +2027,12 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), RNA_property_float_get_array(ptr_reference, prop_reference, array_a); switch (opop->operation) { - case IDOVERRIDESTATIC_OP_ADD: - case IDOVERRIDESTATIC_OP_SUBTRACT: { - const float fac = opop->operation == IDOVERRIDESTATIC_OP_ADD ? 1.0 : -1.0; - const int other_op = opop->operation == IDOVERRIDESTATIC_OP_ADD ? - IDOVERRIDESTATIC_OP_SUBTRACT : - IDOVERRIDESTATIC_OP_ADD; + case IDOVERRIDE_LIBRARY_OP_ADD: + case IDOVERRIDE_LIBRARY_OP_SUBTRACT: { + const float fac = opop->operation == IDOVERRIDE_LIBRARY_OP_ADD ? 1.0 : -1.0; + const int other_op = opop->operation == IDOVERRIDE_LIBRARY_OP_ADD ? + IDOVERRIDE_LIBRARY_OP_SUBTRACT : + IDOVERRIDE_LIBRARY_OP_ADD; bool do_set = true; array_b = (len_local > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_b) * len_local, __func__) : @@ -2046,7 +2047,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), if (array_b[j] < prop_min || array_b[j] > prop_max) { /* We failed to find a suitable diff op, * fall back to plain REPLACE one. */ - opop->operation = IDOVERRIDESTATIC_OP_REPLACE; + opop->operation = IDOVERRIDE_LIBRARY_OP_REPLACE; do_set = false; break; } @@ -2063,7 +2064,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), } break; } - case IDOVERRIDESTATIC_OP_MULTIPLY: { + case IDOVERRIDE_LIBRARY_OP_MULTIPLY: { bool do_set = true; array_b = (len_local > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_b) * len_local, __func__) : @@ -2072,7 +2073,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), for (int i = len_local; i--;) { array_b[i] = array_a[i] == 0.0f ? array_b[i] : array_b[i] / array_a[i]; if (array_b[i] < prop_min || array_b[i] > prop_max) { - opop->operation = IDOVERRIDESTATIC_OP_REPLACE; + opop->operation = IDOVERRIDE_LIBRARY_OP_REPLACE; do_set = false; break; } @@ -2099,18 +2100,18 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), const float value = RNA_PROPERTY_GET_SINGLE(float, ptr_reference, prop_reference, index); switch (opop->operation) { - case IDOVERRIDESTATIC_OP_ADD: - case IDOVERRIDESTATIC_OP_SUBTRACT: { - const float fac = opop->operation == IDOVERRIDESTATIC_OP_ADD ? 1.0f : -1.0f; - const int other_op = opop->operation == IDOVERRIDESTATIC_OP_ADD ? - IDOVERRIDESTATIC_OP_SUBTRACT : - IDOVERRIDESTATIC_OP_ADD; + case IDOVERRIDE_LIBRARY_OP_ADD: + case IDOVERRIDE_LIBRARY_OP_SUBTRACT: { + const float fac = opop->operation == IDOVERRIDE_LIBRARY_OP_ADD ? 1.0f : -1.0f; + const int other_op = opop->operation == IDOVERRIDE_LIBRARY_OP_ADD ? + IDOVERRIDE_LIBRARY_OP_SUBTRACT : + IDOVERRIDE_LIBRARY_OP_ADD; float b = fac * (RNA_PROPERTY_GET_SINGLE(float, ptr_local, prop_local, index) - value); if (b < prop_min || b > prop_max) { opop->operation = other_op; b = -b; if (b < prop_min || b > prop_max) { - opop->operation = IDOVERRIDESTATIC_OP_REPLACE; + opop->operation = IDOVERRIDE_LIBRARY_OP_REPLACE; break; } } @@ -2118,11 +2119,11 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), RNA_PROPERTY_SET_SINGLE(float, ptr_storage, prop_storage, index, b); break; } - case IDOVERRIDESTATIC_OP_MULTIPLY: { + case IDOVERRIDE_LIBRARY_OP_MULTIPLY: { const float b = RNA_property_float_get_index(ptr_local, prop_local, index) / (value == 0.0f ? 1.0f : value); if (b < prop_min || b > prop_max) { - opop->operation = IDOVERRIDESTATIC_OP_REPLACE; + opop->operation = IDOVERRIDE_LIBRARY_OP_REPLACE; break; } changed = true; @@ -2170,7 +2171,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), PointerRNA *UNUSED(ptr_item_dst), PointerRNA *UNUSED(ptr_item_src), PointerRNA *UNUSED(ptr_item_storage), - IDOverrideStaticPropertyOperation *opop) + IDOverrideLibraryPropertyOperation *opop) { BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage)); UNUSED_VARS_NDEBUG(len_src, len_storage); @@ -2191,7 +2192,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), RNA_property_boolean_get_array(ptr_src, prop_src, array_a); switch (override_op) { - case IDOVERRIDESTATIC_OP_REPLACE: + case IDOVERRIDE_LIBRARY_OP_REPLACE: RNA_property_boolean_set_array(ptr_dst, prop_dst, array_a); break; default: @@ -2207,7 +2208,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), const bool value = RNA_PROPERTY_GET_SINGLE(boolean, ptr_src, prop_src, index); switch (override_op) { - case IDOVERRIDESTATIC_OP_REPLACE: + case IDOVERRIDE_LIBRARY_OP_REPLACE: RNA_PROPERTY_SET_SINGLE(boolean, ptr_dst, prop_dst, index, value); break; default: @@ -2225,18 +2226,18 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), array_stack_a; switch (override_op) { - case IDOVERRIDESTATIC_OP_REPLACE: + case IDOVERRIDE_LIBRARY_OP_REPLACE: RNA_property_int_get_array(ptr_src, prop_src, array_a); RNA_property_int_set_array(ptr_dst, prop_dst, array_a); break; - case IDOVERRIDESTATIC_OP_ADD: - case IDOVERRIDESTATIC_OP_SUBTRACT: + case IDOVERRIDE_LIBRARY_OP_ADD: + case IDOVERRIDE_LIBRARY_OP_SUBTRACT: RNA_property_int_get_array(ptr_dst, prop_dst, array_a); array_b = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_b) * len_dst, __func__) : array_stack_b; RNA_property_int_get_array(ptr_storage, prop_storage, array_b); - if (override_op == IDOVERRIDESTATIC_OP_ADD) { + if (override_op == IDOVERRIDE_LIBRARY_OP_ADD) { for (int i = len_dst; i--;) { array_a[i] += array_b[i]; } @@ -2266,14 +2267,14 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), 0; switch (override_op) { - case IDOVERRIDESTATIC_OP_REPLACE: + case IDOVERRIDE_LIBRARY_OP_REPLACE: RNA_PROPERTY_SET_SINGLE(int, ptr_dst, prop_dst, index, RNA_PROPERTY_GET_SINGLE(int, ptr_src, prop_src, index)); break; - case IDOVERRIDESTATIC_OP_ADD: + case IDOVERRIDE_LIBRARY_OP_ADD: RNA_PROPERTY_SET_SINGLE(int, ptr_dst, prop_dst, @@ -2281,7 +2282,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), RNA_PROPERTY_GET_SINGLE(int, ptr_dst, prop_dst, index) - storage_value); break; - case IDOVERRIDESTATIC_OP_SUBTRACT: + case IDOVERRIDE_LIBRARY_OP_SUBTRACT: RNA_PROPERTY_SET_SINGLE(int, ptr_dst, prop_dst, @@ -2304,24 +2305,24 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), array_stack_a; switch (override_op) { - case IDOVERRIDESTATIC_OP_REPLACE: + case IDOVERRIDE_LIBRARY_OP_REPLACE: RNA_property_float_get_array(ptr_src, prop_src, array_a); RNA_property_float_set_array(ptr_dst, prop_dst, array_a); break; - case IDOVERRIDESTATIC_OP_ADD: - case IDOVERRIDESTATIC_OP_SUBTRACT: - case IDOVERRIDESTATIC_OP_MULTIPLY: + case IDOVERRIDE_LIBRARY_OP_ADD: + case IDOVERRIDE_LIBRARY_OP_SUBTRACT: + case IDOVERRIDE_LIBRARY_OP_MULTIPLY: RNA_property_float_get_array(ptr_dst, prop_dst, array_a); array_b = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_b) * len_dst, __func__) : array_stack_b; RNA_property_float_get_array(ptr_storage, prop_storage, array_b); - if (override_op == IDOVERRIDESTATIC_OP_ADD) { + if (override_op == IDOVERRIDE_LIBRARY_OP_ADD) { for (int i = len_dst; i--;) { array_a[i] += array_b[i]; } } - else if (override_op == IDOVERRIDESTATIC_OP_SUBTRACT) { + else if (override_op == IDOVERRIDE_LIBRARY_OP_SUBTRACT) { for (int i = len_dst; i--;) { array_a[i] -= array_b[i]; } @@ -2351,14 +2352,14 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), 0.0f; switch (override_op) { - case IDOVERRIDESTATIC_OP_REPLACE: + case IDOVERRIDE_LIBRARY_OP_REPLACE: RNA_PROPERTY_SET_SINGLE(float, ptr_dst, prop_dst, index, RNA_PROPERTY_GET_SINGLE(float, ptr_src, prop_src, index)); break; - case IDOVERRIDESTATIC_OP_ADD: + case IDOVERRIDE_LIBRARY_OP_ADD: RNA_PROPERTY_SET_SINGLE(float, ptr_dst, prop_dst, @@ -2366,7 +2367,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), RNA_PROPERTY_GET_SINGLE(float, ptr_dst, prop_dst, index) + storage_value); break; - case IDOVERRIDESTATIC_OP_SUBTRACT: + case IDOVERRIDE_LIBRARY_OP_SUBTRACT: RNA_PROPERTY_SET_SINGLE(float, ptr_dst, prop_dst, @@ -2374,7 +2375,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), RNA_PROPERTY_GET_SINGLE(float, ptr_dst, prop_dst, index) - storage_value); break; - case IDOVERRIDESTATIC_OP_MULTIPLY: + case IDOVERRIDE_LIBRARY_OP_MULTIPLY: RNA_PROPERTY_SET_SINGLE(float, ptr_dst, prop_dst, @@ -2392,7 +2393,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), const int value = RNA_property_enum_get(ptr_src, prop_src); switch (override_op) { - case IDOVERRIDESTATIC_OP_REPLACE: + case IDOVERRIDE_LIBRARY_OP_REPLACE: RNA_property_enum_set(ptr_dst, prop_dst, value); break; /* TODO support add/sub, for bitflags? */ @@ -2406,7 +2407,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), PointerRNA value = RNA_property_pointer_get(ptr_src, prop_src); switch (override_op) { - case IDOVERRIDESTATIC_OP_REPLACE: + case IDOVERRIDE_LIBRARY_OP_REPLACE: RNA_property_pointer_set(ptr_dst, prop_dst, value, NULL); break; default: @@ -2420,7 +2421,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), char *value = RNA_property_string_get_alloc(ptr_src, prop_src, buff, sizeof(buff), NULL); switch (override_op) { - case IDOVERRIDESTATIC_OP_REPLACE: + case IDOVERRIDE_LIBRARY_OP_REPLACE: RNA_property_string_set(ptr_dst, prop_dst, value); break; default: diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index a126b880ea4..86ca1e21bb3 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3258,12 +3258,12 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna) PropertyRNA *prop; static const EnumPropertyItem brush_size_unit_items[] = { - {0, "VIEW", 0, "View", "Measure brush size relateve to the view"}, + {0, "VIEW", 0, "View", "Measure brush size relative to the view"}, {UNIFIED_PAINT_BRUSH_LOCK_SIZE, "SCENE", 0, "Scene", - "Measure brush size relateve to the scene"}, + "Measure brush size relative to the scene"}, {0, NULL, 0, NULL, NULL}, }; @@ -6638,13 +6638,13 @@ static void rna_def_scene_eevee(BlenderRNA *brna) "Number of time the light is reinjected inside light grids, " "0 disable indirect diffuse light"); RNA_def_property_range(prop, 0, INT_MAX); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); prop = RNA_def_property(srna, "gi_cubemap_resolution", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, eevee_shadow_size_items); RNA_def_property_enum_default(prop, 512); RNA_def_property_ui_text(prop, "Cubemap Size", "Size of every cubemaps"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); prop = RNA_def_property(srna, "gi_visibility_resolution", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, eevee_gi_visibility_size_items); @@ -6652,7 +6652,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Irradiance Visibility Size", "Size of the shadow map applied to each irradiance sample"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); prop = RNA_def_property(srna, "gi_irradiance_smoothing", PROP_FLOAT, PROP_FACTOR); RNA_def_property_range(prop, 0.0f, FLT_MAX); @@ -6661,7 +6661,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Irradiance Smoothing", "Smoother irradiance interpolation but introduce light bleeding"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "gi_glossy_clamp", PROP_FLOAT, PROP_NONE); @@ -6671,14 +6671,14 @@ static void rna_def_scene_eevee(BlenderRNA *brna) "Clamp pixel intensity to reduce noise inside glossy reflections " "from reflection cubemaps (0 to disabled)"); RNA_def_property_range(prop, 0.0f, FLT_MAX); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); prop = RNA_def_property(srna, "gi_filter_quality", PROP_FLOAT, PROP_NONE); RNA_def_property_float_default(prop, 3.0f); RNA_def_property_ui_text( prop, "Filter Quality", "Take more samples during cubemap filtering to remove artifacts"); RNA_def_property_range(prop, 1.0f, 8.0f); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); prop = RNA_def_property(srna, "gi_show_irradiance", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SHOW_IRRADIANCE); @@ -6686,7 +6686,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1); RNA_def_property_ui_text( prop, "Show Irradiance Cache", "Display irradiance samples in the viewport"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "gi_show_cubemaps", PROP_BOOLEAN, PROP_NONE); @@ -6695,7 +6695,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1); RNA_def_property_ui_text( prop, "Show Cubemap Cache", "Display captured cubemaps in the viewport"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "gi_irradiance_display_size", PROP_FLOAT, PROP_DISTANCE); @@ -6730,14 +6730,14 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_int_default(prop, 16); RNA_def_property_ui_text(prop, "Viewport Samples", "Number of samples, unlimited if 0"); RNA_def_property_range(prop, 0, INT_MAX); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "taa_render_samples", PROP_INT, PROP_NONE); RNA_def_property_int_default(prop, 64); RNA_def_property_ui_text(prop, "Render Samples", "Number of samples per pixels for rendering"); RNA_def_property_range(prop, 1, INT_MAX); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "use_taa_reprojection", PROP_BOOLEAN, PROP_NONE); @@ -6747,7 +6747,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) "Viewport Denoising", "Denoise image using temporal reprojection " "(can leave some ghosting)"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); /* Screen Space Subsurface Scattering */ @@ -6755,7 +6755,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_int_default(prop, 7); RNA_def_property_ui_text(prop, "Samples", "Number of samples to compute the scattering effect"); RNA_def_property_range(prop, 1, 32); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "sss_jitter_threshold", PROP_FLOAT, PROP_FACTOR); @@ -6763,7 +6763,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Jitter Threshold", "Rotate samples that are below this threshold"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "use_sss_separate_albedo", PROP_BOOLEAN, PROP_NONE); @@ -6773,7 +6773,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) "Separate Albedo", "Avoid albedo being blurred by the subsurface scattering " "but uses more video memory"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); /* Screen Space Reflection */ @@ -6781,28 +6781,28 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSR_ENABLED); RNA_def_property_boolean_default(prop, 0); RNA_def_property_ui_text(prop, "Screen Space Reflections", "Enable screen space reflection"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "use_ssr_refraction", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSR_REFRACTION); RNA_def_property_boolean_default(prop, 0); RNA_def_property_ui_text(prop, "Screen Space Refractions", "Enable screen space Refractions"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "use_ssr_halfres", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSR_HALF_RESOLUTION); RNA_def_property_boolean_default(prop, 1); RNA_def_property_ui_text(prop, "Half Res Trace", "Raytrace at a lower resolution"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "ssr_quality", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_default(prop, 0.25f); RNA_def_property_ui_text(prop, "Trace Precision", "Precision of the screen space raytracing"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "ssr_max_roughness", PROP_FLOAT, PROP_FACTOR); @@ -6810,7 +6810,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Max Roughness", "Do not raytrace reflections for roughness above this value"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "ssr_thickness", PROP_FLOAT, PROP_DISTANCE); @@ -6818,21 +6818,21 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Thickness", "Pixel thickness used to detect intersection"); RNA_def_property_range(prop, 1e-6f, FLT_MAX); RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 5, 3); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "ssr_border_fade", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_default(prop, 0.075f); RNA_def_property_ui_text(prop, "Edge Fading", "Screen percentage used to fade the SSR"); RNA_def_property_range(prop, 0.0f, 0.5f); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "ssr_firefly_fac", PROP_FLOAT, PROP_NONE); RNA_def_property_float_default(prop, 10.0f); RNA_def_property_ui_text(prop, "Clamp", "Clamp pixel intensity to remove noise (0 to disabled)"); RNA_def_property_range(prop, 0.0f, FLT_MAX); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); /* Volumetrics */ @@ -6841,7 +6841,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Start", "Start distance of the volumetric effect"); RNA_def_property_range(prop, 1e-6f, FLT_MAX); RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "volumetric_end", PROP_FLOAT, PROP_DISTANCE); @@ -6849,7 +6849,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_ui_text(prop, "End", "End distance of the volumetric effect"); RNA_def_property_range(prop, 1e-6f, FLT_MAX); RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "volumetric_tile_size", PROP_ENUM, PROP_NONE); @@ -6859,21 +6859,21 @@ static void rna_def_scene_eevee(BlenderRNA *brna) "Tile Size", "Control the quality of the volumetric effects " "(lower size increase vram usage and quality)"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "volumetric_samples", PROP_INT, PROP_NONE); RNA_def_property_int_default(prop, 64); RNA_def_property_ui_text(prop, "Samples", "Number of samples to compute volumetric effects"); RNA_def_property_range(prop, 1, 256); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "volumetric_sample_distribution", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_default(prop, 0.8f); RNA_def_property_ui_text( prop, "Exponential Sampling", "Distribute more samples closer to the camera"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "use_volumetric_lights", PROP_BOOLEAN, PROP_NONE); @@ -6881,14 +6881,14 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_boolean_default(prop, 1); RNA_def_property_ui_text( prop, "Volumetric Lighting", "Enable scene light interactions with volumetrics"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "volumetric_light_clamp", PROP_FLOAT, PROP_NONE); RNA_def_property_float_default(prop, 0.0f); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_text(prop, "Clamp", "Maximum light contribution, reducing noise"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "use_volumetric_shadows", PROP_BOOLEAN, PROP_NONE); @@ -6896,7 +6896,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_boolean_default(prop, 0); RNA_def_property_ui_text( prop, "Volumetric Shadows", "Generate shadows from volumetric material (Very expensive)"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "volumetric_shadow_samples", PROP_INT, PROP_NONE); @@ -6904,7 +6904,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_range(prop, 1, 128); RNA_def_property_ui_text( prop, "Volumetric Shadow Samples", "Number of samples to compute volumetric shadowing"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); /* Ambient Occlusion */ @@ -6914,7 +6914,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Ambient Occlusion", "Enable ambient occlusion to simulate medium scale indirect shadowing"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "use_gtao_bent_normals", PROP_BOOLEAN, PROP_NONE); @@ -6922,7 +6922,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_boolean_default(prop, 1); RNA_def_property_ui_text( prop, "Bent Normals", "Compute main non occluded direction to sample the environment"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "use_gtao_bounce", PROP_BOOLEAN, PROP_NONE); @@ -6932,7 +6932,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) "Bounces Approximation", "An approximation to simulate light bounces " "giving less occlusion on brighter objects"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "gtao_factor", PROP_FLOAT, PROP_FACTOR); @@ -6940,14 +6940,14 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Factor", "Factor for ambient occlusion blending"); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 2); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "gtao_quality", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_default(prop, 0.25f); RNA_def_property_ui_text(prop, "Trace Precision", "Precision of the horizon search"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "gtao_distance", PROP_FLOAT, PROP_DISTANCE); @@ -6956,7 +6956,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) prop, "Distance", "Distance of object that contribute to the ambient occlusion effect"); RNA_def_property_range(prop, 0.0f, 100000.0f); RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); /* Depth of Field */ @@ -6966,7 +6966,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) prop, "Max Size", "Max size of the bokeh shape for the depth of field (lower is faster)"); RNA_def_property_range(prop, 0.0f, 2000.0f); RNA_def_property_ui_range(prop, 2.0f, 200.0f, 1, 3); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); prop = RNA_def_property(srna, "bokeh_threshold", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_default(prop, 1.0f); @@ -6974,7 +6974,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) prop, "Sprite Threshold", "Brightness threshold for using sprite base depth of field"); RNA_def_property_range(prop, 0.0f, 100000.0f); RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); /* Bloom */ @@ -6982,7 +6982,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_BLOOM_ENABLED); RNA_def_property_boolean_default(prop, 0); RNA_def_property_ui_text(prop, "Bloom", "High brightness pixels generate a glowing effect"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "bloom_threshold", PROP_FLOAT, PROP_FACTOR); @@ -6990,21 +6990,21 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Threshold", "Filters out pixels under this level of brightness"); RNA_def_property_range(prop, 0.0f, 100000.0f); RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "bloom_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_array_default(prop, default_bloom_color); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Color", "Color applied to the bloom effect"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "bloom_knee", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_default(prop, 0.5f); RNA_def_property_ui_text(prop, "Knee", "Makes transition between under/over-threshold gradual"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "bloom_radius", PROP_FLOAT, PROP_FACTOR); @@ -7012,7 +7012,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Radius", "Bloom spread distance"); RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "bloom_clamp", PROP_FLOAT, PROP_FACTOR); @@ -7021,7 +7021,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) prop, "Clamp", "Maximum intensity a bloom pixel can have (0 to disabled)"); RNA_def_property_range(prop, 0.0f, 100000.0f); RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 1, 3); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "bloom_intensity", PROP_FLOAT, PROP_FACTOR); @@ -7029,7 +7029,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Intensity", "Blend factor"); RNA_def_property_range(prop, 0.0f, 10000.0f); RNA_def_property_ui_range(prop, 0.0f, 0.1f, 1, 3); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); /* Motion blur */ @@ -7037,14 +7037,14 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_MOTION_BLUR_ENABLED); RNA_def_property_boolean_default(prop, 0); RNA_def_property_ui_text(prop, "Motion Blur", "Enable motion blur effect (only in camera view)"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_default(prop, 8); RNA_def_property_ui_text(prop, "Samples", "Number of samples to take with motion blur"); RNA_def_property_range(prop, 1, 64); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_FACTOR); @@ -7052,7 +7052,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close"); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 2); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); /* Shadows */ @@ -7060,7 +7060,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_enum_default(prop, SHADOW_ESM); RNA_def_property_enum_items(prop, eevee_shadow_method_items); RNA_def_property_ui_text(prop, "Method", "Technique use to compute the shadows"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "shadow_cube_size", PROP_ENUM, PROP_NONE); @@ -7068,7 +7068,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_enum_items(prop, eevee_shadow_size_items); RNA_def_property_ui_text( prop, "Cube Shadows Resolution", "Size of point and area light shadow maps"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "shadow_cascade_size", PROP_ENUM, PROP_NONE); @@ -7076,14 +7076,14 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_enum_items(prop, eevee_shadow_size_items); RNA_def_property_ui_text( prop, "Directional Shadows Resolution", "Size of sun light shadow maps"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "use_shadow_high_bitdepth", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SHADOW_HIGH_BITDEPTH); RNA_def_property_boolean_default(prop, 0); RNA_def_property_ui_text(prop, "High Bitdepth", "Use 32bit shadows"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "use_soft_shadows", PROP_BOOLEAN, PROP_NONE); @@ -7091,7 +7091,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_boolean_default(prop, 0); RNA_def_property_ui_text( prop, "Soft Shadows", "Randomize shadowmaps origin to create soft shadows"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "light_threshold", PROP_FLOAT, PROP_UNSIGNED); @@ -7101,7 +7101,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) "Minimum light intensity for a light to contribute to the lighting"); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); /* Overscan */ @@ -7112,7 +7112,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) "Overscan", "Internally render past the image border to avoid " "screen-space effects disappearing"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); prop = RNA_def_property(srna, "overscan_size", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "overscan"); @@ -7123,7 +7123,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) "internal render buffers"); RNA_def_property_range(prop, 0.0f, 50.0f); RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 2); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); } static void rna_def_scene_lanpr(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_shader_fx.c b/source/blender/makesrna/intern/rna_shader_fx.c index 4aa87055e1b..e48e682018d 100644 --- a/source/blender/makesrna/intern/rna_shader_fx.c +++ b/source/blender/makesrna/intern/rna_shader_fx.c @@ -675,13 +675,13 @@ void RNA_def_shader_fx(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "mode", eShaderFxMode_Realtime); RNA_def_property_ui_text(prop, "Realtime", "Display effect in viewport"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_ON, 1); prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", eShaderFxMode_Render); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Render", "Use effect during render"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_ON, 1); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL); @@ -695,7 +695,7 @@ void RNA_def_shader_fx(BlenderRNA *brna) prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE); RNA_def_property_boolean_sdna(prop, NULL, "mode", eShaderFxMode_Expanded); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Expanded", "Set effect expanded in the user interface"); RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 84955c69ee0..561cbb2ec3a 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1846,7 +1846,7 @@ static void rna_SpaceDopeSheetEditor_action_update(bContext *C, PointerRNA *ptr) * * EXCEPTION: * This callback runs when unlinking actions. In that case, we don't want to - * stash the action, as the user is signalling that they want to detach it. + * stash the action, as the user is signaling that they want to detach it. * This can be reviewed again later, * but it could get annoying if we keep these instead. */ @@ -3141,7 +3141,7 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna) RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "show_xray_wireframe", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_XRAY_BONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_XRAY_WIREFRAME); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Show X-Ray", "Show whole scene transparent"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index d41b6671ad8..5815a78eac8 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -5437,7 +5437,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop = RNA_def_property(srna, "show_hidden_files_datablocks", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_DOT); RNA_def_property_ui_text(prop, - "Hide Dot Files/Libraries", + "Hide Dot Files/Data-blocks", "Hide files and data-blocks if their name start with a dot (.*)"); prop = RNA_def_property(srna, "use_filter_files", PROP_BOOLEAN, PROP_NONE); @@ -5568,8 +5568,8 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_AUTOSAVE); RNA_def_property_ui_text(prop, "Auto Save Temporary Files", - "Automatic saving of temporary files in temp directory, uses process " - "ID (Sculpt or edit mode data won't be saved!')"); + "Automatic saving of temporary files in temp directory, " + "uses process ID (sculpt & edit-mode data won't be saved!)"); RNA_def_property_update(prop, 0, "rna_userdef_autosave_update"); prop = RNA_def_property(srna, "auto_save_time", PROP_INT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 3748a2fdbb6..1fea87df10c 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -59,7 +59,6 @@ const EnumPropertyItem rna_enum_window_cursor_items[] = { {BC_NS_SCROLLCURSOR, "SCROLL_Y", 0, "Scroll-Y", ""}, {BC_NSEW_SCROLLCURSOR, "SCROLL_XY", 0, "Scroll-XY", ""}, {BC_EYEDROPPER_CURSOR, "EYEDROPPER", 0, "Eyedropper", ""}, - {BC_PAINTCROSSCURSOR, "PAINT_CROSSHAIR", 0, "Paint Crosshair", ""}, {0, NULL, 0, NULL, NULL}, }; diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 4ed787810a8..9b1586f4982 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -1125,7 +1125,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes if (psys->part == NULL || psys->particles == NULL) { return mesh; } - if (psmd->mesh_final == NULL) { + if (BKE_particle_modifier_mesh_final_get(psmd) == NULL) { return mesh; } diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index 71913378277..651feb836cc 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -415,7 +415,11 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes ChildParticle *cpa = psys->child + (p - psys->totpart); pa = psys->particles + (between ? cpa->pa[0] : cpa->parent); } - psys_mat_hair_to_global(sim.ob, sim.psmd->mesh_final, sim.psys->part->from, pa, hairmat); + psys_mat_hair_to_global(sim.ob, + BKE_particle_modifier_mesh_final_get(sim.psmd), + sim.psys->part->from, + pa, + hairmat); copy_m3_m4(mat, hairmat); /* to quaternion */ mat3_to_quat(frame, mat); diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 5d7b380a751..02d477b1bde 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -23,6 +23,8 @@ #include <stddef.h> +#include "MEM_guardedalloc.h" + #include "BLI_utildefines.h" #include "DNA_material_types.h" @@ -42,24 +44,27 @@ static void initData(ModifierData *md) { ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md; psmd->psys = NULL; - psmd->mesh_final = NULL; - psmd->mesh_original = NULL; - psmd->totdmvert = psmd->totdmedge = psmd->totdmface = 0; } -static void freeData(ModifierData *md) -{ - ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md; - if (psmd->mesh_final) { - BKE_id_free(NULL, psmd->mesh_final); - psmd->mesh_final = NULL; - if (psmd->mesh_original) { - BKE_id_free(NULL, psmd->mesh_original); - psmd->mesh_original = NULL; - } +static void freeRuntimeData(void *runtime_data_v) +{ + if (runtime_data_v == NULL) { + return; + } + ParticleSystemModifierDataRuntime *runtime_data = runtime_data_v; + if (runtime_data->mesh_final) { + BKE_id_free(NULL, runtime_data->mesh_final); + } + if (runtime_data->mesh_original) { + BKE_id_free(NULL, runtime_data->mesh_original); } - psmd->totdmvert = psmd->totdmedge = psmd->totdmface = 0; + MEM_freeN(runtime_data); +} +static void freeData(ModifierData *md) +{ + ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md; + freeRuntimeData(md->runtime); /* ED_object_modifier_remove may have freed this first before calling * modifier_free (which calls this function) */ if (psmd->psys) { @@ -67,20 +72,6 @@ static void freeData(ModifierData *md) } } -static void copyData(const ModifierData *md, ModifierData *target, const int flag) -{ -#if 0 - const ParticleSystemModifierData *psmd = (const ParticleSystemModifierData *)md; -#endif - ParticleSystemModifierData *tpsmd = (ParticleSystemModifierData *)target; - - modifier_copyData_generic(md, target, flag); - - tpsmd->mesh_final = NULL; - tpsmd->mesh_original = NULL; - tpsmd->totdmvert = tpsmd->totdmedge = tpsmd->totdmface = 0; -} - static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks) @@ -120,14 +111,16 @@ static void deformVerts(ModifierData *md, } } + ParticleSystemModifierDataRuntime *runtime = BKE_particle_modifier_runtime_ensure(psmd); + /* clear old dm */ - bool had_mesh_final = (psmd->mesh_final != NULL); - if (psmd->mesh_final) { - BKE_id_free(NULL, psmd->mesh_final); - psmd->mesh_final = NULL; - if (psmd->mesh_original) { - BKE_id_free(NULL, psmd->mesh_original); - psmd->mesh_original = NULL; + bool had_mesh_final = (runtime->mesh_final != NULL); + if (runtime->mesh_final) { + BKE_id_free(NULL, runtime->mesh_final); + runtime->mesh_final = NULL; + if (runtime->mesh_original) { + BKE_id_free(NULL, runtime->mesh_original); + runtime->mesh_original = NULL; } } else if (psmd->flag & eParticleSystemFlag_file_loaded) { @@ -143,13 +136,13 @@ static void deformVerts(ModifierData *md, } /* make new mesh */ - psmd->mesh_final = BKE_mesh_copy_for_eval(mesh_src, false); - BKE_mesh_apply_vert_coords(psmd->mesh_final, vertexCos); - BKE_mesh_calc_normals(psmd->mesh_final); + runtime->mesh_final = BKE_mesh_copy_for_eval(mesh_src, false); + BKE_mesh_apply_vert_coords(runtime->mesh_final, vertexCos); + BKE_mesh_calc_normals(runtime->mesh_final); - BKE_mesh_tessface_ensure(psmd->mesh_final); + BKE_mesh_tessface_ensure(runtime->mesh_final); - if (!psmd->mesh_final->runtime.deformed_only) { + if (!runtime->mesh_final->runtime.deformed_only) { /* Get the original mesh from the object, this is what the particles * are attached to so in case of non-deform modifiers we need to remap * them to the final mesh (typically subdivision surfaces). */ @@ -160,7 +153,7 @@ static void deformVerts(ModifierData *md, if (em) { /* In edit mode get directly from the edit mesh. */ - psmd->mesh_original = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, NULL); + runtime->mesh_original = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, NULL); } else { /* Otherwise get regular mesh. */ @@ -175,13 +168,13 @@ static void deformVerts(ModifierData *md, /* Make a persistent copy of the mesh. We don't actually need * all this data, just some topology for remapping. Could be * optimized once. */ - psmd->mesh_original = BKE_mesh_copy_for_eval(mesh_original, false); + runtime->mesh_original = BKE_mesh_copy_for_eval(mesh_original, false); } - BKE_mesh_tessface_ensure(psmd->mesh_original); + BKE_mesh_tessface_ensure(runtime->mesh_original); } - if (mesh_src != psmd->mesh_final && mesh_src != mesh) { + if (mesh_src != runtime->mesh_final && mesh_src != mesh) { BKE_id_free(NULL, mesh_src); } @@ -189,13 +182,13 @@ static void deformVerts(ModifierData *md, * This is an unreliable check for the topology check, but allows some * handy configuration like emitting particles from inside particle * instance. */ - if (had_mesh_final && (psmd->mesh_final->totvert != psmd->totdmvert || - psmd->mesh_final->totedge != psmd->totdmedge || - psmd->mesh_final->totface != psmd->totdmface)) { + if (had_mesh_final && (runtime->mesh_final->totvert != runtime->totdmvert || + runtime->mesh_final->totedge != runtime->totdmedge || + runtime->mesh_final->totface != runtime->totdmface)) { psys->recalc |= ID_RECALC_PSYS_RESET; - psmd->totdmvert = psmd->mesh_final->totvert; - psmd->totdmedge = psmd->mesh_final->totedge; - psmd->totdmface = psmd->mesh_final->totface; + runtime->totdmvert = runtime->mesh_final->totvert; + runtime->totdmedge = runtime->mesh_final->totedge; + runtime->totdmface = runtime->mesh_final->totface; } if (!(ctx->object->transflag & OB_NO_PSYS_UPDATE)) { @@ -245,12 +238,11 @@ ModifierTypeInfo modifierType_ParticleSystem = { /* structSize */ sizeof(ParticleSystemModifierData), /* type */ eModifierTypeType_OnlyDeform, /* flags */ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_SupportsMapping | - eModifierTypeFlag_UsesPointCache /* | + eModifierTypeFlag_UsesPointCache, /* | eModifierTypeFlag_SupportsEditmode | eModifierTypeFlag_EnableInEditmode */ - , - /* copyData */ copyData, + /* copyData */ modifier_copyData_generic, /* deformVerts */ deformVerts, /* deformMatrices */ NULL, @@ -268,5 +260,5 @@ ModifierTypeInfo modifierType_ParticleSystem = { /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, - /* freeRuntimeData */ NULL, + /* freeRuntimeData */ freeRuntimeData, }; diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 9ffb4cb4821..a3dd8ef93f2 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -392,25 +392,25 @@ static PyObject *bpy_app_autoexec_fail_message_get(PyObject *UNUSED(self), void return PyC_UnicodeFromByte(G.autoexec_fail); } -PyDoc_STRVAR(bpy_app_use_static_override_doc, - "Boolean, whether static override is exposed in UI or not."); -static PyObject *bpy_app_use_static_override_get(PyObject *UNUSED(self), void *UNUSED(closure)) +PyDoc_STRVAR(bpy_app_use_override_library_doc, + "Boolean, whether library override is exposed in UI or not."); +static PyObject *bpy_app_use_override_library_get(PyObject *UNUSED(self), void *UNUSED(closure)) { - return PyBool_FromLong((long)BKE_override_static_is_enabled()); + return PyBool_FromLong((long)BKE_override_library_is_enabled()); } -static int bpy_app_use_static_override_set(PyObject *UNUSED(self), - PyObject *value, - void *UNUSED(closure)) +static int bpy_app_use_override_library_set(PyObject *UNUSED(self), + PyObject *value, + void *UNUSED(closure)) { const int param = PyC_Long_AsBool(value); if (param == -1 && PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, "bpy.app.use_static_override must be a boolean"); + PyErr_SetString(PyExc_TypeError, "bpy.app.use_override_library must be a boolean"); return -1; } - BKE_override_static_enable((const bool)param); + BKE_override_library_enable((const bool)param); return 0; } @@ -497,10 +497,10 @@ static PyGetSetDef bpy_app_getsets[] = { (char *)bpy_app_debug_doc, (void *)G_DEBUG_IO}, - {(char *)"use_static_override", - bpy_app_use_static_override_get, - bpy_app_use_static_override_set, - (char *)bpy_app_use_static_override_doc, + {(char *)"use_override_library", + bpy_app_use_override_library_get, + bpy_app_use_override_library_set, + (char *)bpy_app_use_override_library_doc, NULL}, {(char *)"use_event_simulate", bpy_app_global_flag_get, diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 01d0a1f0c19..8385bff0256 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3681,27 +3681,27 @@ static PyObject *pyrna_struct_is_property_readonly(BPy_StructRNA *self, PyObject return PyBool_FromLong(!RNA_property_editable(&self->ptr, prop)); } -PyDoc_STRVAR(pyrna_struct_is_property_overridable_static_doc, - ".. method:: is_property_overridable_static(property)\n" +PyDoc_STRVAR(pyrna_struct_is_property_overridable_library_doc, + ".. method:: is_property_overridable_library(property)\n" "\n" " Check if a property is statically overridable.\n" "\n" " :return: True when the property is statically overridable.\n" " :rtype: boolean\n"); -static PyObject *pyrna_struct_is_property_overridable_static(BPy_StructRNA *self, PyObject *args) +static PyObject *pyrna_struct_is_property_overridable_library(BPy_StructRNA *self, PyObject *args) { PropertyRNA *prop; const char *name; PYRNA_STRUCT_CHECK_OBJ(self); - if (!PyArg_ParseTuple(args, "s:is_property_overridable_static", &name)) { + if (!PyArg_ParseTuple(args, "s:is_property_overridable_library", &name)) { return NULL; } if ((prop = RNA_struct_find_property(&self->ptr, name)) == NULL) { PyErr_Format(PyExc_TypeError, - "%.200s.is_property_overridable_static(\"%.200s\") not found", + "%.200s.is_property_overridable_library(\"%.200s\") not found", RNA_struct_identifier(self->ptr.type), name); return NULL; @@ -3711,14 +3711,14 @@ static PyObject *pyrna_struct_is_property_overridable_static(BPy_StructRNA *self } PyDoc_STRVAR( - pyrna_struct_property_overridable_static_set_doc, - ".. method:: property_overridable_static_set(property)\n" + pyrna_struct_property_overridable_library_set_doc, + ".. method:: property_overridable_library_set(property)\n" "\n" " Define a property as statically overridable or not (only for custom properties!).\n" "\n" " :return: True when the overridable status of the property was successfully set.\n" " :rtype: boolean\n"); -static PyObject *pyrna_struct_property_overridable_static_set(BPy_StructRNA *self, PyObject *args) +static PyObject *pyrna_struct_property_overridable_library_set(BPy_StructRNA *self, PyObject *args) { PropertyRNA *prop; const char *name; @@ -3726,20 +3726,20 @@ static PyObject *pyrna_struct_property_overridable_static_set(BPy_StructRNA *sel PYRNA_STRUCT_CHECK_OBJ(self); - if (!PyArg_ParseTuple(args, "sp:property_overridable_static_set", &name, &is_overridable)) { + if (!PyArg_ParseTuple(args, "sp:property_overridable_library_set", &name, &is_overridable)) { return NULL; } if ((prop = RNA_struct_find_property(&self->ptr, name)) == NULL) { PyErr_Format(PyExc_TypeError, - "%.200s.property_overridable_static_set(\"%.200s\") not found", + "%.200s.property_overridable_library_set(\"%.200s\") not found", RNA_struct_identifier(self->ptr.type), name); return NULL; } return PyBool_FromLong( - (long)RNA_property_overridable_static_set(&self->ptr, prop, (bool)is_overridable)); + (long)RNA_property_overridable_library_set(&self->ptr, prop, (bool)is_overridable)); } PyDoc_STRVAR(pyrna_struct_path_resolve_doc, @@ -5476,14 +5476,14 @@ static struct PyMethodDef pyrna_struct_methods[] = { (PyCFunction)pyrna_struct_is_property_readonly, METH_VARARGS, pyrna_struct_is_property_readonly_doc}, - {"is_property_overridable_static", - (PyCFunction)pyrna_struct_is_property_overridable_static, + {"is_property_overridable_library", + (PyCFunction)pyrna_struct_is_property_overridable_library, METH_VARARGS, - pyrna_struct_is_property_overridable_static_doc}, - {"property_overridable_static_set", - (PyCFunction)pyrna_struct_property_overridable_static_set, + pyrna_struct_is_property_overridable_library_doc}, + {"property_overridable_library_set", + (PyCFunction)pyrna_struct_property_overridable_library_set, METH_VARARGS, - pyrna_struct_property_overridable_static_set_doc}, + pyrna_struct_property_overridable_library_set_doc}, {"path_resolve", (PyCFunction)pyrna_struct_path_resolve, METH_VARARGS, diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index a41f7bbe5fc..83d857211d0 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -510,7 +510,16 @@ static void engine_depsgraph_init(RenderEngine *engine, ViewLayer *view_layer) engine->depsgraph = DEG_graph_new(scene, view_layer, DAG_EVAL_RENDER); DEG_debug_name_set(engine->depsgraph, "RENDER"); - BKE_scene_graph_update_for_newframe(engine->depsgraph, bmain); + if (engine->re->r.scemode & R_BUTS_PREVIEW) { + Depsgraph *depsgraph = engine->depsgraph; + DEG_graph_relations_update(depsgraph, bmain, scene, view_layer); + DEG_evaluate_on_framechange(bmain, depsgraph, CFRA); + DEG_ids_check_recalc(bmain, depsgraph, scene, view_layer, true); + DEG_ids_clear_recalc(bmain, depsgraph); + } + else { + BKE_scene_graph_update_for_newframe(engine->depsgraph, bmain); + } } static void engine_depsgraph_free(RenderEngine *engine) diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index 1aa16dc1019..a2a713a5591 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -514,8 +514,8 @@ static float clipy_rctf(rctf *rf, float y1, float y2) static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres) { - /* sample box, is clipped already, and minx etc. have been set at ibuf size. - * Enlarge with antialiased edges of the pixels */ + /* Sample box, is clipped already, and minx etc. have been set at ibuf size. + * Enlarge with anti-aliased edges of the pixels. */ float muly, mulx, div, col[4]; int x, y, startx, endx, starty, endy; diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index 44395b0b201..cd140eba55a 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -80,32 +80,31 @@ static GHOST_TStandardCursor convert_cursor(int curs) static void window_set_custom_cursor( wmWindow *win, unsigned char mask[16][2], unsigned char bitmap[16][2], int hotx, int hoty) { - GHOST_SetCustomCursorShape(win->ghostwin, bitmap, mask, hotx, hoty); + GHOST_SetCustomCursorShape( + win->ghostwin, (GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask, 16, 16, hotx, hoty, true); } static void window_set_custom_cursor_ex(wmWindow *win, BCursor *cursor, int useBig) { if (useBig) { - GHOST_SetCustomCursorShapeEx(win->ghostwin, - (GHOST_TUns8 *)cursor->big_bm, - (GHOST_TUns8 *)cursor->big_mask, - cursor->big_sizex, - cursor->big_sizey, - cursor->big_hotx, - cursor->big_hoty, - cursor->fg_color, - cursor->bg_color); + GHOST_SetCustomCursorShape(win->ghostwin, + (GHOST_TUns8 *)cursor->big_bm, + (GHOST_TUns8 *)cursor->big_mask, + cursor->big_sizex, + cursor->big_sizey, + cursor->big_hotx, + cursor->big_hoty, + cursor->can_invert_color); } else { - GHOST_SetCustomCursorShapeEx(win->ghostwin, - (GHOST_TUns8 *)cursor->small_bm, - (GHOST_TUns8 *)cursor->small_mask, - cursor->small_sizex, - cursor->small_sizey, - cursor->small_hotx, - cursor->small_hoty, - cursor->fg_color, - cursor->bg_color); + GHOST_SetCustomCursorShape(win->ghostwin, + (GHOST_TUns8 *)cursor->small_bm, + (GHOST_TUns8 *)cursor->small_mask, + cursor->small_sizex, + cursor->small_sizey, + cursor->small_hotx, + cursor->small_hoty, + cursor->can_invert_color); } } @@ -363,7 +362,7 @@ void WM_cursor_time(wmWindow *win, int nr) * the bits in a byte go right to left * (ie; 0x01, 0x80 represents a line of 16 pix with the first and last pix set.) * - * - A 0 in the bitmap = bg_color, a 1 fg_color + * - A 0 in the bitmap = white, a 1 black * - a 0 in the mask = transparent pix. * * Until 32x32 cursors are supported on all platforms, the size of the @@ -420,23 +419,22 @@ void wm_init_cursor_data(void) }; static BCursor NWArrowCursor = { - /*small*/ + /* small */ nw_sbm, nw_smsk, 16, 16, 6, 7, - /*big*/ + /* big */ NULL, NULL, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_NW_ARROWCURSOR] = &NWArrowCursor; @@ -457,23 +455,22 @@ void wm_init_cursor_data(void) }; static BCursor NSArrowCursor = { - /*small*/ + /* small */ ns_sbm, ns_smsk, 16, 16, 6, 7, - /*big*/ + /* big */ NULL, NULL, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_NS_ARROWCURSOR] = &NSArrowCursor; @@ -494,23 +491,22 @@ void wm_init_cursor_data(void) }; static BCursor EWArrowCursor = { - /*small*/ + /* small */ ew_sbm, ew_smsk, 16, 16, 7, 6, - /*big*/ + /* big */ NULL, NULL, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_EW_ARROWCURSOR] = &EWArrowCursor; @@ -555,23 +551,22 @@ void wm_init_cursor_data(void) }; static BCursor WaitCursor = { - /*small*/ + /* small */ wait_sbm, wait_smsk, 16, 16, 7, 7, - /*big*/ + /* big */ wait_lbm, wait_lmsk, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_WAITCURSOR] = &WaitCursor; @@ -615,23 +610,22 @@ void wm_init_cursor_data(void) }; static BCursor CrossCursor = { - /*small*/ + /* small */ cross_sbm, cross_smsk, 16, 16, 7, 7, - /*big*/ + /* big */ cross_lbm, cross_lmsk, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_CROSSCURSOR] = &CrossCursor; @@ -652,23 +646,22 @@ void wm_init_cursor_data(void) }; static BCursor EditCrossCursor = { - /*small*/ + /* small */ editcross_sbm, editcross_smsk, 16, 16, 9, 8, - /*big*/ + /* big */ NULL, NULL, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_EDITCROSSCURSOR] = &EditCrossCursor; @@ -689,23 +682,22 @@ void wm_init_cursor_data(void) }; static BCursor BoxSelCursor = { - /*small*/ + /* small */ box_sbm, box_smsk, 16, 16, 9, 8, - /*big*/ + /* big */ NULL, NULL, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_BOXSELCURSOR] = &BoxSelCursor; @@ -750,23 +742,22 @@ void wm_init_cursor_data(void) }; static BCursor KnifeCursor = { - /*small*/ + /* small */ knife_sbm, knife_smsk, 16, 16, 0, 15, - /*big*/ + /* big */ knife_lbm, knife_lmsk, 32, 32, 0, 31, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_KNIFECURSOR] = &KnifeCursor; @@ -813,23 +804,22 @@ void wm_init_cursor_data(void) }; static BCursor VLoopCursor = { - /*small*/ + /* small */ vloop_sbm, vloop_smsk, 16, 16, 0, 0, - /*big*/ + /* big */ vloop_lbm, vloop_lmsk, 32, 32, 0, 0, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_VLOOPCURSOR] = &VLoopCursor; @@ -851,23 +841,22 @@ void wm_init_cursor_data(void) }; static BCursor TextEditCursor = { - /*small*/ + /* small */ textedit_sbm, textedit_smsk, 16, 16, 9, 8, - /*big*/ + /* big */ NULL, NULL, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_TEXTEDITCURSOR] = &TextEditCursor; @@ -889,23 +878,22 @@ void wm_init_cursor_data(void) }; static BCursor PaintBrushCursor = { - /*small*/ + /* small */ paintbrush_sbm, paintbrush_smsk, 16, 16, 0, 15, - /*big*/ + /* big */ NULL, NULL, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_PAINTBRUSHCURSOR] = &PaintBrushCursor; @@ -927,23 +915,22 @@ void wm_init_cursor_data(void) }; static BCursor HandCursor = { - /*small*/ + /* small */ hand_sbm, hand_smsk, 16, 16, 8, 8, - /*big*/ + /* big */ NULL, NULL, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_HANDCURSOR] = &HandCursor; @@ -966,23 +953,22 @@ void wm_init_cursor_data(void) }; static BCursor NSEWScrollCursor = { - /*small*/ + /* small */ nsewscroll_sbm, nsewscroll_smsk, 16, 16, 8, 8, - /*big*/ + /* big */ NULL, NULL, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_NSEW_SCROLLCURSOR] = &NSEWScrollCursor; @@ -1005,23 +991,22 @@ void wm_init_cursor_data(void) }; static BCursor NSScrollCursor = { - /*small*/ + /* small */ nsscroll_sbm, nsscroll_smsk, 16, 16, 8, 8, - /*big*/ + /* big */ NULL, NULL, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_NS_SCROLLCURSOR] = &NSScrollCursor; @@ -1044,23 +1029,22 @@ void wm_init_cursor_data(void) }; static BCursor EWScrollCursor = { - /*small*/ + /* small */ ewscroll_sbm, ewscroll_smsk, 16, 16, 8, 8, - /*big*/ + /* big */ NULL, NULL, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_EW_SCROLLCURSOR] = &EWScrollCursor; @@ -1083,23 +1067,22 @@ void wm_init_cursor_data(void) }; static BCursor EyedropperCursor = { - /*small*/ + /* small */ eyedropper_sbm, eyedropper_smsk, 16, 16, 1, 15, - /*big*/ + /* big */ NULL, NULL, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_EYEDROPPER_CURSOR] = &EyedropperCursor; @@ -1121,23 +1104,22 @@ void wm_init_cursor_data(void) }; static BCursor SwapCursor = { - /*small*/ + /* small */ swap_sbm, swap_smsk, 16, 16, 8, 8, - /*big*/ + /* big */ NULL, NULL, 32, 32, 15, 15, - /*color*/ - BC_YELLOW, - BC_BLUE, + /* can invert color */ + true, }; BlenderCursor[BC_SWAPAREA_CURSOR] = &SwapCursor; @@ -1182,23 +1164,22 @@ void wm_init_cursor_data(void) 0x00, 0xC0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}; static BCursor HSplitCursor = { - /*small*/ + /* small */ hsplit_sbm, hsplit_smsk, 16, 16, 7, 7, - /*big*/ + /* big */ hsplit_lbm, hsplit_lmsk, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_H_SPLITCURSOR] = &HSplitCursor; @@ -1243,23 +1224,22 @@ void wm_init_cursor_data(void) 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static BCursor VSplitCursor = { - /*small*/ + /* small */ vsplit_sbm, vsplit_smsk, 16, 16, 7, 7, - /*big*/ + /* big */ vsplit_lbm, vsplit_lmsk, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_V_SPLITCURSOR] = &VSplitCursor; @@ -1304,23 +1284,22 @@ void wm_init_cursor_data(void) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static BCursor NArrowCursor = { - /*small*/ + /* small */ narrow_sbm, narrow_smsk, 16, 16, 7, 4, - /*big*/ + /* big */ narrow_lbm, narrow_lmsk, 32, 32, 15, 10, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_N_ARROWCURSOR] = &NArrowCursor; @@ -1365,23 +1344,22 @@ void wm_init_cursor_data(void) 0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00}; static BCursor SArrowCursor = { - /*small*/ + /* small */ sarrow_sbm, sarrow_smsk, 16, 16, 7, 11, - /*big*/ + /* big */ sarrow_lbm, sarrow_lmsk, 32, 32, 15, 21, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_S_ARROWCURSOR] = &SArrowCursor; @@ -1426,23 +1404,22 @@ void wm_init_cursor_data(void) 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00}; static BCursor EArrowCursor = { - /*small*/ + /* small */ earrow_sbm, earrow_smsk, 16, 16, 11, 7, - /*big*/ + /* big */ earrow_lbm, earrow_lmsk, 32, 32, 15, 22, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_E_ARROWCURSOR] = &EArrowCursor; @@ -1487,23 +1464,22 @@ void wm_init_cursor_data(void) 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static BCursor WArrowCursor = { - /*small*/ + /* small */ warrow_sbm, warrow_smsk, 16, 16, 4, 7, - /*big*/ + /* big */ warrow_lbm, warrow_lmsk, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_W_ARROWCURSOR] = &WArrowCursor; @@ -1548,89 +1524,27 @@ void wm_init_cursor_data(void) 0x00, 0xFE, 0x7F, 0x00, 0x00, 0xF0, 0x0F, 0x00}; static BCursor StopCursor = { - /*small*/ + /* small */ stop_sbm, stop_smsk, 16, 16, 7, 7, - /*big*/ + /* big */ stop_lbm, stop_lmsk, 32, 32, 15, 15, - /*color*/ - BC_BLACK, - BC_WHITE, + /* can invert color */ + true, }; BlenderCursor[BC_STOPCURSOR] = &StopCursor; END_CURSOR_BLOCK; - /********************** PaintCross Cursor ***********************/ - BEGIN_CURSOR_BLOCK; - static char paintcross_sbm[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - - static char paintcross_smsk[] = { - 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0e, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - - static char paintcross_sbm_large[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - - static char paintcross_smsk_large[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, - 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xc0, 0x0f, - 0xfc, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, - 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, - 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - - static BCursor PaintCrossCursor = { - /*small*/ - paintcross_sbm, - paintcross_smsk, - 16, - 16, - 7, - 7, - /*big*/ - paintcross_sbm_large, - paintcross_smsk_large, - 32, - 32, - 15, - 15, - /*color*/ - BC_BLACK, - BC_WHITE, - }; - - BlenderCursor[BC_PAINTCROSSCURSOR] = &PaintCrossCursor; - END_CURSOR_BLOCK; - /********************** Put the cursors in the array ***********************/ } diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 005e05c4003..f20bc6b11fe 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -4134,14 +4134,15 @@ static int convert_key(GHOST_TKey key) static void wm_eventemulation(wmEvent *event, bool test_only) { - /* Store last mmb/rmb event value to make emulation work when modifier keys - * are released first. This really should be in a data structure somewhere. */ + /* Store last middle-mouse event value to make emulation work + * when modifier keys are released first. + * This really should be in a data structure somewhere. */ static int emulating_event = EVENT_NONE; - /* middlemouse and rightmouse emulation */ + /* Middle-mouse emulation. */ if (U.flag & USER_TWOBUTTONMOUSE) { - if (event->type == LEFTMOUSE) { + if (event->type == LEFTMOUSE) { if (event->val == KM_PRESS && event->alt) { event->type = MIDDLEMOUSE; event->alt = 0; @@ -4150,26 +4151,12 @@ static void wm_eventemulation(wmEvent *event, bool test_only) emulating_event = MIDDLEMOUSE; } } -#ifdef __APPLE__ - else if (event->val == KM_PRESS && event->oskey) { - event->type = RIGHTMOUSE; - event->oskey = 0; - - if (!test_only) { - emulating_event = RIGHTMOUSE; - } - } -#endif else if (event->val == KM_RELEASE) { /* only send middle-mouse release if emulated */ if (emulating_event == MIDDLEMOUSE) { event->type = MIDDLEMOUSE; event->alt = 0; } - else if (emulating_event == RIGHTMOUSE) { - event->type = RIGHTMOUSE; - event->oskey = 0; - } if (!test_only) { emulating_event = EVENT_NONE; @@ -5022,7 +5009,7 @@ const char *WM_window_cursor_keymap_status_get(const wmWindow *win, /** * Similar to #BKE_screen_area_map_find_area_xy and related functions, - * use here since the ara is stored in the window manager. + * use here since the area is stored in the window manager. */ ScrArea *WM_window_status_area_find(wmWindow *win, bScreen *screen) { diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 31205ab11f4..63ca46e05c6 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3353,6 +3353,22 @@ static void WM_OT_previews_ensure(wmOperatorType *ot) /* Only types supporting previews currently. */ static const EnumPropertyItem preview_id_type_items[] = { + {FILTER_ID_SCE | FILTER_ID_GR | FILTER_ID_OB | FILTER_ID_MA | FILTER_ID_LA | FILTER_ID_WO | + FILTER_ID_TE | FILTER_ID_IM, + "ALL", + 0, + "All Types", + ""}, + {FILTER_ID_SCE | FILTER_ID_GR | FILTER_ID_OB, + "GEOMETRY", + 0, + "All Geometry Types", + "Clear previews for scenes, collections and objects"}, + {FILTER_ID_MA | FILTER_ID_LA | FILTER_ID_WO | FILTER_ID_TE | FILTER_ID_IM, + "SHADING", + 0, + "All Shading Types", + "Clear previews for materiasl, lights, worlds, textures and images"}, {FILTER_ID_SCE, "SCENE", 0, "Scenes", ""}, {FILTER_ID_GR, "GROUP", 0, "Groups", ""}, {FILTER_ID_OB, "OBJECT", 0, "Objects", ""}, diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index 0c916896560..fa69d750665 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -731,8 +731,7 @@ static const char *toolsystem_default_tool(const bToolKey *tkey) } break; case SPACE_NODE: { - /* 'Select Box' interferes with cut-links which is handy. */ - return "builtin.select"; + return "builtin.select_box"; } } diff --git a/source/blender/windowmanager/wm_cursors.h b/source/blender/windowmanager/wm_cursors.h index 46fdb4baa5b..6793937c413 100644 --- a/source/blender/windowmanager/wm_cursors.h +++ b/source/blender/windowmanager/wm_cursors.h @@ -61,8 +61,7 @@ typedef struct BCursor { char big_hotx; char big_hoty; - char fg_color; - char bg_color; + bool can_invert_color; } BCursor; @@ -92,20 +91,10 @@ enum { BC_E_ARROWCURSOR, BC_W_ARROWCURSOR, BC_STOPCURSOR, - BC_PAINTCROSSCURSOR, /* --- ALWAYS LAST ----- */ BC_NUMCURSORS, }; -enum { - BC_BLACK = 0, - BC_WHITE, - BC_RED, - BC_BLUE, - BC_GREEN, - BC_YELLOW, -}; - struct wmEvent; struct wmWindow; diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index 3cd02fde8ac..e60e104d184 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -1085,8 +1085,8 @@ static int arg_handle_debug_fpe_set(int UNUSED(argc), } static const char arg_handle_app_template_doc[] = - "\n\t" - "Set the application template, use 'default' for none."; + "<template>\n" + "\tSet the application template (matching the directory name), use 'default' for none."; static int arg_handle_app_template(int argc, const char **argv, void *UNUSED(data)) { if (argc > 1) { @@ -1112,14 +1112,14 @@ static int arg_handle_factory_startup_set(int UNUSED(argc), return 0; } -static const char arg_handle_enable_static_override_doc[] = +static const char arg_handle_enable_override_library_doc[] = "\n\t" - "Enable Static Override features in the UI."; -static int arg_handle_enable_static_override(int UNUSED(argc), - const char **UNUSED(argv), - void *UNUSED(data)) + "Enable Library Override features in the UI."; +static int arg_handle_enable_override_library(int UNUSED(argc), + const char **UNUSED(argv), + void *UNUSED(data)) { - BKE_override_static_enable(true); + BKE_override_library_enable(true); return 0; } @@ -1168,7 +1168,11 @@ static int arg_handle_env_system_set(int argc, const char **argv, void *UNUSED(d static const char arg_handle_playback_mode_doc[] = "<options> <file(s)>\n" - "\tPlayback <file(s)>, only operates this way when not running in background.\n\n" + "\tInstead of showing Blender's user interface, this runs Blender as an animation player,\n" + "\tto view movies and image sequences rendered in Blender (ignored if '-b' is set).\n" + "\n" + "\tPlayback Arguments:\n" + "\n" "\t-p <sx> <sy>\n" "\t\tOpen with lower left corner at <sx>, <sy>.\n" "\t-m\n" @@ -1278,7 +1282,7 @@ static int arg_handle_no_window_focus(int UNUSED(argc), static const char arg_handle_start_with_console_doc[] = "\n\t" - "Start with the console window open (ignored if -b is set), (Windows only)."; + "Start with the console window open (ignored if '-b' is set), (Windows only)."; static int arg_handle_start_with_console(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data)) @@ -1340,13 +1344,13 @@ static const char arg_handle_output_set_doc[] = "\n" "\tThe '#' characters are replaced by the frame number, and used to define zero padding.\n" "\n" - "\t* 'ani_##_test.png' becomes 'ani_01_test.png'\n" + "\t* 'animation_##_test.png' becomes 'animation_01_test.png'\n" "\t* 'test-######.png' becomes 'test-000001.png'\n" "\n" "\tWhen the filename does not contain '#', The suffix '####' is added to the filename.\n" "\n" "\tThe frame number will be added at the end of the filename, eg:\n" - "\t# blender -b foobar.blend -o //render_ -F PNG -x 1 -a\n" + "\t# blender -b animation.blend -o //render_ -F PNG -x 1 -a\n" "\t'//render_' becomes '//render_####', writing frames as '//render_0001.png'"; static int arg_handle_output_set(int argc, const char **argv, void *data) { @@ -1370,7 +1374,7 @@ static int arg_handle_output_set(int argc, const char **argv, void *data) static const char arg_handle_engine_set_doc[] = "<engine>\n" "\tSpecify the render engine.\n" - "\tUse -E help to list available engines."; + "\tUse '-E' help to list available engines."; static int arg_handle_engine_set(int argc, const char **argv, void *data) { bContext *C = data; @@ -1397,7 +1401,7 @@ static int arg_handle_engine_set(int argc, const char **argv, void *data) else { printf( "\nError: no blend loaded. " - "order the arguments so '-E / --engine ' is after a blend is loaded.\n"); + "order the arguments so '-E / --engine' is after a blend is loaded.\n"); } } @@ -1412,11 +1416,11 @@ static int arg_handle_engine_set(int argc, const char **argv, void *data) static const char arg_handle_image_type_set_doc[] = "<format>\n" "\tSet the render format.\n" - "\tValid options are 'TGA' 'RAWTGA' 'JPEG' 'IRIS' 'IRIZ' 'AVIRAW' 'AVIJPEG' 'PNG' 'BMP'\n" + "\tValid options are:\n" + "\t'TGA' 'RAWTGA' 'JPEG' 'IRIS' 'IRIZ' 'AVIRAW' 'AVIJPEG' 'PNG' 'BMP'\n" "\n" - "\tFormats that can be compiled into Blender, not available on all systems: 'HDR' 'TIFF' " - "'OPEN_EXR'\n" - "\t'OPEN_EXR_MULTILAYER' 'MPEG' 'CINEON' 'DPX' 'DDS' 'JP2'"; + "\tFormats that can be compiled into Blender, not available on all systems:\n" + "\t'HDR' 'TIFF' 'OPEN_EXR' 'OPEN_EXR_MULTILAYER' 'MPEG' 'CINEON' 'DPX' 'DDS' 'JP2'"; static int arg_handle_image_type_set(int argc, const char **argv, void *data) { bContext *C = data; @@ -2173,7 +2177,7 @@ void main_args_setup(bContext *C, bArgs *ba) BLI_argsAdd(ba, 1, NULL, "--app-template", CB(arg_handle_app_template), NULL); BLI_argsAdd(ba, 1, NULL, "--factory-startup", CB(arg_handle_factory_startup_set), NULL); BLI_argsAdd( - ba, 1, NULL, "--enable-static-override", CB(arg_handle_enable_static_override), NULL); + ba, 1, NULL, "--enable-library-override", CB(arg_handle_enable_override_library), NULL); BLI_argsAdd(ba, 1, NULL, "--enable-event-simulate", CB(arg_handle_enable_event_simulate), NULL); /* TODO, add user env vars? */ |