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:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-10-31 22:15:32 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2014-10-31 22:15:32 +0300
commit23b7f351aaf077cc4464429a3879fe13809b4a74 (patch)
tree5880dcba259d8dd8ac60387da200d85ca21345c9
parentc7222a234ddae3281d2bdc76a01a98bf19e9bb3d (diff)
Optimize vertex parent for edit mode without modifiers
No need to run lookup on the origindex in this case at all.
-rw-r--r--source/blender/blenkernel/intern/object.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 82bcbaff31a..72f7d54b555 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2154,25 +2154,8 @@ static void give_parvert(Object *par, int nr, float vec[3])
int numVerts = dm->getNumVerts(dm);
if (nr < numVerts) {
- /* avoid dm->getVertDataArray() since it allocates arrays in the dm (not thread safe) */
- int i;
bool use_special_ss_case = false;
- if (em && dm->type == DM_TYPE_EDITBMESH) {
- if (em->bm->elem_table_dirty & BM_VERT) {
-#ifdef VPARENT_THREADING_HACK
- BLI_mutex_lock(&vparent_lock);
- if (em->bm->elem_table_dirty & BM_VERT) {
- BM_mesh_elem_table_ensure(em->bm, BM_VERT);
- }
- BLI_mutex_unlock(&vparent_lock);
-#else
- BLI_assert(!"Not safe for threading");
- BM_mesh_elem_table_ensure(em->bm, BM_VERT);
-#endif
- }
- }
-
if (dm->type == DM_TYPE_CCGDM) {
ModifierData *md;
VirtualModifierData virtualModifierData;
@@ -2190,6 +2173,24 @@ static void give_parvert(Object *par, int nr, float vec[3])
}
}
+ if (!use_special_ss_case) {
+ /* avoid dm->getVertDataArray() since it allocates arrays in the dm (not thread safe) */
+ if (em && dm->type == DM_TYPE_EDITBMESH) {
+ if (em->bm->elem_table_dirty & BM_VERT) {
+#ifdef VPARENT_THREADING_HACK
+ BLI_mutex_lock(&vparent_lock);
+ if (em->bm->elem_table_dirty & BM_VERT) {
+ BM_mesh_elem_table_ensure(em->bm, BM_VERT);
+ }
+ BLI_mutex_unlock(&vparent_lock);
+#else
+ BLI_assert(!"Not safe for threading");
+ BM_mesh_elem_table_ensure(em->bm, BM_VERT);
+#endif
+ }
+ }
+ }
+
if (use_special_ss_case) {
/* Special case if the last modifier is SS and no constructive modifier
* are in front of it.
@@ -2200,7 +2201,11 @@ static void give_parvert(Object *par, int nr, float vec[3])
add_v3_v3(vec, co);
count++;
}
- else if (CustomData_has_layer(&dm->vertData, CD_ORIGINDEX)) {
+ else if (CustomData_has_layer(&dm->vertData, CD_ORIGINDEX) &&
+ !(em && dm->type == DM_TYPE_EDITBMESH))
+ {
+ int i;
+
/* Get the average of all verts with (original index == nr). */
for (i = 0; i < numVerts; i++) {
const int *index = dm->getVertData(dm, i, CD_ORIGINDEX);