[Bf-blender-cvs] [ada2b9f6e43] master: Fix T101341: make nodegroups active input/output non-animatable
Commit: ada2b9f6e43e687acba8b7b86394d3cc20eed291 Author: Philipp Oeser Date: Tue Sep 27 09:42:57 2022 +0200 Branches: master https://developer.blender.org/rBada2b9f6e43e687acba8b7b86394d3cc20eed291 Fix T101341: make nodegroups active input/output non-animatable Active UI list index is usually not animatable. Here specifically, the active list index is oly used for operators acting on a specific (active) socket. Note other props here were already made non-animatable in rB1d3b92bdeabc. Maniphest Tasks: T101341 Differential Revision: https://developer.blender.org/D16077 === M source/blender/makesrna/intern/rna_nodetree.c === diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index bdf68dea67b..c9f63e7c315 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -12663,6 +12663,7 @@ static void rna_def_nodetree(BlenderRNA *brna) RNA_def_property_int_funcs( prop, "rna_NodeTree_active_input_get", "rna_NodeTree_active_input_set", NULL); RNA_def_property_ui_text(prop, "Active Input", "Index of the active input"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_NODE, NULL); prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE); @@ -12676,6 +12677,7 @@ static void rna_def_nodetree(BlenderRNA *brna) RNA_def_property_int_funcs( prop, "rna_NodeTree_active_output_get", "rna_NodeTree_active_output_set", NULL); RNA_def_property_ui_text(prop, "Active Output", "Index of the active output"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_NODE, NULL); /* exposed as a function for runtime interface type properties */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c4b7ffa6f50] refactor-mesh-position-generic: Merge branch 'master' into refactor-mesh-position-generic
Commit: c4b7ffa6f50c9680059fd221b5d7391fae6e6f29 Author: Hans Goudey Date: Tue Sep 27 23:04:21 2022 -0500 Branches: refactor-mesh-position-generic https://developer.blender.org/rBc4b7ffa6f50c9680059fd221b5d7391fae6e6f29 Merge branch 'master' into refactor-mesh-position-generic === === diff --cc source/blender/blenkernel/BKE_mesh_legacy_convert.h index 1cc9523f5cf,92182f8045b..b5bd9d17a22 --- a/source/blender/blenkernel/BKE_mesh_legacy_convert.h +++ b/source/blender/blenkernel/BKE_mesh_legacy_convert.h @@@ -10,12 -10,10 +10,14 @@@ #include "BLI_utildefines.h" #ifdef __cplusplus +# include "BLI_resource_scope.hh" + # include "BLI_span.hh" +# include "BLI_vector.hh" + # include "DNA_customdata_types.h" #endif +#include "DNA_customdata_types.h" + #ifdef __cplusplus extern "C" { #endif @@@ -81,15 -82,8 +86,15 @@@ void BKE_mesh_legacy_convert_material_i */ void BKE_mesh_legacy_convert_mpoly_to_material_indices(struct Mesh *mesh); - #ifdef __cplusplus +struct MVert *BKE_mesh_legacy_convert_positions_to_verts( +Mesh *mesh, +blender::ResourceScope &temp_arrays_for_convert, +blender::Vector &vert_layers_to_write); - #endif + +void BKE_mesh_legacy_convert_verts_to_positions(Mesh *mesh); + + #endif + /** * Recreate #MFace Tessellation. * diff --cc source/blender/blenkernel/intern/cloth.c index 7300ca9a8eb,e85e19f04c9..31f3353c91d --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@@ -1147,8 -1148,8 +1148,8 @@@ static void cloth_update_springs(ClothM /* Update rest verts, for dynamically deformable cloth */ static void cloth_update_verts(Object *ob, ClothModifierData *clmd, Mesh *mesh) { - unsigned int i = 0; + uint i = 0; - const MVert *mvert = BKE_mesh_verts(mesh); + const float(*positions)[3] = BKE_mesh_positions(mesh); ClothVertex *verts = clmd->clothObject->verts; /* vertex count is already ensured to match */ diff --cc source/blender/blenkernel/intern/dynamicpaint.c index bd201da0692,03358f50d40..756b4946a54 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@@ -6057,14 -6063,12 +6057,12 @@@ static bool dynamicPaint_generateBakeDa /* Init bdata */ bData->bNormal = (struct PaintBakeNormal *)MEM_mallocN( sData->total_points * sizeof(struct PaintBakeNormal), "Dynamic Paint step data"); - bData->s_pos = MEM_mallocN(sData->total_points * sizeof(unsigned int), -"Dynamic Paint bData s_pos"); - bData->s_num = MEM_mallocN(sData->total_points * sizeof(unsigned int), -"Dynamic Paint bData s_num"); + bData->s_pos = MEM_mallocN(sData->total_points * sizeof(uint), "Dynamic Paint bData s_pos"); + bData->s_num = MEM_mallocN(sData->total_points * sizeof(uint), "Dynamic Paint bData s_num"); bData->realCoord = (struct Vec3f *)MEM_mallocN(surface_totalSamples(surface) * sizeof(Vec3f), "Dynamic Paint point coords"); -bData->prev_verts = MEM_mallocN(canvasNumOfVerts * sizeof(MVert), -"Dynamic Paint bData prev_verts"); +bData->prev_positions = MEM_mallocN(canvasNumOfVerts * sizeof(float[3]), +"Dynamic Paint bData prev_positions"); /* if any allocation failed, free everything */ if (!bData->bNormal || !bData->s_pos || !bData->s_num || !bData->realCoord || !canvas_verts) { diff --cc source/blender/blenkernel/intern/mesh.cc index 2d27d185cd9,4d98efde5f9..2fec68932b0 --- a/source/blender/blenkernel/intern/mesh.cc +++ b/source/blender/blenkernel/intern/mesh.cc @@@ -261,16 -263,8 +261,16 @@@ static void mesh_blend_write(BlendWrite ".select_edge", ".select_poly"}); + mesh->mvert = BKE_mesh_legacy_convert_positions_to_verts( + mesh, temp_arrays_for_legacy_format, vert_layers); + BKE_mesh_legacy_convert_hide_layers_to_flags(mesh); + BKE_mesh_legacy_convert_selection_layers_to_flags(mesh); + BKE_mesh_legacy_convert_material_indices_to_mpoly(mesh); + BKE_mesh_legacy_bevel_weight_from_layers(mesh); - BKE_mesh_legacy_face_set_from_generic(mesh); ++ BKE_mesh_legacy_face_set_from_generic(mesh, poly_layers); + BKE_mesh_legacy_edge_crease_from_layers(mesh); + /* Set deprecated mesh data pointers for forward compatibility. */ - mesh->mvert = const_cast(mesh->verts().data()); mesh->medge = const_cast(mesh->edges().data()); mesh->mpoly = const_cast(mesh->polys().data()); mesh->mloop = const_cast(mesh->loops().data()); diff --cc source/blender/blenkernel/intern/mesh_boolean_convert.cc index c7cc8
[Bf-blender-cvs] [acb8ac6870e] refactor-mesh-position-generic: Cleanup
Commit: acb8ac6870e831b0ebf61cef79ff993e8849fc37 Author: Hans Goudey Date: Tue Sep 27 23:40:03 2022 -0500 Branches: refactor-mesh-position-generic https://developer.blender.org/rBacb8ac6870e831b0ebf61cef79ff993e8849fc37 Cleanup === M source/blender/blenkernel/intern/DerivedMesh.cc M source/blender/blenkernel/intern/cloth.c M source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc === diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index 4be80145eb6..2e2a917821d 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -668,7 +668,8 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, BLI_assert((mesh_input->id.tag & LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT) == 0); - /* TODO(Hans): Remove use of "deformed_verts" in mesh modifier stack. */ + /* TODO: Remove use of "deformed_verts" in mesh modifier stack since mesh positions are now in a + * contiguous array. */ float(*deformed_verts)[3] = nullptr; int num_deformed_verts = mesh_input->totvert; bool isPrevDeform = false; diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 31f3353c91d..711b1179bd2 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -251,7 +251,6 @@ static int do_step_cloth( ClothVertex *verts = NULL; Cloth *cloth; ListBase *effectors = NULL; - MVert *mvert; uint i = 0; int ret = 0; bool vert_mass_changed = false; diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc index 95f7c7add3a..54f7954abd5 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc @@ -165,7 +165,7 @@ static void get_closest_mesh_corners(const Mesh &mesh, const MutableSpan r_distances_sq, const MutableSpan r_positions) { - const Span verts = mesh.verts(); + const Span mesh_positions = mesh.positions(); const Span polys = mesh.polys(); const Span loops = mesh.loops(); @@ -180,24 +180,23 @@ static void get_closest_mesh_corners(const Mesh &mesh, /* Find the closest vertex in the polygon. */ float min_distance_sq = FLT_MAX; -const MVert *closest_mvert; +int closest_vert_index = 0; int closest_loop_index = 0; for (const int loop_index : IndexRange(poly.loopstart, poly.totloop)) { const MLoop &loop = loops[loop_index]; const int vertex_index = loop.v; - const MVert &mvert = verts[vertex_index]; - const float distance_sq = math::distance_squared(position, float3(mvert.co)); + const float distance_sq = math::distance_squared(position, mesh_positions[vertex_index]); if (distance_sq < min_distance_sq) { min_distance_sq = distance_sq; closest_loop_index = loop_index; -closest_mvert = &mvert; +closest_vert_index = vertex_index; } } if (!r_corner_indices.is_empty()) { r_corner_indices[i] = closest_loop_index; } if (!r_positions.is_empty()) { - r_positions[i] = closest_mvert->co; + r_positions[i] = mesh_positions[closest_vert_index]; } if (!r_distances_sq.is_empty()) { r_distances_sq[i] = min_distance_sq; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6a1066904b8] temp-pbvh-seam-texturing-tweaks: Merge branch 'master' into temp-pbvh-seam-texturing-tweaks
Commit: 6a1066904b85b40a7a858d4a1225d0633b62be3d Author: Hans Goudey Date: Tue Sep 27 22:28:53 2022 -0500 Branches: temp-pbvh-seam-texturing-tweaks https://developer.blender.org/rB6a1066904b85b40a7a858d4a1225d0633b62be3d Merge branch 'master' into temp-pbvh-seam-texturing-tweaks === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6d5569bacfc] temp-pbvh-seam-texturing-tweaks: Remove MeshPrimitive completely
Commit: 6d5569bacfc43d5e9e65372b1efe4fcb056934a9 Author: Hans Goudey Date: Tue Sep 27 22:56:01 2022 -0500 Branches: temp-pbvh-seam-texturing-tweaks https://developer.blender.org/rB6d5569bacfc43d5e9e65372b1efe4fcb056934a9 Remove MeshPrimitive completely Now the existing MLoopTri array is used instead, in addition to a separate triangle -> edge connection array. This saves 16 bytes per face corner of memory usage during this process. It also makes the code more "standard", making it possible to share tooling with other areas that deal with UVs and looptriangles === M source/blender/blenkernel/intern/pbvh_pixels.cc M source/blender/blenkernel/intern/pbvh_uv_islands.cc M source/blender/blenkernel/intern/pbvh_uv_islands.hh === diff --git a/source/blender/blenkernel/intern/pbvh_pixels.cc b/source/blender/blenkernel/intern/pbvh_pixels.cc index 59a2c6c9234..0b0359c6df1 100644 --- a/source/blender/blenkernel/intern/pbvh_pixels.cc +++ b/source/blender/blenkernel/intern/pbvh_pixels.cc @@ -106,10 +106,10 @@ static void update_geom_primitives(PBVH &pbvh, const uv_islands::MeshData &mesh_ { PBVHData &pbvh_data = BKE_pbvh_pixels_data_get(pbvh); pbvh_data.clear_data(); - for (const uv_islands::MeshPrimitive &mesh_primitive : mesh_data.primitives) { - pbvh_data.geom_primitives.append(int3(mesh_data.loops[mesh_primitive.loops[0]].v, - mesh_data.loops[mesh_primitive.loops[1]].v, - mesh_data.loops[mesh_primitive.loops[2]].v)); + for (const MLoopTri &looptri : mesh_data.looptris) { +pbvh_data.geom_primitives.append(int3(mesh_data.loops[looptri.tri[0]].v, + mesh_data.loops[looptri.tri[1]].v, + mesh_data.loops[looptri.tri[2]].v)); } } diff --git a/source/blender/blenkernel/intern/pbvh_uv_islands.cc b/source/blender/blenkernel/intern/pbvh_uv_islands.cc index 7eedf7a5843..94666bc2265 100644 --- a/source/blender/blenkernel/intern/pbvh_uv_islands.cc +++ b/source/blender/blenkernel/intern/pbvh_uv_islands.cc @@ -28,15 +28,24 @@ static void uv_primitive_append_to_uv_vertices(UVPrimitive &uv_primitive) } /* */ -/** \name MeshPrimitive +/** \name Mesh Primitives * \{ */ -int MeshPrimitive::get_other_uv_vertex(const MeshData &mesh_data, const int v1, const int v2) const +int primitive_get_other_uv_vertex(const MeshData &mesh_data, + const MLoopTri &looptri, + const int v1, + const int v2) { const Span mesh_loops = mesh_data.loops; - BLI_assert(ELEM(v1, mesh_loops[loops[0]].v, mesh_loops[loops[1]].v, mesh_loops[loops[2]].v)); - BLI_assert(ELEM(v2, mesh_loops[loops[0]].v, mesh_loops[loops[1]].v, mesh_loops[loops[2]].v)); - for (const int loop : loops) { + BLI_assert(ELEM(v1, + mesh_loops[looptri.tri[0]].v, + mesh_loops[looptri.tri[1]].v, + mesh_loops[looptri.tri[2]].v)); + BLI_assert(ELEM(v2, + mesh_loops[looptri.tri[0]].v, + mesh_loops[looptri.tri[1]].v, + mesh_loops[looptri.tri[2]].v)); + for (const int loop : looptri.tri) { const int vert = mesh_loops[loop].v; if (vert != v1 && vert != v2) { return vert; @@ -45,11 +54,13 @@ int MeshPrimitive::get_other_uv_vertex(const MeshData &mesh_data, const int v1, return -1; } -bool MeshPrimitive::has_shared_uv_edge(const Span uv_map, const MeshPrimitive &other) const +bool primitive_has_shared_uv_edge(const Span uv_map, + const MLoopTri &looptri, + const MLoopTri &other) { int shared_uv_verts = 0; - for (const int loop : loops) { -for (const int other_loop : other.loops) { + for (const int loop : looptri.tri) { +for (const int other_loop : other.tri) { if (uv_map[loop] == uv_map[other_loop]) { shared_uv_verts += 1; } @@ -58,25 +69,21 @@ bool MeshPrimitive::has_shared_uv_edge(const Span uv_map, const MeshPrim return shared_uv_verts >= 2; } -static int get_uv_loop(const MeshData &mesh_data, - const MeshPrimitive &mesh_primitive, - const int vert) +static int get_uv_loop(const MeshData &mesh_data, const MLoopTri &looptri, const int vert) { - for (const int loop : mesh_primitive.loops) { + for (const int loop : looptri.tri) { if (mesh_data.loops[loop].v == vert) { return loop; } } BLI_assert_unreachable(); - return mesh_primitive.loops[0]; + return looptri.tri[0]; } -static bool has_vertex(const MeshData &mesh_data, - const MeshPrimitive &mesh_pri
[Bf-blender-cvs] [e88d1467f98] temp-pbvh-seam-texturing-tweaks: Initial patch from Jeroen
Commit: e88d1467f98cdd57c69f470840e71fde78c8b9eb Author: Hans Goudey Date: Tue Sep 27 15:36:55 2022 -0500 Branches: temp-pbvh-seam-texturing-tweaks https://developer.blender.org/rBe88d1467f98cdd57c69f470840e71fde78c8b9eb Initial patch from Jeroen === M source/blender/blenkernel/BKE_pbvh.h M source/blender/blenkernel/BKE_pbvh_pixels.hh M source/blender/blenkernel/CMakeLists.txt M source/blender/blenkernel/intern/paint_canvas.cc M source/blender/blenkernel/intern/pbvh.c M source/blender/blenkernel/intern/pbvh_intern.h M source/blender/blenkernel/intern/pbvh_pixels.cc A source/blender/blenkernel/intern/pbvh_uv_islands.cc A source/blender/blenkernel/intern/pbvh_uv_islands.hh M source/blender/blenlib/BLI_vector.hh A source/blender/blenlib/BLI_vector_list.hh M source/blender/blenlib/CMakeLists.txt M source/blender/blenloader/intern/versioning_300.cc M source/blender/editors/sculpt_paint/sculpt_paint_image.cc M source/blender/editors/space_image/image_buttons.c M source/blender/makesdna/DNA_image_defaults.h M source/blender/makesdna/DNA_image_types.h M source/blender/makesrna/intern/rna_image.c === diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index ff2140732cc..09a2187f586 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -89,6 +89,15 @@ typedef struct { float (*color)[4]; } PBVHColorBufferNode; +typedef struct PBVHPixels { + /** + * Contains data constant for each UVPrimitive. + * + * #blender::bke::pbvh::pixels::PBVHData + */ + void *data; +} PBVHPixels; + typedef struct PBVHPixelsNode { /** * Contains triangle/pixel data used during texture painting. diff --git a/source/blender/blenkernel/BKE_pbvh_pixels.hh b/source/blender/blenkernel/BKE_pbvh_pixels.hh index ad8eca2b36f..5fc648af3f1 100644 --- a/source/blender/blenkernel/BKE_pbvh_pixels.hh +++ b/source/blender/blenkernel/BKE_pbvh_pixels.hh @@ -18,8 +18,46 @@ namespace blender::bke::pbvh::pixels { -struct TrianglePaintInput { - int3 vert_indices; +/** + * Data shared between pixels that belong to the same triangle. + * + * Data is stored as a list of structs, grouped by usage to improve performance (improves CPU + * cache prefetching). + */ +struct PaintGeometryPrimitives { + /** Data accessed by the inner loop of the painting brush. */ + Vector vert_indices; + + public: + void append(const int3 vert_indices) + { +this->vert_indices.append(vert_indices); + } + + const int3 &get_vert_indices(const int index) const + { +return vert_indices[index]; + } + + void clear() + { +vert_indices.clear(); + } + + uint64_t size() const + { +return vert_indices.size(); + } + + uint64_t mem_size() const + { +return size() * sizeof(int3); + } +}; + +struct UVPrimitivePaintInput { + /** Corresponding index into PaintGeometryPrimitives */ + int64_t geometry_primitive_index; /** * Delta barycentric coordinates between 2 neighboring UV's in the U direction. * @@ -33,34 +71,27 @@ struct TrianglePaintInput { * delta_barycentric_coord_u is initialized in a later stage as it requires image tile * dimensions. */ - TrianglePaintInput(const int3 vert_indices) - : vert_indices(vert_indices), delta_barycentric_coord_u(0.0f, 0.0f) + UVPrimitivePaintInput(int64_t geometry_primitive_index) + : geometry_primitive_index(geometry_primitive_index), delta_barycentric_coord_u(0.0f, 0.0f) { } }; -/** - * Data shared between pixels that belong to the same triangle. - * - * Data is stored as a list of structs, grouped by usage to improve performance (improves CPU - * cache prefetching). - */ -struct Triangles { +struct PaintUVPrimitives { /** Data accessed by the inner loop of the painting brush. */ - Vector paint_input; + Vector paint_input; - public: - void append(const int3 vert_indices) + void append(int64_t geometry_primitive_index) { -this->paint_input.append(TrianglePaintInput(vert_indices)); +this->paint_input.append(UVPrimitivePaintInput(geometry_primitive_index)); } - TrianglePaintInput &get_paint_input(const int index) + UVPrimitivePaintInput &last() { -return paint_input[index]; +return paint_input.last(); } - const TrianglePaintInput &get_paint_input(const int index) const + const UVPrimitivePaintInput &get_paint_input(uint64_t index) const { return paint_input[index]; } @@ -77,7 +108,7 @@ struct Triangles { uint64_t mem_size() const { -return paint_input.size() * sizeof(TrianglePaintInput); +return size() * sizeof(UVPrimitivePaintInput); } }; @@ -92,7 +123,7 @@ struct PackedPixelRow { /** Number of sequential pixels encoded in this package. */ ushort num_pixels
[Bf-blender-cvs] [1ce7fbca5e1] temp-pbvh-seam-texturing-tweaks: Remove MeshUVVert, use loop indices instead of "UV verts"
Commit: 1ce7fbca5e169b3073c2138216ba75cf6f1dff74 Author: Hans Goudey Date: Tue Sep 27 21:51:40 2022 -0500 Branches: temp-pbvh-seam-texturing-tweaks https://developer.blender.org/rB1ce7fbca5e169b3073c2138216ba75cf6f1dff74 Remove MeshUVVert, use loop indices instead of "UV verts" === M source/blender/blenkernel/intern/pbvh_pixels.cc M source/blender/blenkernel/intern/pbvh_uv_islands.cc M source/blender/blenkernel/intern/pbvh_uv_islands.hh === diff --git a/source/blender/blenkernel/intern/pbvh_pixels.cc b/source/blender/blenkernel/intern/pbvh_pixels.cc index 538a3b5618e..59a2c6c9234 100644 --- a/source/blender/blenkernel/intern/pbvh_pixels.cc +++ b/source/blender/blenkernel/intern/pbvh_pixels.cc @@ -107,9 +107,9 @@ static void update_geom_primitives(PBVH &pbvh, const uv_islands::MeshData &mesh_ PBVHData &pbvh_data = BKE_pbvh_pixels_data_get(pbvh); pbvh_data.clear_data(); for (const uv_islands::MeshPrimitive &mesh_primitive : mesh_data.primitives) { -pbvh_data.geom_primitives.append(int3(mesh_primitive.vertices[0].vertex, - mesh_primitive.vertices[1].vertex, - mesh_primitive.vertices[2].vertex)); + pbvh_data.geom_primitives.append(int3(mesh_data.loops[mesh_primitive.loops[0]].v, + mesh_data.loops[mesh_primitive.loops[1]].v, + mesh_data.loops[mesh_primitive.loops[2]].v)); } } @@ -149,7 +149,6 @@ struct EncodePixelsUserData { ImageUser *image_user; PBVH *pbvh; Vector *nodes; - const MLoopUV *ldata_uv; const uv_islands::UVIslandsMask *uv_masks; /** Lookup to retrieve the UV primitives based on the primitive index. */ const UVPrimitiveLookup *uv_primitive_lookup; @@ -358,16 +357,16 @@ static void update_pixels(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser *image return; } - const MLoopUV *ldata_uv = static_cast( - CustomData_get_layer(&mesh->ldata, CD_MLOOPUV)); - if (ldata_uv == nullptr) { + const StringRef active_uv_name = CustomData_get_active_layer_name(&mesh->ldata, CD_MLOOPUV); + if (active_uv_name.is_empty()) { return; } - uv_islands::MeshData mesh_data({pbvh->looptri, pbvh->totprim}, - {pbvh->mloop, mesh->totloop}, - pbvh->totvert, - {ldata_uv, mesh->totloop}); + const AttributeAccessor attributes = mesh->attributes(); + const VArraySpan uv_map = attributes.lookup(active_uv_name, ATTR_DOMAIN_CORNER); + + uv_islands::MeshData mesh_data( + {pbvh->looptri, pbvh->totprim}, {pbvh->mloop, mesh->totloop}, pbvh->totvert, uv_map); uv_islands::UVIslands islands(mesh_data); uv_islands::UVIslandsMask uv_masks; @@ -397,7 +396,6 @@ static void update_pixels(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser *image user_data.pbvh = pbvh; user_data.image = image; user_data.image_user = image_user; - user_data.ldata_uv = ldata_uv; user_data.nodes = &nodes_to_update; user_data.uv_primitive_lookup = &uv_primitive_lookup; user_data.uv_masks = &uv_masks; diff --git a/source/blender/blenkernel/intern/pbvh_uv_islands.cc b/source/blender/blenkernel/intern/pbvh_uv_islands.cc index cb7ce9e9ad0..41bc2510b62 100644 --- a/source/blender/blenkernel/intern/pbvh_uv_islands.cc +++ b/source/blender/blenkernel/intern/pbvh_uv_islands.cc @@ -31,24 +31,26 @@ static void uv_primitive_append_to_uv_vertices(UVPrimitive &uv_primitive) /** \name MeshPrimitive * \{ */ -int MeshPrimitive::get_other_uv_vertex(const int v1, const int v2) const -{ - BLI_assert(vertices[0].vertex == v1 || vertices[1].vertex == v1 || vertices[2].vertex == v1); - BLI_assert(vertices[0].vertex == v2 || vertices[1].vertex == v2 || vertices[2].vertex == v2); - for (const MeshUVVert &uv_vertex : vertices) { -if (uv_vertex.vertex != v1 && uv_vertex.vertex != v2) { - return uv_vertex.vertex; +int MeshPrimitive::get_other_uv_vertex(const MeshData &mesh_data, const int v1, const int v2) const +{ + const Span mesh_loops = mesh_data.loops; + BLI_assert(ELEM(v1, mesh_loops[loops[0]].v, mesh_loops[loops[1]].v, mesh_loops[loops[2]].v)); + BLI_assert(ELEM(v2, mesh_loops[loops[0]].v, mesh_loops[loops[1]].v, mesh_loops[loops[2]].v)); + for (const int loop : loops) { +const int vert = mesh_loops[loop].v; +if (vert != v1 && vert != v2) { + return vert; } } return -1; } -bool MeshPrimitive::has_shared_uv_edge(const MeshPrimitive &other) const +bool MeshPrimitive::has_shared_uv_edge(const Span uv_map, const MeshPrimitive &other) const { int shared_uv_verts = 0; - for (const MeshUVVert &vert : vertices) { -for (const MeshUVVert &other_vert : other.vertices) { - if (vert.uv == other_vert.uv) { + for (const
[Bf-blender-cvs] [54dae0fb3cd] temp-pbvh-seam-texturing-tweaks: Remove MeshVertex, use indices for edges and primitives
Commit: 54dae0fb3cdf907162dd0b6cb4b3e0c156889f98 Author: Hans Goudey Date: Tue Sep 27 21:07:36 2022 -0500 Branches: temp-pbvh-seam-texturing-tweaks https://developer.blender.org/rB54dae0fb3cdf907162dd0b6cb4b3e0c156889f98 Remove MeshVertex, use indices for edges and primitives === M source/blender/blenkernel/intern/pbvh_pixels.cc M source/blender/blenkernel/intern/pbvh_uv_islands.cc M source/blender/blenkernel/intern/pbvh_uv_islands.hh === diff --git a/source/blender/blenkernel/intern/pbvh_pixels.cc b/source/blender/blenkernel/intern/pbvh_pixels.cc index 5cb1b9374c0..538a3b5618e 100644 --- a/source/blender/blenkernel/intern/pbvh_pixels.cc +++ b/source/blender/blenkernel/intern/pbvh_pixels.cc @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-or-later * Copyright 2022 Blender Foundation. All rights reserved. */ +#include "BKE_attribute.hh" #include "BKE_customdata.h" #include "BKE_mesh.h" #include "BKE_mesh_mapping.h" @@ -106,9 +107,9 @@ static void update_geom_primitives(PBVH &pbvh, const uv_islands::MeshData &mesh_ PBVHData &pbvh_data = BKE_pbvh_pixels_data_get(pbvh); pbvh_data.clear_data(); for (const uv_islands::MeshPrimitive &mesh_primitive : mesh_data.primitives) { -pbvh_data.geom_primitives.append(int3(mesh_primitive.vertices[0].vertex->v, - mesh_primitive.vertices[1].vertex->v, - mesh_primitive.vertices[2].vertex->v)); +pbvh_data.geom_primitives.append(int3(mesh_primitive.vertices[0].vertex, + mesh_primitive.vertices[1].vertex, + mesh_primitive.vertices[2].vertex)); } } @@ -134,7 +135,7 @@ struct UVPrimitiveLookup { for (VectorList::UsedVector &uv_primitives : uv_island.uv_primitives) { for (uv_islands::UVPrimitive &uv_primitive : uv_primitives) { - lookup[uv_primitive.primitive->index].append_as(Entry(&uv_primitive, uv_island_index)); + lookup[uv_primitive.primitive_i].append_as(Entry(&uv_primitive, uv_island_index)); } } uv_island_index++; @@ -143,6 +144,7 @@ struct UVPrimitiveLookup { }; struct EncodePixelsUserData { + const uv_islands::MeshData *mesh_data; Image *image; ImageUser *image_user; PBVH *pbvh; @@ -158,6 +160,7 @@ static void do_encode_pixels(void *__restrict userdata, const TaskParallelTLS *__restrict UNUSED(tls)) { EncodePixelsUserData *data = static_cast(userdata); + const uv_islands::MeshData &mesh_data = *data->mesh_data; Image *image = data->image; ImageUser image_user = *data->image_user; PBVHNode *node = (*data->nodes)[n]; @@ -183,9 +186,9 @@ static void do_encode_pixels(void *__restrict userdata, data->uv_primitive_lookup->lookup[geom_prim_index]) { uv_islands::UVBorder uv_border = entry.uv_primitive->extract_border(); float2 uvs[3] = { -entry.uv_primitive->get_uv_vertex(0)->uv - tile_offset, -entry.uv_primitive->get_uv_vertex(1)->uv - tile_offset, -entry.uv_primitive->get_uv_vertex(2)->uv - tile_offset, +entry.uv_primitive->get_uv_vertex(mesh_data, 0)->uv - tile_offset, +entry.uv_primitive->get_uv_vertex(mesh_data, 1)->uv - tile_offset, +entry.uv_primitive->get_uv_vertex(mesh_data, 2)->uv - tile_offset, }; const float minv = clamp_f(min_fff(uvs[0].y, uvs[1].y, uvs[2].y), 0.0f, 1.0f); const int miny = floor(minv * image_buffer->y); @@ -362,9 +365,9 @@ static void update_pixels(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser *image } uv_islands::MeshData mesh_data({pbvh->looptri, pbvh->totprim}, - {pbvh->mloop, pbvh->totprim}, + {pbvh->mloop, mesh->totloop}, pbvh->totvert, - {ldata_uv, pbvh->totprim}); + {ldata_uv, mesh->totloop}); uv_islands::UVIslands islands(mesh_data); uv_islands::UVIslandsMask uv_masks; @@ -380,16 +383,17 @@ static void update_pixels(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser *image ushort2(tile_buffer->x, tile_buffer->y)); BKE_image_release_ibuf(image, tile_buffer, nullptr); } - uv_masks.add(islands); + uv_masks.add(mesh_data, islands); uv_masks.dilate(image->seamfix_iter); islands.extract_borders(); - islands.extend_borders(uv_masks); + islands.extend_borders(mesh_data, uv_masks); update_geom_primitives(*pbvh, mesh_data); UVPrimitiveLookup uv_primitive_lookup(mesh_data.looptris.size(), islands); EncodePixelsUserData user_data; + user_data.mesh_data = &mesh_data; user_data.pbvh = pbvh; user_data.image = image;
[Bf-blender-cvs] [a5b0030862a] temp-pbvh-seam-texturing-tweaks: Remove MeshPrimitive.index
Commit: a5b0030862a0be1bbd4a24d7bcf37ca2973b8285 Author: Hans Goudey Date: Tue Sep 27 21:53:45 2022 -0500 Branches: temp-pbvh-seam-texturing-tweaks https://developer.blender.org/rBa5b0030862a0be1bbd4a24d7bcf37ca2973b8285 Remove MeshPrimitive.index === M source/blender/blenkernel/intern/pbvh_uv_islands.cc M source/blender/blenkernel/intern/pbvh_uv_islands.hh === diff --git a/source/blender/blenkernel/intern/pbvh_uv_islands.cc b/source/blender/blenkernel/intern/pbvh_uv_islands.cc index 41bc2510b62..758d96bf1d3 100644 --- a/source/blender/blenkernel/intern/pbvh_uv_islands.cc +++ b/source/blender/blenkernel/intern/pbvh_uv_islands.cc @@ -106,7 +106,6 @@ static void mesh_data_init_primitives(MeshData &mesh_data) for (int64_t i = 0; i < mesh_data.looptris.size(); i++) { const MLoopTri &tri = mesh_data.looptris[i]; MeshPrimitive primitive; -primitive.index = i; primitive.poly = tri.poly; for (int j = 0; j < 3; j++) { diff --git a/source/blender/blenkernel/intern/pbvh_uv_islands.hh b/source/blender/blenkernel/intern/pbvh_uv_islands.hh index 076704d7c28..953af33bb19 100644 --- a/source/blender/blenkernel/intern/pbvh_uv_islands.hh +++ b/source/blender/blenkernel/intern/pbvh_uv_islands.hh @@ -96,7 +96,6 @@ class EdgeToPrimitiveMap { /** Represents a triangle in 3d space (MLoopTri). */ struct MeshPrimitive { - int64_t index; int64_t poly; Vector edges; Vector loops; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [391462f6924] temp-pbvh-seam-texturing-tweaks: Use std::array for MeshPrimitive edges
Commit: 391462f69244be056a59fee6f0213f4a60577d30 Author: Hans Goudey Date: Tue Sep 27 22:00:34 2022 -0500 Branches: temp-pbvh-seam-texturing-tweaks https://developer.blender.org/rB391462f69244be056a59fee6f0213f4a60577d30 Use std::array for MeshPrimitive edges === M source/blender/blenkernel/intern/pbvh_uv_islands.cc M source/blender/blenkernel/intern/pbvh_uv_islands.hh === diff --git a/source/blender/blenkernel/intern/pbvh_uv_islands.cc b/source/blender/blenkernel/intern/pbvh_uv_islands.cc index 758d96bf1d3..7eedf7a5843 100644 --- a/source/blender/blenkernel/intern/pbvh_uv_islands.cc +++ b/source/blender/blenkernel/intern/pbvh_uv_islands.cc @@ -107,10 +107,7 @@ static void mesh_data_init_primitives(MeshData &mesh_data) const MLoopTri &tri = mesh_data.looptris[i]; MeshPrimitive primitive; primitive.poly = tri.poly; - -for (int j = 0; j < 3; j++) { - primitive.loops.append(tri.tri[j]); -} +std::copy(std::begin(tri.tri), std::end(tri.tri), std::begin(primitive.loops)); mesh_data.primitives.append(primitive); } } @@ -122,6 +119,7 @@ static void mesh_data_init_edges(MeshData &mesh_data) for (int64_t i = 0; i < mesh_data.looptris.size(); i++) { const MLoopTri &tri = mesh_data.looptris[i]; MeshPrimitive &primitive = mesh_data.primitives[i]; +Vector edges; for (int j = 0; j < 3; j++) { int v1 = mesh_data.loops[tri.tri[j]].v; int v2 = mesh_data.loops[tri.tri[(j + 1) % 3]].v; @@ -142,8 +140,9 @@ static void mesh_data_init_edges(MeshData &mesh_data) mesh_data.vert_to_edge_map.add(edge_index, v1, v2); } - primitive.edges.append(edge_index); + edges.append(edge_index); } +std::copy(std::begin(edges), std::end(edges), std::begin(primitive.edges)); } /* Build edge to neighboring triangle map. */ mesh_data.edge_to_primitive_map = EdgeToPrimitiveMap(mesh_data.edges.size()); @@ -1136,7 +1135,7 @@ bool UVPrimitive::has_shared_edge(const UVPrimitive &other) const bool UVPrimitive::has_shared_edge(const Span uv_map, const MeshPrimitive &primitive) const { for (const UVEdge *uv_edge : edges) { -int loop_1 = primitive.loops.last(); +int loop_1 = primitive.loops[2]; for (int i = 0; i < primitive.loops.size(); i++) { int loop_2 = primitive.loops[i]; if (uv_edge->has_shared_edge(uv_map, loop_1, loop_2)) { diff --git a/source/blender/blenkernel/intern/pbvh_uv_islands.hh b/source/blender/blenkernel/intern/pbvh_uv_islands.hh index 953af33bb19..39737fec884 100644 --- a/source/blender/blenkernel/intern/pbvh_uv_islands.hh +++ b/source/blender/blenkernel/intern/pbvh_uv_islands.hh @@ -97,8 +97,8 @@ class EdgeToPrimitiveMap { /** Represents a triangle in 3d space (MLoopTri). */ struct MeshPrimitive { int64_t poly; - Vector edges; - Vector loops; + std::array edges; + std::array loops; /** Get the vertex that is not given. Both given vertices must be part of the MeshPrimitive. */ int get_other_uv_vertex(const MeshData &mesh_data, const int v1, const int v2) const; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e61ddf3c038] temp-pbvh-seam-texturing-tweaks: Cleanup: Standardize variable names, use spans
Commit: e61ddf3c038f1a8dd43dfbb565913c0a66d0853a Author: Hans Goudey Date: Tue Sep 27 15:56:15 2022 -0500 Branches: temp-pbvh-seam-texturing-tweaks https://developer.blender.org/rBe61ddf3c038f1a8dd43dfbb565913c0a66d0853a Cleanup: Standardize variable names, use spans === M source/blender/blenkernel/intern/pbvh_pixels.cc M source/blender/blenkernel/intern/pbvh_uv_islands.cc M source/blender/blenkernel/intern/pbvh_uv_islands.hh === diff --git a/source/blender/blenkernel/intern/pbvh_pixels.cc b/source/blender/blenkernel/intern/pbvh_pixels.cc index 2f65f6b02ab..5cb1b9374c0 100644 --- a/source/blender/blenkernel/intern/pbvh_pixels.cc +++ b/source/blender/blenkernel/intern/pbvh_pixels.cc @@ -361,8 +361,10 @@ static void update_pixels(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser *image return; } - uv_islands::MeshData mesh_data( - pbvh->looptri, pbvh->totprim, pbvh->totvert, pbvh->mloop, ldata_uv); + uv_islands::MeshData mesh_data({pbvh->looptri, pbvh->totprim}, + {pbvh->mloop, pbvh->totprim}, + pbvh->totvert, + {ldata_uv, pbvh->totprim}); uv_islands::UVIslands islands(mesh_data); uv_islands::UVIslandsMask uv_masks; @@ -385,7 +387,7 @@ static void update_pixels(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser *image islands.extend_borders(uv_masks); update_geom_primitives(*pbvh, mesh_data); - UVPrimitiveLookup uv_primitive_lookup(mesh_data.looptri_len, islands); + UVPrimitiveLookup uv_primitive_lookup(mesh_data.looptris.size(), islands); EncodePixelsUserData user_data; user_data.pbvh = pbvh; diff --git a/source/blender/blenkernel/intern/pbvh_uv_islands.cc b/source/blender/blenkernel/intern/pbvh_uv_islands.cc index 4c9b52ac958..3303a3623fb 100644 --- a/source/blender/blenkernel/intern/pbvh_uv_islands.cc +++ b/source/blender/blenkernel/intern/pbvh_uv_islands.cc @@ -95,8 +95,8 @@ rctf MeshPrimitive::uv_bounds() const static void mesh_data_init_vertices(MeshData &mesh_data) { - mesh_data.vertices.reserve(mesh_data.vert_len); - for (int64_t i = 0; i < mesh_data.vert_len; i++) { + mesh_data.vertices.reserve(mesh_data.verts_num); + for (int64_t i = 0; i < mesh_data.verts_num; i++) { MeshVertex vert; vert.v = i; mesh_data.vertices.append(vert); @@ -105,9 +105,9 @@ static void mesh_data_init_vertices(MeshData &mesh_data) static void mesh_data_init_primitives(MeshData &mesh_data) { - mesh_data.primitives.reserve(mesh_data.looptri_len); - for (int64_t i = 0; i < mesh_data.looptri_len; i++) { -const MLoopTri &tri = mesh_data.looptri[i]; + mesh_data.primitives.reserve(mesh_data.looptris.size()); + for (int64_t i = 0; i < mesh_data.looptris.size(); i++) { +const MLoopTri &tri = mesh_data.looptris[i]; MeshPrimitive primitive; primitive.index = i; primitive.poly = tri.poly; @@ -115,7 +115,7 @@ static void mesh_data_init_primitives(MeshData &mesh_data) for (int j = 0; j < 3; j++) { MeshUVVert uv_vert; uv_vert.loop = tri.tri[j]; - uv_vert.vertex = &mesh_data.vertices[mesh_data.mloop[uv_vert.loop].v]; + uv_vert.vertex = &mesh_data.vertices[mesh_data.loops[uv_vert.loop].v]; uv_vert.uv = mesh_data.mloopuv[uv_vert.loop].uv; primitive.vertices.append(uv_vert); } @@ -125,14 +125,14 @@ static void mesh_data_init_primitives(MeshData &mesh_data) void mesh_data_init_edges(MeshData &mesh_data) { - mesh_data.edges.reserve(mesh_data.looptri_len * 2); - EdgeHash *eh = BLI_edgehash_new_ex(__func__, mesh_data.looptri_len * 3); - for (int64_t i = 0; i < mesh_data.looptri_len; i++) { -const MLoopTri &tri = mesh_data.looptri[i]; + mesh_data.edges.reserve(mesh_data.looptris.size() * 2); + EdgeHash *eh = BLI_edgehash_new_ex(__func__, mesh_data.looptris.size() * 3); + for (int64_t i = 0; i < mesh_data.looptris.size(); i++) { +const MLoopTri &tri = mesh_data.looptris[i]; MeshPrimitive &primitive = mesh_data.primitives[i]; for (int j = 0; j < 3; j++) { - int v1 = mesh_data.mloop[tri.tri[j]].v; - int v2 = mesh_data.mloop[tri.tri[(j + 1) % 3]].v; + int v1 = mesh_data.loops[tri.tri[j]].v; + int v2 = mesh_data.loops[tri.tri[(j + 1) % 3]].v; void **edge_index_ptr; int64_t edge_index; @@ -215,16 +215,11 @@ static void mesh_data_init(MeshData &mesh_data) mesh_data_init_primitive_uv_island_ids(mesh_data); } -MeshData::MeshData(const MLoopTri *looptri, - const int64_t looptri_len, - const int64_t vert_len, - const MLoop *mloop, - const MLoopUV *mloopuv) -: looptri(looptri), - looptri_len(looptri_len), - vert_len(vert_len), - mloop(mloop), - mloopuv(mloopuv) +MeshData::MeshData(const Span looptris, +
[Bf-blender-cvs] [788f3d72cf8] master: Fix Python module test failing with macOS + address sanitizer
Commit: 788f3d72cf89c0301721a5eb2a72da07058dfa24 Author: Brecht Van Lommel Date: Wed Sep 28 02:54:09 2022 +0200 Branches: master https://developer.blender.org/rB788f3d72cf89c0301721a5eb2a72da07058dfa24 Fix Python module test failing with macOS + address sanitizer Based on patch by Ankit Meel. Ref D10877 === M tests/blender_as_python_module/CMakeLists.txt === diff --git a/tests/blender_as_python_module/CMakeLists.txt b/tests/blender_as_python_module/CMakeLists.txt index 4f6cf0adfdb..6e0ce524903 100644 --- a/tests/blender_as_python_module/CMakeLists.txt +++ b/tests/blender_as_python_module/CMakeLists.txt @@ -10,6 +10,14 @@ function(add_blender_as_python_module_test testname testscript) NAME ${testname} COMMAND ${TEST_PYTHON_EXE} ${testscript} ${ARGN} ) + + # On macOS, asan library must be loaded early. + if(APPLE AND WITH_COMPILER_ASAN) +set_tests_properties( + ${testname} + PROPERTIES ENVIRONMENT DYLD_INSERT_LIBRARIES=${COMPILER_ASAN_LIBRARY} +) + endif() endfunction() add_blender_as_python_module_test(import_bpy ${CMAKE_CURRENT_LIST_DIR}/import_bpy.py ${CMAKE_INSTALL_PREFIX_WITH_CONFIG}) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5beaecb33e7] master: Fix T101414: in 3d viewport, smart uv project failed to pack
Commit: 5beaecb33e74abbdb0adb9144eee5f094ed41f9c Author: Chris Blackbourn Date: Wed Sep 28 12:35:29 2022 +1300 Branches: master https://developer.blender.org/rB5beaecb33e74abbdb0adb9144eee5f094ed41f9c Fix T101414: in 3d viewport, smart uv project failed to pack Regression from https://developer.blender.org/rBa5c696a0c2b9 === M source/blender/editors/uvedit/uvedit_unwrap_ops.c === diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index e66629f8fb0..e45c7410b3b 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -2421,7 +2421,7 @@ static int smart_project_exec(bContext *C, wmOperator *op) .rotate = true, /* We could make this optional. */ .rotate_align_axis = 1, - .only_selected_uvs = true, + .only_selected_uvs = only_selected_uvs, .only_selected_faces = true, .correct_aspect = correct_aspect, .use_seams = true, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6d1d1bf2b12] master: Cleanup: spelling in comments
Commit: 6d1d1bf2b12092e9f6c435c38e1bb84f3798ac5a Author: Campbell Barton Date: Wed Sep 28 09:41:31 2022 +1000 Branches: master https://developer.blender.org/rB6d1d1bf2b12092e9f6c435c38e1bb84f3798ac5a Cleanup: spelling in comments Also add missing task ID. === M intern/cycles/device/queue.h M intern/cycles/integrator/path_trace_work_cpu.h M intern/cycles/kernel/integrator/guiding.h M intern/cycles/kernel/integrator/state_template.h M intern/cycles/kernel/integrator/volume_shader.h M intern/ghost/GHOST_C-api.h M intern/ghost/GHOST_ISystem.h M intern/ghost/intern/GHOST_System.h M source/blender/blenkernel/BKE_lib_override.h M source/blender/blenkernel/intern/blendfile_link_append.c M source/blender/blenkernel/intern/fcurve.c M source/blender/blenlib/BLI_convexhull_2d.h M source/blender/blenloader/intern/readblenentry.cc M source/blender/blenloader/intern/readfile.cc M source/blender/draw/intern/draw_debug.cc M source/blender/editors/object/object_relations.c M source/blender/editors/space_file/filelist.cc M source/blender/editors/space_view3d/view3d_draw.cc M source/blender/gpu/GPU_shader.h M source/blender/makesdna/DNA_ID.h M source/blender/makesdna/DNA_scene_types.h M source/blender/makesdna/DNA_sequence_types.h === diff --git a/intern/cycles/device/queue.h b/intern/cycles/device/queue.h index e9a7a9d8701..1d6a8d736b7 100644 --- a/intern/cycles/device/queue.h +++ b/intern/cycles/device/queue.h @@ -174,7 +174,7 @@ class DeviceQueue { /* Accumulated execution time for combinations of kernels launched together. */ map stats_kernel_time_; /* If it is true, then a performance statistics in the debugging logs will have focus on kernels - * and an explicitqueue synchronization will be added after each kernel execution. */ + * and an explicit queue synchronization will be added after each kernel execution. */ bool is_per_kernel_performance_; }; diff --git a/intern/cycles/integrator/path_trace_work_cpu.h b/intern/cycles/integrator/path_trace_work_cpu.h index 7adb00b4d9d..e50ba8721d9 100644 --- a/intern/cycles/integrator/path_trace_work_cpu.h +++ b/intern/cycles/integrator/path_trace_work_cpu.h @@ -52,9 +52,9 @@ class PathTraceWorkCPU : public PathTraceWork { virtual void cryptomatte_postproces() override; #ifdef WITH_PATH_GUIDING - /* Intializes the per-thread guiding kernel data. The function sets the pointers to the + /* Initializes the per-thread guiding kernel data. The function sets the pointers to the * global guiding field and the sample data storage as well es initializes the per-thread - * guided sampling distrubtions (e.g., SurfaceSamplingDistribution and + * guided sampling distributions (e.g., SurfaceSamplingDistribution and * VolumeSamplingDistribution). */ void guiding_init_kernel_globals(void *guiding_field, void *sample_data_storage, diff --git a/intern/cycles/kernel/integrator/guiding.h b/intern/cycles/kernel/integrator/guiding.h index 5d09e5ceac4..5904b69b046 100644 --- a/intern/cycles/kernel/integrator/guiding.h +++ b/intern/cycles/kernel/integrator/guiding.h @@ -298,7 +298,7 @@ ccl_device_forceinline void guiding_record_volume_emission(KernelGlobals kg, /* Adds a pseudo path vertex/segment when intersecting a virtual light source. * (e.g., area, sphere, or disk light). This call is often followed * a call of guiding_record_surface_emission, if the intersected light source - * emits light in the direction of tha path. */ + * emits light in the direction of the path. */ ccl_device_forceinline void guiding_record_light_surface_segment( KernelGlobals kg, IntegratorState state, ccl_private const Intersection *ccl_restrict isect) { diff --git a/intern/cycles/kernel/integrator/state_template.h b/intern/cycles/kernel/integrator/state_template.h index 760c2f80521..610621f0abe 100644 --- a/intern/cycles/kernel/integrator/state_template.h +++ b/intern/cycles/kernel/integrator/state_template.h @@ -47,8 +47,8 @@ KERNEL_STRUCT_MEMBER(path, float, min_ray_pdf, KERNEL_FEATURE_PATH_TRACING) KERNEL_STRUCT_MEMBER(path, float, continuation_probability, KERNEL_FEATURE_PATH_TRACING) /* Throughput. */ KERNEL_STRUCT_MEMBER(path, PackedSpectrum, throughput, KERNEL_FEATURE_PATH_TRACING) -/* Factor to multiple with throughput to get remove any guiding pdfs. - * Such throughput without guiding pdfs is used for Russian rouletter termination. */ +/* Factor to multiple with throughput to get remove any guiding PDFS. + * Such throughput without guiding PDFS is used for Russian roulette termination. */ KERNEL_STRUCT_MEMBER(path, float, unguided_throughput, KERNEL_FEATURE_PATH_GUIDING) /* Ratio of throughput to distinguish diffuse / glossy / transmission r
[Bf-blender-cvs] [6f9b84c5ce3] master: Cleanup: compiler warnings
Commit: 6f9b84c5ce34b7e0e40f8da1f35ef3dd2397e218 Author: Campbell Barton Date: Wed Sep 28 09:40:52 2022 +1000 Branches: master https://developer.blender.org/rB6f9b84c5ce34b7e0e40f8da1f35ef3dd2397e218 Cleanup: compiler warnings === M source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c === diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c index e3d49ba37d5..5af8c0807b8 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c @@ -266,7 +266,7 @@ static int remapTime(struct GpencilModifierData *md, } static void segment_list_item(struct uiList *UNUSED(ui_list), - struct bContext *UNUSED(C), + const struct bContext *UNUSED(C), struct uiLayout *layout, struct PointerRNA *UNUSED(idataptr), struct PointerRNA *itemptr, @@ -313,7 +313,7 @@ static void panel_draw(const bContext *C, Panel *panel) if (mode == GP_TIME_MODE_CHAIN) { -uiLayout *row = uiLayoutRow(layout, false); +row = uiLayoutRow(layout, false); uiLayoutSetPropSep(row, false); uiTemplateList(row, @@ -331,7 +331,7 @@ static void panel_draw(const bContext *C, Panel *panel) 1, UI_TEMPLATE_LIST_FLAG_NONE); -uiLayout *col = uiLayoutColumn(row, false); +col = uiLayoutColumn(row, false); uiLayoutSetContextPointer(col, "modifier", ptr); uiLayout *sub = uiLayoutColumn(col, true); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [72a7f107d84] master: Cleanup: format
Commit: 72a7f107d84293ceeef92e54362127446dddc9df Author: Campbell Barton Date: Wed Sep 28 09:41:07 2022 +1000 Branches: master https://developer.blender.org/rB72a7f107d84293ceeef92e54362127446dddc9df Cleanup: format === M intern/cycles/device/metal/kernel.mm M source/blender/blenlib/tests/BLI_string_utf8_test.cc === diff --git a/intern/cycles/device/metal/kernel.mm b/intern/cycles/device/metal/kernel.mm index 172c456f0c0..5e0cb6d18f4 100644 --- a/intern/cycles/device/metal/kernel.mm +++ b/intern/cycles/device/metal/kernel.mm @@ -328,8 +328,8 @@ bool MetalKernelPipeline::should_use_binary_archive() const return true; } -/* The remaining kernels are all fast to compile. They may get cached by the system shader cache, - * but will be quick to regenerate if not. */ +/* The remaining kernels are all fast to compile. They may get cached by the system shader + * cache, but will be quick to regenerate if not. */ } return false; } diff --git a/source/blender/blenlib/tests/BLI_string_utf8_test.cc b/source/blender/blenlib/tests/BLI_string_utf8_test.cc index f0c34350e1b..d66bade40ed 100644 --- a/source/blender/blenlib/tests/BLI_string_utf8_test.cc +++ b/source/blender/blenlib/tests/BLI_string_utf8_test.cc @@ -439,7 +439,6 @@ TEST(string, StrCursorStepNextUtf32Simple) EXPECT_FALSE(BLI_str_cursor_step_next_utf32(simple, len, &pos)); } - /* */ /** \name Test #BLI_str_cursor_step_next_utf32_allcombining * \{ */ @@ -857,7 +856,7 @@ TEST(string, StrCursorStepPrevUtf8Invalid) const size_t len = 8; int pos = 8; EXPECT_TRUE(BLI_str_cursor_step_prev_utf8(invalid, len, &pos) && pos == 5); - pos= 7; + pos = 7; EXPECT_TRUE(BLI_str_cursor_step_prev_utf8(invalid, len, &pos) && pos == 5); pos = 6; EXPECT_TRUE(BLI_str_cursor_step_prev_utf8(invalid, len, &pos) && pos == 5); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [552561d46e0] master: Correct sign conversion errors in convexhull_2d.c
Commit: 552561d46e0d3b41a4aff4bb315ea2be628bef58 Author: Campbell Barton Date: Wed Sep 28 09:36:15 2022 +1000 Branches: master https://developer.blender.org/rB552561d46e0d3b41a4aff4bb315ea2be628bef58 Correct sign conversion errors in convexhull_2d.c === M source/blender/blenlib/intern/convexhull_2d.c === diff --git a/source/blender/blenlib/intern/convexhull_2d.c b/source/blender/blenlib/intern/convexhull_2d.c index fee6241a817..9e3fb230d3c 100644 --- a/source/blender/blenlib/intern/convexhull_2d.c +++ b/source/blender/blenlib/intern/convexhull_2d.c @@ -173,8 +173,8 @@ int BLI_convexhull_2d(const float (*points)[2], const int n, int r_points[]) } return n; } - struct PointRef *points_ref = MEM_mallocN(sizeof(*points_ref) * n, __func__); - float(*points_sort)[2] = MEM_mallocN(sizeof(*points_sort) * n, __func__); + struct PointRef *points_ref = MEM_mallocN(sizeof(*points_ref) * (size_t)n, __func__); + float(*points_sort)[2] = MEM_mallocN(sizeof(*points_sort) * (size_t)n, __func__); for (int i = 0; i < n; i++) { points_ref[i].pt = points[i]; @@ -256,14 +256,15 @@ static float BLI_convexhull_aabb_fit_hull_2d(const float (*points_hull)[2], int float BLI_convexhull_aabb_fit_points_2d(const float (*points)[2], int n) { + BLI_assert(n >= 0); float angle = 0.0f; - int *index_map = MEM_mallocN(sizeof(*index_map) * n, __func__); + int *index_map = MEM_mallocN(sizeof(*index_map) * (size_t)n, __func__); int points_hull_num = BLI_convexhull_2d(points, n, index_map); if (points_hull_num > 1) { -float(*points_hull)[2] = MEM_mallocN(sizeof(*points_hull) * points_hull_num, __func__); +float(*points_hull)[2] = MEM_mallocN(sizeof(*points_hull) * (size_t)points_hull_num, __func__); for (int j = 0; j < points_hull_num; j++) { copy_v2_v2(points_hull[j], points[index_map[j]]); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5c93c37678d] master: Cleanup: improve 2D convex hull
Commit: 5c93c37678d16e4c6ee52c579e51fdafb7d0a879 Author: Chris Blackbourn Date: Sun Sep 25 13:09:44 2022 +1300 Branches: master https://developer.blender.org/rB5c93c37678d16e4c6ee52c579e51fdafb7d0a879 Cleanup: improve 2D convex hull Improve correctness, API, comments, memory usage and performance of the 2D convex hull calculation. Pre-requisite for UV packing improvements. Differential Revision: https://developer.blender.org/D16055 === M source/blender/blenlib/BLI_convexhull_2d.h M source/blender/blenlib/intern/convexhull_2d.c M source/blender/python/mathutils/mathutils_geometry.c === diff --git a/source/blender/blenlib/BLI_convexhull_2d.h b/source/blender/blenlib/BLI_convexhull_2d.h index 0b4c3d486fb..f4e4e4d66f1 100644 --- a/source/blender/blenlib/BLI_convexhull_2d.h +++ b/source/blender/blenlib/BLI_convexhull_2d.h @@ -11,43 +11,26 @@ extern "C" { #endif /** - * A.M. Andrew's monotone chain 2D convex hull algorithm. - * - * \param points: An array of 2D points presorted by increasing x and y-coords. - * \param n: The number of points in points. - * \param r_points: An array of the convex hull vertex indices (max is n). - * \returns the number of points in r_points. - */ -int BLI_convexhull_2d_sorted(const float (*points)[2], int n, int r_points[]); -/** - * A.M. Andrew's monotone chain 2D convex hull algorithm. + * Extract 2D convex hull. * * \param points: An array of 2D points. * \param n: The number of points in points. * \param r_points: An array of the convex hull vertex indices (max is n). - * _must_ be allocated as `n * 2` because of how its used internally, - * even though the final result will be no more than \a n in size. - * \returns the number of points in r_points. - */ -int BLI_convexhull_2d(const float (*points)[2], int n, int r_points[]); - -/** - * \return The best angle for fitting the convex hull to an axis aligned bounding box. - * - * Intended to be used with #BLI_convexhull_2d + * \return The number of indices in r_points. * - * \param points_hull: Ordered hull points - * (result of #BLI_convexhull_2d mapped to a contiguous array). + * \note Performance is O(n.log(n)), same as qsort. * - * \note we could return the index of the best edge too if its needed. */ -float BLI_convexhull_aabb_fit_hull_2d(const float (*points_hull)[2], unsigned int n); +int BLI_convexhull_2d(const float (*points)[2], int n, int r_points[/* n */]); + /** - * Wrap #BLI_convexhull_aabb_fit_hull_2d and do the convex hull calculation. + * \return The best angle for fitting the points to an axis aligned bounding box. + * + * \note We could return the index of the best edge too if its needed. * - * \param points: arbitrary 2d points. + * \param points: Arbitrary 2d points. */ -float BLI_convexhull_aabb_fit_points_2d(const float (*points)[2], unsigned int n); +float BLI_convexhull_aabb_fit_points_2d(const float (*points)[2], int n); #ifdef __cplusplus } diff --git a/source/blender/blenlib/intern/convexhull_2d.c b/source/blender/blenlib/intern/convexhull_2d.c index ee5d000b72f..fee6241a817 100644 --- a/source/blender/blenlib/intern/convexhull_2d.c +++ b/source/blender/blenlib/intern/convexhull_2d.c @@ -39,8 +39,9 @@ static float is_left(const float p0[2], const float p1[2], const float p2[2]) return (p1[0] - p0[0]) * (p2[1] - p0[1]) - (p2[0] - p0[0]) * (p1[1] - p0[1]); } -int BLI_convexhull_2d_sorted(const float (*points)[2], const int n, int r_points[]) +static int BLI_convexhull_2d_sorted(const float (*points)[2], const int n, int r_points[]) { + BLI_assert(n >= 2); /* Doesn't handle trivial cases. */ /* the output array r_points[] will be used as the stack */ int bot = 0; int top = -1; /* indices for bottom and top of the stack */ @@ -66,6 +67,7 @@ int BLI_convexhull_2d_sorted(const float (*points)[2], const int n, int r_points r_points[++top] = minmax; } r_points[++top] = minmin; /* add polygon endpoint */ +BLI_assert(top + 1 <= n); return top + 1; } @@ -122,16 +124,18 @@ int BLI_convexhull_2d_sorted(const float (*points)[2], const int n, int r_points } if (points[i][0] == points[r_points[0]][0] && points[i][1] == points[r_points[0]][1]) { + BLI_assert(top + 1 <= n); return top + 1; /* special case (mgomes) */ } r_points[++top] = i; /* push points[i] onto stack */ } - if (minmax != minmin) { + if (minmax != minmin && r_points[0] != minmin) { r_points[++top] = minmin; /* push joining endpoint onto stack */ } + BLI_assert(top + 1 <= n); return top + 1; } @@ -162,35 +166,38 @@ static int pointref_cmp_yx(const void *a_, const void *b_) int BLI_convexhull_2d(const float (*points)[2], const int n, int r_points[]) { - struct PointRef *points_ref = MEM_mallocN(sizeof(*points_ref) * (size_t)n, __func__); - float(*poi
[Bf-blender-cvs] [2ead05d7387] master: Cycles: Add optional per-kernel performance statistics
Commit: 2ead05d73878721703de5d2fe6a07eb9053168aa Author: Nikita Sirgienko Date: Wed Sep 14 15:55:56 2022 +0200 Branches: master https://developer.blender.org/rB2ead05d73878721703de5d2fe6a07eb9053168aa Cycles: Add optional per-kernel performance statistics When verbose level 4 is enabled, Blender prints kernel performance data for Cycles on GPU backends (except Metal that doesn't use debug_enqueue_* methods) for groups of kernels. These changes introduce a new CYCLES_DEBUG_PER_KERNEL_PERFORMANCE environment variable to allow getting timings for each kernels separately and not grouped with others. This is done by adding explicit synchronization after each kernel execution. Differential Revision: https://developer.blender.org/D15971 === M intern/cycles/device/cuda/queue.cpp M intern/cycles/device/hip/queue.cpp M intern/cycles/device/oneapi/queue.cpp M intern/cycles/device/optix/queue.cpp M intern/cycles/device/queue.cpp M intern/cycles/device/queue.h === diff --git a/intern/cycles/device/cuda/queue.cpp b/intern/cycles/device/cuda/queue.cpp index 5912e68a92b..84b0a1e0dd6 100644 --- a/intern/cycles/device/cuda/queue.cpp +++ b/intern/cycles/device/cuda/queue.cpp @@ -79,7 +79,7 @@ bool CUDADeviceQueue::enqueue(DeviceKernel kernel, return false; } - debug_enqueue(kernel, work_size); + debug_enqueue_begin(kernel, work_size); const CUDAContextScope scope(cuda_device_); const CUDADeviceKernel &cuda_kernel = cuda_device_->kernels.get(kernel); @@ -121,6 +121,8 @@ bool CUDADeviceQueue::enqueue(DeviceKernel kernel, 0), "enqueue"); + debug_enqueue_end(); + return !(cuda_device_->have_error()); } diff --git a/intern/cycles/device/hip/queue.cpp b/intern/cycles/device/hip/queue.cpp index 8b3d963a32f..3f8b6267100 100644 --- a/intern/cycles/device/hip/queue.cpp +++ b/intern/cycles/device/hip/queue.cpp @@ -79,7 +79,7 @@ bool HIPDeviceQueue::enqueue(DeviceKernel kernel, return false; } - debug_enqueue(kernel, work_size); + debug_enqueue_begin(kernel, work_size); const HIPContextScope scope(hip_device_); const HIPDeviceKernel &hip_kernel = hip_device_->kernels.get(kernel); @@ -120,6 +120,8 @@ bool HIPDeviceQueue::enqueue(DeviceKernel kernel, 0), "enqueue"); + debug_enqueue_end(); + return !(hip_device_->have_error()); } diff --git a/intern/cycles/device/oneapi/queue.cpp b/intern/cycles/device/oneapi/queue.cpp index 1e822e25f1a..f865b27f976 100644 --- a/intern/cycles/device/oneapi/queue.cpp +++ b/intern/cycles/device/oneapi/queue.cpp @@ -77,7 +77,7 @@ bool OneapiDeviceQueue::enqueue(DeviceKernel kernel, void **args = const_cast(_args.values); - debug_enqueue(kernel, signed_kernel_work_size); + debug_enqueue_begin(kernel, signed_kernel_work_size); assert(signed_kernel_work_size >= 0); size_t kernel_work_size = (size_t)signed_kernel_work_size; @@ -97,6 +97,8 @@ bool OneapiDeviceQueue::enqueue(DeviceKernel kernel, oneapi_device_->oneapi_error_message() + "\""); } + debug_enqueue_end(); + return is_finished_ok; } diff --git a/intern/cycles/device/optix/queue.cpp b/intern/cycles/device/optix/queue.cpp index f0d49ad6f6c..3bc547ed11d 100644 --- a/intern/cycles/device/optix/queue.cpp +++ b/intern/cycles/device/optix/queue.cpp @@ -46,7 +46,7 @@ bool OptiXDeviceQueue::enqueue(DeviceKernel kernel, return false; } - debug_enqueue(kernel, work_size); + debug_enqueue_begin(kernel, work_size); const CUDAContextScope scope(cuda_device_); @@ -131,6 +131,8 @@ bool OptiXDeviceQueue::enqueue(DeviceKernel kernel, 1, 1)); + debug_enqueue_end(); + return !(optix_device->have_error()); } diff --git a/intern/cycles/device/queue.cpp b/intern/cycles/device/queue.cpp index cc0cf0ccf84..8c997b184b6 100644 --- a/intern/cycles/device/queue.cpp +++ b/intern/cycles/device/queue.cpp @@ -12,9 +12,13 @@ CCL_NAMESPACE_BEGIN DeviceQueue::DeviceQueue(Device *device) -: device(device), last_kernels_enqueued_(0), last_sync_time_(0.0) +: device(device), + last_kernels_enqueued_(0), + last_sync_time_(0.0), + is_per_kernel_performance_(false) { DCHECK_NE(device, nullptr); + is_per_kernel_performance_ = getenv("CYCLES_DEBUG_PER_KERNEL_PERFORMANCE"); } DeviceQueue::~DeviceQueue() @@ -33,11 +37,17 @@ DeviceQueue::~DeviceQueue() }); VLOG_DEVICE_STATS << "GPU queue stats:"; +double total_time = 0.0; for (const auto &[mask, time] : stats_sorted) { + total_time += time; VLOG_DEVICE_STATS << " " << std::setfill(' ') << std::setw(10) << std::fixed << std::setprecision(5) << std::right << tim
[Bf-blender-cvs] [aa58f58e46c] master: Fix: Assert in legacy mesh conversion
Commit: aa58f58e46c39750fd0bcc695ff2f70007de380c Author: Hans Goudey Date: Tue Sep 27 14:04:18 2022 -0500 Branches: master https://developer.blender.org/rBaa58f58e46c39750fd0bcc695ff2f70007de380c Fix: Assert in legacy mesh conversion When setting the old face set custom data type, do it in the "layers to write" vector instead of the mesh's poly custom data layers, which weren't "prepared" yet. Otherwise this could make the mesh's custom data typemap invalid. === M source/blender/blenkernel/BKE_mesh_legacy_convert.h M source/blender/blenkernel/intern/mesh.cc M source/blender/blenkernel/intern/mesh_legacy_convert.cc === diff --git a/source/blender/blenkernel/BKE_mesh_legacy_convert.h b/source/blender/blenkernel/BKE_mesh_legacy_convert.h index d3e582ff197..92182f8045b 100644 --- a/source/blender/blenkernel/BKE_mesh_legacy_convert.h +++ b/source/blender/blenkernel/BKE_mesh_legacy_convert.h @@ -9,6 +9,11 @@ #include "BLI_utildefines.h" +#ifdef __cplusplus +# include "BLI_span.hh" +# include "DNA_customdata_types.h" +#endif + #ifdef __cplusplus extern "C" { #endif @@ -17,10 +22,13 @@ struct CustomData; struct Mesh; struct MFace; +#ifdef __cplusplus + /** * Move face sets to the legacy type from a generic type. */ -void BKE_mesh_legacy_face_set_from_generic(struct Mesh *mesh); +void BKE_mesh_legacy_face_set_from_generic( +Mesh *mesh, blender::MutableSpan poly_layers_to_write); /** * Copy face sets to the generic data type from the legacy type. */ @@ -74,6 +82,8 @@ void BKE_mesh_legacy_convert_material_indices_to_mpoly(struct Mesh *mesh); */ void BKE_mesh_legacy_convert_mpoly_to_material_indices(struct Mesh *mesh); +#endif + /** * Recreate #MFace Tessellation. * diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc index dfd023b548b..4d98efde5f9 100644 --- a/source/blender/blenkernel/intern/mesh.cc +++ b/source/blender/blenkernel/intern/mesh.cc @@ -252,7 +252,7 @@ static void mesh_blend_write(BlendWriter *writer, ID *id, const void *id_address BKE_mesh_legacy_convert_selection_layers_to_flags(mesh); BKE_mesh_legacy_convert_material_indices_to_mpoly(mesh); BKE_mesh_legacy_bevel_weight_from_layers(mesh); - BKE_mesh_legacy_face_set_from_generic(mesh); + BKE_mesh_legacy_face_set_from_generic(mesh, poly_layers); BKE_mesh_legacy_edge_crease_from_layers(mesh); /* When converting to the old mesh format, don't save redundant attributes. */ names_to_skip.add_multiple_new({".hide_vert", diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc b/source/blender/blenkernel/intern/mesh_legacy_convert.cc index b68117b7eb2..df3057d9592 100644 --- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc +++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc @@ -922,10 +922,11 @@ void BKE_mesh_add_mface_layers(CustomData *fdata, CustomData *ldata, int total) /** \name Face Set Conversion * \{ */ -void BKE_mesh_legacy_face_set_from_generic(Mesh *mesh) +void BKE_mesh_legacy_face_set_from_generic(Mesh *mesh, + blender::MutableSpan poly_layers) { using namespace blender; - for (CustomDataLayer &layer : MutableSpan(mesh->pdata.layers, mesh->pdata.totlayer)) { + for (CustomDataLayer &layer : poly_layers) { if (StringRef(layer.name) == ".sculpt_face_set") { layer.type = CD_SCULPT_FACE_SETS; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2f0c40c7a27] master: Cleanup: Use signed integers for mesh vertex indices
Commit: 2f0c40c7a27066755f29b2fb3960052ba4587b1f Author: Hans Goudey Date: Tue Sep 27 14:02:22 2022 -0500 Branches: master https://developer.blender.org/rB2f0c40c7a27066755f29b2fb3960052ba4587b1f Cleanup: Use signed integers for mesh vertex indices === M source/blender/blenkernel/BKE_mesh.h M source/blender/blenkernel/intern/mesh.cc M source/blender/editors/sculpt_paint/sculpt.c === diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index de89abf9cf6..0a000f4543a 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -106,7 +106,7 @@ void BKE_mesh_ensure_default_orig_index_customdata_no_check(struct Mesh *mesh); * Find the index of the loop in 'poly' which references vertex, * returns -1 if not found */ -int poly_find_loop_from_vert(const struct MPoly *poly, const struct MLoop *loopstart, uint vert); +int poly_find_loop_from_vert(const struct MPoly *poly, const struct MLoop *loopstart, int vert); /** * Fill \a r_adj with the loop indices in \a poly adjacent to the * vertex. Returns the index of the loop matching vertex, or -1 if the @@ -114,8 +114,8 @@ int poly_find_loop_from_vert(const struct MPoly *poly, const struct MLoop *loops */ int poly_get_adj_loops_from_vert(const struct MPoly *poly, const struct MLoop *mloop, - unsigned int vert, - unsigned int r_adj[2]); + int vert, + int r_adj[2]); /** * Return the index of the edge vert that is not equal to \a v. If diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc index 7079a3e1ae8..dfd023b548b 100644 --- a/source/blender/blenkernel/intern/mesh.cc +++ b/source/blender/blenkernel/intern/mesh.cc @@ -1459,7 +1459,7 @@ void BKE_mesh_auto_smooth_flag_set(Mesh *me, } } -int poly_find_loop_from_vert(const MPoly *poly, const MLoop *loopstart, uint vert) +int poly_find_loop_from_vert(const MPoly *poly, const MLoop *loopstart, int vert) { for (int j = 0; j < poly->totloop; j++, loopstart++) { if (loopstart->v == vert) { @@ -1470,7 +1470,7 @@ int poly_find_loop_from_vert(const MPoly *poly, const MLoop *loopstart, uint ver return -1; } -int poly_get_adj_loops_from_vert(const MPoly *poly, const MLoop *mloop, uint vert, uint r_adj[2]) +int poly_get_adj_loops_from_vert(const MPoly *poly, const MLoop *mloop, int vert, int r_adj[2]) { int corner = poly_find_loop_from_vert(poly, &mloop[poly->loopstart], vert); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index ce00f20b88e..a300edff042 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -799,7 +799,7 @@ static void sculpt_vertex_neighbors_get_faces(SculptSession *ss, continue; } const MPoly *p = &ss->mpoly[vert_map->indices[i]]; -uint f_adj_v[2]; +int f_adj_v[2]; if (poly_get_adj_loops_from_vert(p, ss->mloop, vertex.i, f_adj_v) != -1) { for (int j = 0; j < ARRAY_SIZE(f_adj_v); j += 1) { if (f_adj_v[j] != vertex.i) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f2bad0e49f8] master: Fix T101348: Sculpt smooth brush artifacts with hidden faces
Commit: f2bad0e49f8c36b36f32fb945517a44ca82e3ca1 Author: Hans Goudey Date: Tue Sep 27 14:49:40 2022 -0500 Branches: master https://developer.blender.org/rBf2bad0e49f8c36b36f32fb945517a44ca82e3ca1 Fix T101348: Sculpt smooth brush artifacts with hidden faces The brush mixed up the vert and poly hide layers. === 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 a300edff042..114c2c3839a 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -791,10 +791,9 @@ static void sculpt_vertex_neighbors_get_faces(SculptSession *ss, iter->capacity = SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY; iter->neighbors = iter->neighbors_fixed; iter->neighbor_indices = iter->neighbor_indices_fixed; - const bool *hide_poly = BKE_pbvh_get_vert_hide(ss->pbvh); for (int i = 0; i < vert_map->count; i++) { -if (hide_poly && hide_poly[vert_map->indices[i]]) { +if (ss->hide_poly && ss->hide_poly[vert_map->indices[i]]) { /* Skip connectivity from hidden faces. */ continue; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b145cc9d361] master: Cleanup: Unused variable warning with path guiding turned off
Commit: b145cc9d361e21da3a8a0ff2ef3bad1f8e8fbae6 Author: Hans Goudey Date: Tue Sep 27 15:00:37 2022 -0500 Branches: master https://developer.blender.org/rBb145cc9d361e21da3a8a0ff2ef3bad1f8e8fbae6 Cleanup: Unused variable warning with path guiding turned off === M intern/cycles/integrator/path_trace.cpp === diff --git a/intern/cycles/integrator/path_trace.cpp b/intern/cycles/integrator/path_trace.cpp index 56b8e46ebda..6b033cfd051 100644 --- a/intern/cycles/integrator/path_trace.cpp +++ b/intern/cycles/integrator/path_trace.cpp @@ -1314,6 +1314,9 @@ void PathTrace::set_guiding_params(const GuidingParams &guiding_params, const bo guiding_field_->Reset(); } } +#else + (void)guiding_params; + (void)reset; #endif } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b6ee599d920] master: Cleanup: Use variable and const for sculpt mesh vertex to poly maps
Commit: b6ee599d9205814aacd95a2aa09e1dba47e7494d Author: Hans Goudey Date: Tue Sep 27 13:44:27 2022 -0500 Branches: master https://developer.blender.org/rBb6ee599d9205814aacd95a2aa09e1dba47e7494d Cleanup: Use variable and const for sculpt mesh vertex to poly maps === 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 eb4cc9fd866..ce00f20b88e 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -444,7 +444,7 @@ bool SCULPT_vertex_any_face_visible_get(SculptSession *ss, PBVHVertRef vertex) if (!ss->hide_poly) { return true; } - MeshElemMap *vert_map = &ss->pmap[vertex.i]; + const MeshElemMap *vert_map = &ss->pmap[vertex.i]; for (int j = 0; j < ss->pmap[vertex.i].count; j++) { if (!ss->hide_poly[vert_map->indices[j]]) { return true; @@ -467,8 +467,8 @@ bool SCULPT_vertex_all_faces_visible_get(const SculptSession *ss, PBVHVertRef ve if (!ss->hide_poly) { return true; } - MeshElemMap *vert_map = &ss->pmap[vertex.i]; - for (int j = 0; j < ss->pmap[vertex.i].count; j++) { + const MeshElemMap *vert_map = &ss->pmap[vertex.i]; + for (int j = 0; j < vert_map->count; j++) { if (ss->hide_poly[vert_map->indices[j]]) { return false; } @@ -495,8 +495,8 @@ void SCULPT_vertex_face_set_set(SculptSession *ss, PBVHVertRef vertex, int face_ switch (BKE_pbvh_type(ss->pbvh)) { case PBVH_FACES: { BLI_assert(ss->face_sets != NULL); - MeshElemMap *vert_map = &ss->pmap[vertex.i]; - for (int j = 0; j < ss->pmap[vertex.i].count; j++) { + const MeshElemMap *vert_map = &ss->pmap[vertex.i]; + for (int j = 0; j < vert_map->count; j++) { const int poly_index = vert_map->indices[j]; if (ss->hide_poly && ss->hide_poly[poly_index]) { /* Skip hidden faces connected to the vertex. */ @@ -530,9 +530,9 @@ int SCULPT_vertex_face_set_get(SculptSession *ss, PBVHVertRef vertex) if (!ss->face_sets) { return SCULPT_FACE_SET_NONE; } - MeshElemMap *vert_map = &ss->pmap[vertex.i]; + const MeshElemMap *vert_map = &ss->pmap[vertex.i]; int face_set = 0; - for (int i = 0; i < ss->pmap[vertex.i].count; i++) { + for (int i = 0; i < vert_map->count; i++) { if (ss->face_sets[vert_map->indices[i]] > face_set) { face_set = abs(ss->face_sets[vert_map->indices[i]]); } @@ -561,8 +561,8 @@ bool SCULPT_vertex_has_face_set(SculptSession *ss, PBVHVertRef vertex, int face_ if (!ss->face_sets) { return face_set == SCULPT_FACE_SET_NONE; } - MeshElemMap *vert_map = &ss->pmap[vertex.i]; - for (int i = 0; i < ss->pmap[vertex.i].count; i++) { + const MeshElemMap *vert_map = &ss->pmap[vertex.i]; + for (int i = 0; i < vert_map->count; i++) { if (ss->face_sets[vert_map->indices[i]] == face_set) { return true; } @@ -613,9 +613,9 @@ static bool sculpt_check_unique_face_set_in_base_mesh(SculptSession *ss, int ind if (!ss->face_sets) { return true; } - MeshElemMap *vert_map = &ss->pmap[index]; + const MeshElemMap *vert_map = &ss->pmap[index]; int face_set = -1; - for (int i = 0; i < ss->pmap[index].count; i++) { + for (int i = 0; i < vert_map->count; i++) { if (face_set == -1) { face_set = ss->face_sets[vert_map->indices[i]]; } @@ -634,9 +634,9 @@ static bool sculpt_check_unique_face_set_in_base_mesh(SculptSession *ss, int ind */ static bool sculpt_check_unique_face_set_for_edge_in_base_mesh(SculptSession *ss, int v1, int v2) { - MeshElemMap *vert_map = &ss->pmap[v1]; + const MeshElemMap *vert_map = &ss->pmap[v1]; int p1 = -1, p2 = -1; - for (int i = 0; i < ss->pmap[v1].count; i++) { + for (int i = 0; i < vert_map->count; i++) { const MPoly *p = &ss->mpoly[vert_map->indices[i]]; for (int l = 0; l < p->totloop; l++) { const MLoop *loop = &ss->mloop[p->loopstart + l]; @@ -785,7 +785,7 @@ static void sculpt_vertex_neighbors_get_faces(SculptSession *ss, PBVHVertRef vertex, SculptVertexNeighborIter *iter) { - MeshElemMap *vert_map = &ss->pmap[vertex.i]; + const MeshElemMap *vert_map = &ss->pmap[vertex.i]; iter->size = 0; iter->num_duplicates = 0; iter->capacity = SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY; @@ -793,7 +793,7 @@ static void sculpt_vertex_neighbors_get_faces(SculptSession *ss, iter->neighbor_indices = iter->neighbor_indices_fixed; const bool *hide_poly = BKE_pbvh_get_vert_hide(ss->pbvh); - for (int i = 0; i < ss->pmap[vertex.i].count; i++) { + for (int
[Bf-blender-cvs] [81fa0b15b57] temp-pbvh-vbos: temp-pbvh-vbos: Make requested changes
Commit: 81fa0b15b575a49f1f1c5d25ab8384921807afb9 Author: Joseph Eagar Date: Tue Sep 27 12:27:36 2022 -0700 Branches: temp-pbvh-vbos https://developer.blender.org/rB81fa0b15b575a49f1f1c5d25ab8384921807afb9 temp-pbvh-vbos: Make requested changes Also finished color attribute code, which was missing support for corners and byte colors. === M source/blender/blenkernel/intern/pbvh.c M source/blender/blenlib/BLI_math_vec_types.hh M source/blender/draw/intern/draw_cache_impl_mesh.cc M source/blender/draw/intern/draw_manager_data.c M source/blender/draw/intern/draw_pbvh.cc === diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 9eddb4cd34f..23cefa14a73 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -513,7 +513,7 @@ static void pbvh_build(PBVH *pbvh, BB *cb, BBC *prim_bbc, int totprim) build_sub(pbvh, 0, cb, prim_bbc, 0, totprim); } -static void pbvh_draw_args(PBVH *pbvh, PBVH_GPU_Args *args, PBVHNode *node) +static void pbvh_draw_args_init(PBVH *pbvh, PBVH_GPU_Args *args, PBVHNode *node) { memset((void *)args, 0, sizeof(*args)); @@ -1349,7 +1349,7 @@ static void pbvh_update_draw_buffer_cb(void *__restrict userdata, if (node->flag & PBVH_RebuildDrawBuffers) { PBVH_GPU_Args args; -pbvh_draw_args(pbvh, &args, node); +pbvh_draw_args_init(pbvh, &args, node); node->draw_batches = DRW_pbvh_node_create(&args); } @@ -1360,7 +1360,7 @@ static void pbvh_update_draw_buffer_cb(void *__restrict userdata, if (node->draw_batches) { PBVH_GPU_Args args; - pbvh_draw_args(pbvh, &args, node); + pbvh_draw_args_init(pbvh, &args, node); DRW_pbvh_node_update(node->draw_batches, &args); } } @@ -1406,7 +1406,7 @@ static void pbvh_update_draw_buffers(PBVH *pbvh, PBVHNode **nodes, int totnode, else if ((node->flag & PBVH_UpdateDrawBuffers) && node->draw_batches) { PBVH_GPU_Args args; -pbvh_draw_args(pbvh, &args, node); +pbvh_draw_args_init(pbvh, &args, node); DRW_pbvh_update_pre(node->draw_batches, &args); } } @@ -2834,7 +2834,7 @@ void BKE_pbvh_draw_cb(PBVH *pbvh, for (int i = 0; i < totnode; i++) { PBVHNode *node = nodes[i]; if (!(node->flag & PBVH_FullyHidden)) { - pbvh_draw_args(pbvh, &args, node); + pbvh_draw_args_init(pbvh, &args, node); draw_fn(user_data, node->draw_batches, &args); } diff --git a/source/blender/blenlib/BLI_math_vec_types.hh b/source/blender/blenlib/BLI_math_vec_types.hh index c19317867a9..5916193894b 100644 --- a/source/blender/blenlib/BLI_math_vec_types.hh +++ b/source/blender/blenlib/BLI_math_vec_types.hh @@ -556,6 +556,11 @@ template struct vec_base : public vec_struct_base } }; +using char3 = blender::vec_base; + +using uchar3 = blender::vec_base; +using uchar4 = blender::vec_base; + using int2 = vec_base; using int3 = vec_base; using int4 = vec_base; @@ -564,7 +569,11 @@ using uint2 = vec_base; using uint3 = vec_base; using uint4 = vec_base; +using short3 = blender::vec_base; + using ushort2 = vec_base; +using ushort3 = blender::vec_base; +using ushort4 = blender::vec_base; using float2 = vec_base; using float3 = vec_base; diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.cc b/source/blender/draw/intern/draw_cache_impl_mesh.cc index ee1322846e2..0166c4977d4 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.cc +++ b/source/blender/draw/intern/draw_cache_impl_mesh.cc @@ -62,6 +62,7 @@ #include "draw_subdivision.h" #include "draw_cache_impl.h" /* own include */ +#include "draw_manager.h" #include "mesh_extractors/extract_mesh.hh" @@ -977,12 +978,12 @@ GPUBatch *DRW_mesh_batch_cache_get_edit_mesh_analysis(Mesh *me) return DRW_batch_request(&cache->batch.edit_mesh_analysis); } -extern "C" void DRW_mesh_get_attributes(Object *object, -Mesh *me, -struct GPUMaterial **gpumat_array, -int gpumat_array_len, -DRW_Attributes *r_attrs, -DRW_MeshCDMask *r_cd_needed) +void DRW_mesh_get_attributes(Object *object, + Mesh *me, + struct GPUMaterial **gpumat_array, + int gpumat_array_len, + DRW_Attributes *r_attrs, + DRW_MeshCDMask *r_cd_needed) { DRW_Attributes attrs_needed; drw_attributes_clear(&attrs_needed); @@ -991,8 +992,6 @@ extern "C" void DRW_mesh_get_attributes(Object *object, BLI_assert(gpumat_array_len == cache->mat_len); - ThreadMutex *mesh_render_mutex = (ThreadMutex *)me->ru
[Bf-blender-cvs] [41088e16dfb] temp-pbvh-vbos: Merge branch 'master' into temp-pbvh-vbos
Commit: 41088e16dfb8a3ae57871456175ae37d25dc8bcf Author: Joseph Eagar Date: Tue Sep 27 11:28:45 2022 -0700 Branches: temp-pbvh-vbos https://developer.blender.org/rB41088e16dfb8a3ae57871456175ae37d25dc8bcf Merge branch 'master' into temp-pbvh-vbos === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6637ad54324] temp-pbvh-vbos: Merge branch 'master' into temp-pbvh-vbos
Commit: 6637ad543241211bd49a02bcc83f03eef4f19584 Author: Joseph Eagar Date: Sat Sep 24 13:38:38 2022 -0700 Branches: temp-pbvh-vbos https://developer.blender.org/rB6637ad543241211bd49a02bcc83f03eef4f19584 Merge branch 'master' into temp-pbvh-vbos === === diff --cc source/blender/draw/engines/overlay/overlay_sculpt.cc index e760d66fa6d,ddad1f06537..8f142d68350 --- a/source/blender/draw/engines/overlay/overlay_sculpt.cc +++ b/source/blender/draw/engines/overlay/overlay_sculpt.cc @@@ -53,10 -53,10 +53,10 @@@ void OVERLAY_sculpt_cache_populate(OVER } if (use_pbvh) { -DRW_shgroup_call_sculpt(pd->sculpt_mask_grp, ob, false, true); +DRW_shgroup_call_sculpt(pd->sculpt_mask_grp, ob, false, true, true, false, false); } else { - sculpt_overlays = DRW_mesh_batch_cache_get_sculpt_overlays(ob->data); + sculpt_overlays = DRW_mesh_batch_cache_get_sculpt_overlays(static_cast(ob->data)); if (sculpt_overlays) { DRW_shgroup_call(pd->sculpt_mask_grp, sculpt_overlays, ob); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2c1bc8e4518] temp-sculpt-cavity-mask: temp-sculpt-cavity-mask: Make requested patch changes
Commit: 2c1bc8e45189e8242848cb2c5be5fe357e35b2d5 Author: Joseph Eagar Date: Tue Sep 27 11:25:03 2022 -0700 Branches: temp-sculpt-cavity-mask https://developer.blender.org/rB2c1bc8e45189e8242848cb2c5be5fe357e35b2d5 temp-sculpt-cavity-mask: Make requested patch changes === M release/scripts/startup/bl_ui/properties_paint_common.py M release/scripts/startup/bl_ui/space_view3d_toolbar.py M source/blender/blenkernel/intern/brush.cc M source/blender/editors/sculpt_paint/sculpt.c M source/blender/editors/sculpt_paint/sculpt_automasking.cc M source/blender/editors/sculpt_paint/sculpt_expand.c M source/blender/editors/sculpt_paint/sculpt_filter_color.c M source/blender/editors/sculpt_paint/sculpt_filter_mesh.c M source/blender/editors/sculpt_paint/sculpt_intern.h M source/blender/editors/sculpt_paint/sculpt_ops.c M source/blender/makesrna/RNA_access.h M source/blender/makesrna/intern/rna_brush.c M source/blender/makesrna/intern/rna_internal.h M source/blender/makesrna/intern/rna_sculpt_paint.c === diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index a68b3e208fc..a4a328fce1a 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -947,8 +947,11 @@ def brush_settings_advanced(layout, context, brush, popover=False): col.prop(brush, "use_automasking_cavity_inverted", text="Cavity (Inverted)") col.separator() +col.prop(brush, "automasking_boundary_edges_propagation_steps") if brush.use_automasking_cavity or brush.use_automasking_cavity_inverted: +col.separator() + col.prop(brush, "automasking_cavity_factor", text="Cavity Factor") col.prop(brush, "automasking_cavity_blur_steps", text="Cavity Blur") col.prop(brush, "use_automasking_custom_cavity_curve", text="Use Curve") @@ -956,8 +959,6 @@ def brush_settings_advanced(layout, context, brush, popover=False): if brush.use_automasking_custom_cavity_curve: col.template_curve_mapping(brush, "automasking_cavity_curve") -col.prop(brush, "automasking_boundary_edges_propagation_steps") - layout.separator() # sculpt plane settings diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 94cf23a03f3..2d339e53a96 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -975,8 +975,11 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel): col.prop(sculpt, "use_automasking_cavity_inverted", text="Cavity (Inverted)") col.separator() +col.prop(sculpt.brush, "automasking_boundary_edges_propagation_steps") if sculpt.use_automasking_cavity or sculpt.use_automasking_cavity_inverted: +col.separator() + col2 = col.column() props = col2.operator("sculpt.mask_from_cavity", text="Mask From Cavity") props.use_automask_settings = True @@ -991,8 +994,6 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel): if sculpt.use_automasking_custom_cavity_curve: col2.template_curve_mapping(sculpt, "automasking_cavity_curve") -col2.prop(sculpt.brush, "automasking_boundary_edges_propagation_steps") - class VIEW3D_PT_sculpt_options_gravity(Panel, View3DPaintPanel): bl_context = ".sculpt_mode" # dot on purpose (access from topbar) @@ -1016,7 +1017,7 @@ class VIEW3D_PT_sculpt_options_gravity(Panel, View3DPaintPanel): col.active = capabilities.has_gravity col.prop(sculpt, "gravity", slider=True, text="Factor") col.prop(sculpt, "gravity_object") - + # TODO, move to space_view3d.py class VIEW3D_PT_sculpt_symmetry(Panel, View3DPaintPanel): bl_context = ".sculpt_mode" # dot on purpose (access from topbar) diff --git a/source/blender/blenkernel/intern/brush.cc b/source/blender/blenkernel/intern/brush.cc index f7bbd50aafa..fb8a6785f64 100644 --- a/source/blender/blenkernel/intern/brush.cc +++ b/source/blender/blenkernel/intern/brush.cc @@ -1713,7 +1713,7 @@ void BKE_brush_sculpt_reset(Brush *br) /* Note that sculpt defaults where set when 0.5 was the default (now it's 1.0) * assign this so logic below can remain the same. */ br->alpha = 0.5f; - + /* Brush settings */ switch (br->sculpt_tool) { case SCULPT_TOOL_DRAW_SHARP: diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 588637daab8..de517785a0a 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/edi
[Bf-blender-cvs] [6e6461c84c7] temp-sculpt-cavity-mask: Merge branch 'master' into temp-sculpt-cavity-mask
Commit: 6e6461c84c76f47a169d561bd932011709847d33 Author: Joseph Eagar Date: Tue Sep 27 10:49:47 2022 -0700 Branches: temp-sculpt-cavity-mask https://developer.blender.org/rB6e6461c84c76f47a169d561bd932011709847d33 Merge branch 'master' into temp-sculpt-cavity-mask === === diff --cc source/blender/blenloader/intern/versioning_300.cc index bc8721b2c40,f0ebc6c7942..eb313e31bc1 --- a/source/blender/blenloader/intern/versioning_300.cc +++ b/source/blender/blenloader/intern/versioning_300.cc @@@ -3527,30 -3519,7 +3527,15 @@@ void blo_do_versions_300(FileData *fd, BKE_main_namemap_validate_and_fix(bmain); } + + if (!MAIN_VERSION_ATLEAST(bmain, 304, 1)) { +/* Initialize brush curves sculpt settings. */ +LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) { - if (brush->ob_mode != OB_MODE_SCULPT) { - continue; - } - + brush->automasking_cavity_factor = 0.5f; +} + } + - /** -* Versioning code until next subversion bump goes here. -* -* \note Be sure to check when bumping the version: -* - "versioning_userdef.c", #blo_do_versions_userdef -* - "versioning_userdef.c", #do_versions_theme -* -* \note Keep this message at the bottom of the function. -*/ - { - /* Keep this block, even when empty. */ - + if (!MAIN_VERSION_ATLEAST(bmain, 304, 1)) { /* Image generation information transferred to tiles. */ if (!DNA_struct_elem_find(fd->filesdna, "ImageTile", "int", "gen_x")) { LISTBASE_FOREACH (Image *, ima, &bmain->images) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a84e67adaf5] temp-sculpt-normals-masking: temp-sculpt-normals-masking: Make requested patch changes
Commit: a84e67adaf5475399ff03bfbc6d6325de7d271c8 Author: Joseph Eagar Date: Tue Sep 27 10:46:57 2022 -0700 Branches: temp-sculpt-normals-masking https://developer.blender.org/rBa84e67adaf5475399ff03bfbc6d6325de7d271c8 temp-sculpt-normals-masking: Make requested patch changes === M source/blender/editors/sculpt_paint/sculpt_automasking.cc M source/blender/editors/sculpt_paint/sculpt_transform.c M source/blender/makesrna/intern/rna_brush.c M source/blender/makesrna/intern/rna_sculpt_paint.c === diff --git a/source/blender/editors/sculpt_paint/sculpt_automasking.cc b/source/blender/editors/sculpt_paint/sculpt_automasking.cc index 895f66e97f5..b2a8faa96ba 100644 --- a/source/blender/editors/sculpt_paint/sculpt_automasking.cc +++ b/source/blender/editors/sculpt_paint/sculpt_automasking.cc @@ -516,7 +516,10 @@ void sculpt_normal_occlusion_automasking_fill(AutomaskingCache *automasking, f *= automasking_view_normal_factor(automasking, ss, vertex, &nodedata); } -*(uchar *)SCULPT_vertex_attr_get(vertex, ss->attrs.stroke_id) = ss->stroke_id; +if (ss->attrs.stroke_id) { + *(uchar *)SCULPT_vertex_attr_get(vertex, ss->attrs.stroke_id) = ss->stroke_id; +} + *(float *)SCULPT_vertex_attr_get(vertex, ss->attrs.automasking_factor) = f; } } diff --git a/source/blender/editors/sculpt_paint/sculpt_transform.c b/source/blender/editors/sculpt_paint/sculpt_transform.c index 7fe50398ec8..f841cd14386 100644 --- a/source/blender/editors/sculpt_paint/sculpt_transform.c +++ b/source/blender/editors/sculpt_paint/sculpt_transform.c @@ -67,7 +67,6 @@ void ED_sculpt_init_transform(struct bContext *C, Object *ob, const int mval[2], SCULPT_vertex_random_access_ensure(ss); - /* TODO: make the area normal pixel radius user-configurable? */ SCULPT_filter_cache_init(C, ob, sd, SCULPT_UNDO_COORDS, mval, 5.0); if (sd->transform_mode == SCULPT_TRANSFORM_MODE_RADIUS_ELASTIC) { diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 0e29b23f937..00421dcd97a 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -3211,7 +3211,7 @@ static void rna_def_brush(BlenderRNA *brna) prop, NULL, "automasking_flags", BRUSH_AUTOMASKING_BRUSH_NORMAL); RNA_def_property_ui_text(prop, "Area Normal", - "Only include vertices with similar normal to initial brush dab"); + "Affect only vertices with a similar normal to where the stroke starts"); RNA_def_property_update(prop, 0, "rna_Brush_update"); prop = RNA_def_property(srna, "use_automasking_view_normal", PROP_BOOLEAN, PROP_NONE); @@ -3219,12 +3219,12 @@ static void rna_def_brush(BlenderRNA *brna) prop, NULL, "automasking_flags", BRUSH_AUTOMASKING_VIEW_NORMAL); RNA_def_property_ui_text(prop, "View Normal", - "Mask back facing vertices"); + "Affect only vertices with a normal that faces the viewer"); RNA_def_property_update(prop, 0, "rna_Brush_update"); prop = RNA_def_property(srna, "use_automasking_view_occlusion", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "automasking_flags", BRUSH_AUTOMASKING_VIEW_OCCLUSION); - RNA_def_property_ui_text(prop, "Occlusion", "Mask occluded vertices"); + RNA_def_property_ui_text(prop, "Occlusion", "Only affect vertices that are not occluded by other faces. (Slower performance)"); RNA_def_property_update(prop, 0, "rna_Brush_update"); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 4de31f52c08..ffa0dfe35a9 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -938,7 +938,7 @@ static void rna_def_sculpt(BlenderRNA *brna) RNA_def_property_range(prop, 0.0001f, M_PI); RNA_def_property_ui_text(prop, "Area Normal Limit", - "Angular range that will be affected."); + "The range of angles that will be affected"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); prop = RNA_def_property(srna, "automasking_start_normal_falloff", PROP_FLOAT, PROP_FACTOR); @@ -956,7 +956,7 @@ static void rna_def_sculpt(BlenderRNA *brna) RNA_def_property_range(prop, 0.0001f, M_PI); RNA_def_property_ui_text(prop, "View Normal Limit", - "Angular range that will be affected."); + "The range of angles that will be affected"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETT
[Bf-blender-cvs] [337d21b77d9] temp-sculpt-normals-masking: Merge branch 'master' into temp-sculpt-normals-masking
Commit: 337d21b77d91bb63c88710c5f8f44e8d2db16bb5 Author: Joseph Eagar Date: Tue Sep 27 09:28:27 2022 -0700 Branches: temp-sculpt-normals-masking https://developer.blender.org/rB337d21b77d91bb63c88710c5f8f44e8d2db16bb5 Merge branch 'master' into temp-sculpt-normals-masking === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f69aaf71f82] master: WM: Support opening backup .blend files via drag-drop
Commit: f69aaf71f82ad9c52a8590479dbb20e1c2916f1e Author: Pablo Vazquez Date: Tue Sep 27 19:19:29 2022 +0200 Branches: master https://developer.blender.org/rBf69aaf71f82ad9c52a8590479dbb20e1c2916f1e WM: Support opening backup .blend files via drag-drop Add support for opening Blender backup `.blend` files (`.blend1`, `.blend2`, etc) by dropping them into the window, just like regular .blend files. {F13393482, size=full} Reviewed By: Severin Differential Revision: https://developer.blender.org/D15700 === M source/blender/editors/screen/screen_ops.c === diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index c24850fdad5..e04cf5c6d68 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -5742,7 +5742,7 @@ static void keymap_modal_set(wmKeyConfig *keyconf) static bool blend_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_PATH) { -if (ELEM(drag->icon, ICON_FILE_BLEND, ICON_BLENDER)) { +if (ELEM(drag->icon, ICON_FILE_BLEND, ICON_FILE_BACKUP, ICON_BLENDER)) { return true; } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [447368b4729] master: Fix: OpenPGL related build error on windows
Commit: 447368b472962fc4431f713a7908e26abe3aaf90 Author: Ray Molenkamp Date: Tue Sep 27 10:48:09 2022 -0600 Branches: master https://developer.blender.org/rB447368b472962fc4431f713a7908e26abe3aaf90 Fix: OpenPGL related build error on windows Debug and Release libs are different libs on Windows and will give linker errors when you try to mix and match them. This changes retrieves both libs and fills the OPENPGL_LIBRARIES variable appropriately resolving the linker error. === M intern/cycles/cmake/external_libs.cmake === diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake index ab709b1ca10..184bf7d6ae3 100644 --- a/intern/cycles/cmake/external_libs.cmake +++ b/intern/cycles/cmake/external_libs.cmake @@ -284,7 +284,13 @@ if(WITH_CYCLES_PATH_GUIDING) find_package(openpgl QUIET) if(openpgl_FOUND) -get_target_property(OPENPGL_LIBRARIES openpgl::openpgl LOCATION) +if(WIN32) + get_target_property(OPENPGL_LIBRARIES_RELEASE openpgl::openpgl LOCATION_RELEASE) + get_target_property(OPENPGL_LIBRARIES_DEBUG openpgl::openpgl LOCATION_DEBUG) + set(OPENPGL_LIBRARIES optimized ${OPENPGL_LIBRARIES_RELEASE} debug ${OPENPGL_LIBRARIES_DEBUG}) +else() + get_target_property(OPENPGL_LIBRARIES openpgl::openpgl LOCATION) +endif() get_target_property(OPENPGL_INCLUDE_DIR openpgl::openpgl INTERFACE_INCLUDE_DIRECTORIES) else() set(WITH_CYCLES_PATH_GUIDING OFF) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2b88ee50fb7] master: Cycles: Tweak inlining policy on Metal
Commit: 2b88ee50fb7b3ed7e6c0704eee8b39b404219430 Author: Michael Jones Date: Tue Sep 27 17:01:17 2022 +0100 Branches: master https://developer.blender.org/rB2b88ee50fb7b3ed7e6c0704eee8b39b404219430 Cycles: Tweak inlining policy on Metal This patch optimises the Metal inlining policy. It gives a small speedup (2-3% on M1 Max) with no notable compilation slowdown vs what is already in master. Previously noted compilation slowdowns (as reported in T100102) were caused by forcing inlining for `ccl_device`, but we get better rendering perf by relying on compiler heuristics in these cases. Reviewed By: brecht Differential Revision: https://developer.blender.org/D16081 === M intern/cycles/kernel/device/metal/compat.h === diff --git a/intern/cycles/kernel/device/metal/compat.h b/intern/cycles/kernel/device/metal/compat.h index 130a9ebafae..f689e93e5a2 100644 --- a/intern/cycles/kernel/device/metal/compat.h +++ b/intern/cycles/kernel/device/metal/compat.h @@ -29,28 +29,13 @@ using namespace metal::raytracing; /* Qualifiers */ -/* Inline everything for Apple GPUs. This gives ~1.1x speedup and 10% spill - * reduction for integator_shade_surface. However it comes at the cost of - * longer compile times (~4.5 minutes on M1 Max) and is disabled for that - * reason, until there is a user option to manually enable it. */ - -#if 0 // defined(__KERNEL_METAL_APPLE__) - -# define ccl_device __attribute__((always_inline)) -# define ccl_device_inline __attribute__((always_inline)) -# define ccl_device_forceinline __attribute__((always_inline)) -# define ccl_device_noinline __attribute__((always_inline)) - +#define ccl_device +#define ccl_device_inline ccl_device __attribute__((always_inline)) +#define ccl_device_forceinline ccl_device __attribute__((always_inline)) +#if defined(__KERNEL_METAL_APPLE__) +# define ccl_device_noinline ccl_device #else - -# define ccl_device -# define ccl_device_inline ccl_device -# define ccl_device_forceinline ccl_device -# if defined(__KERNEL_METAL_APPLE__) -#define ccl_device_noinline ccl_device -# else -#define ccl_device_noinline ccl_device __attribute__((noinline)) -# endif +# define ccl_device_noinline ccl_device __attribute__((noinline)) #endif #define ccl_device_noinline_cpu ccl_device ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [fc604a0be3a] master: Cycles: Disable binary archives on macOS < 13.0
Commit: fc604a0be3a9ad1bf7f646dd70d4f106c7df2a75 Author: Michael Jones Date: Tue Sep 27 14:34:37 2022 +0100 Branches: master https://developer.blender.org/rBfc604a0be3a9ad1bf7f646dd70d4f106c7df2a75 Cycles: Disable binary archives on macOS < 13.0 An bug with binary archives was fixed in macOS 13.0 which stops some spurious kernel recompilations. In older macOS versions, falling back on the system shader cache will prevent recompilations in most instances (this is the same behaviour as in Blender 3.1.x and 3.2.x). Reviewed By: brecht Differential Revision: https://developer.blender.org/D16082 === M intern/cycles/device/metal/kernel.mm === diff --git a/intern/cycles/device/metal/kernel.mm b/intern/cycles/device/metal/kernel.mm index 385cb412b06..172c456f0c0 100644 --- a/intern/cycles/device/metal/kernel.mm +++ b/intern/cycles/device/metal/kernel.mm @@ -308,26 +308,29 @@ MetalKernelPipeline *ShaderCache::get_best_pipeline(DeviceKernel kernel, const M bool MetalKernelPipeline::should_use_binary_archive() const { - if (auto str = getenv("CYCLES_METAL_DISABLE_BINARY_ARCHIVES")) { -if (atoi(str) != 0) { - /* Don't archive if we have opted out by env var. */ - return false; + /* Issues with binary archives in older macOS versions. */ + if (@available(macOS 13.0, *)) { +if (auto str = getenv("CYCLES_METAL_DISABLE_BINARY_ARCHIVES")) { + if (atoi(str) != 0) { +/* Don't archive if we have opted out by env var. */ +return false; + } } - } - if (pso_type == PSO_GENERIC) { -/* Archive the generic kernels. */ -return true; - } +if (pso_type == PSO_GENERIC) { + /* Archive the generic kernels. */ + return true; +} - if (device_kernel >= DEVICE_KERNEL_INTEGRATOR_SHADE_BACKGROUND && - device_kernel <= DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW) { -/* Archive all shade kernels - they take a long time to compile. */ -return true; - } +if (device_kernel >= DEVICE_KERNEL_INTEGRATOR_SHADE_BACKGROUND && +device_kernel <= DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW) { + /* Archive all shade kernels - they take a long time to compile. */ + return true; +} - /* The remaining kernels are all fast to compile. They may get cached by the system shader cache, - * but will be quick to regenerate if not. */ +/* The remaining kernels are all fast to compile. They may get cached by the system shader cache, + * but will be quick to regenerate if not. */ + } return false; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [12fdf9069ab] master: BLF: Editing Text with Combining Characters
Commit: 12fdf9069abe3cd2250a9efec6e059eb85ec59d8 Author: Harley Acheson Date: Tue Sep 27 08:39:24 2022 -0700 Branches: master https://developer.blender.org/rB12fdf9069abe3cd2250a9efec6e059eb85ec59d8 BLF: Editing Text with Combining Characters Corrections for caret insertion & movement and deletion for text strings that include non-precomposed diacritical marks (Unicode combining characters). See D15659 for more details and examples. Differential Revision: https://developer.blender.org/D15659 Reviewed by Campbell Barton === M source/blender/blenfont/intern/blf_font.c M source/blender/blenkernel/intern/text.c M source/blender/blenlib/BLI_string_cursor_utf8.h M source/blender/blenlib/intern/string_cursor_utf8.c M source/blender/blenlib/tests/BLI_string_utf8_test.cc M source/blender/editors/curve/editfont.c === diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index cbf656289b5..2ee8cf088aa 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -33,6 +33,7 @@ #include "BLI_path_util.h" #include "BLI_rect.h" #include "BLI_string.h" +#include "BLI_string_cursor_utf8.h" #include "BLI_string_utf8.h" #include "BLI_threads.h" @@ -973,9 +974,16 @@ size_t blf_str_offset_from_cursor_position(struct FontBLF *font, .r_offset = (size_t)-1, }; blf_font_boundbox_foreach_glyph(font, str, str_len, blf_cursor_position_foreach_glyph, &data); + if (data.r_offset == (size_t)-1) { +/* We are to the right of the string, so return position of null terminator. */ data.r_offset = BLI_strnlen(str, str_len); } + else if (BLI_str_utf8_char_width(&str[data.r_offset]) < 1) { +/* This is a combining character (or invalid), so move to previous visible valid char. */ +BLI_str_cursor_step_prev_utf8(str, str_len, (int *)&data.r_offset); + } + return data.r_offset; } diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index c32ab64c478..1a0c0716fcd 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -896,8 +896,7 @@ void txt_move_left(Text *text, const bool sel) (*charp) -= tabsize; } else { - const char *prev = BLI_str_find_prev_char_utf8((*linep)->line + *charp, (*linep)->line); - *charp = prev - (*linep)->line; + BLI_str_cursor_step_prev_utf8((*linep)->line, (*linep)->len, charp); } } @@ -941,7 +940,7 @@ void txt_move_right(Text *text, const bool sel) (*charp) += tabsize; } else { - (*charp) += BLI_str_utf8_size((*linep)->line + *charp); + BLI_str_cursor_step_next_utf8((*linep)->line, (*linep)->len, charp); } } @@ -1757,8 +1756,6 @@ void txt_duplicate_line(Text *text) void txt_delete_char(Text *text) { - uint c = '\n'; - if (!text->curl) { return; } @@ -1778,10 +1775,9 @@ void txt_delete_char(Text *text) } } else { /* Just deleting a char */ -size_t c_len = text->curc; -c = BLI_str_utf8_as_unicode_step(text->curl->line, text->curl->len, &c_len); -c_len -= text->curc; -UNUSED_VARS(c); +int pos = text->curc; +BLI_str_cursor_step_next_utf8(text->curl->line, text->curl->len, &pos); +size_t c_len = pos - text->curc; memmove(text->curl->line + text->curc, text->curl->line + text->curc + c_len, @@ -1805,8 +1801,6 @@ void txt_delete_word(Text *text) void txt_backspace_char(Text *text) { - uint c = '\n'; - if (!text->curl) { return; } @@ -1828,13 +1822,9 @@ void txt_backspace_char(Text *text) txt_pop_sel(text); } else { /* Just backspacing a char */ -const char *prev = BLI_str_find_prev_char_utf8(text->curl->line + text->curc, - text->curl->line); -size_t c_len = prev - text->curl->line; -c = BLI_str_utf8_as_unicode_step(text->curl->line, text->curl->len, &c_len); -c_len -= prev - text->curl->line; - -UNUSED_VARS(c); +int pos = text->curc; +BLI_str_cursor_step_prev_utf8(text->curl->line, text->curl->len, &pos); +size_t c_len = text->curc - pos; /* source and destination overlap, don't use memcpy() */ memmove(text->curl->line + text->curc - c_len, diff --git a/source/blender/blenlib/BLI_string_cursor_utf8.h b/source/blender/blenlib/BLI_string_cursor_utf8.h index 70ba5da8e5a..9c0589b230a 100644 --- a/source/blender/blenlib/BLI_string_cursor_utf8.h +++ b/source/blender/blenlib/BLI_string_cursor_utf8.h @@ -25,6 +25,9 @@ typedef enum eStrCursorJumpDirection { bool BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos); bool BLI_str_cursor_step_prev_utf8(const char *str, size_t maxlen, int *pos); +bool BLI_str_cursor_step_next_utf32(const char32
[Bf-blender-cvs] [697e86a7619] master: View3D: move view3d_draw.c to c++
Commit: 697e86a76199c66267370f0222932b8fcb30dc3d Author: Jacques Lucke Date: Tue Sep 27 17:38:23 2022 +0200 Branches: master https://developer.blender.org/rB697e86a76199c66267370f0222932b8fcb30dc3d View3D: move view3d_draw.c to c++ === M source/blender/editors/space_view3d/CMakeLists.txt R093source/blender/editors/space_view3d/view3d_draw.c source/blender/editors/space_view3d/view3d_draw.cc === diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt index d465460682d..59519fcc0d3 100644 --- a/source/blender/editors/space_view3d/CMakeLists.txt +++ b/source/blender/editors/space_view3d/CMakeLists.txt @@ -31,7 +31,7 @@ set(SRC view3d_buttons.c view3d_camera_control.c view3d_cursor_snap.c - view3d_draw.c + view3d_draw.cc view3d_edit.c view3d_gizmo_armature.c view3d_gizmo_camera.c diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.cc similarity index 93% rename from source/blender/editors/space_view3d/view3d_draw.c rename to source/blender/editors/space_view3d/view3d_draw.cc index d7ee224adff..792421ef4b9 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.cc @@ -10,6 +10,7 @@ #include "BLI_jitter_2d.h" #include "BLI_listbase.h" #include "BLI_math.h" +#include "BLI_math_vector.hh" #include "BLI_rect.h" #include "BLI_string.h" #include "BLI_string_utils.h" @@ -84,6 +85,8 @@ #include "view3d_intern.h" /* own include */ +using blender::float4; + #define M_GOLDEN_RATIO_CONJUGATE 0.618033988749895f #define VIEW3D_OVERLAY_LINEHEIGHT (0.9f * U.widget_unit) @@ -101,7 +104,7 @@ void ED_view3d_update_viewmat(Depsgraph *depsgraph, const rcti *rect, bool offscreen) { - RegionView3D *rv3d = region->regiondata; + RegionView3D *rv3d = static_cast(region->regiondata); /* setup window matrices */ if (winmat) { @@ -122,7 +125,7 @@ void ED_view3d_update_viewmat(Depsgraph *depsgraph, rect_scale[1] = (float)BLI_rcti_size_y(rect) / (float)region->winy; } /* NOTE: calls BKE_object_where_is_calc for camera... */ -view3d_viewmatrix_set(depsgraph, scene, v3d, rv3d, rect ? rect_scale : NULL); +view3d_viewmatrix_set(depsgraph, scene, v3d, rv3d, rect ? rect_scale : nullptr); } /* update utility matrices */ mul_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat); @@ -182,7 +185,7 @@ static void view3d_main_region_setup_view(Depsgraph *depsgraph, const float winmat[4][4], const rcti *rect) { - RegionView3D *rv3d = region->regiondata; + RegionView3D *rv3d = static_cast(region->regiondata); ED_view3d_update_viewmat(depsgraph, scene, v3d, region, viewmat, winmat, rect, false); @@ -198,8 +201,8 @@ static void view3d_main_region_setup_offscreen(Depsgraph *depsgraph, const float viewmat[4][4], const float winmat[4][4]) { - RegionView3D *rv3d = region->regiondata; - ED_view3d_update_viewmat(depsgraph, scene, v3d, region, viewmat, winmat, NULL, true); + RegionView3D *rv3d = static_cast(region->regiondata); + ED_view3d_update_viewmat(depsgraph, scene, v3d, region, viewmat, winmat, nullptr, true); /* set for opengl */ GPU_matrix_projection_set(rv3d->winmat); @@ -215,7 +218,7 @@ static bool view3d_stereo3d_active(wmWindow *win, return false; } - if ((v3d->camera == NULL) || (v3d->camera->type != OB_CAMERA) || rv3d->persp != RV3D_CAMOB) { + if ((v3d->camera == nullptr) || (v3d->camera->type != OB_CAMERA) || rv3d->persp != RV3D_CAMOB) { return false; } @@ -224,8 +227,8 @@ static bool view3d_stereo3d_active(wmWindow *win, return false; break; case STEREO_3D_ID: - /* win will be NULL when calling this from the selection or draw loop. */ - if ((win == NULL) || (WM_stereo3d_enabled(win, true) == false)) { + /* win will be nullptr when calling this from the selection or draw loop. */ + if ((win == nullptr) || (WM_stereo3d_enabled(win, true) == false)) { return false; } if (((scene->r.views_format & SCE_VIEWS_FORMAT_MULTIVIEW) != 0) && @@ -280,7 +283,7 @@ static void view3d_stereo3d_setup( data_eval->shiftx = BKE_camera_multiview_shift_x(&scene->r, v3d->camera, viewname); BKE_camera_multiview_view_matrix(&scene->r, v3d->camera, is_left, viewmat); -view3d_main_region_setup_view(depsgraph, scene, v3d, region, viewmat, NULL, rect); +view3d_main_region_setup_view(depsgraph, scene, v3d, region, viewmat, nullptr, rect); data_eval->shiftx = shiftx; BLI_thread_unloc
[Bf-blender-cvs] [5f7259a0013] master: GPencil: New Outline modifier
Commit: 5f7259a0013bdfeff681b9e80202c0c281937bbd Author: Antonio Vazquez Date: Tue Sep 27 16:42:00 2022 +0200 Branches: master https://developer.blender.org/rB5f7259a0013bdfeff681b9e80202c0c281937bbd GPencil: New Outline modifier This modifier converts any stroke (no fill strokes) into perimeter from camera view. Also, it's possible to define an alternative material for the outline. There is an option to include a target object to manipulate the start point of the strokes. The start point will be the nearest point to the target object. Reviewed By: mendio, frogstomp Maniphest Tasks: T100826 Differential Revision: https://developer.blender.org/D15882 Note: Icon will be updated in T101155 === M source/blender/gpencil_modifiers/CMakeLists.txt M source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h M source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c A source/blender/gpencil_modifiers/intern/MOD_gpenciloutline.c M source/blender/makesdna/DNA_gpencil_modifier_defaults.h M source/blender/makesdna/DNA_gpencil_modifier_types.h M source/blender/makesdna/intern/dna_defaults.c M source/blender/makesrna/intern/rna_gpencil_modifier.c === diff --git a/source/blender/gpencil_modifiers/CMakeLists.txt b/source/blender/gpencil_modifiers/CMakeLists.txt index 5ef9ae1bbc6..8dbac602c06 100644 --- a/source/blender/gpencil_modifiers/CMakeLists.txt +++ b/source/blender/gpencil_modifiers/CMakeLists.txt @@ -47,6 +47,7 @@ set(SRC intern/MOD_gpencilnoise.c intern/MOD_gpenciloffset.c intern/MOD_gpencilopacity.c + intern/MOD_gpenciloutline.c intern/MOD_gpencilshrinkwrap.c intern/MOD_gpencilsimplify.c intern/MOD_gpencilsmooth.c diff --git a/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h b/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h index 9025fecacd8..2f3cf4d2312 100644 --- a/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h +++ b/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h @@ -20,6 +20,7 @@ extern GpencilModifierTypeInfo modifierType_Gpencil_Color; extern GpencilModifierTypeInfo modifierType_Gpencil_Array; extern GpencilModifierTypeInfo modifierType_Gpencil_Build; extern GpencilModifierTypeInfo modifierType_Gpencil_Opacity; +extern GpencilModifierTypeInfo modifierType_Gpencil_Outline; extern GpencilModifierTypeInfo modifierType_Gpencil_Lattice; extern GpencilModifierTypeInfo modifierType_Gpencil_Length; extern GpencilModifierTypeInfo modifierType_Gpencil_Mirror; diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c index bd8fd9f72ad..d4ada842d0b 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c @@ -41,6 +41,7 @@ void gpencil_modifier_type_init(GpencilModifierTypeInfo *types[]) INIT_GP_TYPE(Array); INIT_GP_TYPE(Build); INIT_GP_TYPE(Opacity); + INIT_GP_TYPE(Outline); INIT_GP_TYPE(Lattice); INIT_GP_TYPE(Length); INIT_GP_TYPE(Mirror); diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciloutline.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciloutline.c new file mode 100644 index 000..9a0ee4d9d92 --- /dev/null +++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloutline.c @@ -0,0 +1,342 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright 2022 Blender Foundation. */ + +/** \file + * \ingroup modifiers + */ + +#include + +#include "BLI_utildefines.h" + +#include "BLI_listbase.h" +#include "BLI_math_vector.h" + +#include "BLT_translation.h" + +#include "DNA_defaults.h" +#include "DNA_gpencil_modifier_types.h" +#include "DNA_gpencil_types.h" +#include "DNA_material_types.h" +#include "DNA_object_types.h" +#include "DNA_scene_types.h" +#include "DNA_screen_types.h" + +#include "BKE_context.h" +#include "BKE_gpencil.h" +#include "BKE_gpencil_geom.h" +#include "BKE_gpencil_modifier.h" +#include "BKE_lib_query.h" +#include "BKE_main.h" +#include "BKE_material.h" +#include "BKE_scene.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "BKE_modifier.h" + +#include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" + +#include "MOD_gpencil_modifiertypes.h" +#include "MOD_gpencil_ui_common.h" +#include "MOD_gpencil_util.h" + +static void initData(GpencilModifierData *md) +{ + OutlineGpencilModifierData *gpmd = (OutlineGpencilModifierData *)md; + + BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(gpmd, modifier)); + + MEMCPY_STRUCT_AFTER(gpmd, DNA_struct_default_get(OutlineGpencilModifierData), modifier); +} + +static void copyData(const GpencilModifierData *md, GpencilModifierData *target) +{ + BKE_gpencil_modifier_copydata_generic(md, target); +} + +static void free_old_strokes(Depsgraph *depsgraph,
[Bf-blender-cvs] [75a6d3abf75] master: Cycles: add Path Guiding on CPU through Intel OpenPGL
Commit: 75a6d3abf75f3082adf5240ae34973844c0d9a09 Author: Sebastian Herhoz Date: Wed Sep 21 17:58:34 2022 +0200 Branches: master https://developer.blender.org/rB75a6d3abf75f3082adf5240ae34973844c0d9a09 Cycles: add Path Guiding on CPU through Intel OpenPGL This adds path guiding features into Cycles by integrating Intel's Open Path Guiding Library. It can be enabled in the Sampling > Path Guiding panel in the render properties. This feature helps reduce noise in scenes where finding a path to light is difficult for regular path tracing. The current implementation supports guiding directional sampling decisions on surfaces, when the material contains a least one diffuse component, and in volumes with isotropic and anisotropic Henyey-Greenstein phase functions. On surfaces, the guided sampling decision is proportional to the product of the incident radiance and the normal-oriented cosine lobe and in volumes it is proportional to the product of the incident radiance and the phase function. The incident radiance field of a scene is learned and updated during rendering after each per-frame rendering iteration/progression. At the moment, path guiding is only supported by the CPU backend. Support for GPU backends will be added in future versions of OpenPGL. Ref T92571 Differential Revision: https://developer.blender.org/D15286 === M CMakeLists.txt M build_files/cmake/config/blender_full.cmake M build_files/cmake/config/blender_release.cmake M intern/cycles/CMakeLists.txt M intern/cycles/blender/addon/engine.py M intern/cycles/blender/addon/properties.py M intern/cycles/blender/addon/ui.py M intern/cycles/blender/python.cpp M intern/cycles/blender/sync.cpp M intern/cycles/cmake/external_libs.cmake M intern/cycles/cmake/macros.cmake M intern/cycles/device/cpu/device.cpp M intern/cycles/device/cpu/device_impl.cpp M intern/cycles/device/cpu/device_impl.h M intern/cycles/device/cpu/kernel_thread_globals.cpp M intern/cycles/device/cpu/kernel_thread_globals.h M intern/cycles/device/device.cpp M intern/cycles/device/device.h M intern/cycles/integrator/CMakeLists.txt A intern/cycles/integrator/guiding.h M intern/cycles/integrator/path_trace.cpp M intern/cycles/integrator/path_trace.h M intern/cycles/integrator/path_trace_work.h M intern/cycles/integrator/path_trace_work_cpu.cpp M intern/cycles/integrator/path_trace_work_cpu.h M intern/cycles/integrator/render_scheduler.cpp M intern/cycles/integrator/render_scheduler.h M intern/cycles/kernel/CMakeLists.txt M intern/cycles/kernel/data_template.h M intern/cycles/kernel/device/cpu/globals.h A intern/cycles/kernel/integrator/guiding.h M intern/cycles/kernel/integrator/intersect_closest.h M intern/cycles/kernel/integrator/mnee.h M intern/cycles/kernel/integrator/path_state.h M intern/cycles/kernel/integrator/shade_background.h M intern/cycles/kernel/integrator/shade_light.h M intern/cycles/kernel/integrator/shade_shadow.h M intern/cycles/kernel/integrator/shade_surface.h M intern/cycles/kernel/integrator/shade_volume.h M intern/cycles/kernel/integrator/shadow_state_template.h M intern/cycles/kernel/integrator/state.h M intern/cycles/kernel/integrator/state_template.h M intern/cycles/kernel/integrator/subsurface.h M intern/cycles/kernel/integrator/subsurface_disk.h M intern/cycles/kernel/integrator/subsurface_random_walk.h M intern/cycles/kernel/integrator/surface_shader.h M intern/cycles/kernel/integrator/volume_shader.h M intern/cycles/kernel/types.h M intern/cycles/scene/film.cpp M intern/cycles/scene/integrator.cpp M intern/cycles/scene/integrator.h M intern/cycles/scene/pass.cpp M intern/cycles/scene/scene.cpp M intern/cycles/scene/scene.h M intern/cycles/session/session.cpp M intern/cycles/util/CMakeLists.txt A intern/cycles/util/guiding.h M tests/python/CMakeLists.txt M tests/python/cycles_render_tests.py === diff --git a/CMakeLists.txt b/CMakeLists.txt index ef3309ded48..d8adf6c396f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -429,6 +429,7 @@ mark_as_advanced(WITH_CPU_SIMD) # Cycles option(WITH_CYCLES "Enable Cycles Render Engine" ON) option(WITH_CYCLES_OSL "Build Cycles with OpenShadingLanguage support" ON) +option(WITH_CYCLES_PATH_GUIDING "Build Cycles with path guiding support" ON) option(WITH_CYCLES_EMBREE"Build Cycles with Embree support" ON) option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON) option(WITH_CYCLES_DEBUG "Build Cycles with options useful for debugging (e.g., MIS)" O
[Bf-blender-cvs] [bd249eb4f37] master: Cycles: BSDF changes in preparation of path guiding
Commit: bd249eb4f37e65b2f4b3deef775bb136a2c234d1 Author: Sebastian Herhoz Date: Wed Sep 21 17:46:10 2022 +0200 Branches: master https://developer.blender.org/rBbd249eb4f37e65b2f4b3deef775bb136a2c234d1 Cycles: BSDF changes in preparation of path guiding * Return roughness and IOR for BSDF sampling * Add functions to query IOR and label for given BSDF * Default IOR to 1.0 instead of 0.0 for BSDFs that don't use it * Ensure pdf >= 0.0 in case of numerical precision issues Ref T92571, D15286 === M intern/cycles/kernel/closure/bsdf.h M intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h M intern/cycles/kernel/closure/bsdf_hair.h M intern/cycles/kernel/closure/bsdf_hair_principled.h M intern/cycles/kernel/closure/bsdf_microfacet.h M intern/cycles/kernel/closure/bsdf_microfacet_multi.h M intern/cycles/kernel/closure/bsdf_phong_ramp.h M intern/cycles/kernel/closure/bsdf_reflection.h M intern/cycles/kernel/closure/bsdf_refraction.h M intern/cycles/kernel/integrator/shade_surface.h M intern/cycles/kernel/integrator/surface_shader.h M intern/cycles/kernel/osl/closures_setup.h M intern/cycles/kernel/svm/closure.h === diff --git a/intern/cycles/kernel/closure/bsdf.h b/intern/cycles/kernel/closure/bsdf.h index f0b28ff77c4..d202018be9a 100644 --- a/intern/cycles/kernel/closure/bsdf.h +++ b/intern/cycles/kernel/closure/bsdf.h @@ -105,7 +105,9 @@ ccl_device_inline int bsdf_sample(KernelGlobals kg, float randv, ccl_private Spectrum *eval, ccl_private float3 *omega_in, - ccl_private float *pdf) + ccl_private float *pdf, + ccl_private float2 *sampled_roughness, + ccl_private float *eta) { /* For curves use the smooth normal, particularly for ribbons the geometric * normal gives too much darkening otherwise. */ @@ -115,78 +117,131 @@ ccl_device_inline int bsdf_sample(KernelGlobals kg, switch (sc->type) { case CLOSURE_BSDF_DIFFUSE_ID: label = bsdf_diffuse_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf); + *sampled_roughness = one_float2(); + *eta = 1.0f; break; #if defined(__SVM__) || defined(__OSL__) case CLOSURE_BSDF_OREN_NAYAR_ID: label = bsdf_oren_nayar_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf); + *sampled_roughness = one_float2(); + *eta = 1.0f; break; # ifdef __OSL__ case CLOSURE_BSDF_PHONG_RAMP_ID: - label = bsdf_phong_ramp_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf); + label = bsdf_phong_ramp_sample( + sc, Ng, sd->I, randu, randv, eval, omega_in, pdf, sampled_roughness); + *eta = 1.0f; break; case CLOSURE_BSDF_DIFFUSE_RAMP_ID: label = bsdf_diffuse_ramp_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf); + *sampled_roughness = one_float2(); + *eta = 1.0f; break; # endif case CLOSURE_BSDF_TRANSLUCENT_ID: label = bsdf_translucent_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf); + *sampled_roughness = one_float2(); + *eta = 1.0f; break; case CLOSURE_BSDF_REFLECTION_ID: - label = bsdf_reflection_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf); + label = bsdf_reflection_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf, eta); + *sampled_roughness = zero_float2(); break; case CLOSURE_BSDF_REFRACTION_ID: - label = bsdf_refraction_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf); + label = bsdf_refraction_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf, eta); + *sampled_roughness = zero_float2(); break; case CLOSURE_BSDF_TRANSPARENT_ID: label = bsdf_transparent_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf); + *sampled_roughness = zero_float2(); + *eta = 1.0f; break; case CLOSURE_BSDF_MICROFACET_GGX_ID: case CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID: case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID: case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID: - label = bsdf_microfacet_ggx_sample(kg, sc, Ng, sd->I, randu, randv, eval, omega_in, pdf); + label = bsdf_microfacet_ggx_sample( + kg, sc, Ng, sd->I, randu, randv, eval, omega_in, pdf, sampled_roughness, eta); break; case CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID: case CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID: - label = bsdf_microfacet_multi_ggx_sample( - kg, sc, Ng, sd->I, randu, randv, eval, omega_in, pdf, &sd->lcg_state); + label = bsdf_microfacet_multi_ggx_sample(kg, + sc,
[Bf-blender-cvs] [6d19da0b2d4] master: Cycles: BSDF eval refactor to remove separate reflection/refraction methods
Commit: 6d19da0b2d468f099e0c1f56392ab8a1750d114f Author: Brecht Van Lommel Date: Thu Sep 22 20:03:24 2022 +0200 Branches: master https://developer.blender.org/rB6d19da0b2d468f099e0c1f56392ab8a1750d114f Cycles: BSDF eval refactor to remove separate reflection/refraction methods Simplifies code overall to do it inside the eval function, most of the BSDFs already compute the dot product. The refactoring in bsdf_principled_hair_eval() was needed to avoid a HIP compiler bug. Cause is unclear, just changing the implementation enough is meant to sidestep it. Ref T92571, D15286 === M intern/cycles/kernel/closure/bsdf.h M intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h M intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h M intern/cycles/kernel/closure/bsdf_diffuse.h M intern/cycles/kernel/closure/bsdf_diffuse_ramp.h M intern/cycles/kernel/closure/bsdf_hair.h M intern/cycles/kernel/closure/bsdf_hair_principled.h M intern/cycles/kernel/closure/bsdf_microfacet.h M intern/cycles/kernel/closure/bsdf_microfacet_multi.h M intern/cycles/kernel/closure/bsdf_oren_nayar.h M intern/cycles/kernel/closure/bsdf_phong_ramp.h M intern/cycles/kernel/closure/bsdf_principled_diffuse.h M intern/cycles/kernel/closure/bsdf_principled_sheen.h M intern/cycles/kernel/closure/bsdf_reflection.h M intern/cycles/kernel/closure/bsdf_refraction.h M intern/cycles/kernel/closure/bsdf_toon.h M intern/cycles/kernel/closure/bsdf_transparent.h M intern/cycles/kernel/integrator/mnee.h M intern/cycles/kernel/integrator/shade_surface.h M intern/cycles/kernel/integrator/surface_shader.h === diff --git a/intern/cycles/kernel/closure/bsdf.h b/intern/cycles/kernel/closure/bsdf.h index d202018be9a..71af68aa80e 100644 --- a/intern/cycles/kernel/closure/bsdf.h +++ b/intern/cycles/kernel/closure/bsdf.h @@ -69,7 +69,11 @@ ccl_device_inline float bsdf_get_roughness_squared(ccl_private const ShaderClosu * Yining Karl Li and Brent Burley. */ ccl_device_inline float bump_shadowing_term(float3 Ng, float3 N, float3 I) { - float g = safe_divide(dot(Ng, I), dot(N, I) * dot(Ng, N)); + const float cosNI = dot(N, I); + if (cosNI < 0.0f) { +Ng = -Ng; + } + float g = safe_divide(dot(Ng, I), cosNI * dot(Ng, N)); /* If the incoming light is on the unshadowed side, return full brightness. */ if (g >= 1.0f) { @@ -98,6 +102,12 @@ ccl_device_inline float shift_cos_in(float cos_in, const float frequency_multipl return val; } +ccl_device_inline bool bsdf_is_transmission(ccl_private const ShaderClosure *sc, +const float3 omega_in) +{ + return dot(sc->N, omega_in) < 0.0f; +} + ccl_device_inline int bsdf_sample(KernelGlobals kg, ccl_private ShaderData *sd, ccl_private const ShaderClosure *sc, @@ -264,11 +274,12 @@ ccl_device_inline int bsdf_sample(KernelGlobals kg, const float frequency_multiplier = kernel_data_fetch(objects, sd->object).shadow_terminator_shading_offset; if (frequency_multiplier > 1.0f) { - *eval *= shift_cos_in(dot(*omega_in, sc->N), frequency_multiplier); + const float cosNI = dot(*omega_in, sc->N); + *eval *= shift_cos_in(cosNI, frequency_multiplier); } if (label & LABEL_DIFFUSE) { if (!isequal(sc->N, sd->N)) { -*eval *= bump_shadowing_term((label & LABEL_TRANSMIT) ? -sd->N : sd->N, sc->N, *omega_in); +*eval *= bump_shadowing_term(sd->N, sc->N, *omega_in); } } } @@ -491,7 +502,7 @@ ccl_device_inline int bsdf_label(const KernelGlobals kg, label = LABEL_TRANSMIT | LABEL_GLOSSY; break; case CLOSURE_BSDF_HAIR_PRINCIPLED_ID: - if (is_transmission) + if (bsdf_is_transmission(sc, omega_in)) label = LABEL_TRANSMIT | LABEL_GLOSSY; else label = LABEL_REFLECT | LABEL_GLOSSY; @@ -531,179 +542,104 @@ ccl_device_inline ccl_private ShaderData *sd, ccl_private const ShaderClosure *sc, const float3 omega_in, - const bool is_transmission, ccl_private float *pdf) { Spectrum eval = zero_spectrum(); - if (!is_transmission) { -switch (sc->type) { - case CLOSURE_BSDF_DIFFUSE_ID: -eval = bsdf_diffuse_eval_reflect(sc, sd->I, omega_in, pdf); -break; + switch (sc->type) { +case CLOSURE_BSDF_DIFFUSE_ID: + eval = bsdf_diffuse_eval(sc, sd->I, omega_in, pdf); + break; #if defined(__SVM__) || defined(__OSL__) - case CLOSURE_BSDF_OREN_NAYAR_ID: -eval = bsdf_oren_nayar_eval_reflect(sc, sd->I, omega_in, pdf); -break; +case CLOSURE_BSDF_OREN_NAYAR_ID: + eval = bsdf_oren_nayar_eval(sc, sd->I, omega_in, pdf); +
[Bf-blender-cvs] [39987a890ad] blender-projects-basics: Add create, dummy load function and tests for project settings directory
Commit: 39987a890adf3dbd3ed88f2ec774564881294946 Author: Julian Eisel Date: Tue Sep 27 15:30:02 2022 +0200 Branches: blender-projects-basics https://developer.blender.org/rB39987a890adf3dbd3ed88f2ec774564881294946 Add create, dummy load function and tests for project settings directory === A source/blender/blenkernel/BKE_project_settings.hh M source/blender/blenkernel/CMakeLists.txt A source/blender/blenkernel/intern/project_settings.cc A source/blender/blenkernel/intern/project_settings_test.cc === diff --git a/source/blender/blenkernel/BKE_project_settings.hh b/source/blender/blenkernel/BKE_project_settings.hh new file mode 100644 index 000..536df0dd18e --- /dev/null +++ b/source/blender/blenkernel/BKE_project_settings.hh @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup bke + */ + +#pragma once + +#include + +#include "BLI_string_ref.hh" + +namespace blender::bke { + +class ProjectSettings { + std::string project_root_path_; + + public: + inline static const StringRefNull SETTINGS_DIRNAME = ".blender_project"; + + /** + * Initializes a blender project by creating a .blender_project directory at the given \a + * project_root_path. + * \return True if the settings directory was created, or already existed. False on failure. + */ + static auto create_settings_directory(StringRef project_root_path) -> bool; + + /** + * Read project settings from the given \a project_path, which may be either a project root + * directory or the .blender_project directory. + * \return The read project settings or null in case of failure. + */ + static auto load_from_disk [[nodiscard]] (StringRef project_path) + -> std::unique_ptr; + + explicit ProjectSettings(StringRef project_root_path); + + auto project_root_path [[nodiscard]] () const -> StringRefNull; +}; + +} // namespace blender::bke diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 877407a644c..314f11357c5 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -254,6 +254,7 @@ set(SRC intern/pointcache.c intern/pointcloud.cc intern/preferences.c + intern/project_settings.cc intern/report.c intern/rigidbody.c intern/scene.cc @@ -452,6 +453,7 @@ set(SRC BKE_pointcache.h BKE_pointcloud.h BKE_preferences.h + BKE_project_settings.hh BKE_report.h BKE_rigidbody.h BKE_scene.h @@ -843,6 +845,7 @@ if(WITH_GTESTS) intern/lib_id_remapper_test.cc intern/lib_id_test.cc intern/lib_remap_test.cc +intern/project_settings_test.cc intern/tracking_test.cc ) set(TEST_INC diff --git a/source/blender/blenkernel/intern/project_settings.cc b/source/blender/blenkernel/intern/project_settings.cc new file mode 100644 index 000..8645f0e63d4 --- /dev/null +++ b/source/blender/blenkernel/intern/project_settings.cc @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup bke + */ + +#include "BKE_project_settings.hh" + +#include "BLI_fileops.h" + +namespace blender::bke { + +ProjectSettings::ProjectSettings(StringRef project_root_path) +: project_root_path_(project_root_path) +{ +} + +bool ProjectSettings::create_settings_directory(StringRef project_root_path) +{ + return BLI_dir_create_recursive(std::string(project_root_path + "/" + SETTINGS_DIRNAME).c_str()); +} + +std::unique_ptr ProjectSettings::load_from_disk(StringRef project_path) +{ + if (!BLI_exists(std::string(project_path).c_str())) { +return nullptr; + } + + StringRef project_root_path = project_path; + + const int64_t pos_before_trailing_slash = project_path.find_last_not_of("\\/"); + const StringRef path_no_trailing_slashes = (pos_before_trailing_slash == StringRef::not_found) ? + project_path : + project_path.substr( + 0, pos_before_trailing_slash + 1); + if (path_no_trailing_slashes.endswith(SETTINGS_DIRNAME)) { +project_root_path = project_path.drop_suffix(SETTINGS_DIRNAME.size() + 1); + } + + return std::make_unique(project_root_path); +} + +StringRefNull ProjectSettings::project_root_path() const +{ + return project_root_path_; +} + +} // namespace blender::bke diff --git a/source/blender/blenkernel/intern/project_settings_test.cc b/source/blender/blenkernel/intern/project_settings_test.cc new file mode 100644 index 000..ccd9ca26812 --- /dev/null +++ b/source/blender/blenkernel/intern/project_settings_test.cc @@ -0,0 +1,85 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright 2022 Blender Foundation. All rights reserved. */ + +#include "BKE_appdir.h" +#include "BKE_project_settings.hh" + +#inclu
[Bf-blender-cvs] [715c86d9e58] master: Fix T101231: Console flooded with warnings when fluid type is Domain
Commit: 715c86d9e58f44ed078dd61c1fed45739bf65723 Author: Germano Cavalcante Date: Tue Sep 27 10:11:54 2022 -0300 Branches: master https://developer.blender.org/rB715c86d9e58f44ed078dd61c1fed45739bf65723 Fix T101231: Console flooded with warnings when fluid type is Domain Although rB67e23b4b2967 turned the problem more recurrent, the warning messages in the console always appear when `BKE_fluid_cache_free_all` is called. This is because of a bug in `BLI_filelist_dir_contents` as this function calls `BLI_strdupcat` instead of `BLI_join_dirfile` NOTE: Other places in Blender avoid this problem by making sure to add a `SEP_STR` to the end of the directory. Differential Revision: https://developer.blender.org/D16043 === M source/blender/blenlib/intern/BLI_filelist.c === diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c index 37636ef1cf1..4e532f90fb5 100644 --- a/source/blender/blenlib/intern/BLI_filelist.c +++ b/source/blender/blenlib/intern/BLI_filelist.c @@ -174,10 +174,10 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname) struct direntry *file = &dir_ctx->files[dir_ctx->files_num]; while (dlink) { char fullname[PATH_MAX]; + BLI_join_dirfile(fullname, sizeof(fullname), dirname, dlink->name); memset(file, 0, sizeof(struct direntry)); file->relname = dlink->name; - file->path = BLI_strdupcat(dirname, dlink->name); - BLI_join_dirfile(fullname, sizeof(fullname), dirname, dlink->name); + file->path = BLI_strdup(fullname); if (BLI_stat(fullname, &file->s) != -1) { file->type = file->s.st_mode; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0084b8635f7] master: Fix T101398: Transfer Attribute node still defined in menu
Commit: 0084b8635f7502cce9df242c20c580f4a7b6fc2f Author: Hans Goudey Date: Tue Sep 27 07:49:21 2022 -0500 Branches: master https://developer.blender.org/rB0084b8635f7502cce9df242c20c580f4a7b6fc2f Fix T101398: Transfer Attribute node still defined in menu Removing this item was missed in 837144b4577f161baf1625. === M release/scripts/startup/bl_ui/node_add_menu_geometry.py === diff --git a/release/scripts/startup/bl_ui/node_add_menu_geometry.py b/release/scripts/startup/bl_ui/node_add_menu_geometry.py index 8495dcfbe37..b29e607d413 100644 --- a/release/scripts/startup/bl_ui/node_add_menu_geometry.py +++ b/release/scripts/startup/bl_ui/node_add_menu_geometry.py @@ -14,7 +14,6 @@ class NODE_MT_geometry_node_GEO_ATTRIBUTE(Menu): node_add_menu.add_node_type(layout, "GeometryNodeCaptureAttribute") node_add_menu.add_node_type(layout, "GeometryNodeAttributeDomainSize") node_add_menu.add_node_type(layout, "GeometryNodeAttributeStatistic") -node_add_menu.add_node_type(layout, "GeometryNodeAttributeTransfer") node_add_menu.add_node_type(layout, "GeometryNodeRemoveAttribute") node_add_menu.add_node_type(layout, "GeometryNodeStoreNamedAttribute") ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ed28ba4e999] master: Fix T101393: Vertex Crease operator does not create vertex crease layer
Commit: ed28ba4e999df846c32b68d68173d8d0b0ede977 Author: Philipp Oeser Date: Tue Sep 27 13:12:56 2022 +0200 Branches: master https://developer.blender.org/rBed28ba4e999df846c32b68d68173d8d0b0ede977 Fix T101393: Vertex Crease operator does not create vertex crease layer Typo in rBa8a454287a27 (created layer on edge data instead of vertex data). Maniphest Tasks: T101393 Differential Revision: https://developer.blender.org/D16079 === M source/blender/editors/transform/transform_convert_mesh_vert_cdata.c === diff --git a/source/blender/editors/transform/transform_convert_mesh_vert_cdata.c b/source/blender/editors/transform/transform_convert_mesh_vert_cdata.c index e0b346945c3..59836180166 100644 --- a/source/blender/editors/transform/transform_convert_mesh_vert_cdata.c +++ b/source/blender/editors/transform/transform_convert_mesh_vert_cdata.c @@ -90,8 +90,8 @@ static void createTransMeshVertCData(bContext *UNUSED(C), TransInfo *t) cd_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT); } else { - if (!CustomData_has_layer(&bm->edata, CD_CREASE)) { -BM_data_layer_add(bm, &bm->edata, CD_CREASE); + if (!CustomData_has_layer(&bm->vdata, CD_CREASE)) { +BM_data_layer_add(bm, &bm->vdata, CD_CREASE); } cd_offset = CustomData_get_offset(&bm->vdata, CD_CREASE); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f6664217b32] master: Build: temporarily disable wayland dependency
Commit: f6664217b3214be869afb732d1d5bfc471a88e9a Author: Campbell Barton Date: Tue Sep 27 22:28:55 2022 +1000 Branches: master https://developer.blender.org/rBf6664217b3214be869afb732d1d5bfc471a88e9a Build: temporarily disable wayland dependency This caused problems on centos7, see D16074 for details. === M build_files/build_environment/CMakeLists.txt M build_files/build_environment/cmake/harvest.cmake === diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt index 468a434b887..f44bb1cbf75 100644 --- a/build_files/build_environment/CMakeLists.txt +++ b/build_files/build_environment/CMakeLists.txt @@ -171,7 +171,8 @@ if(UNIX AND NOT APPLE) include(cmake/mesa.cmake) include(cmake/wayland_protocols.cmake) # Can be removed when the build-bot upgrades to v1.20.x or newer. - include(cmake/wayland.cmake) + # DISABLED: (see D16074). + # include(cmake/wayland.cmake) endif() include(cmake/harvest.cmake) diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake index 6c920e651fe..85c823309fb 100644 --- a/build_files/build_environment/cmake/harvest.cmake +++ b/build_files/build_environment/cmake/harvest.cmake @@ -117,7 +117,8 @@ else() harvest(xml2/lib xml2/lib "*.a") harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml") -harvest(wayland/bin wayland/bin "wayland-scanner") +# DISABLED: (see D16074). +# harvest(wayland/bin wayland/bin "wayland-scanner") else() harvest(blosc/lib openvdb/lib "*.a") harvest(xml2/lib opencollada/lib "*.a") ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1cbfe046387] master: Fix: GPencil animated layer transforms evaluate wrong when identity
Commit: 1cbfe0463879fb3dde7e10f151b5ef24008bd211 Author: Philipp Oeser Date: Tue Sep 20 12:11:56 2022 +0200 Branches: master https://developer.blender.org/rB1cbfe0463879fb3dde7e10f151b5ef24008bd211 Fix: GPencil animated layer transforms evaluate wrong when identity Due to (optimization) checks in in `BKE_gpencil_prepare_eval_data` & `BKE_gpencil_update_layer_transforms`, updates were skipped if animation reached exact identity transforms. Now check if the matrix has changed additionally to gain proper updates. Unsure if this is the cheapest way to check for the animated state of layer transforms tbh, but I see similar checks elsewhere. Fixes T101164. Maniphest Tasks: T101164 Differential Revision: https://developer.blender.org/D16018 === M source/blender/blenkernel/intern/gpencil.c M source/blender/blenkernel/intern/gpencil_modifier.c === diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 8d6f8a06e8c..bfffd44e73d 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -2785,11 +2785,14 @@ void BKE_gpencil_update_layer_transforms(const Depsgraph *depsgraph, Object *ob) changed = !equals_m4m4(gpl->inverse, cur_mat); } -/* Calc local layer transform. */ +/* Calc local layer transform. Early out if we have non-animated zero transforms. */ bool transformed = ((!is_zero_v3(gpl->location)) || (!is_zero_v3(gpl->rotation)) || (!is_one_v3(gpl->scale))); +float tmp_mat[4][4]; +loc_eul_size_to_mat4(tmp_mat, gpl->location, gpl->rotation, gpl->scale); +transformed |= !equals_m4m4(gpl->layer_mat, tmp_mat); if (transformed) { - loc_eul_size_to_mat4(gpl->layer_mat, gpl->location, gpl->rotation, gpl->scale); + copy_m4_m4(gpl->layer_mat, tmp_mat); } /* Continue if no transformations are applied to this layer. */ diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c index 8361d8e1849..70b8717abbe 100644 --- a/source/blender/blenkernel/intern/gpencil_modifier.c +++ b/source/blender/blenkernel/intern/gpencil_modifier.c @@ -720,7 +720,14 @@ void BKE_gpencil_prepare_eval_data(Depsgraph *depsgraph, Scene *scene, Object *o do_parent = true; break; } -if ((!is_zero_v3(gpl->location)) || (!is_zero_v3(gpl->rotation)) || (!is_one_v3(gpl->scale))) { + +/* Only do layer transformations for non-zero or animated transforms. */ +bool transformed = ((!is_zero_v3(gpl->location)) || (!is_zero_v3(gpl->rotation)) || +(!is_one_v3(gpl->scale))); +float tmp_mat[4][4]; +loc_eul_size_to_mat4(tmp_mat, gpl->location, gpl->rotation, gpl->scale); +transformed |= !equals_m4m4(gpl->layer_mat, tmp_mat); +if (transformed) { do_transform = true; break; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [30113e54d26] master: Fix curves sculpting in deformed space when using Subdivide node
Commit: 30113e54d262454d3576bed2a0fcf9ee92ca06e5 Author: Philipp Oeser Date: Tue Sep 27 11:51:47 2022 +0200 Branches: master https://developer.blender.org/rB30113e54d262454d3576bed2a0fcf9ee92ca06e5 Fix curves sculpting in deformed space when using Subdivide node Needs a call to remember_deformed_curve_positions_if_necessary, missed in rB1f94b56d7744. Thx @JacquesLucke for the solution! Differential Revision: https://developer.blender.org/D16078 === M source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc === diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc index 919d0056bca..5a1d2461c72 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc @@ -29,6 +29,8 @@ static void node_geo_exec(GeoNodeExecParams params) GeometrySet geometry_set = params.extract_input("Curve"); Field cuts_field = params.extract_input>("Cuts"); + GeometryComponentEditData::remember_deformed_curve_positions_if_necessary(geometry_set); + geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) { if (!geometry_set.has_curves()) { return; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4a60c4746dd] master: Fix T101272: Missing view layer updates handling collections via python.
Commit: 4a60c4746ddf3ebd3bc236ddb678aae5a7fdad6a Author: Jeroen Bakker Date: Tue Sep 27 11:57:34 2022 +0200 Branches: master https://developer.blender.org/rB4a60c4746ddf3ebd3bc236ddb678aae5a7fdad6a Fix T101272: Missing view layer updates handling collections via python. Fixed by ensuring the view layer is up to date. === M source/blender/makesrna/intern/rna_layer.c === diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index ae0366bebad..427a38094be 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -369,6 +369,41 @@ static bool rna_LayerCollection_has_selected_objects(LayerCollection *lc, return false; } +static bool rna_LayerCollection_children_lookupint(struct PointerRNA *ptr, + int key, + struct PointerRNA *r_ptr) +{ + Scene *scene = (Scene *)ptr->owner_id; + LayerCollection *lc = (LayerCollection *)ptr->data; + ViewLayer *view_layer = BKE_view_layer_find_from_collection(scene, lc); + BKE_view_layer_synced_ensure(scene, view_layer); + + LayerCollection *child = BLI_findlink(&lc->layer_collections, key); + if (!child) { +return false; + } + RNA_pointer_create(ptr->owner_id, &RNA_LayerCollection, child, r_ptr); + return true; +} + +static bool rna_LayerCollection_children_lookupstring(struct PointerRNA *ptr, + const char *key, + struct PointerRNA *r_ptr) +{ + Scene *scene = (Scene *)ptr->owner_id; + LayerCollection *lc = (LayerCollection *)ptr->data; + ViewLayer *view_layer = BKE_view_layer_find_from_collection(scene, lc); + BKE_view_layer_synced_ensure(scene, view_layer); + + LISTBASE_FOREACH (LayerCollection *, child, &lc->layer_collections) { +if (STREQ(child->collection->id.name + 2, key)) { + RNA_pointer_create(ptr->owner_id, &RNA_LayerCollection, child, r_ptr); + return true; +} + } + return false; +} + #else static void rna_def_layer_collection(BlenderRNA *brna) @@ -399,6 +434,15 @@ static void rna_def_layer_collection(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "layer_collections", NULL); RNA_def_property_struct_type(prop, "LayerCollection"); RNA_def_property_ui_text(prop, "Children", "Child layer collections"); + RNA_def_property_collection_funcs(prop, +NULL, +NULL, +NULL, +NULL, +NULL, +"rna_LayerCollection_children_lookupint", + "rna_LayerCollection_children_lookupstring", +NULL); /* Restriction flags. */ prop = RNA_def_property(srna, "exclude", PROP_BOOLEAN, PROP_NONE); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9232e2395a0] temp-T97352-3d-texturing-seam-bleeding-b2: Added comment about data structure.
Commit: 9232e2395a05509d5a1863ec425e8f07a373819d Author: Jeroen Bakker Date: Tue Sep 27 11:34:07 2022 +0200 Branches: temp-T97352-3d-texturing-seam-bleeding-b2 https://developer.blender.org/rB9232e2395a05509d5a1863ec425e8f07a373819d Added comment about data structure. === M source/blender/blenkernel/intern/pbvh_uv_islands.hh === diff --git a/source/blender/blenkernel/intern/pbvh_uv_islands.hh b/source/blender/blenkernel/intern/pbvh_uv_islands.hh index 78250c6e840..26a2e9785c9 100644 --- a/source/blender/blenkernel/intern/pbvh_uv_islands.hh +++ b/source/blender/blenkernel/intern/pbvh_uv_islands.hh @@ -7,7 +7,14 @@ * Island. * * \note Similar to `uvedit_islands.cc`, but optimized for PBVH painting without using BMesh for - * performance reasons. Does not support manifold meshes or edges with more than 3 faces. + * performance reasons. Does not support non-manifold meshes or edges with more than 2 faces. + * + * Polygons (face with more than 3 edges) are supported as they are split up to primitives. + * + * \note After the algorithm is stable the OO data structures should be converted back to use DOD + * principles to improve reusability. Currently this is not done (yet) as during implementation it + * was hard to follow when the algorithm evolved during several iterations. At that time we needed + * more flexibility. */ #pragma once ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [cbab7344450] master: Build: add wayland to deps build
Commit: cbab734445060e4dc39a37a7164282910a8fad11 Author: Campbell Barton Date: Tue Sep 27 11:54:35 2022 +1000 Branches: master https://developer.blender.org/rBcbab734445060e4dc39a37a7164282910a8fad11 Build: add wayland to deps build This is needed to ensure and up to date "wayland-scanner" is used, as versions before 1.20.0 generate headers incompatible with dynamic linking (WITH_GHOST_WAYLAND_DYNLOAD). As the centos7 version of wayland is 1.15 so make this part of Blender's dependencies on Linux. We intend to enable Wayland for Blender 3.4 release, this is needed for the build-bot. Reviewed By: brecht Ref D16074 === M build_files/build_environment/CMakeLists.txt M build_files/build_environment/cmake/download.cmake M build_files/build_environment/cmake/harvest.cmake M build_files/build_environment/cmake/versions.cmake A build_files/build_environment/cmake/wayland.cmake M build_files/cmake/platform/platform_unix.cmake === diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt index 8c427c63944..468a434b887 100644 --- a/build_files/build_environment/CMakeLists.txt +++ b/build_files/build_environment/CMakeLists.txt @@ -170,6 +170,8 @@ if(UNIX AND NOT APPLE) include(cmake/libglu.cmake) include(cmake/mesa.cmake) include(cmake/wayland_protocols.cmake) + # Can be removed when the build-bot upgrades to v1.20.x or newer. + include(cmake/wayland.cmake) endif() include(cmake/harvest.cmake) diff --git a/build_files/build_environment/cmake/download.cmake b/build_files/build_environment/cmake/download.cmake index 82f5d8260b7..c5b0c5ede84 100644 --- a/build_files/build_environment/cmake/download.cmake +++ b/build_files/build_environment/cmake/download.cmake @@ -89,6 +89,7 @@ download_source(MESA) download_source(NASM) download_source(XR_OPENXR_SDK) download_source(WL_PROTOCOLS) +download_source(WAYLAND) download_source(ISPC) download_source(GMP) download_source(POTRACE) diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake index e18c22fc4ad..6c920e651fe 100644 --- a/build_files/build_environment/cmake/harvest.cmake +++ b/build_files/build_environment/cmake/harvest.cmake @@ -117,6 +117,7 @@ else() harvest(xml2/lib xml2/lib "*.a") harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml") +harvest(wayland/bin wayland/bin "wayland-scanner") else() harvest(blosc/lib openvdb/lib "*.a") harvest(xml2/lib opencollada/lib "*.a") diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake index a03adcbad7b..a6ff4628325 100644 --- a/build_files/build_environment/cmake/versions.cmake +++ b/build_files/build_environment/cmake/versions.cmake @@ -458,6 +458,12 @@ set(WL_PROTOCOLS_URI https://gitlab.freedesktop.org/wayland/wayland-protocols/-/ set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a) set(WL_PROTOCOLS_HASH_TYPE MD5) +set(WAYLAND_VERSION 1.21.0) +set(WAYLAND_FILE wayland-${WAYLAND_VERSION}.tar.xz) +set(WAYLAND_URI https://wayland.freedesktop.org/releases/wayland-${WAYLAND_VERSION}.tar.xz) +set(WAYLAND_HASH f2653a2293bcd882d756c6a83d278903) +set(WAYLAND_HASH_TYPE MD5) + set(ISPC_VERSION v1.17.0) set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz) set(ISPC_HASH 4f476a3109332a77fe839a9014c60ca9) diff --git a/build_files/build_environment/cmake/wayland.cmake b/build_files/build_environment/cmake/wayland.cmake new file mode 100644 index 000..0f800b2e7eb --- /dev/null +++ b/build_files/build_environment/cmake/wayland.cmake @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +ExternalProject_Add(external_wayland + URL file://${PACKAGE_DIR}/${WAYLAND_FILE} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH ${WAYLAND_HASH_TYPE}=${WAYLAND_HASH} + PREFIX ${BUILD_DIR}/wayland + # Use `-E` so the `PKG_CONFIG_PATH` can be defined to link against our own LIBEXPAT. + CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${LIBDIR}/expat/lib/pkgconfig +meson --prefix ${LIBDIR}/wayland . ../external_wayland + BUILD_COMMAND ninja + INSTALL_COMMAND ninja install +) + +add_dependencies( + external_wayland + external_expat +) diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index f640f7f7650..6ad4547fa00 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -764,7 +764,11 @@ if(WITH_GHOST_WAYLAND) add_definitions(-DWITH_GHOST_WAYLAND_LIBDECOR) endif() -pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner) +if(EXISTS "${LIBDIR}/wayland/bin/wayland-scanner") + set(WAYLAND_SCANNE
[Bf-blender-cvs] [5f6d66c1c5f] master: Cleanup: Fix brace-scalar-init warning
Commit: 5f6d66c1c5f4a704d73a0aed8d13af53cf09bb52 Author: Sergey Sharybin Date: Tue Sep 27 10:19:12 2022 +0200 Branches: master https://developer.blender.org/rB5f6d66c1c5f4a704d73a0aed8d13af53cf09bb52 Cleanup: Fix brace-scalar-init warning === M source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc === diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc index 30b3b65f854..f3c182cd97a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc @@ -27,7 +27,7 @@ using namespace blender::bke::mesh_surface_sample; static void node_declare(NodeDeclarationBuilder &b) { - b.add_input(N_("Mesh")).supported_type({GEO_COMPONENT_TYPE_MESH}); + b.add_input(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH); b.add_input(N_("Value"), "Value_Float").hide_value().supports_field(); b.add_input(N_("Value"), "Value_Int").hide_value().supports_field(); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b6a7541f87c] master: GHOST: exit with an error when GHOST cannot be initialized
Commit: b6a7541f87c5ed07634eb829af3abdb8239aca18 Author: Campbell Barton Date: Tue Sep 27 17:05:08 2022 +1000 Branches: master https://developer.blender.org/rBb6a7541f87c5ed07634eb829af3abdb8239aca18 GHOST: exit with an error when GHOST cannot be initialized When the GHOST back-end Blender was built with isn't supported, Blender would crash on startup without any useful information. This could happen when building X11 only, then running on Wayland. Now show a list of the GHOST back-ends that were attempted and exit with an error code instead of crashing. === M intern/ghost/GHOST_ISystem.h M intern/ghost/intern/GHOST_C-api.cpp M intern/ghost/intern/GHOST_ISystem.cpp M source/blender/windowmanager/intern/wm_playanim.c M source/blender/windowmanager/intern/wm_window.c === diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h index da6233456c3..05ed089809a 100644 --- a/intern/ghost/GHOST_ISystem.h +++ b/intern/ghost/GHOST_ISystem.h @@ -117,9 +117,10 @@ class GHOST_ISystem { public: /** * Creates the one and only system. + * \param verbose: report back-ends that were attempted no back-end could be loaded. * \return An indication of success. */ - static GHOST_TSuccess createSystem(); + static GHOST_TSuccess createSystem(bool verbose); static GHOST_TSuccess createSystemBackground(); /** diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index 0026a33bfc2..69fc6b5f2d0 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -24,7 +24,7 @@ GHOST_SystemHandle GHOST_CreateSystem(void) { - GHOST_ISystem::createSystem(); + GHOST_ISystem::createSystem(true); GHOST_ISystem *system = GHOST_ISystem::getSystem(); return (GHOST_SystemHandle)system; diff --git a/intern/ghost/intern/GHOST_ISystem.cpp b/intern/ghost/intern/GHOST_ISystem.cpp index 13eccf661f5..304d7f0abe6 100644 --- a/intern/ghost/intern/GHOST_ISystem.cpp +++ b/intern/ghost/intern/GHOST_ISystem.cpp @@ -33,8 +33,13 @@ GHOST_ISystem *GHOST_ISystem::m_system = nullptr; GHOST_TBacktraceFn GHOST_ISystem::m_backtrace_fn = nullptr; -GHOST_TSuccess GHOST_ISystem::createSystem() +GHOST_TSuccess GHOST_ISystem::createSystem(bool verbose) { + /* When GHOST fails to start, report the back-ends that were attempted. + * A Verbose argument could be supported in printing isn't always desired. */ + const char *backends_attempted[8] = {nullptr}; + int backends_attempted_num = 0; + GHOST_TSuccess success; if (!m_system) { @@ -52,15 +57,23 @@ GHOST_TSuccess GHOST_ISystem::createSystem() /* Pass. */ #elif defined(WITH_GHOST_X11) && defined(WITH_GHOST_WAYLAND) /* Special case, try Wayland, fall back to X11. */ -try { - m_system = has_wayland_libraries ? new GHOST_SystemWayland() : nullptr; +if (has_wayland_libraries) { + backends_attempted[backends_attempted_num++] = "WAYLAND"; + try { +m_system = new GHOST_SystemWayland(); + } + catch (const std::runtime_error &) { +delete m_system; +m_system = nullptr; + } } -catch (const std::runtime_error &) { - delete m_system; +else { m_system = nullptr; } + if (!m_system) { /* Try to fallback to X11. */ + backends_attempted[backends_attempted_num++] = "X11"; try { m_system = new GHOST_SystemX11(); } @@ -70,6 +83,7 @@ GHOST_TSuccess GHOST_ISystem::createSystem() } } #elif defined(WITH_GHOST_X11) +backends_attempted[backends_attempted_num++] = "X11"; try { m_system = new GHOST_SystemX11(); } @@ -78,14 +92,21 @@ GHOST_TSuccess GHOST_ISystem::createSystem() m_system = nullptr; } #elif defined(WITH_GHOST_WAYLAND) -try { - m_system = has_wayland_libraries ? new GHOST_SystemWayland() : nullptr; +if (has_wayland_libraries) { + backends_attempted[backends_attempted_num++] = "WAYLAND"; + try { +m_system = new GHOST_SystemWayland(); + } + catch (const std::runtime_error &) { +delete m_system; +m_system = nullptr; + } } -catch (const std::runtime_error &) { - delete m_system; +else { m_system = nullptr; } #elif defined(WITH_GHOST_SDL) +backends_attempted[backends_attempted_num++] = "SDL"; try { m_system = new GHOST_SystemSDL(); } @@ -94,10 +115,24 @@ GHOST_TSuccess GHOST_ISystem::createSystem() m_system = nullptr; } #elif defined(WIN32) +backends_attempted[backends_attempted_num++] = "WIN32"; m_system = new GHOST_SystemWin32(); #elif defined(__APPLE__) +backends_attempted[backends_attempted_num++] = "COCOA"; m_system = new GHOST_SystemCocoa(); #endif + +if ((m_system == nullptr) && verbose) { + fpri