Skip to content

Commit 7a23be9

Browse files
authored
Merge pull request #1211 from Geode-solutions/fix/python-additional-file
fix(Python): simpler additional file naming
2 parents 5fc4d24 + 60fc93f commit 7a23be9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+141
-204
lines changed

bindings/python/src/basic/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ add_geode_python_binding(
2727
"cell_array.cpp"
2828
"identifier.cpp"
2929
"identifier_builder.cpp"
30+
"input.cpp"
3031
"mapping.cpp"
3132
"percentage.cpp"
3233
"uuid.cpp"

bindings/python/src/basic/basic.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ namespace geode
3333
void define_attribute_manager( pybind11::module& );
3434
void define_identifier( pybind11::module& );
3535
void define_identifier_builder( pybind11::module& );
36+
void define_input( pybind11::module& );
3637
void define_mapping( pybind11::module& );
3738
void define_percentage( pybind11::module& );
3839
void define_uuid( pybind11::module& );
@@ -54,6 +55,7 @@ PYBIND11_MODULE( opengeode_py_basic, module )
5455
geode::define_attribute_manager( module );
5556
geode::define_identifier( module );
5657
geode::define_identifier_builder( module );
58+
geode::define_input( module );
5759
geode::define_mapping( module );
5860
geode::define_percentage( module );
5961
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2019 - 2025 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
#include "../common.hpp"
25+
26+
#include <geode/basic/input.hpp>
27+
28+
namespace geode
29+
{
30+
void define_input( pybind11::module& module )
31+
{
32+
pybind11::class_< AdditionalFile >( module, "AdditionalFile" )
33+
.def_readwrite( "filename", &AdditionalFile::filename )
34+
.def_readwrite( "is_missing", &AdditionalFile::is_missing );
35+
pybind11::class_< AdditionalFiles >( module, "AdditionalFiles" )
36+
.def(
37+
"has_additional_files", &AdditionalFiles::has_additional_files )
38+
.def_readwrite( "optional_files", &AdditionalFiles::optional_files )
39+
.def_readwrite(
40+
"mandatory_files", &AdditionalFiles::mandatory_files );
41+
}
42+
} // namespace geode

bindings/python/src/basic/input.hpp

Lines changed: 0 additions & 55 deletions
This file was deleted.

bindings/python/src/image/io/raster_image.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "../../common.hpp"
2727

2828
#include "../../basic/factory.hpp"
29-
#include "../../basic/input.hpp"
3029

3130
#include <geode/basic/percentage.hpp>
3231

@@ -49,8 +48,6 @@
4948
"is_raster_image_loadable" + std::to_string( dimension ) + "D"; \
5049
module.def( \
5150
loadable##dimension.c_str(), &is_raster_image_loadable< dimension > ); \
52-
PYTHON_INPUT_CLASS( RasterImage##dimension##D, \
53-
"RasterImage" + std::to_string( dimension ) + "D" ); \
5451
const auto check##dimension = \
5552
"raster_image_additional_files" + std::to_string( dimension ) + "D"; \
5653
module.def( check##dimension.c_str(), \

bindings/python/src/mesh/io/edged_curve.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <string>
2525

2626
#include "../../basic/factory.hpp"
27-
#include "../../basic/input.hpp"
2827
#include "../../common.hpp"
2928

3029
#include <geode/mesh/core/edged_curve.hpp>
@@ -48,8 +47,6 @@
4847
"is_edged_curve_loadable" + std::to_string( dimension ) + "D"; \
4948
module.def( \
5049
loadable##dimension.c_str(), &is_edged_curve_loadable< dimension > ); \
51-
PYTHON_INPUT_MESH_CLASS( std::unique_ptr< EdgedCurve< dimension > >, \
52-
"EdgedCurve" + std::to_string( dimension ) + "D" ); \
5350
const auto check##dimension = \
5451
"edged_curve_additional_files" + std::to_string( dimension ) + "D"; \
5552
module.def( check##dimension.c_str(), \

bindings/python/src/mesh/io/graph.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
*/
2323

2424
#include "../../basic/factory.hpp"
25-
#include "../../basic/input.hpp"
2625
#include "../../common.hpp"
2726

2827
#include <geode/mesh/core/graph.hpp>
@@ -40,7 +39,6 @@ namespace geode
4039
module.def( "graph_object_priority", &graph_object_priority );
4140
module.def( "is_graph_loadable", &is_graph_loadable );
4241
module.def( "is_graph_saveable", &is_graph_saveable );
43-
PYTHON_INPUT_MESH_CLASS( std::unique_ptr< Graph >, "Graph" );
4442
module.def( "graph_additional_files", &graph_additional_files );
4543
PYTHON_FACTORY_CLASS( GraphInputFactory );
4644
PYTHON_FACTORY_CLASS( GraphOutputFactory );

bindings/python/src/mesh/io/hybrid_solid.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <string>
2525

2626
#include "../../basic/factory.hpp"
27-
#include "../../basic/input.hpp"
2827
#include "../../common.hpp"
2928

3029
#include <geode/mesh/core/hybrid_solid.hpp>
@@ -48,8 +47,6 @@
4847
"is_hybrid_solid_loadable" + std::to_string( dimension ) + "D"; \
4948
module.def( \
5049
loadable##dimension.c_str(), &is_hybrid_solid_loadable< dimension > ); \
51-
PYTHON_INPUT_MESH_CLASS( std::unique_ptr< HybridSolid< dimension > >, \
52-
"HybridSolid" + std::to_string( dimension ) + "D" ); \
5350
const auto check##dimension = \
5451
"hybrid_solid_additional_files" + std::to_string( dimension ) + "D"; \
5552
module.def( check##dimension.c_str(), \

bindings/python/src/mesh/io/light_regular_grid.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <string>
2525

2626
#include "../../basic/factory.hpp"
27-
#include "../../basic/input.hpp"
2827
#include "../../common.hpp"
2928

3029
#include <geode/mesh/core/light_regular_grid.hpp>
@@ -49,8 +48,6 @@
4948
"is_light_regular_grid_loadable" + std::to_string( dimension ) + "D"; \
5049
module.def( loadable##dimension.c_str(), \
5150
&is_light_regular_grid_loadable< dimension > ); \
52-
PYTHON_INPUT_CLASS( LightRegularGrid< dimension >, \
53-
"LightRegularGrid" + std::to_string( dimension ) + "D" ); \
5451
const auto check##dimension = "light_regular_grid_additional_files" \
5552
+ std::to_string( dimension ) + "D"; \
5653
module.def( check##dimension.c_str(), \

bindings/python/src/mesh/io/point_set.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <string>
2525

2626
#include "../../basic/factory.hpp"
27-
#include "../../basic/input.hpp"
2827
#include "../../common.hpp"
2928

3029
#include <geode/mesh/core/point_set.hpp>
@@ -48,8 +47,6 @@
4847
"is_point_set_loadable" + std::to_string( dimension ) + "D"; \
4948
module.def( \
5049
loadable##dimension.c_str(), &is_point_set_loadable< dimension > ); \
51-
PYTHON_INPUT_MESH_CLASS( std::unique_ptr< PointSet< dimension > >, \
52-
"PointSet" + std::to_string( dimension ) + "D" ); \
5350
const auto check##dimension = \
5451
"point_set_additional_files" + std::to_string( dimension ) + "D"; \
5552
module.def( \

0 commit comments

Comments
 (0)