Skip to content

Commit

Permalink
Changed py::overload_cast to static_cast
Browse files Browse the repository at this point in the history
Signed-off-by: Bhavye Mathur <[email protected]>
  • Loading branch information
BhavyeMathur committed Mar 27, 2024
1 parent 066b4c5 commit db6fde8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions goopylib/header.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#define _GP_COLOR_SETTER(cls, ...) MAP(GP_TO_COLOR, MAP_LIST(_GP_COLOR_PREFIX, __VA_ARGS__)) self.setColor(MAP_LIST(_GP_COLOR_CAST, __VA_ARGS__))
#define GP_COLOR_SETTER(cls, ...) [Color](_GP_COLOR_SETTER_ARGS(cls, __VA_ARGS__)) { _GP_COLOR_SETTER(cls, __VA_ARGS__); }

#define _GP_COLOR_SETTER1(cls) .def("set_color", py::overload_cast<const gp::Color &>(&cls::setColor))
#define _GP_COLOR_SETTER2(cls) .def("set_color", py::overload_cast<const char *, float>(&cls::setColor), "color"_a, "alpha"_a=1)
#define _GP_COLOR_SETTER3(cls) .def("set_color", py::overload_cast<int, int, int, float>(&cls::setColor), "red"_a, "green"_a, "blue"_a, "alpha"_a=1)
#define _GP_COLOR_SETTER1(cls) .def("set_color", static_cast<void (cls::*)(const gp::Color &)>(&cls::setColor))
#define _GP_COLOR_SETTER2(cls) .def("set_color", static_cast<void (cls::*)(const char *, float)>(&cls::setColor), "color"_a, "alpha"_a=1)
#define _GP_COLOR_SETTER3(cls) .def("set_color", static_cast<void (cls::*)(int, int, int, float)>(&cls::setColor), "red"_a, "green"_a, "blue"_a, "alpha"_a=1)
#define _GP_COLOR_SETTER4(cls, ...) .def("set_color", GP_COLOR_SETTER(cls, __VA_ARGS__))
#define GP_COLOR_SETTERS(cls, ...) _GP_COLOR_SETTER1(cls) _GP_COLOR_SETTER2(cls) _GP_COLOR_SETTER3(cls) _GP_COLOR_SETTER4(cls, __VA_ARGS__)
2 changes: 1 addition & 1 deletion goopylib/objects/line.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ PYBIND11_MODULE(line, m) {
return new gp::Line(v1, v2, thickness);
}), "p1"_a, "p2"_a, "thickness"_a = 3)

GP_COLOR_SETTERS(gp::Line, 1, 2, 3, 4)
GP_COLOR_SETTERS(gp::Quad, 1, 2, 3, 4)
.def("set_color", GP_COLOR_SETTER(gp::Line, 1, 2))

.def_property("transparency",
Expand Down

0 comments on commit db6fde8

Please sign in to comment.