Skip to content

Commit

Permalink
Fix enum location
Browse files Browse the repository at this point in the history
  • Loading branch information
oitel committed Sep 23, 2024
1 parent ec4e3b1 commit 99018a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/wheel/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
import meshlib.mrmeshpy as _mr

# override resources directory to the package's dir
_mr.SystemPath.overrideDirectory(_mr.SystemPathDirectory.Resources, _pathlib.Path(__file__).parent.resolve())
_mr.SystemPath.overrideDirectory(_mr.SystemPath.Directory.Resources, _pathlib.Path(__file__).parent.resolve())
10 changes: 6 additions & 4 deletions source/mrmeshpy/MRPythonSystemPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@ using namespace MR;

MR_ADD_PYTHON_CUSTOM_DEF( mrmeshpy, SystemPath, [] ( pybind11::module_& m )
{
pybind11::enum_<SystemPath::Directory>( m, "SystemPathDirectory" )
auto clsSystemPath = pybind11::class_<SystemPath>( m, "SystemPath" );

pybind11::enum_<SystemPath::Directory>( clsSystemPath, "Directory" )
.value( "Resources", SystemPath::Directory::Resources )
.value( "Fonts", SystemPath::Directory::Fonts )
.value( "Plugins", SystemPath::Directory::Plugins )
.value( "PythonModules", SystemPath::Directory::PythonModules )
;

pybind11::class_<MR::SystemPath>( m, "SystemPath" )
.def_static( "getDirectory", &MR::SystemPath::getDirectory,
clsSystemPath
.def_static( "getDirectory", &SystemPath::getDirectory,
pybind11::arg( "dir" ),
"get the directory path for specified category"
)
.def_static( "overrideDirectory", &MR::SystemPath::overrideDirectory,
.def_static( "overrideDirectory", &SystemPath::overrideDirectory,
pybind11::arg( "dir" ), pybind11::arg( "path" ),
"override the directory path for specified category, useful for custom configurations"
)
Expand Down

0 comments on commit 99018a4

Please sign in to comment.