[Bf-blender-cvs] [744369c1144] master: Cleanup: move doc-strings into headers
Campbell Barton
noreply at git.blender.org
Mon Apr 4 23:50:34 CEST 2022
Commit: 744369c1144ec4c4685732e6fb06ba7b9513de41
Author: Campbell Barton
Date: Tue Apr 5 07:44:36 2022 +1000
Branches: master
https://developer.blender.org/rB744369c1144ec4c4685732e6fb06ba7b9513de41
Cleanup: move doc-strings into headers
- The comment for create_normals was moved into an inline note
as it's not related to the public API.
- Use a colon after parameters.
Ref T92709
===================================================================
M source/blender/io/wavefront_obj/IO_wavefront_obj.cc
M source/blender/io/wavefront_obj/IO_wavefront_obj.h
M source/blender/io/wavefront_obj/importer/importer_mesh_utils.hh
M source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
M source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh
M source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
M source/blender/io/wavefront_obj/importer/obj_import_mesh.hh
M source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
M source/blender/io/wavefront_obj/importer/obj_import_mtl.hh
M source/blender/io/wavefront_obj/importer/obj_import_nurbs.cc
M source/blender/io/wavefront_obj/importer/obj_import_nurbs.hh
M source/blender/io/wavefront_obj/importer/parser_string_utils.cc
M source/blender/io/wavefront_obj/importer/parser_string_utils.hh
===================================================================
diff --git a/source/blender/io/wavefront_obj/IO_wavefront_obj.cc b/source/blender/io/wavefront_obj/IO_wavefront_obj.cc
index c80d10d9efd..fb0b4a1aca9 100644
--- a/source/blender/io/wavefront_obj/IO_wavefront_obj.cc
+++ b/source/blender/io/wavefront_obj/IO_wavefront_obj.cc
@@ -11,18 +11,12 @@
#include "obj_exporter.hh"
#include "obj_importer.hh"
-/**
- * C-interface for the exporter.
- */
void OBJ_export(bContext *C, const OBJExportParams *export_params)
{
SCOPED_TIMER("OBJ export");
blender::io::obj::exporter_main(C, *export_params);
}
-/**
- * Time the full import process.
- */
void OBJ_import(bContext *C, const OBJImportParams *import_params)
{
SCOPED_TIMER(__func__);
diff --git a/source/blender/io/wavefront_obj/IO_wavefront_obj.h b/source/blender/io/wavefront_obj/IO_wavefront_obj.h
index b80c1e073b8..b06ccbf8702 100644
--- a/source/blender/io/wavefront_obj/IO_wavefront_obj.h
+++ b/source/blender/io/wavefront_obj/IO_wavefront_obj.h
@@ -86,8 +86,14 @@ struct OBJImportParams {
eTransformAxisUp up_axis;
};
+/**
+ * Time the full import process.
+ */
void OBJ_import(bContext *C, const struct OBJImportParams *import_params);
+/**
+ * C-interface for the exporter.
+ */
void OBJ_export(bContext *C, const struct OBJExportParams *export_params);
#ifdef __cplusplus
diff --git a/source/blender/io/wavefront_obj/importer/importer_mesh_utils.hh b/source/blender/io/wavefront_obj/importer/importer_mesh_utils.hh
index 6db1fcdb2b7..ce47da3e863 100644
--- a/source/blender/io/wavefront_obj/importer/importer_mesh_utils.hh
+++ b/source/blender/io/wavefront_obj/importer/importer_mesh_utils.hh
@@ -19,10 +19,12 @@ namespace blender::io::obj {
* Given an invalid polygon (with holes or duplicated vertex indices),
* turn it into possibly multiple polygons that are valid.
*
- * \param vertex_coords Polygon's vertex coordinate list.
- * \param face_vertex_indices A polygon's indices that index into the given vertex coordinate list.
- * \return List of polygons with each element containing indices of one polygon.
- * The indices are into face_vertex_indices array.
+ * \param vertex_coords: Polygon's vertex coordinate list.
+ * \param face_vertex_indices: A polygon's indices that index into the given vertex coordinate
+ * list.
+ *
+ * \return List of polygons with each element containing indices of one polygon. The indices
+ * are into face_vertex_indices array.
*/
Vector<Vector<int>> fixup_invalid_polygon(Span<float3> vertex_coords,
Span<int> face_vertex_indices);
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
index d6020895fbf..d3d4e1ba860 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
@@ -318,9 +318,6 @@ static void geom_update_smooth_group(const StringRef rest_line, bool &r_state_sh
}
}
-/**
- * Open OBJ file at the path given in import parameters.
- */
OBJParser::OBJParser(const OBJImportParams &import_params) : import_params_(import_params)
{
obj_file_.open(import_params_.filepath);
@@ -330,10 +327,6 @@ OBJParser::OBJParser(const OBJImportParams &import_params) : import_params_(impo
}
}
-/**
- * Read the OBJ file line by line and create OBJ Geometry instances. Also store all the vertex
- * and UV vertex coordinates in a struct accessible by all objects.
- */
void OBJParser::parse(Vector<std::unique_ptr<Geometry>> &r_all_geometries,
GlobalVertices &r_global_vertices)
{
@@ -499,17 +492,11 @@ static string fix_bad_map_keys(StringRef map_key)
return new_map_key;
}
-/**
- * Return a list of all material library filepaths referenced by the OBJ file.
- */
Span<std::string> OBJParser::mtl_libraries() const
{
return mtl_libraries_;
}
-/**
- * Open material library file.
- */
MTLParser::MTLParser(StringRef mtl_library, StringRefNull obj_filepath)
{
char obj_file_dir[FILE_MAXDIR];
@@ -523,9 +510,6 @@ MTLParser::MTLParser(StringRef mtl_library, StringRefNull obj_filepath)
}
}
-/**
- * Read MTL file(s) and add MTLMaterial instances to the given Map reference.
- */
void MTLParser::parse_and_store(Map<string, std::unique_ptr<MTLMaterial>> &r_mtl_materials)
{
if (!mtl_file_.good()) {
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh
index c8d8b78fc0e..24d026d75e5 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh
+++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh
@@ -22,10 +22,20 @@ class OBJParser {
Vector<std::string> mtl_libraries_;
public:
+ /**
+ * Open OBJ file at the path given in import parameters.
+ */
OBJParser(const OBJImportParams &import_params);
+ /**
+ * Read the OBJ file line by line and create OBJ Geometry instances. Also store all the vertex
+ * and UV vertex coordinates in a struct accessible by all objects.
+ */
void parse(Vector<std::unique_ptr<Geometry>> &r_all_geometries,
GlobalVertices &r_global_vertices);
+ /**
+ * Return a list of all material library filepaths referenced by the OBJ file.
+ */
Span<std::string> mtl_libraries() const;
};
@@ -144,8 +154,14 @@ class MTLParser {
blender::fstream mtl_file_;
public:
+ /**
+ * Open material library file.
+ */
MTLParser(StringRef mtl_library_, StringRefNull obj_filepath);
+ /**
+ * Read MTL file(s) and add MTLMaterial instances to the given Map reference.
+ */
void parse_and_store(Map<std::string, std::unique_ptr<MTLMaterial>> &r_mtl_materials);
};
} // namespace blender::io::obj
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc b/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
index e9dfcf6d091..55b2873a3de 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
@@ -68,11 +68,6 @@ Object *MeshFromGeometry::create_mesh(
return obj;
}
-/**
- * OBJ files coming from the wild might have faces that are invalid in Blender
- * (mostly with duplicate vertex indices, used by some software to indicate
- * polygons with holes). This method tries to fix them up.
- */
void MeshFromGeometry::fixup_invalid_faces()
{
for (int64_t face_idx = 0; face_idx < mesh_geometry_.face_elements_.size(); ++face_idx) {
@@ -158,13 +153,6 @@ void MeshFromGeometry::create_vertices(Mesh *mesh)
}
}
-/**
- * Create polygons for the Mesh, set smooth shading flag, deform group name, assigned material
- * also.
- *
- * It must receive all polygons to be added to the mesh. Remove holes from polygons before
- * calling this.
- */
void MeshFromGeometry::create_polys_loops(Object *obj, Mesh *mesh)
{
/* Will not be used if vertex groups are not imported. */
@@ -245,9 +233,6 @@ void MeshFromGeometry::create_polys_loops(Object *obj, Mesh *mesh)
}
}
-/**
- * Add explicitly imported OBJ edges to the mesh.
- */
void MeshFromGeometry::create_edges(Mesh *mesh)
{
const int64_t tot_edges{mesh_geometry_.edges_.size()};
@@ -268,9 +253,6 @@ void MeshFromGeometry::create_edges(Mesh *mesh)
BKE_mesh_calc_edges_loose(mesh);
}
-/**
- * Add UV layer and vertices to the Mesh.
- */
void MeshFromGeometry::create_uv_verts(Mesh *mesh)
{
if (global_vertices_.uv_vertices.size() <= 0) {
@@ -329,9 +311,6 @@ static Material *get_or_create_material(
return mat;
}
-/**
- * Add materials and the nodetree to the Mesh Object.
- */
void MeshFromGeometry::create_materials(
Main *bmain,
const Map<std::string, std::unique_ptr<MTLMaterial>> &materials,
@@ -348,11 +327,10 @@ void MeshFromGeometry::create_materials(
}
}
-/**
- * Needs more clarity about what is expected in the viewport if the function works.
- */
void MeshFromGeometry::create_normals(Mesh *mesh)
{
+ /* NOTE: Needs more clarity about what is expected in the viewport if the function works. */
+
/* No normal data: nothing to do. */
if (global_vertices_.vertex_normals.is_empty() || !mesh_geometry_.has_vertex_normals_) {
return;
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mesh.hh b/source/blender/io/wavefront_obj/importer/obj_import_mesh.hh
index 86132b94a31..e2cdb4c0721 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_mesh.hh
+++ b/source/blender/io/wavefront_obj/importer/obj_import_mesh.hh
@@ -37,11 +37,32 @@ class MeshFromGeometry : NonMovable, NonCopyable {
const OBJImportParams &import_params);
private:
+ /**
+ * OBJ files coming from the wild might have faces that are invalid in Blender
+ * (mostly with duplicate vertex indices, used by some software to indicate
+ * polygons with holes). This method tries to fix them up.
+ */
void fixup_invalid_faces();
void create_vertices(Mesh *mesh);
+ /**
+ * Create polygons for the Mesh, set smooth shading flag, deform group name,
+ * assigned material also.
+ *
+ * It must receive all polygons to be added to the mesh.
+ * Remove holes from polygons before * calling this.
+ */
void create_polys_loops(Object *obj, Mesh *mesh);
+ /**
+ * Add explicitly imported OBJ edges to the mesh.
+ */
void create_edges(Mesh *mesh);
+ /**
+ * Add UV layer and vertices to the Mesh.
+ */
void create_uv_verts(Mesh *mesh);
+ /**
+ * Add materials and the nodetree to the Mesh Object.
+ */
void create_materials(Main *bmain,
const Map<std::string, std::unique_ptr<MTLMaterial>> &materials,
Map<std::string, Material *> &created_materials,
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
index ef97f58eb0e..88a8c07e325 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
@@ -111,10 +111,6 @@ static bool load_texture_image(Main *bmain, const tex_map_XX &tex_map, bNode *r_
return false;
}
-/**
- * Ini
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list