From df62deb0a7602878cc5367c0c7d3e3ac723a76c5 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 31 Aug 2018 12:41:23 +0200 Subject: Remove CCGDM from PBVH The statement that PBVH needs to keep track of CCGDM is wrong, PBVH itself does not care about CCGDM at all, and it's weird for it to carry on this beast so others can access. Even more, nobody will actually caring about CCGDM itself, all the usages were checking whether there is CCGDM or not. This is as good as simply checking PBVH type. Tested with an original report T53551 and everything is still stable. --- source/blender/blenkernel/BKE_pbvh.h | 2 - source/blender/blenkernel/intern/pbvh.c | 10 ---- source/blender/blenkernel/intern/pbvh_intern.h | 2 - source/blender/blenkernel/intern/subsurf_ccg.c | 13 ++---- source/blender/editors/sculpt_paint/paint_vertex.c | 54 +++++++++++++--------- 5 files changed, 34 insertions(+), 47 deletions(-) diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index f619133ee4b..1fede116193 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -74,7 +74,6 @@ void BKE_pbvh_build_grids(PBVH *bvh, struct CCGElem **grid_elems, struct CCGKey *key, void **gridfaces, struct DMFlagMat *flagmats, unsigned int **grid_hidden); void BKE_pbvh_build_bmesh(PBVH *bvh, struct BMesh *bm, bool smooth_shading, struct BMLog *log, const int cd_vert_node_offset, const int cd_face_node_offset); -void BKE_pbvh_set_ccgdm(PBVH *bvh, struct CCGDerivedMesh *ccgdm); void BKE_pbvh_free(PBVH *bvh); void BKE_pbvh_free_layer_disp(PBVH *bvh); @@ -155,7 +154,6 @@ int BKE_pbvh_count_grid_quads(BLI_bitmap **grid_hidden, /* multires level, only valid for type == PBVH_GRIDS */ void BKE_pbvh_get_grid_key(const PBVH *pbvh, struct CCGKey *key); -struct CCGDerivedMesh *BKE_pbvh_get_ccgdm(const PBVH *bvh); /* Only valid for type == PBVH_BMESH */ struct BMesh *BKE_pbvh_get_bmesh(PBVH *pbvh); diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 6d29646319f..772cda7266e 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -607,11 +607,6 @@ void BKE_pbvh_build_grids(PBVH *bvh, CCGElem **grids, MEM_freeN(prim_bbc); } -void BKE_pbvh_set_ccgdm(PBVH *bvh, CCGDerivedMesh *ccgdm) -{ - bvh->ccgdm = ccgdm; -} - PBVH *BKE_pbvh_new(void) { PBVH *bvh = MEM_callocN(sizeof(PBVH), "pbvh"); @@ -1358,11 +1353,6 @@ void BKE_pbvh_get_grid_key(const PBVH *bvh, CCGKey *key) *key = bvh->gridkey; } -CCGDerivedMesh *BKE_pbvh_get_ccgdm(const PBVH *bvh) -{ - return bvh->ccgdm; -} - BMesh *BKE_pbvh_get_bmesh(PBVH *bvh) { diff --git a/source/blender/blenkernel/intern/pbvh_intern.h b/source/blender/blenkernel/intern/pbvh_intern.h index afd539b2273..4aef97bda47 100644 --- a/source/blender/blenkernel/intern/pbvh_intern.h +++ b/source/blender/blenkernel/intern/pbvh_intern.h @@ -149,8 +149,6 @@ struct PBVH { * objects in sculpt mode with different sizes at the same time, so now storing that common gpu buffer * in an opaque pointer per pbvh. See T47637. */ struct GridCommonGPUBuffer *grid_common_gpu_buffer; - /* The ccgdm is required for CD_ORIGINDEX lookup in vertex paint + multires */ - struct CCGDerivedMesh *ccgdm; /* Only used during BVH build and update, * don't need to remain valid after */ diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index e08560cccac..221c600f502 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -4492,8 +4492,9 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm) if (ob->sculpt->pbvh) { /* Note that we have to clean up exisitng pbvh instead of updating it in case it does not match current * grid_pbvh status. */ + const PBVHType pbvh_type = BKE_pbvh_type(ob->sculpt->pbvh); if (grid_pbvh) { - if (BKE_pbvh_get_ccgdm(ob->sculpt->pbvh) != NULL) { + if (pbvh_type == PBVH_GRIDS) { /* pbvh's grids, gridadj and gridfaces points to data inside ccgdm * but this can be freed on ccgdm release, this updates the pointers * when the ccgdm gets remade, the assumption is that the topology @@ -4507,7 +4508,7 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm) ob->sculpt->pbvh = NULL; } } - else if (BKE_pbvh_get_ccgdm(ob->sculpt->pbvh) != NULL) { + else if (pbvh_type == PBVH_GRIDS) { BKE_pbvh_free(ob->sculpt->pbvh); ob->sculpt->pbvh = NULL; } @@ -4516,10 +4517,6 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm) } if (ccgdm->pbvh) { - /* For grid pbvh, keep track of ccgdm */ - if (grid_pbvh) { - BKE_pbvh_set_ccgdm(ccgdm->pbvh, ccgdm); - } return ccgdm->pbvh; } @@ -4571,10 +4568,6 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm) pbvh_show_mask_set(ccgdm->pbvh, ob->sculpt->show_mask); } - /* For grid pbvh, keep track of ccgdm. */ - if (grid_pbvh && ccgdm->pbvh) { - BKE_pbvh_set_ccgdm(ccgdm->pbvh, ccgdm); - } return ccgdm->pbvh; } diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 0fa5df4ad33..e1d8cfc3221 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1600,7 +1600,8 @@ static void do_wpaint_brush_blur_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); const struct SculptVertexPaintGeomMap *gmap = &ss->mode.wpaint.gmap; const Brush *brush = data->brush; @@ -1627,8 +1628,8 @@ static void do_wpaint_brush_blur_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { /* For grid based pbvh, take the vert whose loop coopresponds to the current grid. * Otherwise, take the current vert. */ - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; - const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f; const char v_flag = data->me->mvert[v_index].flag; /* If the vertex is selected */ if (!(use_face_sel || use_vert_sel) || v_flag & SELECT) { @@ -1691,7 +1692,8 @@ static void do_wpaint_brush_smear_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); const struct SculptVertexPaintGeomMap *gmap = &ss->mode.wpaint.gmap; const Brush *brush = data->brush; @@ -1723,8 +1725,8 @@ static void do_wpaint_brush_smear_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { /* For grid based pbvh, take the vert whose loop cooresponds to the current grid. * Otherwise, take the current vert. */ - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; - const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f; const MVert *mv_curr = &data->me->mvert[v_index]; /* If the vertex is selected */ @@ -1800,7 +1802,8 @@ static void do_wpaint_brush_draw_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); const Scene *scene = CTX_data_scene(data->C); const Brush *brush = data->brush; @@ -1829,8 +1832,8 @@ static void do_wpaint_brush_draw_task_cb_ex( /* Note: grids are 1:1 with corners (aka loops). * For multires, take the vert whose loop cooresponds to the current grid. * Otherwise, take the current vert. */ - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; - const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f; const char v_flag = data->me->mvert[v_index].flag; /* If the vertex is selected */ @@ -1873,7 +1876,8 @@ static void do_wpaint_brush_calc_average_weight_cb_ex( SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; StrokeCache *cache = ss->cache; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); const bool use_normal = vwpaint_use_normal(data->vp); const bool use_face_sel = (data->me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0; @@ -1898,8 +1902,8 @@ static void do_wpaint_brush_calc_average_weight_cb_ex( const float angle_cos = (use_normal && vd.no) ? dot_vf3vs3(sculpt_normal_frontface, vd.no) : 1.0f; if (angle_cos > 0.0 && BKE_brush_curve_strength(data->brush, sqrtf(test.dist), cache->radius) > 0.0) { - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; - // const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + // const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f; const char v_flag = data->me->mvert[v_index].flag; /* If the vertex is selected. */ @@ -2506,7 +2510,8 @@ static void do_vpaint_brush_calc_average_color_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); const struct SculptVertexPaintGeomMap *gmap = &ss->mode.vpaint.gmap; StrokeCache *cache = ss->cache; @@ -2528,7 +2533,7 @@ static void do_vpaint_brush_calc_average_color_cb_ex( { /* Test to see if the vertex coordinates are within the spherical brush region. */ if (sculpt_brush_test_sq_fn(&test, vd.co)) { - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; if (BKE_brush_curve_strength(data->brush, 0.0, cache->radius) > 0.0) { /* If the vertex is selected for painting. */ const MVert *mv = &data->me->mvert[v_index]; @@ -2570,7 +2575,8 @@ static void do_vpaint_brush_draw_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); const struct SculptVertexPaintGeomMap *gmap = &ss->mode.vpaint.gmap; const Brush *brush = data->brush; @@ -2598,8 +2604,8 @@ static void do_vpaint_brush_draw_task_cb_ex( /* Note: Grids are 1:1 with corners (aka loops). * For grid based pbvh, take the vert whose loop cooresponds to the current grid. * Otherwise, take the current vert. */ - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; - const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f; const MVert *mv = &data->me->mvert[v_index]; /* If the vertex is selected for painting. */ @@ -2664,7 +2670,8 @@ static void do_vpaint_brush_blur_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); Scene *scene = CTX_data_scene(data->C); const struct SculptVertexPaintGeomMap *gmap = &ss->mode.vpaint.gmap; @@ -2691,8 +2698,8 @@ static void do_vpaint_brush_blur_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { /* For grid based pbvh, take the vert whose loop cooresponds to the current grid. * Otherwise, take the current vert. */ - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; - const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f; const MVert *mv = &data->me->mvert[v_index]; /* If the vertex is selected for painting. */ @@ -2775,7 +2782,8 @@ static void do_vpaint_brush_smear_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh); + const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh); + const bool has_grids = (pbvh_type == PBVH_GRIDS); Scene *scene = CTX_data_scene(data->C); const struct SculptVertexPaintGeomMap *gmap = &ss->mode.vpaint.gmap; @@ -2808,8 +2816,8 @@ static void do_vpaint_brush_smear_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { /* For grid based pbvh, take the vert whose loop cooresponds to the current grid. * Otherwise, take the current vert. */ - const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; - const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f; + const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i]; + const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f; const MVert *mv_curr = &data->me->mvert[v_index]; /* if the vertex is selected for painting. */ -- cgit v1.2.3 From d9b9a46aa3b5d5fcbc14f0aa3fa052f8e4c00c3f Mon Sep 17 00:00:00 2001 From: Monique Dewanchand Date: Fri, 31 Aug 2018 15:00:38 +0200 Subject: Python: Enable MASS unit in FloatProperty MASS unit was already implemented for the C api. Only making sure it is accessible in the python api. Also added 'CAMERA' to the documentation as a valid option. --- source/blender/makesrna/intern/rna_rna.c | 1 + source/blender/python/intern/bpy_props.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 7eb48272c56..b8a9e9f92cd 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -121,6 +121,7 @@ const EnumPropertyItem rna_enum_property_unit_items[] = { {PROP_UNIT_TIME, "TIME", 0, "Time", ""}, {PROP_UNIT_VELOCITY, "VELOCITY", 0, "Velocity", ""}, {PROP_UNIT_ACCELERATION, "ACCELERATION", 0, "Acceleration", ""}, + {PROP_UNIT_MASS, "MASS", 0, "Mass", ""}, {PROP_UNIT_CAMERA, "CAMERA", 0, "Camera", ""}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 9b74b551b20..0db2fc189c1 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -1904,7 +1904,7 @@ static void bpy_prop_callback_assign_enum(struct PropertyRNA *prop, PyObject *ge " :type description: string\n" \ #define BPY_PROPDEF_UNIT_DOC \ -" :arg unit: Enumerator in ['NONE', 'LENGTH', 'AREA', 'VOLUME', 'ROTATION', 'TIME', 'VELOCITY', 'ACCELERATION'].\n" \ +" :arg unit: Enumerator in ['NONE', 'LENGTH', 'AREA', 'VOLUME', 'ROTATION', 'TIME', 'VELOCITY', 'ACCELERATION', 'MASS', 'CAMERA'].\n" \ " :type unit: string\n" \ #define BPY_PROPDEF_NUM_MIN_DOC \ -- cgit v1.2.3 From 8a3b548cb2b2c7a05a4d0a1c613f788d38a04e85 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 31 Aug 2018 17:05:51 +0200 Subject: Buildbot: Usable PIE Makes it impossible to run from GUI on certain platforms, see T56628. --- build_files/buildbot/config/blender_linux.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_files/buildbot/config/blender_linux.cmake b/build_files/buildbot/config/blender_linux.cmake index b4d1387a5c8..1c400339dfe 100644 --- a/build_files/buildbot/config/blender_linux.cmake +++ b/build_files/buildbot/config/blender_linux.cmake @@ -185,4 +185,4 @@ set(PCRE_LIBRARY "${LIBDIR}/opencollada/lib/libpcre.a" CACHE STRING endif() # Additional linking libraries -set(CMAKE_EXE_LINKER_FLAGS "-lrt -static-libstdc++" CACHE STRING "" FORCE) +set(CMAKE_EXE_LINKER_FLAGS "-lrt -static-libstdc++ -no-pie" CACHE STRING "" FORCE) -- cgit v1.2.3