Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2019-03-07 13:13:40 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-03-07 13:29:50 +0300
commitab0bc65c24bdf68c356adb2566f3669153c931ea (patch)
tree23909478874a13d84e504a905809eb211e62a9e2 /source/blender/editors/physics
parentcee53160d2bd9067a3d43cc862ce61e36ff70454 (diff)
Refactor CDData masks, to have one mask per mesh elem type.
We already have different storages for cddata of verts, edges etc., 'simply' do the same for the mask flags we use all around Blender code to request some data, or limit some operation to some layers, etc. Reason we need this is that some cddata types (like Normals) are actually shared between verts/polys/loops, and we don’t want to generate clnors everytime we request vnors! As a side note, this also does final fix to T59338, which was the trigger for this patch (need to request computed loop normals for another mesh than evaluated one). Reviewers: brecht, campbellbarton, sergey Differential Revision: https://developer.blender.org/D4407
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r--source/blender/editors/physics/particle_edit.c4
-rw-r--r--source/blender/editors/physics/particle_object.c12
2 files changed, 6 insertions, 10 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 0c08fc6fb29..b2f314a66ec 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -3593,9 +3593,9 @@ static int particle_intersect_mesh(Depsgraph *depsgraph, Scene *UNUSED(scene), O
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
- mesh = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH);
+ mesh = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH);
if (mesh == NULL) {
- mesh = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH);
+ mesh = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH);
}
psys_enable_all(ob);
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index e0903a9d7c5..ac304f1aeec 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -51,7 +51,6 @@
#include "BKE_report.h"
#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_query.h"
#include "DEG_depsgraph_build.h"
#include "RNA_access.h"
@@ -1030,7 +1029,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
ParticleSystem *psys_start = NULL, *psys, *psys_from;
ParticleSystem **tmp_psys;
Mesh *final_mesh;
- CustomDataMask cdmask;
+ CustomData_MeshMasks cdmask = {0};
int i, totpsys;
if (ob_to->type != OB_MESH)
@@ -1052,7 +1051,6 @@ static bool copy_particle_systems_to_object(const bContext *C,
tmp_psys = MEM_mallocN(sizeof(ParticleSystem *) * totpsys, "temporary particle system array");
- cdmask = 0;
for (psys_from = PSYS_FROM_FIRST, i = 0;
psys_from;
psys_from = PSYS_FROM_NEXT(psys_from), ++i)
@@ -1063,7 +1061,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
if (psys_start == NULL)
psys_start = psys;
- cdmask |= psys_emitter_customdata_mask(psys);
+ psys_emitter_customdata_mask(psys, &cdmask);
}
/* to iterate source and target psys in sync,
* we need to know where the newly added psys start
@@ -1071,8 +1069,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
psys_start = totpsys > 0 ? tmp_psys[0] : NULL;
/* Get the evaluated mesh (psys and their modifiers have not been appended yet) */
- Object *ob_to_eval = DEG_get_evaluated_object(depsgraph, ob_to);
- final_mesh = mesh_get_eval_final(depsgraph, scene, ob_to_eval, cdmask);
+ final_mesh = mesh_get_eval_final(depsgraph, scene, ob_to, &cdmask);
/* now append psys to the object and make modifiers */
for (i = 0, psys_from = PSYS_FROM_FIRST;
@@ -1085,7 +1082,6 @@ static bool copy_particle_systems_to_object(const bContext *C,
/* append to the object */
BLI_addtail(&ob_to->particlesystem, psys);
- psys_unique_name(ob_to, psys, "");
/* add a particle system modifier for each system */
md = modifier_new(eModifierType_ParticleSystem);
@@ -1093,7 +1089,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
/* push on top of the stack, no use trying to reproduce old stack order */
BLI_addtail(&ob_to->modifiers, md);
- BLI_strncpy(md->name, psys->name, sizeof(md->name));
+ BLI_snprintf(md->name, sizeof(md->name), "ParticleSystem %i", i);
modifier_unique_name(&ob_to->modifiers, (ModifierData *)psmd);
psmd->psys = psys;