[Bf-blender-cvs] [17fafe2f63c] temp_bmesh_multires: fix memory leak
Commit: 17fafe2f63cef0ed7d7ff9f7a101275a815d4730 Author: Joseph Eagar Date: Fri May 14 21:21:01 2021 -0700 Branches: temp_bmesh_multires https://developer.blender.org/rB17fafe2f63cef0ed7d7ff9f7a101275a815d4730 fix memory leak === M source/blender/blenkernel/intern/pbvh_bmesh.c === diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index 5f2523ad752..6987d760384 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -496,6 +496,11 @@ static void pbvh_bmesh_node_split( MEM_freeN(n->layer_disp); } + if (n->tribuf) { +BKE_pbvh_bmesh_free_tris(pbvh, n); +n->tribuf = NULL; + } + n->bm_faces = NULL; n->bm_unique_verts = NULL; n->bm_other_verts = NULL; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [89d56ea225b] temp_bmesh_multires: fix missing null pointer check.
Commit: 89d56ea225bb17580af753d45f2d9fbd373ec0b6 Author: Joseph Eagar Date: Fri May 14 21:12:23 2021 -0700 Branches: temp_bmesh_multires https://developer.blender.org/rB89d56ea225bb17580af753d45f2d9fbd373ec0b6 fix missing null pointer check. === M source/blender/editors/sculpt_paint/sculpt.c === diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 0694a9d5b42..e61ba7d0133 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1281,6 +1281,11 @@ static void sculpt_vertex_neighbors_get_bmesh(SculptSession *ss, #if 1 BMEdge *e = v->e; + + if (!v->e) { +return; + } + do { if (v == e->v1) { sculpt_vertex_neighbor_add_nocheck( ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [cfd6d48aab8] temp_bmesh_multires: * Prototyped a faster smooth algo, currently disabled. * Wrote a new API for wrangling temporary customdata layers across pbvh types: - SCULPT_temp_
Commit: cfd6d48aab81ed42beec70fe76c191749b5e790d Author: Joseph Eagar Date: Fri May 14 18:26:41 2021 -0700 Branches: temp_bmesh_multires https://developer.blender.org/rBcfd6d48aab81ed42beec70fe76c191749b5e790d * Prototyped a faster smooth algo, currently disabled. * Wrote a new API for wrangling temporary customdata layers across pbvh types: - SCULPT_temp_customlayer_ensure: makes sure a (named) customdata layer exists. Works for multires; since these are temporary layers we can safely allocate them in a temporary CustomData structure (in ss->temp_vdata). - SCULPT_temp_customlayer_get: initializes a special structure, SculptCustomLayer, that is used to get per elem customdata. - SCULPT_temp_cdata_get: Uses a SculptCustomLayer ref along with a SculptVertexRef to look up the data. === M source/blender/blenkernel/BKE_customdata.h M source/blender/blenkernel/BKE_paint.h M source/blender/blenkernel/intern/customdata.c M source/blender/blenkernel/intern/paint.c M source/blender/bmesh/intern/bmesh_log.c M source/blender/bmesh/intern/bmesh_polygon.c M source/blender/editors/sculpt_paint/sculpt.c M source/blender/editors/sculpt_paint/sculpt_dyntopo.c M source/blender/editors/sculpt_paint/sculpt_intern.h M source/blender/editors/sculpt_paint/sculpt_smooth.c === diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 5c73f4e3ca1..7b33a6077d0 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -605,6 +605,8 @@ void CustomData_blend_read(struct BlendDataReader *reader, struct CustomData *da void CustomData_unmark_temporary_nocopy(struct CustomData *data); void CustomData_mark_temporary_nocopy(struct CustomData *data); +int CustomData_get_elem_size(CustomDataLayer *layer); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 301e9ed9422..a6b4f3ab49b 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -27,6 +27,7 @@ #include "BLI_bitmap.h" #include "BLI_utildefines.h" #include "DNA_brush_enums.h" +#include "DNA_customdata_types.h" #include "DNA_object_enums.h" #ifdef __cplusplus @@ -471,6 +472,12 @@ typedef struct SculptSession { struct MPoly *mpoly; struct MLoop *mloop; + // only assigned in PBVH_FACES and PBVH_GRIDS + CustomData *vdata, *edata, *ldata, *pdata; + + // for grids + CustomData temp_vdata, temp_pdata; + /* These contain the vertex and poly counts of the final mesh. */ int totvert, totpoly; diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 3e3e5ca39af..1c5792461ca 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -2107,6 +2107,11 @@ static const LayerTypeInfo *layerType_getInfo(int type) return &LAYERTYPEINFO[type]; } +int CustomData_get_elem_size(CustomDataLayer *layer) +{ + return layerType_getInfo(layer->type)->size; +} + static const char *layerType_getName(int type) { if (type < 0 || type >= CD_NUMTYPES) { diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 80467bef5f2..2c830e92142 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -1630,7 +1630,7 @@ static void sculpt_update_object(Depsgraph *depsgraph, Scene *scene = DEG_get_input_scene(depsgraph); Sculpt *sd = scene->toolsettings->sculpt; SculptSession *ss = ob->sculpt; - const Mesh *me = BKE_object_get_original_mesh(ob); + Mesh *me = BKE_object_get_original_mesh(ob); MultiresModifierData *mmd = BKE_sculpt_multires_active(scene, ob); const bool use_face_sets = (ob->mode & OB_MODE_SCULPT) != 0; @@ -1683,6 +1683,11 @@ static void sculpt_update_object(Depsgraph *depsgraph, ss->multires.level = 0; ss->vmask = CustomData_get_layer(&me->vdata, CD_PAINT_MASK); ss->vcol = CustomData_get_layer(&me->vdata, CD_PROP_COLOR); + +ss->vdata = &me->vdata; +ss->edata = &me->edata; +ss->ldata = &me->ldata; +ss->pdata = &me->pdata; } /* Sculpt Face Sets. */ @@ -2233,7 +2238,7 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob) pbvh = build_pbvh_for_dynamic_topology(ob); ob->sculpt->pbvh = pbvh; -//reorder mesh elements to improve memory cache performance +// reorder mesh elements to improve memory cache performance SCULPT_reorder_bmesh(ob->sculpt); } else { diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c index c6c96481e7f..cd5cd05f10a 100644 --- a/source/blender/bmesh/intern/bmesh_log.c +++ b/sour
[Bf-blender-cvs] [65997a058f9] master: Merge branch 'blender-v2.93-release'
Commit: 65997a058f9cb4903cd71dd3207b972eaa4bdb59 Author: Philipp Oeser Date: Sat May 15 02:55:25 2021 +0200 Branches: master https://developer.blender.org/rB65997a058f9cb4903cd71dd3207b972eaa4bdb59 Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f432b5ccf5c] blender-v2.93-release: RigidBodies: Clarify usage of the custom density in the calculate mass operator
Commit: f432b5ccf5c1b74583e4dd64ccdafa2a513b134d Author: Philipp Oeser Date: Mon May 10 10:30:28 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rBf432b5ccf5c1b74583e4dd64ccdafa2a513b134d RigidBodies: Clarify usage of the custom density in the calculate mass operator This is only used when the preset is set to 'Custom', make that clear in the tooltip and disable editing the value if another preset is used. Issue came up in T88155. Maniphest Tasks: T88155 Differential Revision: https://developer.blender.org/D11210 === M source/blender/editors/physics/rigidbody_object.c === diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c index 81a8b57776b..fca3b5817b0 100644 --- a/source/blender/editors/physics/rigidbody_object.c +++ b/source/blender/editors/physics/rigidbody_object.c @@ -520,6 +520,26 @@ static int rigidbody_objects_calc_mass_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } +static bool mass_calculate_poll_property(const bContext *UNUSED(C), + wmOperator *op, + const PropertyRNA *prop) +{ + const char *prop_id = RNA_property_identifier(prop); + + /* Disable density input when not using the 'Custom' preset. */ + if (STREQ(prop_id, "density")) { +int material = RNA_enum_get(op->ptr, "material"); +if (material >= 0) { + RNA_def_property_clear_flag((PropertyRNA *)prop, PROP_EDITABLE); +} +else { + RNA_def_property_flag((PropertyRNA *)prop, PROP_EDITABLE); +} + } + + return true; +} + void RIGIDBODY_OT_mass_calculate(wmOperatorType *ot) { PropertyRNA *prop; @@ -533,6 +553,7 @@ void RIGIDBODY_OT_mass_calculate(wmOperatorType *ot) ot->invoke = WM_menu_invoke; /* XXX */ ot->exec = rigidbody_objects_calc_mass_exec; ot->poll = ED_operator_rigidbody_active_poll; + ot->poll_property = mass_calculate_poll_property; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -554,7 +575,7 @@ void RIGIDBODY_OT_mass_calculate(wmOperatorType *ot) FLT_MIN, FLT_MAX, "Density", -"Custom density value (kg/m^3) to use instead of material preset", +"Density value (kg/m^3), allows custom value if the 'Custom' preset is used", 1.0f, 2500.0f); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ccb22740c1e] master: Merge branch 'blender-v2.93-release'
Commit: ccb22740c1e364d157b6464dbacaa2c66f8e6f85 Author: Philipp Oeser Date: Sat May 15 02:34:47 2021 +0200 Branches: master https://developer.blender.org/rBccb22740c1e364d157b6464dbacaa2c66f8e6f85 Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4707c861795] blender-v2.93-release: Fix T88188: Keyframing Vertex Mass in Cloth Simulation doesn't have any effect
Commit: 4707c8617951cd3f68847216f8de8aa1029c3348 Author: Philipp Oeser Date: Tue May 11 12:54:18 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rB4707c8617951cd3f68847216f8de8aa1029c3348 Fix T88188: Keyframing Vertex Mass in Cloth Simulation doesn't have any effect The way it is now, `ClothVertex->mass` is setup once for the clothObject and then reused if it already exists [so does not change across frames/ steps] which happens in`cloth_from_object` / `do_init_cloth`, where `SIM_cloth_solver_init` / `SIM_mass_spring_set_vertex_mass` are called and set up masses in `Implicit_Data`. Seems possible to update `ClothVertex->mass` every step in `do_step_cloth`, however it seems more involved to update the masses in `Implicit_Data` there as well. The masses from `Implicit_Data` are accessed in many places, so it would be mandatory to have these masses kept up-to-date (and even then it is unclear if the solver was designed to work with these animated or if there are assumptions about this being stable across the sim). So propose to remove the (broken/not implemented) animation capabilities on the property instead. Maniphest Tasks: T88188 Differential Revision: https://developer.blender.org/D11225 === M source/blender/makesrna/intern/rna_cloth.c === diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index 2bc00dd5af5..9e57368f8f9 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -652,6 +652,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_text(prop, "Vertex Mass", "The mass of each vertex on the cloth material"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, 0, "rna_cloth_update"); prop = RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3458d09a74c] master: Merge branch 'blender-v2.93-release'
Commit: 3458d09a74c53d6fb78360bb8963816999af38ff Author: Philipp Oeser Date: Sat May 15 02:06:02 2021 +0200 Branches: master https://developer.blender.org/rB3458d09a74c53d6fb78360bb8963816999af38ff Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [baf7f78f9fd] blender-v2.93-release: Fix T87715: Eevee: Holdout options not available in Outliner Collection context menu
Commit: baf7f78f9fd854556d5cf07d293c2c5b7c7e183e Author: Philipp Oeser Date: Tue May 11 18:34:33 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rBbaf7f78f9fd854556d5cf07d293c2c5b7c7e183e Fix T87715: Eevee: Holdout options not available in Outliner Collection context menu Collection holdouts are now supported by eevee. Maniphest Tasks: T87715 Differential Revision: https://developer.blender.org/D11233 === M release/scripts/startup/bl_ui/space_outliner.py === diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py index 1e799379543..6eafa570f4c 100644 --- a/release/scripts/startup/bl_ui/space_outliner.py +++ b/release/scripts/startup/bl_ui/space_outliner.py @@ -162,13 +162,13 @@ class OUTLINER_MT_collection_view_layer(Menu): layout.operator("outliner.collection_exclude_set") layout.operator("outliner.collection_exclude_clear") +layout.operator("outliner.collection_holdout_set") +layout.operator("outliner.collection_holdout_clear") + if context.engine == 'CYCLES': layout.operator("outliner.collection_indirect_only_set") layout.operator("outliner.collection_indirect_only_clear") -layout.operator("outliner.collection_holdout_set") -layout.operator("outliner.collection_holdout_clear") - class OUTLINER_MT_collection_visibility(Menu): bl_label = "Visibility" ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6be2c079c12] temp_bmesh_multires: Did some profiling with VTune. * Sculpt code seems to be memory bandwidth bound. * Some key topology loops will have to be written manually instead
Commit: 6be2c079c1281173724ade93a2d9fe89917bc5f3 Author: Joseph Eagar Date: Fri May 14 15:56:04 2021 -0700 Branches: temp_bmesh_multires https://developer.blender.org/rB6be2c079c1281173724ade93a2d9fe89917bc5f3 Did some profiling with VTune. * Sculpt code seems to be memory bandwidth bound. * Some key topology loops will have to be written manually instead of using BM_ITER. I wrote a function to re-allocate a bmesh with elements ordered by PBVH leaf nodes, SCULPT_reorder_bmesh. It's currently disabled. This is going to take more profiling, but my original proxy refactor idea might be worth revisiting. Might be more cache efficient. The good news is that the worst case is the smooth code, which I can speed up significantly by keeping a bit of state around. === M source/blender/blenkernel/BKE_pbvh.h M source/blender/blenkernel/intern/customdata.c M source/blender/blenkernel/intern/paint.c M source/blender/blenkernel/intern/pbvh.c M source/blender/blenkernel/intern/pbvh_bmesh.c M source/blender/bmesh/intern/bmesh_log.c M source/blender/bmesh/intern/bmesh_log.h M source/blender/editors/sculpt_paint/sculpt.c M source/blender/editors/sculpt_paint/sculpt_dyntopo.c M source/blender/editors/sculpt_paint/sculpt_intern.h === diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index 5912e52b079..f75f1491d68 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -715,6 +715,8 @@ struct BMVert *BKE_pbvh_vert_create_bmesh( PBVH *pbvh, float co[3], float no[3], PBVHNode *node, struct BMVert *v_example); PBVHNode *BKE_pbvh_node_from_face_bmesh(PBVH *pbvh, struct BMFace *f); +struct BMesh *BKE_pbvh_reorder_bmesh(PBVH *pbvh); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index c065c448328..3e3e5ca39af 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -35,6 +35,7 @@ #include "DNA_meshdata_types.h" #include "BLI_bitmap.h" +#include "BLI_compiler_attrs.h" #include "BLI_endian_switch.h" #include "BLI_math.h" #include "BLI_math_color_blend.h" @@ -2943,15 +2944,17 @@ bool CustomData_is_referenced_layer(struct CustomData *data, int type) return (layer->flag & CD_FLAG_NOFREE) != 0; } -void CustomData_unmark_temporary_nocopy(CustomData *data) { - for (int i=0; itotlayer; i++) { +void CustomData_unmark_temporary_nocopy(CustomData *data) +{ + for (int i = 0; i < data->totlayer; i++) { if (data->layers[i].flag & CD_FLAG_TEMPORARY) { data->layers[i].flag &= ~CD_FLAG_NOCOPY; } } } -void CustomData_mark_temporary_nocopy(CustomData *data) { +void CustomData_mark_temporary_nocopy(CustomData *data) +{ for (int i = 0; i < data->totlayer; i++) { if (data->layers[i].flag & CD_FLAG_TEMPORARY) { data->layers[i].flag |= CD_FLAG_NOCOPY; @@ -3915,7 +3918,7 @@ void CustomData_bmesh_copy_data_exclude_by_type(const CustomData *source, } } - for (int dest_i=0; dest_i < dest->totlayer; dest_i++) { + for (int dest_i = 0; dest_i < dest->totlayer; dest_i++) { CustomData_bmesh_set_default_n(dest, dest_block, dest_i); dest_i++; } diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 49fc04f7588..80467bef5f2 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -82,6 +82,7 @@ // XXX todo: work our bad module cross ref void SCULPT_dynamic_topology_sync_layers(Object *ob, Mesh *me); void SCULPT_on_sculptsession_bmesh_free(SculptSession *ss); +void SCULPT_reorder_bmesh(SculptSession *ss); static void palette_init_data(ID *id) { @@ -1383,9 +1384,10 @@ static void sculptsession_bm_to_me_update_data_only(Object *ob, bool reorder) if (ss->bm) { if (ob->data) { - if (reorder) { + if (reorder && ss->bm_log) { BM_log_mesh_elems_reorder(ss->bm, ss->bm_log); } + BM_mesh_bm_to_me(NULL, NULL, ss->bm, @@ -1470,8 +1472,8 @@ void BKE_sculptsession_free(Object *ob) if (ob && ob->sculpt) { SculptSession *ss = ob->sculpt; -if (ss->bm_log) { - BM_log_free(ss->bm_log, true); +if (ss->bm_log && BM_log_free(ss->bm_log, true)) { + ss->bm_log = NULL; } /*try to save current mesh*/ @@ -2229,6 +2231,10 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob) if (ob->sculpt->bm != NULL) { /* Sculpting on a BMesh (dynamic-topology) gets a special PBVH. */ pbvh = build_pbvh_for_dynamic_topology(ob); + +ob->sculpt->pbvh = pbvh; +//reorder mesh elements to improve memory cache performance +SCUL
[Bf-blender-cvs] [32ceaa79191] temp_bmesh_multires: Update ATTR_NO_OPT macro
Commit: 32ceaa7919181b4235fcd8f432a7171f88f076fa Author: Joseph Eagar Date: Wed May 12 22:27:35 2021 -0700 Branches: temp_bmesh_multires https://developer.blender.org/rB32ceaa7919181b4235fcd8f432a7171f88f076fa Update ATTR_NO_OPT macro === M source/blender/blenlib/BLI_compiler_attrs.h M source/blender/editors/sculpt_paint/sculpt_geodesic.c === diff --git a/source/blender/blenlib/BLI_compiler_attrs.h b/source/blender/blenlib/BLI_compiler_attrs.h index df54d061db7..08b415fef96 100644 --- a/source/blender/blenlib/BLI_compiler_attrs.h +++ b/source/blender/blenlib/BLI_compiler_attrs.h @@ -101,13 +101,13 @@ /* Disable optimization for a function (for debugging use only)*/ #ifdef __clang__ -#define ATTR_NO_OPT __attribute__((optnone)) +# define ATTR_NO_OPT __attribute__((optnone)) #elif __MSC_VER # define ATTR_NO_OPT __pragma(optimize("", off)) #elif __GNUC__ -#define ATTR_NO_OPT _Pragma(optimize, "O0") +# define ATTR_NO_OPT __attribute__((optimize("O0"))) #else -#define ATTR_NO_OPT +# define ATTR_NO_OPT #endif /* Alignment directive */ diff --git a/source/blender/editors/sculpt_paint/sculpt_geodesic.c b/source/blender/editors/sculpt_paint/sculpt_geodesic.c index 4a1cd5508f0..db9fd368584 100644 --- a/source/blender/editors/sculpt_paint/sculpt_geodesic.c +++ b/source/blender/editors/sculpt_paint/sculpt_geodesic.c @@ -216,7 +216,7 @@ static float fast_geodesic_distance_propagate_across_triangle( printf("%.7f : %.7f\n", result*2.0, geodesic_distance_propagate_across_triangle(v0, v1, v2, dist1, dist2));*/ - return result*4.0; + return result * 4.0; } } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e7e183aa2b9] master: Cleanup: Update / improve comments
Commit: e7e183aa2b99b8c787a2d2c357cdc4f61f0f6bf1 Author: Hans Goudey Date: Fri May 14 16:37:05 2021 -0500 Branches: master https://developer.blender.org/rBe7e183aa2b99b8c787a2d2c357cdc4f61f0f6bf1 Cleanup: Update / improve comments === M source/blender/blenkernel/BKE_spline.hh M source/blender/blenkernel/intern/spline_bezier.cc M source/blender/blenkernel/intern/spline_nurbs.cc === diff --git a/source/blender/blenkernel/BKE_spline.hh b/source/blender/blenkernel/BKE_spline.hh index 54a8e97d5c6..acff2843806 100644 --- a/source/blender/blenkernel/BKE_spline.hh +++ b/source/blender/blenkernel/BKE_spline.hh @@ -48,10 +48,12 @@ using SplinePtr = std::unique_ptr; * evaluation happens in a layer on top of the evaluated points generated by the derived types. * * There are a few methods to evaluate a spline: - * 1. #evaluated_positions and #interpolate_to_evaluated_points give data at the initial + * 1. #evaluated_positions and #interpolate_to_evaluated_points give data for the initial * evaluated points, depending on the resolution. * 2. #lookup_evaluated_factor and #lookup_evaluated_factor are meant for one-off lookups * along the length of a curve. + * 3. #sample_uniform_index_factors returns an array that stores uniform-length samples + * along the spline which can be used to interpolate data from method 1. * * Commonly used evaluated data is stored in caches on the spline itself so that operations on * splines don't need to worry about taking ownership of evaluated data when they don't need to. @@ -288,7 +290,7 @@ class BezierSpline final : public Spline { int next_control_point_index; /** * Linear interpolation weight between the two indices, from 0 to 1. - * Higher means next control point. + * Higher means closer to next control point. */ float factor; }; @@ -319,6 +321,8 @@ class NURBSpline final : public Spline { EndPoint, Bezier, }; + + /** Method used to recalculate the knots vector when points are added or removed. */ KnotsMode knots_mode; struct BasisCache { diff --git a/source/blender/blenkernel/intern/spline_bezier.cc b/source/blender/blenkernel/intern/spline_bezier.cc index ba0f33e0093..58a8f46730a 100644 --- a/source/blender/blenkernel/intern/spline_bezier.cc +++ b/source/blender/blenkernel/intern/spline_bezier.cc @@ -168,6 +168,10 @@ static float3 next_position(Span positions, const bool cyclic, const int return positions[i + 1]; } +/** + * Recalculate all #Auto and #Vector handles with positions automatically + * derived from the neighboring control points. + */ void BezierSpline::ensure_auto_handles() const { if (!auto_handles_dirty_) { @@ -504,7 +508,7 @@ Span BezierSpline::evaluated_positions() const /** * Convert the data encoded in #evaulated_mappings into its parts-- the information necessary * to interpolate data from control points to evaluated points between them. The next control - * point index result will not overflow the size of the vector. + * point index result will not overflow the size of the control point vectors. */ BezierSpline::InterpolationData BezierSpline::interpolation_data_from_index_factor( const float index_factor) const diff --git a/source/blender/blenkernel/intern/spline_nurbs.cc b/source/blender/blenkernel/intern/spline_nurbs.cc index 2022b9fb85a..7816f303e2e 100644 --- a/source/blender/blenkernel/intern/spline_nurbs.cc +++ b/source/blender/blenkernel/intern/spline_nurbs.cc @@ -259,7 +259,7 @@ static void calculate_basis_for_point(const float parameter, MutableSpan basis_buffer, NURBSpline::BasisCache &basis_cache) { - /* Clamp parameter due to floating point inaccuracy. TODO: Look into using doubles. */ + /* Clamp parameter due to floating point inaccuracy. */ const float t = std::clamp(parameter, knots[0], knots[points_len + order - 1]); int start = 0; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3c978a73d1f] master: Docs: PyAPI: Replace use of the bgl module in the RenderEngine example
Commit: 3c978a73d1ffc287263b371a6a7e9b38cb169f45 Author: Germano Cavalcante Date: Sun May 2 16:30:23 2021 -0300 Branches: master https://developer.blender.org/rB3c978a73d1ffc287263b371a6a7e9b38cb169f45 Docs: PyAPI: Replace use of the bgl module in the RenderEngine example The bgl module will be discontinued. This example is seen at: https://docs.blender.org/api/current/bpy.types.RenderEngine.html uses it. Differential Revision: https://developer.blender.org/D11262 === M doc/python_api/examples/bpy.types.RenderEngine.py === diff --git a/doc/python_api/examples/bpy.types.RenderEngine.py b/doc/python_api/examples/bpy.types.RenderEngine.py index 45910194244..0b8795340ad 100644 --- a/doc/python_api/examples/bpy.types.RenderEngine.py +++ b/doc/python_api/examples/bpy.types.RenderEngine.py @@ -4,7 +4,9 @@ Simple Render Engine """ import bpy -import bgl +import array +import gpu +from gpu_extras.presets import draw_texture_2d class CustomRenderEngine(bpy.types.RenderEngine): @@ -100,8 +102,7 @@ class CustomRenderEngine(bpy.types.RenderEngine): dimensions = region.width, region.height # Bind shader that converts from scene linear to display space, -bgl.glEnable(bgl.GL_BLEND) -bgl.glBlendFunc(bgl.GL_ONE, bgl.GL_ONE_MINUS_SRC_ALPHA) +gpu.state.blend_set('ALPHA_PREMULT') self.bind_display_space_shader(scene) if not self.draw_data or self.draw_data.dimensions != dimensions: @@ -110,7 +111,7 @@ class CustomRenderEngine(bpy.types.RenderEngine): self.draw_data.draw() self.unbind_display_space_shader() -bgl.glDisable(bgl.GL_BLEND) +gpu.state.blend_set('NONE') class CustomDrawData: @@ -119,68 +120,21 @@ class CustomDrawData: self.dimensions = dimensions width, height = dimensions -pixels = [0.1, 0.2, 0.1, 1.0] * width * height -pixels = bgl.Buffer(bgl.GL_FLOAT, width * height * 4, pixels) +pixels = width * height * array.array('f', [0.1, 0.2, 0.1, 1.0]) +pixels = gpu.types.Buffer('FLOAT', width * height * 4, pixels) # Generate texture -self.texture = bgl.Buffer(bgl.GL_INT, 1) -bgl.glGenTextures(1, self.texture) -bgl.glActiveTexture(bgl.GL_TEXTURE0) -bgl.glBindTexture(bgl.GL_TEXTURE_2D, self.texture[0]) -bgl.glTexImage2D(bgl.GL_TEXTURE_2D, 0, bgl.GL_RGBA16F, width, height, 0, bgl.GL_RGBA, bgl.GL_FLOAT, pixels) -bgl.glTexParameteri(bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_MIN_FILTER, bgl.GL_LINEAR) -bgl.glTexParameteri(bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_MAG_FILTER, bgl.GL_LINEAR) -bgl.glBindTexture(bgl.GL_TEXTURE_2D, 0) +self.texture = gpu.types.GPUTexture((width, height), format='RGBA16F', data=pixels) -# Bind shader that converts from scene linear to display space, -# use the scene's color management settings. -shader_program = bgl.Buffer(bgl.GL_INT, 1) -bgl.glGetIntegerv(bgl.GL_CURRENT_PROGRAM, shader_program) - -# Generate vertex array -self.vertex_array = bgl.Buffer(bgl.GL_INT, 1) -bgl.glGenVertexArrays(1, self.vertex_array) -bgl.glBindVertexArray(self.vertex_array[0]) - -texturecoord_location = bgl.glGetAttribLocation(shader_program[0], "texCoord") -position_location = bgl.glGetAttribLocation(shader_program[0], "pos") - -bgl.glEnableVertexAttribArray(texturecoord_location) -bgl.glEnableVertexAttribArray(position_location) - -# Generate geometry buffers for drawing textured quad -position = [0.0, 0.0, width, 0.0, width, height, 0.0, height] -position = bgl.Buffer(bgl.GL_FLOAT, len(position), position) -texcoord = [0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0] -texcoord = bgl.Buffer(bgl.GL_FLOAT, len(texcoord), texcoord) - -self.vertex_buffer = bgl.Buffer(bgl.GL_INT, 2) - -bgl.glGenBuffers(2, self.vertex_buffer) -bgl.glBindBuffer(bgl.GL_ARRAY_BUFFER, self.vertex_buffer[0]) -bgl.glBufferData(bgl.GL_ARRAY_BUFFER, 32, position, bgl.GL_STATIC_DRAW) -bgl.glVertexAttribPointer(position_location, 2, bgl.GL_FLOAT, bgl.GL_FALSE, 0, None) - -bgl.glBindBuffer(bgl.GL_ARRAY_BUFFER, self.vertex_buffer[1]) -bgl.glBufferData(bgl.GL_ARRAY_BUFFER, 32, texcoord, bgl.GL_STATIC_DRAW) -bgl.glVertexAttribPointer(texturecoord_location, 2, bgl.GL_FLOAT, bgl.GL_FALSE, 0, None) - -bgl.glBindBuffer(bgl.GL_ARRAY_BUFFER, 0) -bgl.glBindVertexArray(0) +# Note: This is just a didactic example. +# In this case it would be more convenient to fill the texture with: +# self.texture.clear('FLOAT', value=[0.1, 0.2, 0.1, 1.0]) def __del__(self): -bgl.glDeleteBuffers(2, self.vertex_buffer) -bgl.glDeleteVertexArrays(1, self
[Bf-blender-cvs] [782ccbde70d] master: Cleanup: Move attribute code to attribute header
Commit: 782ccbde70d873ee61691b7be2253b2b1b4d3cc1 Author: Hans Goudey Date: Fri May 14 15:53:43 2021 -0500 Branches: master https://developer.blender.org/rB782ccbde70d873ee61691b7be2253b2b1b4d3cc1 Cleanup: Move attribute code to attribute header This code in the geometry set header was not directly related to geometry sets, it makes more sense in the attribute access header. This makes it clearer that code for geometry components uses attribute code, rather than the other way around. It also allows adding more functionality to `BKE_attribute_access.hh` that depends on these things without including `BKE_geometry_set.hh` there. === M source/blender/blenkernel/BKE_attribute_access.hh M source/blender/blenkernel/BKE_geometry_set.hh === diff --git a/source/blender/blenkernel/BKE_attribute_access.hh b/source/blender/blenkernel/BKE_attribute_access.hh index 5feae1bf4ca..358daa40723 100644 --- a/source/blender/blenkernel/BKE_attribute_access.hh +++ b/source/blender/blenkernel/BKE_attribute_access.hh @@ -27,6 +27,80 @@ #include "BLI_color.hh" #include "BLI_float2.hh" #include "BLI_float3.hh" +#include "BLI_function_ref.hh" + +/** + * Contains information about an attribute in a geometry component. + * More information can be added in the future. E.g. whether the attribute is builtin and how it is + * stored (uv map, vertex group, ...). + */ +struct AttributeMetaData { + AttributeDomain domain; + CustomDataType data_type; +}; + +/** + * Base class for the attribute intializer types described below. + */ +struct AttributeInit { + enum class Type { +Default, +VArray, +MoveArray, + }; + Type type; + AttributeInit(const Type type) : type(type) + { + } +}; + +/** + * Create an attribute using the default value for the data type. + * The default values may depend on the attribute provider implementation. + */ +struct AttributeInitDefault : public AttributeInit { + AttributeInitDefault() : AttributeInit(Type::Default) + { + } +}; + +/** + * Create an attribute by copying data from an existing virtual array. The virtual array + * must have the same type as the newly created attribute. + * + * Note that this can be used to fill the new attribute with the default + */ +struct AttributeInitVArray : public AttributeInit { + const blender::fn::GVArray *varray; + + AttributeInitVArray(const blender::fn::GVArray *varray) + : AttributeInit(Type::VArray), varray(varray) + { + } +}; + +/** + * Create an attribute with a by passing ownership of a pre-allocated contiguous array of data. + * Sometimes data is created before a geometry component is available. In that case, it's + * preferable to move data directly to the created attribute to avoid a new allocation and a copy. + * + * Note that this will only have a benefit for attributes that are stored directly as contiguous + * arrays, so not for some built-in attributes. + * + * The array must be allocated with MEM_*, since `attribute_try_create` will free the array if it + * can't be used directly, and that is generally how Blender expects custom data to be allocated. + */ +struct AttributeInitMove : public AttributeInit { + void *data = nullptr; + + AttributeInitMove(void *data) : AttributeInit(Type::MoveArray), data(data) + { + } +}; + +/* Returns false when the iteration should be stopped. */ +using AttributeForeachCallback = blender::FunctionRef; namespace blender::bke { diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh index bd2b062152d..3b3856f11ab 100644 --- a/source/blender/blenkernel/BKE_geometry_set.hh +++ b/source/blender/blenkernel/BKE_geometry_set.hh @@ -25,7 +25,6 @@ #include "BLI_float3.hh" #include "BLI_float4x4.hh" -#include "BLI_function_ref.hh" #include "BLI_hash.hh" #include "BLI_map.hh" #include "BLI_set.hh" @@ -57,79 +56,6 @@ class ComponentAttributeProviders; class GeometryComponent; -/** - * Contains information about an attribute in a geometry component. - * More information can be added in the future. E.g. whether the attribute is builtin and how it is - * stored (uv map, vertex group, ...). - */ -struct AttributeMetaData { - AttributeDomain domain; - CustomDataType data_type; -}; - -/* Returns false when the iteration should be stopped. */ -using AttributeForeachCallback = blender::FunctionRef; - -/** - * Base class for the attribute intializer types described below. - */ -struct AttributeInit { - enum class Type { -Default, -VArray, -MoveArray, - }; - Type type; - AttributeInit(const Type type) : type(type) - { - } -}; - -/** - * Create an attribute using the default value for the data type. - * The default values may depend on the attribute provider implementation. - */ -struct AttributeInitDefault : public AttributeInit { - AttributeInitDefault() : AttributeInit(Ty
[Bf-blender-cvs] [ae5d971e8fc] sculpt-dev: Merge branch 'master' into sculpt-dev
Commit: ae5d971e8fc85cda01cabd32729caabe9a0ef771 Author: Pablo Dobarro Date: Fri May 14 19:09:06 2021 +0200 Branches: sculpt-dev https://developer.blender.org/rBae5d971e8fc85cda01cabd32729caabe9a0ef771 Merge branch 'master' into sculpt-dev === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [72aad837806] sculpt-dev: Merge branch 'master' into sculpt-dev
Commit: 72aad8378061c843dbe4bcc3436371f776ac59e7 Author: Pablo Dobarro Date: Thu May 13 17:43:21 2021 +0200 Branches: sculpt-dev https://developer.blender.org/rB72aad8378061c843dbe4bcc3436371f776ac59e7 Merge branch 'master' into sculpt-dev === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [13bdc4a7e61] sculpt-dev: Merge branch 'master' into sculpt-dev
Commit: 13bdc4a7e6115cdbccd4789aad991d12e9a05843 Author: Pablo Dobarro Date: Fri May 14 19:08:19 2021 +0200 Branches: sculpt-dev https://developer.blender.org/rB13bdc4a7e6115cdbccd4789aad991d12e9a05843 Merge branch 'master' into sculpt-dev === === diff --cc source/blender/editors/sculpt_paint/paint_cursor.c index 587ce8e572d,3829aeebbeb..0834fb4486c --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@@ -1645,12 -1654,7 +1654,13 @@@ static void paint_cursor_draw_3d_view_b 2); } + /* Transform Pivot. */ + if (pcontext->paint && pcontext->paint->flags & PAINT_SCULPT_SHOW_PIVOT) { +cursor_draw_point_screen_space( +pcontext->pos, pcontext->region, pcontext->ss->pivot_pos, pcontext->vc.obact->obmat, 2); + } - if (brush->sculpt_tool == SCULPT_TOOL_BOUNDARY) { ++ + if (is_brush_tool && brush->sculpt_tool == SCULPT_TOOL_BOUNDARY) { paint_cursor_preview_boundary_data_update(pcontext, update_previews); paint_cursor_preview_boundary_data_pivot_draw(pcontext); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [db59f0b943a] master: Fix T88262: Curve to mesh crash with vector last segment
Commit: db59f0b943acd684b2c571e5ef30a4c53e6ab5c4 Author: Hans Goudey Date: Fri May 14 11:26:42 2021 -0500 Branches: master https://developer.blender.org/rBdb59f0b943acd684b2c571e5ef30a4c53e6ab5c4 Fix T88262: Curve to mesh crash with vector last segment The code incorrectly used the size of the second to last segment rather than the last segment's size. That was a problem when the last segment is a vector segment but the second to last isn't. I also used the opportunity to slightly refactor the control point offsets cache, making it one longer so it also contains information about the size of the last segment, simplifying other code. === M source/blender/blenkernel/intern/spline_bezier.cc M source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc === diff --git a/source/blender/blenkernel/intern/spline_bezier.cc b/source/blender/blenkernel/intern/spline_bezier.cc index 0bc6e71fa4d..ba0f33e0093 100644 --- a/source/blender/blenkernel/intern/spline_bezier.cc +++ b/source/blender/blenkernel/intern/spline_bezier.cc @@ -258,9 +258,13 @@ bool BezierSpline::point_is_sharp(const int index) const bool BezierSpline::segment_is_vector(const int index) const { if (index == this->size() - 1) { -BLI_assert(is_cyclic_); -return handle_types_right_.last() == HandleType::Vector && - handle_types_left_.first() == HandleType::Vector; +if (is_cyclic_) { + return handle_types_right_.last() == HandleType::Vector && + handle_types_left_.first() == HandleType::Vector; +} +/* There is actually no segment in this case, but it's nice to avoid + * having a special case for the last segment in calling code. */ +return true; } return handle_types_right_[index] == HandleType::Vector && handle_types_left_[index + 1] == HandleType::Vector; @@ -279,15 +283,8 @@ void BezierSpline::mark_cache_invalid() int BezierSpline::evaluated_points_size() const { - const int points_len = this->size(); - BLI_assert(points_len > 0); - - const int last_offset = this->control_point_offsets().last(); - if (is_cyclic_ && points_len > 1) { -return last_offset + (this->segment_is_vector(points_len - 1) ? 1 : resolution_); - } - - return last_offset + 1; + BLI_assert(this->size() > 0); + return this->control_point_offsets().last(); } /** @@ -358,8 +355,12 @@ void BezierSpline::evaluate_bezier_segment(const int index, /** * Returns access to a cache of offsets into the evaluated point array for each control point. - * This is important because while most control point edges generate the number of edges specified - * by the resolution, vector segments only generate one edge. + * While most control point edges generate the number of edges specified by the resolution, vector + * segments only generate one edge. + * + * \note The length of the result is one greater than the number of points, so that the last item + * is the total number of evaluated points. This is useful to avoid recalculating the size of the + * last segment everywhere. */ Span BezierSpline::control_point_offsets() const { @@ -373,12 +374,12 @@ Span BezierSpline::control_point_offsets() const } const int points_len = this->size(); - offset_cache_.resize(points_len); + offset_cache_.resize(points_len + 1); MutableSpan offsets = offset_cache_; int offset = 0; - for (const int i : IndexRange(points_len - 1)) { + for (const int i : IndexRange(points_len)) { offsets[i] = offset; offset += this->segment_is_vector(i) ? 1 : resolution_; } @@ -400,7 +401,7 @@ static void calculate_mappings_linear_resolution(Span offsets, } const int grain_size = std::max(2048 / resolution, 1); - blender::parallel_for(IndexRange(1, size - 2), grain_size, [&](IndexRange range) { + parallel_for(IndexRange(1, size - 2), grain_size, [&](IndexRange range) { for (const int i_control_point : range) { const int segment_len = offsets[i_control_point + 1] - offsets[i_control_point]; const float segment_len_inv = 1.0f / segment_len; @@ -411,7 +412,7 @@ static void calculate_mappings_linear_resolution(Span offsets, }); if (is_cyclic) { -const int last_segment_len = offsets[size - 1] - offsets[size - 2]; +const int last_segment_len = offsets[size] - offsets[size - 1]; const float last_segment_len_inv = 1.0f / last_segment_len; for (const int i : IndexRange(last_segment_len)) { r_mappings[offsets[size - 1] + i] = size - 1 + i * last_segment_len_inv; @@ -471,25 +472,24 @@ Span BezierSpline::evaluated_positions() const this->ensure_auto_handles(); + const int size = this->size(); const int eval_size = this->evaluated_points_size(); evaluated_position_cache_.resize(eval_size); MutableSpan positions = evaluated_position_cache_; Span offsets = this->control_poin
[Bf-blender-cvs] [7178e541222] master: Merge branch 'blender-v2.93-release'
Commit: 7178e541222038bd27cde4491c747d27ef614301 Author: Philipp Oeser Date: Fri May 14 18:18:24 2021 +0200 Branches: master https://developer.blender.org/rB7178e541222038bd27cde4491c747d27ef614301 Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [d4a36c7ad55] blender-v2.93-release: Fix T88234: Crash with Eevee when shader displacement socket connection is muted
Commit: d4a36c7ad55b3dfbe5fc52f6183ae26484afa5b9 Author: Philipp Oeser Date: Fri May 14 15:42:07 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rBd4a36c7ad55b3dfbe5fc52f6183ae26484afa5b9 Fix T88234: Crash with Eevee when shader displacement socket connection is muted In {rB266cd7bb82ce}, support for muting links was added. It might be debatable if we define a shader as "having" displacement even if the link is muted, but after said commit, shader_has_displacement() would return true but still leave the returned node as NULL. Now also return false if the link is muted (otherwise the caller would need to additionally check the returned node as well.) Maniphest Tasks: T88234 Differential Revision: https://developer.blender.org/D11256 === M source/blender/nodes/shader/node_shader_tree.c === diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index 7b52b525541..83f476884e6 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -557,12 +557,14 @@ static bool ntree_shader_has_displacement(bNodeTree *ntree, /* Non-cycles node is used as an output. */ return false; } + if ((displacement->link != NULL) && !(displacement->link->flag & NODE_LINK_MUTED)) { *r_node = displacement->link->fromnode; *r_socket = displacement->link->fromsock; *r_link = displacement->link; +return true; } - return displacement->link != NULL; + return false; } static void ntree_shader_relink_node_normal(bNodeTree *ntree, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7efe92f63b4] master: Merge branch 'blender-v2.93-release'
Commit: 7efe92f63b4bb68bb46edc2fad66282d5acceed6 Author: Philipp Oeser Date: Fri May 14 18:10:12 2021 +0200 Branches: master https://developer.blender.org/rB7efe92f63b4bb68bb46edc2fad66282d5acceed6 Merge branch 'blender-v2.93-release' Conflicts: source/blender/editors/object/object_add.c === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1573c5fa90d] greasepencil-object: Merge branch 'master' into greasepencil-object
Commit: 1573c5fa90dfedbf299bde9051566d73e2ee9b58 Author: Antonio Vazquez Date: Fri May 14 18:04:57 2021 +0200 Branches: greasepencil-object https://developer.blender.org/rB1573c5fa90dfedbf299bde9051566d73e2ee9b58 Merge branch 'master' into greasepencil-object === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f6cb9433d45] master: GPencil: Refactor Append operators
Commit: f6cb9433d45a5504ffba17d0971e9b23b3632a54 Author: Antonio Vazquez Date: Fri May 14 17:59:16 2021 +0200 Branches: master https://developer.blender.org/rBf6cb9433d45a5504ffba17d0971e9b23b3632a54 GPencil: Refactor Append operators Now the operators work like other areas of Blender using the list of selected objects. Also, the name has been changed to: ```Layers: - Copy Layer to Selected - Copy All Layers to Selected Materials: - Copy Material to Selected - Copy All Materials to Selected``` Reviewed By: mendio, pablovazquez, pepeland Differential Revision: https://developer.blender.org/D11216 === M release/scripts/startup/bl_ui/properties_data_gpencil.py M release/scripts/startup/bl_ui/properties_material_gpencil.py M release/scripts/startup/bl_ui/space_view3d.py M source/blender/blenkernel/BKE_gpencil.h M source/blender/blenkernel/intern/gpencil.c M source/blender/blenkernel/intern/gpencil_curve.c M source/blender/blenkernel/intern/gpencil_geom.c M source/blender/editors/gpencil/annotate_paint.c M source/blender/editors/gpencil/gpencil_add_blank.c M source/blender/editors/gpencil/gpencil_add_lineart.c M source/blender/editors/gpencil/gpencil_add_monkey.c M source/blender/editors/gpencil/gpencil_add_stroke.c M source/blender/editors/gpencil/gpencil_convert.c M source/blender/editors/gpencil/gpencil_data.c M source/blender/editors/gpencil/gpencil_edit.c M source/blender/editors/gpencil/gpencil_fill.c M source/blender/editors/gpencil/gpencil_intern.h M source/blender/editors/gpencil/gpencil_ops.c M source/blender/editors/gpencil/gpencil_paint.c M source/blender/editors/gpencil/gpencil_primitive.c M source/blender/editors/gpencil/gpencil_trace_ops.c M source/blender/editors/space_view3d/view3d_gizmo_ruler.c M source/blender/io/gpencil/intern/gpencil_io_import_svg.cc M source/blender/makesrna/intern/rna_gpencil.c === diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py index d88c9a3502d..e71ea2f31a4 100644 --- a/release/scripts/startup/bl_ui/properties_data_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py @@ -113,8 +113,8 @@ class GPENCIL_MT_layer_context_menu(Menu): layout.operator("gpencil.layer_merge", icon='SORT_ASC', text="Merge Down") layout.separator() -layout.menu("VIEW3D_MT_gpencil_append_active_layer") -layout.menu("VIEW3D_MT_gpencil_append_all_layers") +layout.operator("gpencil.layer_duplicate_object", text="Copy Layer to Selected").only_active=True +layout.operator("gpencil.layer_duplicate_object", text="Copy All Layers to Selected").only_active=False class DATA_PT_gpencil_layers(DataButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py index ed5863b463a..9d099ff2231 100644 --- a/release/scripts/startup/bl_ui/properties_material_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py @@ -46,16 +46,18 @@ class GPENCIL_MT_material_context_menu(Menu): layout.separator() -layout.operator("object.material_slot_remove_unused") -layout.operator("gpencil.stroke_merge_material", text="Merge Similar") - -layout.separator() layout.operator("gpencil.material_to_vertex_color", text="Convert Materials to Vertex Color") layout.operator("gpencil.extract_palette_vertex", text="Extract Palette from Vertex Color") layout.separator() -layout.menu("VIEW3D_MT_gpencil_append_active_material") -layout.menu("VIEW3D_MT_gpencil_append_all_materials") + +layout.operator("gpencil.materials_copy_to_object", text="Copy Material to Selected").only_active = True +layout.operator("gpencil.materials_copy_to_object", text="Copy All Materials to Selected").only_active = False + +layout.separator() + +layout.operator("gpencil.stroke_merge_material", text="Merge Similar") +layout.operator("object.material_slot_remove_unused") class GPENCIL_UL_matslots(UIList): diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 4b06a2df3a0..df004b21077 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -4956,75 +4956,6 @@ class VIEW3D_MT_assign_material(Menu): icon='LAYER_ACTIVE' if mat == mat_active else 'BLANK1').material = mat.name -def gpencil_layer_append_menu_items(context, layout, only_active): -done = False -view_layer = context.view_layer -obact = context.active_object -g
[Bf-blender-cvs] [8c80267352f] master: CLOG: Fix memleak in own recent improvement to CLOG filter.
Commit: 8c80267352f171269a2d1c12c780db86ab27a023 Author: Bastien Montagne Date: Fri May 14 17:45:14 2021 +0200 Branches: master https://developer.blender.org/rB8c80267352f171269a2d1c12c780db86ab27a023 CLOG: Fix memleak in own recent improvement to CLOG filter. Mistake in rBef5782e29744. === M intern/clog/clog.c === diff --git a/intern/clog/clog.c b/intern/clog/clog.c index 50a51ebe913..416ea25ee0c 100644 --- a/intern/clog/clog.c +++ b/intern/clog/clog.c @@ -322,7 +322,9 @@ static bool clg_ctx_filter_check(CLogContext *ctx, const char *identifier) if (flt->match[0] == '*' && flt->match[len - 1] == '*') { char *match = MEM_callocN(sizeof(char) * len - 1, __func__); memcpy(match, flt->match + 1, len - 2); -if (strstr(identifier, match) != NULL) { +const bool success = (strstr(identifier, match) != NULL); +MEM_freeN(match); +if (success) { return (bool)i; } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [48fa029dd11] master: Python GPU: New 'platform' module
Commit: 48fa029dd11bb09d4aca8e0a420781e3ec07a3a2 Author: Germano Cavalcante Date: Fri May 14 11:15:00 2021 -0300 Branches: master https://developer.blender.org/rB48fa029dd11bb09d4aca8e0a420781e3ec07a3a2 Python GPU: New 'platform' module This module exposes the platform utils defined in the GPU module in C. This will be useful for porting existing code with `bgl` to `gpu`. Reviewed By: fclem, brecht, campbellbarton Maniphest Tasks: T80730 Part of D11147 === M source/blender/gpu/GPU_platform.h M source/blender/gpu/intern/gpu_platform.cc M source/blender/gpu/intern/gpu_platform_private.hh M source/blender/gpu/opengl/gl_backend.cc M source/blender/python/gpu/CMakeLists.txt M source/blender/python/gpu/gpu_py_api.c A source/blender/python/gpu/gpu_py_platform.c A source/blender/python/gpu/gpu_py_platform.h === diff --git a/source/blender/gpu/GPU_platform.h b/source/blender/gpu/GPU_platform.h index c457b829bf7..fa7d5d7fba8 100644 --- a/source/blender/gpu/GPU_platform.h +++ b/source/blender/gpu/GPU_platform.h @@ -68,6 +68,9 @@ extern "C" { bool GPU_type_matches(eGPUDeviceType device, eGPUOSType os, eGPUDriverType driver); eGPUSupportLevel GPU_platform_support_level(void); +const char *GPU_platform_vendor(void); +const char *GPU_platform_renderer(void); +const char *GPU_platform_version(void); const char *GPU_platform_support_level_key(void); const char *GPU_platform_gpu_name(void); diff --git a/source/blender/gpu/intern/gpu_platform.cc b/source/blender/gpu/intern/gpu_platform.cc index 6b9878f2ba4..49dde473300 100644 --- a/source/blender/gpu/intern/gpu_platform.cc +++ b/source/blender/gpu/intern/gpu_platform.cc @@ -41,10 +41,10 @@ namespace blender::gpu { GPUPlatformGlobal GPG; -void GPUPlatformGlobal::create_key(eGPUSupportLevel support_level, - const char *vendor, - const char *renderer, - const char *version) +static char *create_key(eGPUSupportLevel support_level, +const char *vendor, +const char *renderer, +const char *version) { DynStr *ds = BLI_dynstr_new(); BLI_dynstr_appendf(ds, "{%s/%s/%s}=", vendor, renderer, version); @@ -58,29 +58,56 @@ void GPUPlatformGlobal::create_key(eGPUSupportLevel support_level, BLI_dynstr_append(ds, "UNSUPPORTED"); } - support_key = BLI_dynstr_get_cstring(ds); + char *support_key = BLI_dynstr_get_cstring(ds); BLI_dynstr_free(ds); BLI_str_replace_char(support_key, '\n', ' '); BLI_str_replace_char(support_key, '\r', ' '); + return support_key; } -void GPUPlatformGlobal::create_gpu_name(const char *vendor, -const char *renderer, -const char *version) +static char *create_gpu_name(const char *vendor, const char *renderer, const char *version) { DynStr *ds = BLI_dynstr_new(); BLI_dynstr_appendf(ds, "%s %s %s", vendor, renderer, version); - gpu_name = BLI_dynstr_get_cstring(ds); + char *gpu_name = BLI_dynstr_get_cstring(ds); BLI_dynstr_free(ds); BLI_str_replace_char(gpu_name, '\n', ' '); BLI_str_replace_char(gpu_name, '\r', ' '); + return gpu_name; +} + +void GPUPlatformGlobal::init(eGPUDeviceType gpu_device, + eGPUOSType os_type, + eGPUDriverType driver_type, + eGPUSupportLevel gpu_support_level, + const char *vendor_str, + const char *renderer_str, + const char *version_str) +{ + this->clear(); + + this->initialized = true; + + this->device = gpu_device; + this->os = os_type; + this->driver = driver_type; + this->support_level = gpu_support_level; + + this->vendor = BLI_strdup(vendor_str); + this->renderer = BLI_strdup(renderer_str); + this->version = BLI_strdup(version_str); + this->support_key = create_key(gpu_support_level, vendor_str, renderer_str, version_str); + this->gpu_name = create_gpu_name(vendor_str, renderer_str, version_str); } void GPUPlatformGlobal::clear() { - MEM_SAFE_FREE(GPG.support_key); - MEM_SAFE_FREE(GPG.gpu_name); + MEM_SAFE_FREE(vendor); + MEM_SAFE_FREE(renderer); + MEM_SAFE_FREE(version); + MEM_SAFE_FREE(support_key); + MEM_SAFE_FREE(gpu_name); initialized = false; } @@ -96,22 +123,44 @@ using namespace blender::gpu; eGPUSupportLevel GPU_platform_support_level() { + BLI_assert(GPG.initialized); return GPG.support_level; } -const char *GPU_platform_support_level_key() +const char *GPU_platform_vendor(void) +{ + BLI_assert(GPG.initialized); + return GPG.vendor; +} + +const char *GPU_platform_renderer(void) +{ + BLI_assert(GPG.initialized); + retu
[Bf-blender-cvs] [b11499939c7] master: Python GPU: Replace part of the code that uses 'bgl' with 'gpu'
Commit: b11499939c7731e369be37c594142fd16e111ca7 Author: Germano Cavalcante Date: Fri May 14 11:15:00 2021 -0300 Branches: master https://developer.blender.org/rBb11499939c7731e369be37c594142fd16e111ca7 Python GPU: Replace part of the code that uses 'bgl' with 'gpu' This is part of the process described in T80730. The aim is to deprecate the bgl module. Reviewed By: fclem, brecht, campbellbarton Revision: D11147 === M intern/cycles/blender/addon/engine.py M release/scripts/modules/bl_ui_utils/bug_report_url.py M release/scripts/modules/sys_info.py === diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py index dfa696714fb..d8398772a84 100644 --- a/intern/cycles/blender/addon/engine.py +++ b/intern/cycles/blender/addon/engine.py @@ -19,16 +19,16 @@ from __future__ import annotations def _is_using_buggy_driver(): -import bgl +import gpu # We need to be conservative here because in multi-GPU systems display card # might be quite old, but others one might be just good. # # So We shouldn't disable possible good dedicated cards just because display # card seems weak. And instead we only blacklist configurations which are # proven to cause problems. -if bgl.glGetString(bgl.GL_VENDOR) == "ATI Technologies Inc.": +if gpu.platform.vendor_get() == "ATI Technologies Inc.": import re -version = bgl.glGetString(bgl.GL_VERSION) +version = gpu.platform.version_get() if version.endswith("Compatibility Profile Context"): # Old HD 4xxx and 5xxx series drivers did not have driver version # in the version string, but those cards do not quite work and diff --git a/release/scripts/modules/bl_ui_utils/bug_report_url.py b/release/scripts/modules/bl_ui_utils/bug_report_url.py index 5676e0d6815..3fc57467dac 100644 --- a/release/scripts/modules/bl_ui_utils/bug_report_url.py +++ b/release/scripts/modules/bl_ui_utils/bug_report_url.py @@ -21,7 +21,7 @@ def url_prefill_from_blender(addon_info=None): import bpy -import bgl +import gpu import struct import platform import urllib.parse @@ -38,9 +38,9 @@ def url_prefill_from_blender(addon_info=None): ) fh.write( "Graphics card: %s %s %s\n" % ( -bgl.glGetString(bgl.GL_RENDERER), -bgl.glGetString(bgl.GL_VENDOR), -bgl.glGetString(bgl.GL_VERSION), +gpu.platform.renderer_get(), +gpu.platform.vendor_get(), +gpu.platform.version_get(), ) ) fh.write( diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py index 5116e0f0088..192fc1a201f 100644 --- a/release/scripts/modules/sys_info.py +++ b/release/scripts/modules/sys_info.py @@ -28,7 +28,7 @@ def write_sysinfo(filepath): import subprocess import bpy -import bgl +import gpu # pretty repr def prepr(v): @@ -190,46 +190,29 @@ def write_sysinfo(filepath): if bpy.app.background: output.write("\nOpenGL: missing, background mode\n") else: -output.write(title("OpenGL")) -version = bgl.glGetString(bgl.GL_RENDERER) -output.write("renderer:\t%r\n" % version) -output.write("vendor:\t\t%r\n" % (bgl.glGetString(bgl.GL_VENDOR))) -output.write("version:\t%r\n" % (bgl.glGetString(bgl.GL_VERSION))) +output.write(title("GPU")) +output.write("renderer:\t%r\n" % gpu.platform.renderer_get()) +output.write("vendor:\t\t%r\n" % gpu.platform.vendor_get()) +output.write("version:\t%r\n" % gpu.platform.version_get()) output.write("extensions:\n") -limit = bgl.Buffer(bgl.GL_INT, 1) -bgl.glGetIntegerv(bgl.GL_NUM_EXTENSIONS, limit) - -glext = [] -for i in range(limit[0]): -glext.append(bgl.glGetStringi(bgl.GL_EXTENSIONS, i)) - -glext = sorted(glext) +glext = sorted(gpu.capabilities.extensions_get()) for l in glext: output.write("\t%s\n" % l) -output.write(title("Implementation Dependent OpenGL Limits")) -bgl.glGetIntegerv(bgl.GL_MAX_ELEMENTS_VERTICES, limit) -output.write("Maximum DrawElements Vertices:\t%d\n" % limit[0]) -bgl.glGetIntegerv(bgl.GL_MAX_ELEMENTS_INDICES, limit) -output.write("Maximum DrawElements Indices:\t%d\n" % limit[0]) +output.write(title("Implementation Dependent GPU Limits")) +output.write("Maximum Batch Vertices:\t%d\n" % gpu.capabilities.max_batch_vertices_get()) +out
[Bf-blender-cvs] [3f4f1096460] master: Python GPU: New 'capabilities' module
Commit: 3f4f109646059ee0780bb40dbd65b3bc8c3a8f3f Author: Germano Cavalcante Date: Fri May 14 11:15:00 2021 -0300 Branches: master https://developer.blender.org/rB3f4f109646059ee0780bb40dbd65b3bc8c3a8f3f Python GPU: New 'capabilities' module This module exposes the capabilities defined in the GPU module in C. This will be useful for porting existing code in `bgl` to `gpu`. Reviewed By: fclem, brecht, campbellbarton Maniphest Tasks: T80730 Part of D11147 === M source/blender/gpu/GPU_capabilities.h M source/blender/gpu/intern/gpu_capabilities.cc M source/blender/gpu/intern/gpu_capabilities_private.hh M source/blender/gpu/opengl/gl_backend.cc M source/blender/python/gpu/CMakeLists.txt M source/blender/python/gpu/gpu_py_api.c A source/blender/python/gpu/gpu_py_capabilities.c A source/blender/python/gpu/gpu_py_capabilities.h === diff --git a/source/blender/gpu/GPU_capabilities.h b/source/blender/gpu/GPU_capabilities.h index b95053a3715..f54ecece659 100644 --- a/source/blender/gpu/GPU_capabilities.h +++ b/source/blender/gpu/GPU_capabilities.h @@ -37,6 +37,15 @@ int GPU_max_textures(void); int GPU_max_textures_vert(void); int GPU_max_textures_geom(void); int GPU_max_textures_frag(void); +int GPU_max_uniforms_vert(void); +int GPU_max_uniforms_frag(void); +int GPU_max_batch_indices(void); +int GPU_max_batch_vertices(void); +int GPU_max_vertex_attribs(void); +int GPU_max_varying_floats(void); + +int GPU_extensions_len(void); +const char *GPU_extension_get(int i); int GPU_texture_size_with_limit(int res, bool limit_gl_texture_size); diff --git a/source/blender/gpu/intern/gpu_capabilities.cc b/source/blender/gpu/intern/gpu_capabilities.cc index 6d9182dcf17..d8764502800 100644 --- a/source/blender/gpu/intern/gpu_capabilities.cc +++ b/source/blender/gpu/intern/gpu_capabilities.cc @@ -82,6 +82,46 @@ int GPU_max_textures(void) return GCaps.max_textures; } +int GPU_max_uniforms_vert(void) +{ + return GCaps.max_uniforms_vert; +} + +int GPU_max_uniforms_frag(void) +{ + return GCaps.max_uniforms_frag; +} + +int GPU_max_batch_indices(void) +{ + return GCaps.max_batch_indices; +} + +int GPU_max_batch_vertices(void) +{ + return GCaps.max_batch_vertices; +} + +int GPU_max_vertex_attribs(void) +{ + return GCaps.max_vertex_attribs; +} + +int GPU_max_varying_floats(void) +{ + return GCaps.max_varying_floats; +} + +int GPU_extensions_len(void) +{ + return GCaps.extensions_len; +} + +const char *GPU_extension_get(int i) +{ + return GCaps.extension_get ? GCaps.extension_get(i) : "\0"; +} + bool GPU_mip_render_workaround(void) { return GCaps.mip_render_workaround; diff --git a/source/blender/gpu/intern/gpu_capabilities_private.hh b/source/blender/gpu/intern/gpu_capabilities_private.hh index 2b3292749f8..7c1d4590ce8 100644 --- a/source/blender/gpu/intern/gpu_capabilities_private.hh +++ b/source/blender/gpu/intern/gpu_capabilities_private.hh @@ -41,6 +41,15 @@ struct GPUCapabilities { int max_textures_vert = 0; int max_textures_geom = 0; int max_textures_frag = 0; + int max_uniforms_vert = 0; + int max_uniforms_frag = 0; + int max_batch_indices = 0; + int max_batch_vertices = 0; + int max_vertex_attribs = 0; + int max_varying_floats = 0; + int extensions_len = 0; + const char *(*extension_get)(int); + bool mem_stats_support = false; bool shader_image_load_store_support = false; /* OpenGL related workarounds. */ diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc index a04d4be0e52..89bad1c9a4b 100644 --- a/source/blender/gpu/opengl/gl_backend.cc +++ b/source/blender/gpu/opengl/gl_backend.cc @@ -142,9 +142,9 @@ void GLBackend::platform_init() GPG.support_level = GPU_SUPPORT_LEVEL_LIMITED; } } +GPG.create_key(GPG.support_level, vendor, renderer, version); +GPG.create_gpu_name(vendor, renderer, version); } - GPG.create_key(GPG.support_level, vendor, renderer, version); - GPG.create_gpu_name(vendor, renderer, version); } void GLBackend::platform_exit() @@ -204,6 +204,11 @@ static bool detect_mip_render_workaround() return enable_workaround; } +const char *gl_extension_get(int i) +{ + return (char *)glGetStringi(GL_EXTENSIONS, i); +} + static void detect_workarounds() { const char *vendor = (const char *)glGetString(GL_VENDOR); @@ -419,6 +424,16 @@ void GLBackend::capabilities_init() glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &GCaps.max_textures_vert); glGetIntegerv(GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, &GCaps.max_textures_geom); glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &GCaps.max_textures); + glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &GCaps.max_uniforms_vert); + glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &GCaps.max_uniforms_frag); + glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &G
[Bf-blender-cvs] [c3e13d5a2b8] blender-v2.93-release: GPencil: fix separate points/strokes freezing with empty selection
Commit: c3e13d5a2b8e9ada467850b4629dc4f228a2b2b8 Author: Philipp Oeser Date: Fri May 14 13:21:10 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rBc3e13d5a2b8e9ada467850b4629dc4f228a2b2b8 GPencil: fix separate points/strokes freezing with empty selection Code would still create an object (without setting up materials), code for removing unused material slots would then freeze. Now return/cancel early in case of empty selection. This came up in T88269 [which is still not fully fixed, transforming curve edit points clear their GP_STROKE_SELECT flag which now results in the early exit, should be looked at separately] Maniphest Tasks: T88269 Differential Revision: https://developer.blender.org/D11252 === M source/blender/editors/gpencil/gpencil_edit.c M source/blender/editors/gpencil/gpencil_utils.c M source/blender/editors/include/ED_gpencil.h === diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index d388e11dc8c..66d50e2fd12 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -4520,6 +4520,9 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op) eGP_SeparateModes mode = RNA_enum_get(op->ptr, "mode"); + const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_src); + const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd_src); + /* sanity checks */ if (ELEM(NULL, gpd_src)) { return OPERATOR_CANCELLED; @@ -4530,8 +4533,22 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_src); - const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd_src); + /* Cancel if nothing selected. */ + if (ELEM(mode, GP_SEPARATE_POINT, GP_SEPARATE_STROKE)) { +bool has_selected = false; +CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) { + if (ED_gpencil_layer_has_selected_stroke(gpl, is_multiedit)) { +has_selected = true; +break; + } +} +CTX_DATA_END; + +if (!has_selected) { + BKE_report(op->reports, RPT_ERROR, "Nothing selected"); + return OPERATOR_CANCELLED; +} + } /* Create a new object. */ /* Take into account user preferences for duplicating actions. */ diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 8d42024a518..9fba2ce5902 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -542,6 +542,38 @@ bool gpencil_stroke_inside_circle(const float mval[2], int rad, int x0, int y0, return false; } +/* */ +/* Selection Validity Testing */ + +bool ED_gpencil_frame_has_selected_stroke(const bGPDframe *gpf) +{ + LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { +if (gps->flag & GP_STROKE_SELECT) { + return true; +} + } + + return false; +} + +bool ED_gpencil_layer_has_selected_stroke(const bGPDlayer *gpl, const bool is_multiedit) +{ + bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe; + for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) { +if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) { + if (ED_gpencil_frame_has_selected_stroke(gpf)) { +return true; + } +} +/* If not multiedit, exit loop. */ +if (!is_multiedit) { + break; +} + } + + return false; +} + /* */ /* Stroke Validity Testing */ diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index e9ac21f60cf..d4ff374dc38 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -144,6 +144,8 @@ bool ED_gpencil_data_owner_is_annotation(struct PointerRNA *owner_ptr); bool ED_gpencil_has_keyframe_v3d(struct Scene *scene, struct Object *ob, int cfra); /* --- Stroke Editing Utilities */ +bool ED_gpencil_frame_has_selected_stroke(const struct bGPDframe *gpf); +bool ED_gpencil_layer_has_selected_stroke(const struct bGPDlayer *gpl, const bool is_multiedit); bool ED_gpencil_stroke_can_use_direct(const struct ScrArea *area, const struct bGPDstroke *gps); bool ED_gpencil_stroke_can_use(const struct bContext *C, const struct bGPDstroke *gps); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [079f415debd] master: Cleanup: use enum types for screen direction variables
Commit: 079f415debd85b44f9ceaca17edfb82517240448 Author: Campbell Barton Date: Thu May 13 15:43:53 2021 +1000 Branches: master https://developer.blender.org/rB079f415debd85b44f9ceaca17edfb82517240448 Cleanup: use enum types for screen direction variables The term direction was used in 3 different ways in screen editing code, making it hard to follow: - 0-3 for as magic numbers mapped to [west,north,east,south]. - `h`, `v` characters for [horizontal,vertical] axes. - Cycle direction SPACE_CONTEXT_CYCLE_PREV, SPACE_CONTEXT_CYCLE_NEXT The following changes have been made: - Add `eScreenDir` for [west,north,east,south], use variable name `dir`. - Add `eScreenAxis` for [horizontal,vertical] values, use variable name `dir_axis`. - Add `eScreenCycle` for existing enum `SPACE_CONTEXT_CYCLE_{PREV/NEXT}`. - Add macros `SCREEN_DIR_IS_VERTICAL(dir)`, `SCREEN_DIR_IS_HORIZONTAL(dir)`. Replacing `ELEM(dir, 1, 3)`, `ELEM(dir, 0, 2)`. - Move `ED_screen_draw_join_highlight`, `ED_screen_draw_split_preview` to `screen_intern.h`. Reviewed By: Severin Ref D11245 === M source/blender/editors/include/ED_screen.h M source/blender/editors/screen/area.c M source/blender/editors/screen/screen_draw.c M source/blender/editors/screen/screen_edit.c M source/blender/editors/screen/screen_geometry.c M source/blender/editors/screen/screen_intern.h M source/blender/editors/screen/screen_ops.c === diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index c46f0f78eb5..bdd7ec571dc 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -200,8 +200,6 @@ ScrArea *ED_screen_areas_iter_next(const bScreen *screen, const ScrArea *area); /* screens */ void ED_screens_init(struct Main *bmain, struct wmWindowManager *wm); void ED_screen_draw_edges(struct wmWindow *win); -void ED_screen_draw_join_highlight(struct ScrArea *sa1, struct ScrArea *sa2); -void ED_screen_draw_split_preview(struct ScrArea *area, const int dir, const float fac); void ED_screen_refresh(struct wmWindowManager *wm, struct wmWindow *win); void ED_screen_ensure_updated(struct wmWindowManager *wm, struct wmWindow *win, @@ -450,10 +448,10 @@ enum { }; /* SCREEN_OT_space_context_cycle direction */ -enum { +typedef enum eScreenCycle { SPACE_CONTEXT_CYCLE_PREV, SPACE_CONTEXT_CYCLE_NEXT, -}; +} eScreenCycle; #ifdef __cplusplus } diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index bd2b1c4c553..b83eccdcfdd 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1172,12 +1172,12 @@ static void region_azones_add(const bScreen *screen, ScrArea *area, ARegion *reg } /* dir is direction to check, not the splitting edge direction! */ -static int rct_fits(const rcti *rect, char dir, int size) +static int rct_fits(const rcti *rect, const eScreenAxis dir_axis, int size) { - if (dir == 'h') { + if (dir_axis == SCREEN_AXIS_H) { return BLI_rcti_size_x(rect) + 1 - size; } - /* 'v' */ + /* Vertical. */ return BLI_rcti_size_y(rect) + 1 - size; } @@ -1398,7 +1398,8 @@ static void region_rect_recursive( region->flag |= RGN_FLAG_TOO_SMALL; } } - else if (rct_fits(remainder, 'v', 1) < 0 || rct_fits(remainder, 'h', 1) < 0) { + else if (rct_fits(remainder, SCREEN_AXIS_V, 1) < 0 || + rct_fits(remainder, SCREEN_AXIS_H, 1) < 0) { /* remainder is too small for any usage */ region->flag |= RGN_FLAG_TOO_SMALL; } @@ -1410,11 +1411,11 @@ static void region_rect_recursive( else if (ELEM(alignment, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) { rcti *winrct = (region->overlap) ? overlap_remainder : remainder; -if ((prefsizey == 0) || (rct_fits(winrct, 'v', prefsizey) < 0)) { +if ((prefsizey == 0) || (rct_fits(winrct, SCREEN_AXIS_V, prefsizey) < 0)) { region->flag |= RGN_FLAG_TOO_SMALL; } else { - int fac = rct_fits(winrct, 'v', prefsizey); + int fac = rct_fits(winrct, SCREEN_AXIS_V, prefsizey); if (fac < 0) { prefsizey += fac; @@ -1436,11 +1437,11 @@ static void region_rect_recursive( else if (ELEM(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) { rcti *winrct = (region->overlap) ? overlap_remainder : remainder; -if ((prefsizex == 0) || (rct_fits(winrct, 'h', prefsizex) < 0)) { +if ((prefsizex == 0) || (rct_fits(winrct, SCREEN_AXIS_H, prefsizex) < 0)) { region->flag |= RGN_FLAG_TOO_SMALL; } else { - int fac = rct_fits(winrct, 'h', prefsizex); + int fac = rct_fits(winrct, SCREEN_AXIS_H, prefsizex); if (fac < 0) { prefsizex += fac; @@ -1464,7 +1465,7 @@ static void region_rect_recursive( region->winrct = *remainder; i
[Bf-blender-cvs] [265d97556aa] master: PyAPI: use iterators for ID property methods (keys, values & items)
Commit: 265d97556aa0f0f2a0e4dd7584e3b8573bbddd54 Author: Campbell Barton Date: Tue May 11 09:40:41 2021 +1000 Branches: master https://developer.blender.org/rB265d97556aa0f0f2a0e4dd7584e3b8573bbddd54 PyAPI: use iterators for ID property methods (keys, values & items) - Matches changes in Python 3.x dictionary methods. - Iterating now raises a run-time error if the property-group changes size during iteration. - IDPropertyGroup.iteritems() has been removed. - IDPropertyGroup View & Iterator types have been added. - Some set functionality from dict_keys/values/items aren't yet supported (isdisjoint method and boolean set style operations). Proposed as part of T85675. === M release/scripts/modules/rna_prop_ui.py M source/blender/python/generic/idprop_py_api.c M source/blender/python/generic/idprop_py_api.h M source/blender/python/intern/bpy_rna.c M tests/python/bl_pyapi_idprop.py === diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py index e3158118146..54cde1e1c04 100644 --- a/release/scripts/modules/rna_prop_ui.py +++ b/release/scripts/modules/rna_prop_ui.py @@ -235,7 +235,7 @@ def draw(layout, context, context_member, property_type, use_edit=True): assert(isinstance(rna_item, property_type)) -items = rna_item.items() +items = list(rna_item.items()) items.sort() # TODO: Allow/support adding new custom props to overrides. diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index fc7054f675a..9b6ca7fcec5 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -42,6 +42,18 @@ extern bool pyrna_id_FromPyObject(PyObject *obj, ID **id); extern PyObject *pyrna_id_CreatePyObject(ID *id); extern bool pyrna_id_CheckPyObject(PyObject *obj); +/* Currently there is no need to expose this publicly. */ +static PyObject *BPy_IDGroup_IterKeys_CreatePyObject(BPy_IDProperty *group, const bool reversed); +static PyObject *BPy_IDGroup_IterValues_CreatePyObject(BPy_IDProperty *group, const bool reversed); +static PyObject *BPy_IDGroup_IterItems_CreatePyObject(BPy_IDProperty *group, const bool reversed); + +static PyObject *BPy_IDGroup_ViewKeys_CreatePyObject(BPy_IDProperty *group); +static PyObject *BPy_IDGroup_ViewValues_CreatePyObject(BPy_IDProperty *group); +static PyObject *BPy_IDGroup_ViewItems_CreatePyObject(BPy_IDProperty *group); + +static BPy_IDGroup_View *IDGroup_View_New_WithType(BPy_IDProperty *group, PyTypeObject *type); +static int BPy_IDGroup_Contains(BPy_IDProperty *self, PyObject *value); + /* */ /** \name Python from ID-Property (Internal Conversions) * @@ -756,13 +768,7 @@ static int BPy_IDGroup_Map_SetItem(BPy_IDProperty *self, PyObject *key, PyObject static PyObject *BPy_IDGroup_iter(BPy_IDProperty *self) { - BPy_IDGroup_Iter *iter = PyObject_GC_New(BPy_IDGroup_Iter, &BPy_IDGroup_Iter_Type); - iter->group = self; - Py_INCREF(self); - iter->mode = IDPROP_ITER_KEYS; - iter->cur = self->prop->data.group.first; - PyObject_GC_Track(iter); - return (PyObject *)iter; + return BPy_IDGroup_ViewKeys_CreatePyObject(self); } /* for simple, non nested types this is the same as BPy_IDGroup_WrapData */ @@ -874,6 +880,370 @@ PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop) /** \} */ +/* */ +/** \name ID-Property Group Iterator Type + * \{ */ + +static PyObject *BPy_IDGroup_Iter_repr(BPy_IDGroup_Iter *self) +{ + if (self->group == NULL) { +return PyUnicode_FromFormat("<%s>", Py_TYPE(self)->tp_name); + } + return PyUnicode_FromFormat("<%s \"%s\">", Py_TYPE(self)->tp_name, self->group->prop->name); +} + +static void BPy_IDGroup_Iter_dealloc(BPy_IDGroup_Iter *self) +{ + if (self->group != NULL) { +PyObject_GC_UnTrack(self); + } + Py_CLEAR(self->group); + PyObject_GC_Del(self); +} + +static int BPy_IDGroup_Iter_traverse(BPy_IDGroup_Iter *self, visitproc visit, void *arg) +{ + Py_VISIT(self->group); + return 0; +} + +static int BPy_IDGroup_Iter_clear(BPy_IDGroup_Iter *self) +{ + Py_CLEAR(self->group); + return 0; +} + +static bool BPy_Group_Iter_same_size_or_raise_error(BPy_IDGroup_Iter *self) +{ + if (self->len_init == self->group->prop->len) { +return true; + } + PyErr_SetString(PyExc_RuntimeError, "IDPropertyGroup changed size during iteration"); + return false; +} + +static PyObject *BPy_Group_IterKeys_next(BPy_IDGroup_Iter *self) +{ + if (self->cur != NULL) { +/* When `cur` is set, `group` cannot be NULL. */ +if (!BPy_Group_Iter_same_size_or_raise_error(self)) { + return NULL; +} +IDProperty *cur = self->cur; +self->cur = self->reversed ? self
[Bf-blender-cvs] [d19d79c5a64] blender-v2.93-release: LineArt: Custom UI for adding GP object.
Commit: d19d79c5a644914564902c685f32e94e1b6449bb Author: YimingWu Date: Fri May 14 22:40:47 2021 +0800 Branches: blender-v2.93-release https://developer.blender.org/rBd19d79c5a644914564902c685f32e94e1b6449bb LineArt: Custom UI for adding GP object. This allows extra options (in-front and stroke order) to be shown when adding line art kind of grease pencil object. Reviewed by: Antonio Vazquez (antoniov) Diff: https://developer.blender.org/D11130 === M source/blender/editors/object/object_add.c === diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index fbb68542645..4c28b24b8d9 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1310,6 +1310,8 @@ static int object_gpencil_add_exec(bContext *C, wmOperator *op) bGPdata *gpd = (ob && (ob->type == OB_GPENCIL)) ? ob->data : NULL; const int type = RNA_enum_get(op->ptr, "type"); + const bool use_in_front = RNA_boolean_get(op->ptr, "use_in_front"); + const int stroke_depth_order = RNA_enum_get(op->ptr, "stroke_depth_order"); ushort local_view_bits; float loc[3], rot[3]; @@ -1421,7 +1423,16 @@ static int object_gpencil_add_exec(bContext *C, wmOperator *op) } /* Stroke object is drawn in front of meshes by default. */ - ob->dtx |= OB_DRAW_IN_FRONT; + if (use_in_front) { +ob->dtx |= OB_DRAW_IN_FRONT; + } + else { +if (stroke_depth_order == GP_DRAWMODE_3D) { + gpd->draw_mode = GP_DRAWMODE_3D; +} + } + + break; } case GP_EMPTY: /* do nothing */ @@ -1443,6 +1454,38 @@ static int object_gpencil_add_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } +static void object_add_ui(bContext *UNUSED(C), wmOperator *op) +{ + uiLayout *layout = op->layout; + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, op->ptr, "radius", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "align", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "location", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "rotation", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "type", 0, NULL, ICON_NONE); + + int type = RNA_enum_get(op->ptr, "type"); + if (type == GP_LRT_COLLECTION || type == GP_LRT_OBJECT || type == GP_LRT_SCENE) { +uiItemR(layout, op->ptr, "use_in_front", 0, NULL, ICON_NONE); +bool in_front = RNA_boolean_get(op->ptr, "use_in_front"); +uiLayout *row = uiLayoutRow(layout, false); +uiLayoutSetActive(row, !in_front); +uiItemR(row, op->ptr, "stroke_depth_order", 0, NULL, ICON_NONE); + } +} + +static EnumPropertyItem rna_enum_gpencil_add_stroke_depth_order_items[] = { +{GP_DRAWMODE_2D, + "2D", + 0, + "2D Layers", + "Display strokes using grease pencil layers to define order"}, +{GP_DRAWMODE_3D, "3D", 0, "3D Location", "Display strokes using real 3D position in 3D space"}, +{0, NULL, 0, NULL, NULL}, +}; + void OBJECT_OT_gpencil_add(wmOperatorType *ot) { /* identifiers */ @@ -1458,11 +1501,26 @@ void OBJECT_OT_gpencil_add(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + /* ui */ + ot->ui = object_add_ui; + /* properties */ ED_object_add_unit_props_radius(ot); ED_object_add_generic_props(ot, false); ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_object_gpencil_type_items, 0, "Type", ""); + RNA_def_boolean(ot->srna, + "use_in_front", + false, + "In Front", + "Show line art grease pencil in front of everything"); + RNA_def_enum( + ot->srna, + "stroke_depth_order", + rna_enum_gpencil_add_stroke_depth_order_items, + GP_DRAWMODE_3D, + "Stroke Depth Order", + "Defines how the strokes are ordered in 3D space for objects not displayed 'In Front'"); } /** \} */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [65f95508137] master: Nodes: fix connecting wrong sockets when inserting node
Commit: 65f955081370e77a61d822da1fa78960c8a0149e Author: Jacques Lucke Date: Fri May 14 16:01:55 2021 +0200 Branches: master https://developer.blender.org/rB65f955081370e77a61d822da1fa78960c8a0149e Nodes: fix connecting wrong sockets when inserting node Differential Revision: https://developer.blender.org/D11231 === M source/blender/editors/space_node/node_relationships.c === diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index 3b812ee1580..28c660b0632 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -1876,28 +1876,63 @@ void ED_node_link_intersect_test(ScrArea *area, int test) } } -/* assumes sockets in list */ -static bNodeSocket *socket_best_match(ListBase *sockets) -{ - /* find type range */ - int maxtype = 0; +static int get_main_socket_priority(const bNodeSocket *socket) +{ + switch ((eNodeSocketDatatype)socket->type) { +case __SOCK_MESH: +case SOCK_CUSTOM: + return -1; +case SOCK_BOOLEAN: + return 0; +case SOCK_INT: + return 1; +case SOCK_FLOAT: + return 2; +case SOCK_VECTOR: + return 3; +case SOCK_RGBA: + return 4; +case SOCK_STRING: +case SOCK_SHADER: +case SOCK_OBJECT: +case SOCK_IMAGE: +case SOCK_GEOMETRY: +case SOCK_COLLECTION: +case SOCK_TEXTURE: +case SOCK_MATERIAL: + return 5; + } + return -1; +} + +/** Get the "main" socket of a socket list using a heuristic based on socket types. */ +static bNodeSocket *get_main_socket(ListBase *sockets) +{ + /* find priority range */ + int maxpriority = -1; LISTBASE_FOREACH (bNodeSocket *, sock, sockets) { -maxtype = max_ii(sock->type, maxtype); +if (sock->flag & SOCK_UNAVAIL) { + continue; +} +maxpriority = max_ii(get_main_socket_priority(sock), maxpriority); } - /* try all types, starting from 'highest' (i.e. colors, vectors, values) */ - for (int type = maxtype; type >= 0; type--) { + /* try all priorities, starting from 'highest' */ + for (int priority = maxpriority; priority >= 0; priority--) { LISTBASE_FOREACH (bNodeSocket *, sock, sockets) { - if (!nodeSocketIsHidden(sock) && type == sock->type) { + if (!nodeSocketIsHidden(sock) && priority == get_main_socket_priority(sock)) { return sock; } } } - /* no visible sockets, unhide first of highest type */ - for (int type = maxtype; type >= 0; type--) { + /* no visible sockets, unhide first of highest priority */ + for (int priority = maxpriority; priority >= 0; priority--) { LISTBASE_FOREACH (bNodeSocket *, sock, sockets) { - if (type == sock->type) { + if (sock->flag & SOCK_UNAVAIL) { +continue; + } + if (priority == get_main_socket_priority(sock)) { sock->flag &= ~SOCK_HIDDEN; return sock; } @@ -2242,8 +2277,8 @@ void ED_node_link_insert(Main *bmain, ScrArea *area) } if (link) { -bNodeSocket *best_input = socket_best_match(&select->inputs); -bNodeSocket *best_output = socket_best_match(&select->outputs); +bNodeSocket *best_input = get_main_socket(&select->inputs); +bNodeSocket *best_output = get_main_socket(&select->outputs); if (best_input && best_output) { bNode *node = link->tonode; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a4f0780acfd] master: Merge branch 'blender-v2.93-release'
Commit: a4f0780acfde7545be85b81d20d3e2d7ff8cebe4 Author: Jacques Lucke Date: Fri May 14 13:45:48 2021 +0200 Branches: master https://developer.blender.org/rBa4f0780acfde7545be85b81d20d3e2d7ff8cebe4 Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [16bcf7dc8e7] blender-v2.93-release: Fix T87417: crash when evaluating geo nodes without window manager
Commit: 16bcf7dc8e70890b8ad75c84f8699a4507477668 Author: Pratik Borhade Date: Fri May 14 13:43:30 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rB16bcf7dc8e70890b8ad75c84f8699a4507477668 Fix T87417: crash when evaluating geo nodes without window manager Differential Revision: https://developer.blender.org/D11240 === M source/blender/modifiers/intern/MOD_nodes.cc === diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index 607b05d39b0..d808052e5f5 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -1074,8 +1074,11 @@ static void reset_tree_ui_storage(Span tree static Vector find_spreadsheet_editors(Main *bmain) { - Vector spreadsheets; wmWindowManager *wm = (wmWindowManager *)bmain->wm.first; + if (wm == nullptr) { +return {}; + } + Vector spreadsheets; LISTBASE_FOREACH (wmWindow *, window, &wm->windows) { bScreen *screen = BKE_workspace_active_screen_get(window->workspace_hook); LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5860d4e2403] temp-lineart-contained: LineArt: Use array instead of array for ba->linked_edge
Commit: 5860d4e240396a3a16d9b2b7f940214a8444c48a Author: YimingWu Date: Fri May 14 19:15:48 2021 +0800 Branches: temp-lineart-contained https://developer.blender.org/rB5860d4e240396a3a16d9b2b7f940214a8444c48a LineArt: Use array instead of array for ba->linked_edge === M source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h M source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c M source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c === diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h index d3e3aa5ce92..7e980669a33 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h +++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h @@ -216,6 +216,7 @@ enum eLineArtTileRecursiveLimit { }; #define LRT_TILE_SPLITTING_TRIANGLE_LIMIT 100 +#define LRT_TILE_EDGE_COUNT_INITIAL 32 typedef struct LineartRenderBuffer { struct LineartRenderBuffer *prev, *next; @@ -470,11 +471,12 @@ typedef struct LineartBoundingArea { short triangle_count; short max_triangle_count; + short line_count; + short max_line_count; /* Use array for speeding up multiple accesses. */ struct LineartTriangle **linked_triangles; - - ListBase linked_lines; + struct LineartEdge **linked_lines; /** Reserved for image space reduction && multi-thread chaining. */ ListBase linked_chains; diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c index 53fb0b7333d..9b1f6becde5 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c @@ -41,8 +41,8 @@ static LineartEdge *lineart_line_get_connected(LineartBoundingArea *ba, int match_flag, unsigned char match_isec_mask) { - LISTBASE_FOREACH (LinkData *, lip, &ba->linked_lines) { -LineartEdge *n_e = lip->data; + for (int i = 0; i < ba->line_count; i++) { +LineartEdge *n_e = ba->linked_lines[i]; if ((!(n_e->flags & LRT_EDGE_FLAG_ALL_TYPE)) || (n_e->flags & LRT_EDGE_FLAG_CHAIN_PICKED)) { continue; diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c index 3abf5b0bb20..ed951ca43b8 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c @@ -335,6 +335,21 @@ static void lineart_bounding_area_triangle_add(LineartRenderBuffer *rb, ba->triangle_count++; } +static void lineart_bounding_area_line_add(LineartRenderBuffer *rb, + LineartBoundingArea *ba, + LineartEdge *rl) +{ + if (ba->line_count >= ba->max_line_count) { +LineartEdge **new_array = lineart_mem_aquire(&rb->render_data_pool, + sizeof(LineartEdge *) * ba->max_line_count * 2); +memcpy(new_array, ba->linked_lines, sizeof(LineartEdge *) * ba->max_line_count); +ba->max_line_count *= 2; +ba->linked_lines = new_array; + } + ba->linked_lines[ba->line_count] = rl; + ba->line_count++; +} + static void lineart_occlusion_single_line(LineartRenderBuffer *rb, LineartEdge *e, int thread_id) { double x = e->v1->fbcoord[0], y = e->v1->fbcoord[1]; @@ -3094,8 +3109,11 @@ static void lineart_main_bounding_area_make_initial(LineartRenderBuffer *rb) /* Init linked_triangles array. */ ba->max_triangle_count = LRT_TILE_SPLITTING_TRIANGLE_LIMIT; + ba->max_line_count = LRT_TILE_EDGE_COUNT_INITIAL; ba->linked_triangles = lineart_mem_aquire( - &rb->render_data_pool, sizeof(LineartTriangle *) * LRT_TILE_SPLITTING_TRIANGLE_LIMIT); + &rb->render_data_pool, sizeof(LineartTriangle *) * ba->max_triangle_count); + ba->linked_lines = lineart_mem_aquire(&rb->render_data_pool, +sizeof(LineartEdge *) * ba->max_line_count); /* Link adjacent ones. */ if (row) { @@ -3314,8 +3332,11 @@ static void lineart_bounding_area_split(LineartRenderBuffer *rb, /* Init linked_triangles array. */ for (int i = 0; i < 4; i++) { ba[i].max_triangle_count = LRT_TILE_SPLITTING_TRIANGLE_LIMIT; +ba[i].max_line_count = LRT_TILE_EDGE_COUNT_INITIAL; ba[i].linked_triangles = lineart_mem_aquire( &rb->render_data_pool, sizeof(LineartTriangle *) * LRT_TILE_SPLITTING_TRIANGLE_LIMIT); +ba[i].linked_lines = lineart_mem_aquire(&rb->render_data_pool, +sizeof(LineartEdge *) * LRT_TILE_EDG
[Bf-blender-cvs] [bd5bab961ed] master: Merge branch 'blender-v2.93-release'
Commit: bd5bab961edefdb69558a9771054beac676aeede Author: Campbell Barton Date: Fri May 14 19:27:30 2021 +1000 Branches: master https://developer.blender.org/rBbd5bab961edefdb69558a9771054beac676aeede Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3c09beb3b1f] blender-v2.93-release: Fix memory leak in IDPropertyGroup.pop()
Commit: 3c09beb3b1f785c920eed3d61f7c2a2a06deba50 Author: Campbell Barton Date: Fri May 14 19:18:50 2021 +1000 Branches: blender-v2.93-release https://developer.blender.org/rB3c09beb3b1f785c920eed3d61f7c2a2a06deba50 Fix memory leak in IDPropertyGroup.pop() When popping ID-property groups/arrays, ID-property was removed but not freed. Now the value is converted to a native Python type and freed. === M source/blender/python/generic/idprop_py_api.c M source/blender/python/generic/idprop_py_api.h M source/blender/python/intern/bpy_rna.c M tests/python/bl_pyapi_idprop.py === diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index 75fd63e16f9..fc7054f675a 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -766,7 +766,7 @@ static PyObject *BPy_IDGroup_iter(BPy_IDProperty *self) } /* for simple, non nested types this is the same as BPy_IDGroup_WrapData */ -static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop) +PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop) { switch (prop->type) { case IDP_STRING: @@ -919,7 +919,7 @@ static PyObject *BPy_IDGroup_pop(BPy_IDProperty *self, PyObject *args) return NULL; } - IDP_RemoveFromGroup(self->prop, idprop); + IDP_FreeFromGroup(self->prop, idprop); return pyform; } diff --git a/source/blender/python/generic/idprop_py_api.h b/source/blender/python/generic/idprop_py_api.h index 991ae7be9c9..4cccea3a936 100644 --- a/source/blender/python/generic/idprop_py_api.h +++ b/source/blender/python/generic/idprop_py_api.h @@ -60,6 +60,7 @@ PyObject *BPy_Wrap_GetValues(struct ID *id, struct IDProperty *prop); PyObject *BPy_Wrap_GetItems(struct ID *id, struct IDProperty *prop); int BPy_Wrap_SetMapItem(struct IDProperty *prop, PyObject *key, PyObject *val); +PyObject *BPy_IDGroup_MapDataToPy(struct IDProperty *prop); PyObject *BPy_IDGroup_WrapData(struct ID *id, struct IDProperty *prop, struct IDProperty *parent); bool BPy_IDProperty_Map_ValidateAndCreate(PyObject *key, struct IDProperty *group, PyObject *ob); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 354aa9b6986..1711637458a 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -5006,8 +5006,13 @@ static PyObject *pyrna_struct_pop(BPy_StructRNA *self, PyObject *args) idprop = IDP_GetPropertyFromGroup(group, key); if (idprop) { - PyObject *ret = BPy_IDGroup_WrapData(self->ptr.owner_id, idprop, group); - IDP_RemoveFromGroup(group, idprop); + /* Don't use #BPy_IDGroup_WrapData as the id-property is being removed from the ID. */ + PyObject *ret = BPy_IDGroup_MapDataToPy(idprop); + /* Internal error. */ + if (UNLIKELY(ret == NULL)) { +return NULL; + } + IDP_FreeFromGroup(group, idprop); return ret; } } diff --git a/tests/python/bl_pyapi_idprop.py b/tests/python/bl_pyapi_idprop.py index 3d0cbd2a7bb..7b480f5fa16 100644 --- a/tests/python/bl_pyapi_idprop.py +++ b/tests/python/bl_pyapi_idprop.py @@ -15,12 +15,12 @@ class TestHelper: def setUp(self): self._id = bpy.context.scene -assert(len(self._id.keys()) == 0 or self._id.keys() == ["cycles"]) +self._id.pop("cycles", None) +assert(len(self._id.keys()) == 0) def tearDown(self): for key in list(self._id.keys()): -if key != "cycles": -del self._id[key] +del self._id[key] def assertAlmostEqualSeq(self, list1, list2): self.assertEqual(len(list1), len(list2)) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2871fadcad3] master: Geometry Nodes: use texture socket in Attribute Sample Texture node
Commit: 2871fadcad30fd9c5103022b782d986772301533 Author: Jacques Lucke Date: Fri May 14 11:22:02 2021 +0200 Branches: master https://developer.blender.org/rB2871fadcad30fd9c5103022b782d986772301533 Geometry Nodes: use texture socket in Attribute Sample Texture node There is a new Texture data-block socket that we can use in Geometry Nodes now. This commit replaces the texture property of a node and gives it a texture input socket instead. That increases flexibility. The texture socket still has some limitations that will be lifted in the next couple of days (e.g. it's not supported by the switch node and cannot be exposed the a modifier yet). Differential Revision: https://developer.blender.org/D11222 === M source/blender/blenloader/intern/versioning_300.c M source/blender/editors/space_buttons/buttons_intern.h M source/blender/editors/space_buttons/buttons_texture.c M source/blender/makesrna/intern/rna_nodetree.c M source/blender/nodes/NOD_static_types.h M source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc === diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index ae2371402e4..8c5e86eadd3 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -31,6 +31,7 @@ #include "BKE_lib_id.h" #include "BKE_main.h" +#include "BKE_node.h" #include "BLO_readfile.h" #include "readfile.h" @@ -57,6 +58,30 @@ void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports)) */ { /* Keep this block, even when empty. */ + +/* Use new texture socket in Attribute Sample Texture node. */ +LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) { + if (ntree->type != NTREE_GEOMETRY) { +continue; + } + LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { +if (node->type != GEO_NODE_ATTRIBUTE_SAMPLE_TEXTURE) { + continue; +} +if (node->id == NULL) { + continue; +} +LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) { + if (socket->type == SOCK_TEXTURE) { +bNodeSocketValueTexture *socket_value = (bNodeSocketValueTexture *) +socket->default_value; +socket_value->value = (Tex *)node->id; +break; + } +} +node->id = NULL; + } +} } } diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h index 74e7bc11c26..7564fa4b930 100644 --- a/source/blender/editors/space_buttons/buttons_intern.h +++ b/source/blender/editors/space_buttons/buttons_intern.h @@ -35,6 +35,7 @@ struct bContext; struct bContextDataResult; struct bNode; struct bNodeTree; +struct bNodeSocket; struct wmOperatorType; struct SpaceProperties_Runtime { @@ -66,6 +67,7 @@ typedef struct ButsTextureUser { struct bNodeTree *ntree; struct bNode *node; + struct bNodeSocket *socket; const char *category; int icon; diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index 43128ed00fa..97e3cb750c1 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -75,15 +75,16 @@ static SpaceProperties *find_space_properties(const bContext *C); /* Texture User **/ -static void buttons_texture_user_node_property_add(ListBase *users, - ID *id, - PointerRNA ptr, - PropertyRNA *prop, - bNodeTree *ntree, - bNode *node, - const char *category, - int icon, - const char *name) +static void buttons_texture_user_socket_property_add(ListBase *users, + ID *id, + PointerRNA ptr, + PropertyRNA *prop, + bNodeTree *ntree, + bNode *node, + bNodeSocket *socket, + const char *category, + int icon, +
[Bf-blender-cvs] [26b4ef6823b] master: Geometry Nodes: remove some unnecessary updates
Commit: 26b4ef6823b6c943ccfe7ca13598f9f2a0570c0d Author: Jacques Lucke Date: Fri May 14 10:58:08 2021 +0200 Branches: master https://developer.blender.org/rB26b4ef6823b6c943ccfe7ca13598f9f2a0570c0d Geometry Nodes: remove some unnecessary updates This fixes a few "obvious" places where we do unnecessary updates. Those special cases were added in the early days of geometry nodes when many updates were missing and we tried to get it to work at all. There is a fairly high risk that with this change some required updates will be missing again. Those can be fixed when we find thme. Some of the update issues might have been fixed by rB58818cba40794905f9323080e60884e090f2d388 and similar changes we added over time. Differential Revision: https://developer.blender.org/D11238 === M source/blender/blenkernel/intern/node.cc M source/blender/editors/space_node/node_edit.c M source/blender/editors/space_node/node_relationships.c === diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 96a06f6e2de..a0e444186f2 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -4327,7 +4327,7 @@ void ntreeUpdateAllUsers(Main *main, ID *id) if (GS(id->name) == ID_NT) { bNodeTree *ngroup = (bNodeTree *)id; -if (ngroup->type == NTREE_GEOMETRY) { +if (ngroup->type == NTREE_GEOMETRY && (ngroup->update & NTREE_UPDATE_GROUP)) { LISTBASE_FOREACH (Object *, object, &main->objects) { LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) { if (md->type == eModifierType_Nodes) { diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index d4780534a83..50fa8b28468 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1713,8 +1713,6 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op)) } } - do_tag_update |= ED_node_is_geometry(snode); - snode_notify(C, snode); if (do_tag_update) { snode_dag_update(C, snode); @@ -1755,8 +1753,6 @@ static int node_delete_exec(bContext *C, wmOperator *UNUSED(op)) } } - do_tag_update |= ED_node_is_geometry(snode); - ntreeUpdateTree(CTX_data_main(C), snode->edittree); snode_notify(C, snode); diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index 91fe8f5ec89..3b812ee1580 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -852,8 +852,6 @@ static void node_link_exit(bContext *C, wmOperator *op, bool apply_links) } ntree->is_updating = false; - do_tag_update |= ED_node_is_geometry(snode); - ntreeUpdateTree(bmain, ntree); snode_notify(C, snode); if (do_tag_update) { @@ -1291,8 +1289,6 @@ static int cut_links_exec(bContext *C, wmOperator *op) } } -do_tag_update |= ED_node_is_geometry(snode); - if (found) { ntreeUpdateTree(CTX_data_main(C), snode->edittree); snode_notify(C, snode); @@ -1399,8 +1395,6 @@ static int mute_links_exec(bContext *C, wmOperator *op) link->flag &= ~NODE_LINK_TEST; } -do_tag_update |= ED_node_is_geometry(snode); - ntreeUpdateTree(CTX_data_main(C), snode->edittree); snode_notify(C, snode); if (do_tag_update) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9797b95f617] master: Animation: Pose sliding tools improvements
Commit: 9797b95f617561dc87b702e1bce829a551260689 Author: Christoph Lendenfeld Date: Fri May 14 10:46:19 2021 +0200 Branches: master https://developer.blender.org/rB9797b95f617561dc87b702e1bce829a551260689 Animation: Pose sliding tools improvements Improve the "In Betweens" tools: - Push Pose from Rest Pose - Relax Pose to Rest Pose - Push Pose from Breakdown - Relax Pose to Breakdown - Pose Breakdowner These all now use the same new sliding tool: - Actual visual indication of the blending/pushing percentage applied. - Mouse wrapping to allow for extrapolation without having to worry about the initial placement of the mouse. This also means these tools are actually usable when chosen from the menu. - Precision mode by holding {key Shift}. - Snapping to 10% increments by holding {key Ctrl}. - Overshoot protection; by default the tool doesn't allow overshoot (lower than 0% or higher than 100%), and it can be enabled by pressing {key E}. - Bones are hidden while sliding, so the pose itself can be seen more clearly. This can be toggled by pressing {key H} while using the tool. Reviewed By: #animation_rigging, zeddb, sybren, #user_interface, brecht, Severin, looch Maniphest Tasks: T81836 Differential Revision: https://developer.blender.org/D9054 === M source/blender/editors/armature/CMakeLists.txt M source/blender/editors/armature/pose_slide.c === diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt index 98c050950be..7266b1b88d7 100644 --- a/source/blender/editors/armature/CMakeLists.txt +++ b/source/blender/editors/armature/CMakeLists.txt @@ -19,6 +19,7 @@ set(INC ../include ../../blenkernel ../../blenlib + ../../blenfont ../../blentranslation ../../depsgraph ../../gpu diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c index 93d36abe792..edac5dc61c9 100644 --- a/source/blender/editors/armature/pose_slide.c +++ b/source/blender/editors/armature/pose_slide.c @@ -33,6 +33,7 @@ #include "DNA_armature_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_vec_types.h" #include "BKE_fcurve.h" #include "BKE_nla.h" @@ -50,15 +51,28 @@ #include "WM_types.h" #include "UI_interface.h" +#include "UI_resources.h" #include "ED_armature.h" #include "ED_keyframes_draw.h" #include "ED_markers.h" #include "ED_numinput.h" #include "ED_screen.h" +#include "ED_space_api.h" + +#include "GPU_immediate.h" +#include "GPU_immediate_util.h" +#include "GPU_matrix.h" +#include "GPU_state.h" #include "armature_intern.h" +#include "BLF_api.h" + +/* Pixel distance from 0% to 100%. */ +#define SLIDE_PIXEL_DISTANCE (300 * U.pixelsize) +#define OVERSHOOT_RANGE_DELTA 0.2f + /* */ /* == POSE 'SLIDING' TOOLS == * @@ -110,15 +124,36 @@ typedef struct tPoseSlideOp { /** unused for now, but can later get used for storing runtime settings */ short flag; + /* Store overlay settings when invoking the operator. Bones will be temporarily hidden. */ + int overlay_flag; + /** which transforms/channels are affected (ePoseSlide_Channels) */ short channels; /** axis-limits for transforms (ePoseSlide_AxisLock) */ short axislock; - /** 0-1 value for determining the influence of whatever is relevant */ + /* Allow overshoot or clamp between 0% and 100%. */ + bool overshoot; + + /* Reduces percentage delta from mouse movement. */ + bool precision; + + /* Move percentage in 10% steps. */ + bool increments; + + /* Draw callback handler. */ + void *draw_handle; + + /* Accumulative, unclamped and unrounded percentage. */ + float raw_percentage; + + /* 0-1 value for determining the influence of whatever is relevant. */ float percentage; - /** numeric input */ + /* Last cursor position in screen space used for mouse movement delta calculation. */ + int last_cursor_x; + + /* Numeric input. */ NumInput num; struct tPoseSlideObject *ob_data_array; @@ -187,6 +222,240 @@ static const EnumPropertyItem prop_axis_lock_types[] = { /* */ +static void draw_overshoot_triangle(const uint8_t color[4], +const bool facing_right, +const float x, +const float y) +{ + const uint shdr_pos_2d = GPU_vertformat_attr_add( + immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + GPU_blend(GPU_BLEND_ALPHA); + GPU_polygon_smooth(true); + immUniformColor3ubvAlpha(color, 225); + const float triangle_side_length = facing_right ? 6 * U.pixelsize : -6 * U.pixelsize; + const float triangle_offset = facing_right ? 2 * U.pixelsize
[Bf-blender-cvs] [d956936e761] cycles-x: Merge branch 'master' into cycles-x
Commit: d956936e761d29f21b785d8524360b31d2494b75 Author: Sergey Sharybin Date: Fri May 14 10:17:47 2021 +0200 Branches: cycles-x https://developer.blender.org/rBd956936e761d29f21b785d8524360b31d2494b75 Merge branch 'master' into cycles-x === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5d5e4079cf4] cycles-x: Fix OIDN denoiser in Cycles X after recent refactor
Commit: 5d5e4079cf44dc78b7400f5594daa6a8ad9c544b Author: Sergey Sharybin Date: Fri May 14 09:43:57 2021 +0200 Branches: cycles-x https://developer.blender.org/rB5d5e4079cf44dc78b7400f5594daa6a8ad9c544b Fix OIDN denoiser in Cycles X after recent refactor === M intern/cycles/integrator/denoiser_oidn.cpp === diff --git a/intern/cycles/integrator/denoiser_oidn.cpp b/intern/cycles/integrator/denoiser_oidn.cpp index b494edd86b4..8adebaedadf 100644 --- a/intern/cycles/integrator/denoiser_oidn.cpp +++ b/intern/cycles/integrator/denoiser_oidn.cpp @@ -183,7 +183,7 @@ static void oidn_scale_combined_pass_after_denoise(const BufferParams &buffer_pa float *buffer_row = buffer_data + buffer_offset + y * row_stride; for (int x = 0; x < width; ++x) { float *buffer_pixel = buffer_row + x * pixel_stride; - const float pixel_scale = buffer_pixel[pass_sample_count]; + const float pixel_scale = __float_as_uint(buffer_pixel[pass_sample_count]); buffer_pixel[0] = buffer_pixel[0] * pixel_scale; buffer_pixel[1] = buffer_pixel[1] * pixel_scale; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c1c0b661c01] master: Cleanup: clang-format
Commit: c1c0b661c0147faf565f6fde080c356504710a70 Author: Campbell Barton Date: Fri May 14 17:35:08 2021 +1000 Branches: master https://developer.blender.org/rBc1c0b661c0147faf565f6fde080c356504710a70 Cleanup: clang-format === M intern/cycles/render/geometry.cpp M intern/cycles/render/geometry.h M intern/cycles/render/hair.cpp M intern/cycles/render/hair.h M intern/cycles/render/mesh.h M source/blender/compositor/intern/COM_ChunkOrderHotspot.cc M source/blender/editors/sculpt_paint/paint_cursor.c M source/blender/functions/FN_generic_virtual_array.hh M tests/python/bl_blendfile_library_overrides.py M tests/python/compositor_render_tests.py M tests/python/operators.py === diff --git a/intern/cycles/render/geometry.cpp b/intern/cycles/render/geometry.cpp index 5d8fc236e99..16fc36231b4 100644 --- a/intern/cycles/render/geometry.cpp +++ b/intern/cycles/render/geometry.cpp @@ -46,7 +46,7 @@ CCL_NAMESPACE_BEGIN /* Geometry */ -PackFlags operator |=(PackFlags &pack_flags, uint32_t value) +PackFlags operator|=(PackFlags &pack_flags, uint32_t value) { pack_flags = (PackFlags)((uint32_t)pack_flags | value); return pack_flags; @@ -1325,7 +1325,8 @@ void GeometryManager::device_update_bvh(Device *device, // Iterate over scene mesh list instead of objects, since 'optix_prim_offset' was calculated // based on that list, which may be ordered differently from the object list. foreach (Geometry *geom, scene->geometry) { - /* Make a copy of the pack_flags so the current geometry's flags do not pollute the others'. */ + /* Make a copy of the pack_flags so the current geometry's flags do not pollute the others'. + */ PackFlags geom_pack_flags = pack_flags; if (geom->is_modified()) { @@ -1951,7 +1952,8 @@ void GeometryManager::device_update(Device *device, * Also update the BVH if the transformations change, we cannot rely on tagging the Geometry * as modified in this case, as we may accumulate displacement if the vertices do not also * change. */ - bool need_update_scene_bvh = (scene->bvh == nullptr || (update_flags & (TRANSFORM_MODIFIED | VISIBILITY_MODIFIED)) != 0); + bool need_update_scene_bvh = (scene->bvh == nullptr || +(update_flags & (TRANSFORM_MODIFIED | VISIBILITY_MODIFIED)) != 0); { scoped_callback_timer timer([scene](double time) { if (scene->update_stats) { diff --git a/intern/cycles/render/geometry.h b/intern/cycles/render/geometry.h index 4fd867d9894..4d11d04e4c8 100644 --- a/intern/cycles/render/geometry.h +++ b/intern/cycles/render/geometry.h @@ -59,7 +59,7 @@ enum PackFlags : uint32_t { PACK_ALL = (PACK_GEOMETRY | PACK_VERTICES | PACK_VISIBILITY), }; -PackFlags operator |= (PackFlags &pack_flags, uint32_t value); +PackFlags operator|=(PackFlags &pack_flags, uint32_t value); /* Geometry * @@ -144,7 +144,10 @@ class Geometry : public Node { int n, int total); - virtual void pack_primitives(PackedBVH *pack, int object, uint visibility, PackFlags pack_flags) = 0; + virtual void pack_primitives(PackedBVH *pack, + int object, + uint visibility, + PackFlags pack_flags) = 0; /* Check whether the geometry should have own BVH built separately. Briefly, * own BVH is needed for geometry, if: diff --git a/intern/cycles/render/hair.cpp b/intern/cycles/render/hair.cpp index 1cae16d7f32..72fc612c0c0 100644 --- a/intern/cycles/render/hair.cpp +++ b/intern/cycles/render/hair.cpp @@ -522,7 +522,8 @@ void Hair::pack_primitives(PackedBVH *pack, int object, uint visibility, PackFla uint type = has_motion_blur() ? ((curve_shape == CURVE_RIBBON) ? PRIMITIVE_MOTION_CURVE_RIBBON : PRIMITIVE_MOTION_CURVE_THICK) : -((curve_shape == CURVE_RIBBON) ? PRIMITIVE_CURVE_RIBBON : PRIMITIVE_CURVE_THICK); +((curve_shape == CURVE_RIBBON) ? PRIMITIVE_CURVE_RIBBON : + PRIMITIVE_CURVE_THICK); size_t index = 0; for (size_t j = 0; j < num_curves(); ++j) { diff --git a/intern/cycles/render/hair.h b/intern/cycles/render/hair.h index 9c553624077..1a8f422e8c4 100644 --- a/intern/cycles/render/hair.h +++ b/intern/cycles/render/hair.h @@ -146,7 +146,10 @@ class Hair : public Geometry { /* BVH */ void pack_curves(Scene *scene, float4 *curve_key_co, float4 *curve_data, size_t curvekey_offset); - void pack_primitives(PackedBVH *pack, int object, uint visibility, PackFlags pack_flags) override; + void pack_primitives(PackedBVH *pack, + int object, +
[Bf-blender-cvs] [a1568431126] master: Cleanup: spelling, rename metas to meta-strips / meta-balls
Commit: a1568431126ec2bcc0a5c9035656c009a89c0cac Author: Campbell Barton Date: Fri May 14 17:35:22 2021 +1000 Branches: master https://developer.blender.org/rBa1568431126ec2bcc0a5c9035656c009a89c0cac Cleanup: spelling, rename metas to meta-strips / meta-balls === M intern/cycles/render/geometry.h M source/blender/blenkernel/intern/anim_data.c M source/blender/blenkernel/intern/anim_sys.c M source/blender/blenkernel/intern/mball_tessellate.c M source/blender/editors/object/object_relations.c M source/blender/editors/space_nla/nla_draw.c M source/blender/editors/space_sequencer/sequencer_edit.c M source/blender/editors/transform/transform_convert_sequencer.c M source/blender/editors/transform/transform_mode.c M source/blender/makesdna/DNA_sequence_types.h M source/blender/sequencer/intern/effects.c M source/blender/sequencer/intern/sequencer.c M source/blender/sequencer/intern/strip_edit.c M source/blender/sequencer/intern/strip_time.c === diff --git a/intern/cycles/render/geometry.h b/intern/cycles/render/geometry.h index 4d11d04e4c8..7db122f69cb 100644 --- a/intern/cycles/render/geometry.h +++ b/intern/cycles/render/geometry.h @@ -50,7 +50,7 @@ enum PackFlags : uint32_t { /* Pack the geometry information (e.g. triangle or curve keys indices). */ PACK_GEOMETRY = (1u << 0), - /* Pack the vertice, for Meshes and Volumes' bouding meshes. */ + /* Pack the vertices, for Meshes and Volumes' bounding meshes. */ PACK_VERTICES = (1u << 1), /* Pack the visibility flags for each triangle or curve. */ diff --git a/source/blender/blenkernel/intern/anim_data.c b/source/blender/blenkernel/intern/anim_data.c index 68de3e93a8e..44b760aefc8 100644 --- a/source/blender/blenkernel/intern/anim_data.c +++ b/source/blender/blenkernel/intern/anim_data.c @@ -947,7 +947,7 @@ static bool nlastrips_path_rename_fix(ID *owner_id, owner_id, prefix, oldName, newName, oldKey, newKey, &strip->act->curves, verify_paths); } /* Ignore own F-Curves, since those are local. */ -/* Check sub-strips (if metas) */ +/* Check sub-strips (if meta-strips). */ is_changed |= nlastrips_path_rename_fix( owner_id, prefix, oldName, newName, oldKey, newKey, &strip->strips, verify_paths); } @@ -1177,7 +1177,7 @@ static bool nlastrips_path_remove_fix(const char *prefix, ListBase *strips) any_removed |= fcurves_path_remove_fix(prefix, &strip->act->curves); } -/* check sub-strips (if metas) */ +/* Check sub-strips (if meta-strips). */ any_removed |= nlastrips_path_remove_fix(prefix, &strip->strips); } return any_removed; @@ -1245,7 +1245,7 @@ static void nlastrips_apply_all_curves_cb(ID *id, ListBase *strips, AllFCurvesCb fcurves_apply_cb(id, &strip->act->curves, wrapper->func, wrapper->user_data); } -/* check sub-strips (if metas) */ +/* Check sub-strips (if meta-strips). */ nlastrips_apply_all_curves_cb(id, &strip->strips, wrapper); } } diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 51a38d81966..e347306e0ae 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1794,7 +1794,7 @@ static void nlaevalchan_combine_quaternion(NlaEvalChannelSnapshot *lower_necs, } /** - * Based on blendmode and mixmode, blend lower necs with upper necs into blended necs. + * Based on blend-mode and mix-mode, blend lower necs with upper necs into blended necs. * * Each upper value's blend domain determines whether to blend or to copy directly * from lower. @@ -1879,7 +1879,7 @@ static void nlaevalchan_blend_value_get_inverted_upper_evalchan( } /** - * Based on mixmode, solve for the upper values such that when lower combined with upper then we + * Based on mix-mode, solve for the upper values such that when lower combined with upper then we * get blended values as a result. * * Only processes blended values in the remap domain. Successfully remapped upper values are placed @@ -2407,12 +2407,12 @@ static void nla_eval_domain_strips(PointerRNA *ptr, GSet *touched_actions) { LISTBASE_FOREACH (NlaStrip *, strip, strips) { -/* check strip's action */ +/* Check strip's action. */ if (strip->act) { nla_eval_domain_action(ptr, channels, strip->act, touched_actions); } -/* check sub-strips (if metas) */ +/* Check sub-strips (if meta-strips). */ nla_eval_domain_strips(ptr, channels, &strip->strips, touched_actions); } } @@ -2859,9 +2859,9 @@ void nlasnapshot_ensure_channels(NlaEvalData *eval_data, NlaEvalSnapshot *snapsh * Blends the \a lower_snapshot with the \a upper_snapshot into \a r_blended_snapshot according *