Skip to content

Commit

Permalink
update ImPlot3D (rebased on dev branch at the moment, since project i…
Browse files Browse the repository at this point in the history
…s still new and evolving quickly)
  • Loading branch information
pthom committed Jan 4, 2025
1 parent d109ab2 commit 999a9e3
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
5 changes: 5 additions & 0 deletions bindings/imgui_bundle/implot3d/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,11 @@ def setup_axes_limits(
"""
pass

# IMPLOT3D_API void SetupBoxScale(float x, float y, float z); /* original C++ signature */
def setup_box_scale(x: float, y: float, z: float) -> None:
"""Sets the plot box X/Y/Z scale. A scale of 1.0 is the default. Values greater than 1.0 enlarge the plot, while values between 0.0 and 1.0 shrink it."""
pass

# IMPLOT3D_API void SetupLegend(ImPlot3DLocation location, ImPlot3DLegendFlags flags = 0); /* original C++ signature */
def setup_legend(location: Location, flags: LegendFlags = 0) -> None:
pass
Expand Down
19 changes: 9 additions & 10 deletions bindings/imgui_bundle/implot3d/internal.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -688,14 +688,6 @@ class Axis:
def apply_fit(self) -> None:
"""(private API)"""
pass
# float PlotToNDC(float value) const; /* original C++ signature */
def plot_to_ndc(self, value: float) -> float:
"""(private API)"""
pass
# float NDCToPlot(float value) const; /* original C++ signature */
def ndc_to_plot(self, value: float) -> float:
"""(private API)"""
pass

class Plot:
""" Holds plot state information that must persist after EndPlot"""
Expand All @@ -716,9 +708,11 @@ class Plot:
canvas_rect: ImRect # Frame rectangle reduced by padding
# ImRect PlotRect; /* original C++ signature */
plot_rect: ImRect # Bounding rectangle for the actual plot area
# Rotation & Axes
# Rotation & axes & box
# ImPlot3DQuat Rotation; /* original C++ signature */
rotation: Quat
rotation: Quat # Current rotation quaternion
# ImPlot3DPoint BoxScale; /* original C++ signature */
box_scale: Point # Scale factor for plot box X, Y, Z axes
# Animation
# float AnimationTime; /* original C++ signature */
animation_time: float # Remaining animation time
Expand Down Expand Up @@ -756,6 +750,7 @@ class Plot:
# Rotation = ImPlot3DQuat(0.0f, 0.0f, 0.0f, 1.0f);
# for (int i = 0; i < 3; i++)
# Axes[i] = ImPlot3DAxis();
# BoxScale = ImPlot3DPoint(1.0f, 1.0f, 1.0f);
# AnimationTime = 0.0f;
# RotationAnimationEnd = Rotation;
# SetupLocked = false;
Expand Down Expand Up @@ -807,6 +802,10 @@ class Plot:
def set_range(self, min: Point, max: Point) -> None:
"""(private API)"""
pass
# float GetBoxZoom() const; /* original C++ signature */
def get_box_zoom(self) -> float:
"""(private API)"""
pass

class Context:
# ImPlot3DPlot* CurrentPlot; /* original C++ signature */
Expand Down
5 changes: 5 additions & 0 deletions external/implot3d/bindings/pybind_implot3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ void py_init_module_implot3d(nb::module_& m)
nb::arg("x_min"), nb::arg("x_max"), nb::arg("y_min"), nb::arg("y_max"), nb::arg("z_min"), nb::arg("z_max"), nb::arg("cond") = nb::none(),
" Sets the X/Y/Z axes range limits. If ImPlotCond_Always is used, the axes limits will be locked (shorthand for two calls to SetupAxisLimits)\n---\nPython bindings defaults:\n If cond is None, then its default value will be: Cond_Once");

m.def("setup_box_scale",
ImPlot3D::SetupBoxScale,
nb::arg("x"), nb::arg("y"), nb::arg("z"),
"Sets the plot box X/Y/Z scale. A scale of 1.0 is the default. Values greater than 1.0 enlarge the plot, while values between 0.0 and 1.0 shrink it.");

m.def("setup_legend",
ImPlot3D::SetupLegend, nb::arg("location"), nb::arg("flags") = 0);

Expand Down
13 changes: 4 additions & 9 deletions external/implot3d/bindings/pybind_implot3d_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,6 @@ void py_init_module_implot3d_internal(nb::module_& m)
"(private API)")
.def("apply_fit",
&ImPlot3DAxis::ApplyFit, "(private API)")
.def("plot_to_ndc",
&ImPlot3DAxis::PlotToNDC,
nb::arg("value"),
"(private API)")
.def("ndc_to_plot",
&ImPlot3DAxis::NDCToPlot,
nb::arg("value"),
"(private API)")
;


Expand All @@ -366,7 +358,8 @@ void py_init_module_implot3d_internal(nb::module_& m)
.def_rw("frame_rect", &ImPlot3DPlot::FrameRect, "Outermost bounding rectangle that encapsulates whole the plot/title/padding/etc")
.def_rw("canvas_rect", &ImPlot3DPlot::CanvasRect, "Frame rectangle reduced by padding")
.def_rw("plot_rect", &ImPlot3DPlot::PlotRect, "Bounding rectangle for the actual plot area")
.def_rw("rotation", &ImPlot3DPlot::Rotation, "")
.def_rw("rotation", &ImPlot3DPlot::Rotation, "Current rotation quaternion")
.def_rw("box_scale", &ImPlot3DPlot::BoxScale, "Scale factor for plot box X, Y, Z axes")
.def_rw("animation_time", &ImPlot3DPlot::AnimationTime, "Remaining animation time")
.def_rw("rotation_animation_end", &ImPlot3DPlot::RotationAnimationEnd, "End rotation for animation")
.def_rw("setup_locked", &ImPlot3DPlot::SetupLocked, "")
Expand Down Expand Up @@ -404,6 +397,8 @@ void py_init_module_implot3d_internal(nb::module_& m)
&ImPlot3DPlot::SetRange,
nb::arg("min"), nb::arg("max"),
"(private API)")
.def("get_box_zoom",
&ImPlot3DPlot::GetBoxZoom, "(private API)")
;


Expand Down
2 changes: 1 addition & 1 deletion external/implot3d/implot3d

0 comments on commit 999a9e3

Please sign in to comment.