[Bf-blender-cvs] [3a9ea48b7d9] refactor-mesh-sharp-face-generic: Merge branch 'master' into refactor-mesh-sharp-face-generic
Hans Goudey
noreply at git.blender.org
Tue Jan 10 22:38:48 CET 2023
Commit: 3a9ea48b7d9c7807738f8c4d7301640a6dd447c0
Author: Hans Goudey
Date: Tue Jan 10 16:30:22 2023 -0500
Branches: refactor-mesh-sharp-face-generic
https://developer.blender.org/rB3a9ea48b7d9c7807738f8c4d7301640a6dd447c0
Merge branch 'master' into refactor-mesh-sharp-face-generic
===================================================================
===================================================================
diff --cc release/scripts/startup/bl_ui/properties_data_mesh.py
index 7cca560cfce,61027f68f19..bb1ce7f3ea3
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@@ -605,9 -605,8 +605,8 @@@ class DATA_PT_mesh_attributes(MeshButto
colliding_names = []
for collection in (
# Built-in names.
- {"position": None, "normal": None, "crease": None},
- {"shade_smooth": None, "normal": None, "crease": None},
++ {"normal": None, "crease": None},
mesh.attributes,
- mesh.uv_layers,
None if ob is None else ob.vertex_groups,
):
if collection is None:
diff --cc source/blender/blenkernel/BKE_mesh.h
index 0727cb71b85,4d81507ef1c..f705248e52e
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@@ -475,18 -471,15 +471,18 @@@ void BKE_mesh_ensure_normals_for_displa
*
* Used when defining an empty custom loop normals data layer,
* to keep same shading as with auto-smooth!
+ *
+ * \param sharp_faces: Optional array used to mark specific faces as sharp.
*/
- void BKE_edges_sharp_from_angle_set(struct MEdge *medges,
- int numEdges,
+ void BKE_edges_sharp_from_angle_set(int numEdges,
const struct MLoop *mloops,
int numLoops,
const struct MPoly *mpolys,
const float (*poly_normals)[3],
+ const bool *sharp_faces,
int numPolys,
- float split_angle);
+ float split_angle,
+ bool *sharp_edges);
/**
* References a contiguous loop-fan with normal offset vars.
@@@ -599,9 -592,10 +595,11 @@@ void BKE_lnor_space_custom_normal_to_da
* (splitting edges).
*
* \param loop_to_poly_map: Optional pre-created map from loops to their polygon.
+ * \param sharp_faces: Optional array used to mark specific faces as sharp.
+ * \param sharp_edges: Optional array of sharp edge tags, used to split the evaluated normals on
+ * each side of the edge.
*/
- void BKE_mesh_normals_loop_split(const struct MVert *mverts,
+ void BKE_mesh_normals_loop_split(const float (*vert_positions)[3],
const float (*vert_normals)[3],
int numVerts,
const struct MEdge *medges,
@@@ -629,10 -623,10 +628,11 @@@ void BKE_mesh_normals_loop_custom_set(c
int numLoops,
const struct MPoly *mpolys,
const float (*poly_normals)[3],
+ const bool *sharp_faces,
int numPolys,
+ bool *sharp_edges,
short (*r_clnors_data)[2]);
- void BKE_mesh_normals_loop_custom_from_verts_set(const struct MVert *mverts,
+ void BKE_mesh_normals_loop_custom_from_verts_set(const float (*vert_positions)[3],
const float (*vert_normals)[3],
float (*r_custom_vert_normals)[3],
int numVerts,
@@@ -642,8 -636,8 +642,9 @@@
int numLoops,
const struct MPoly *mpolys,
const float (*poly_normals)[3],
+ const bool *sharp_faces,
int numPolys,
+ bool *sharp_edges,
short (*r_clnors_data)[2]);
/**
diff --cc source/blender/blenkernel/BKE_mesh_legacy_convert.h
index 6e7a5833281,d6689da7d86..d0747a07efe
--- a/source/blender/blenkernel/BKE_mesh_legacy_convert.h
+++ b/source/blender/blenkernel/BKE_mesh_legacy_convert.h
@@@ -91,6 -95,16 +95,19 @@@ void BKE_mesh_legacy_convert_loose_edge
void BKE_mesh_legacy_attribute_flags_to_strings(struct Mesh *mesh);
void BKE_mesh_legacy_attribute_strings_to_flags(struct Mesh *mesh);
++void BKE_mesh_sharp_faces_to_flags(struct Mesh *mesh);
++void BKE_mesh_sharp_faces_from_flags(struct Mesh *mesh);
++
+ void BKE_mesh_legacy_sharp_edges_to_flags(struct Mesh *mesh);
+ void BKE_mesh_legacy_sharp_edges_from_flags(struct Mesh *mesh);
+
+ struct MVert *BKE_mesh_legacy_convert_positions_to_verts(
+ Mesh *mesh,
+ blender::ResourceScope &temp_arrays_for_convert,
+ blender::Vector<CustomDataLayer, 16> &vert_layers_to_write);
+
+ void BKE_mesh_legacy_convert_verts_to_positions(Mesh *mesh);
+
#endif
/**
diff --cc source/blender/blenkernel/intern/customdata.cc
index 60ddb146d57,433c4355d97..e5976727862
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@@ -2379,7 -2301,7 +2301,8 @@@ static bool attribute_stored_in_bmesh_f
".select_edge",
".select_poly",
"material_index",
- "sharp_face");
++ "sharp_face",
+ "sharp_edge");
}
CustomData CustomData_shallow_copy_remove_non_bmesh_attributes(const CustomData *src,
diff --cc source/blender/blenkernel/intern/data_transfer.cc
index 0bf66fdcead,b3b8d4730bb..17da2eb8596
--- a/source/blender/blenkernel/intern/data_transfer.cc
+++ b/source/blender/blenkernel/intern/data_transfer.cc
@@@ -354,10 -361,10 +363,12 @@@ static void data_transfer_dtdata_type_p
num_loops_dst,
polys_dst,
poly_nors_dst,
+ static_cast<const bool *>(CustomData_get_layer_named(
+ &me_dst->pdata, CD_PROP_BOOL, "sharp_face")),
num_polys_dst,
+ sharp_edges.span.data(),
custom_nors_dst);
+ sharp_edges.finish();
}
}
diff --cc source/blender/blenkernel/intern/geometry_component_mesh.cc
index 60bd1598ef2,7b694be324a..f1841ddf32a
--- a/source/blender/blenkernel/intern/geometry_component_mesh.cc
+++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc
@@@ -922,16 -912,16 +912,6 @@@ static void tag_component_positions_cha
}
}
- static float2 get_loop_uv(const MLoopUV &uv)
-static bool get_shade_smooth(const MPoly &mpoly)
--{
- return float2(uv.uv);
- return mpoly.flag & ME_SMOOTH;
--}
--
- static void set_loop_uv(MLoopUV &uv, float2 co)
-static void set_shade_smooth(MPoly &mpoly, bool value)
--{
- copy_v2_v2(uv.uv, co);
- SET_FLAG_FROM_TEST(mpoly.flag, value, ME_SMOOTH);
--}
--
static float get_crease(const float &crease)
{
return crease;
@@@ -1274,18 -1263,31 +1253,30 @@@ static ComponentAttributeProviders crea
nullptr,
AttributeValidator{&material_index_clamp});
- static BuiltinCustomDataLayerProvider shade_smooth(
- "shade_smooth",
- ATTR_DOMAIN_FACE,
- CD_PROP_BOOL,
- CD_MPOLY,
- BuiltinAttributeProvider::NonCreatable,
- BuiltinAttributeProvider::Writable,
- BuiltinAttributeProvider::NonDeletable,
- face_access,
- make_derived_read_attribute<MPoly, bool, get_shade_smooth>,
- make_derived_write_attribute<MPoly, bool, get_shade_smooth, set_shade_smooth>,
- nullptr);
+ static BuiltinCustomDataLayerProvider sharp_face("sharp_face",
+ ATTR_DOMAIN_FACE,
+ CD_PROP_BOOL,
+ CD_PROP_BOOL,
+ BuiltinAttributeProvider::Creatable,
+ BuiltinAttributeProvider::Writable,
+ BuiltinAttributeProvider::Deletable,
+ face_access,
+ make_array_read_attribute<bool>,
+ make_array_write_attribute<bool>,
+ nullptr);
+ static BuiltinCustomDataLayerProvider sharp_edge("sharp_edge",
+ ATTR_DOMAIN_EDGE,
+ CD_PROP_BOOL,
+ CD_PROP_BOOL,
+ BuiltinAttributeProvider::Creatable,
+ BuiltinAttributeProvider::Writable,
+ BuiltinAttributeProvider::Deletable,
+ edge_access,
+ make_array_read_attribute<bool>,
+ make_array_write_attribute<bool>,
+ nullptr);
+
static BuiltinCustomDataLayerProvider crease(
"crease",
ATTR_DOMAIN_EDGE,
@@@ -1314,9 -1308,8 +1297,8 @@@
static CustomDataAttributeProvider face_custom_data(ATTR_DOMAIN_FACE, face_access);
return ComponentAttributeProviders(
- {&position, &id, &material_index, &sharp_face, &normal, &crease},
- {&uvs,
- &corner_custom_data,
- {&position, &id, &material_index, &shade_smooth, &sharp_edge, &normal, &crease},
++ {&position, &id, &material_index,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list