Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--[WIP][Bugfix]- Address remaining issues with bindings stubgen #2432

Merged
merged 5 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/esp/bindings/AttributesBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void initAttributesBindings(py::module& m) {
.value("LINK_VISUALS",
metadata::attributes::ArticulatedObjectRenderMode::LinkVisuals,
"Render the Articulated Object using urdf-defined "
"meshes/primitives to respresent each link.")
"meshes/primitives to represent each link.")
.value("NONE", metadata::attributes::ArticulatedObjectRenderMode::None,
"Do not render the Articulated Object.")
.value("BOTH", metadata::attributes::ArticulatedObjectRenderMode::Both,
Expand Down Expand Up @@ -1045,7 +1045,7 @@ void initAttributesBindings(py::module& m) {
R"(Whether or not the asset described by this attributes supports texture-based semantics)")
.def_property_readonly(
"num_regions", &SemanticAttributes::getNumRegionInstances,
R"(The nmumber of semantic regions defined by this Semantic Attributes.)");
R"(The number of semantic regions defined by this Semantic Attributes.)");

// ==== StageAttributes ====
py::class_<StageAttributes, AbstractObjectAttributes, StageAttributes::ptr>(
Expand Down
2 changes: 1 addition & 1 deletion src/esp/bindings/AttributesManagersBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ void initAttributesManagersBindings(py::module& m) {
AttributesManager<PbrShaderAttributes, ManagedObjectAccess::Copy>,
PbrShaderAttributesManager::ptr>(
m, "PbrShaderAttributesManager",
R"(Manages PbrShaderAttributess which define PBR shader calculation control values, such as
R"(Manages PbrShaderAttributes which define PBR shader calculation control values, such as
enabling IBL or specifying direct and indirect lighting balance. Can import .pbr_config.json files.)");

// ==== Semantic Attributes Template manager ====
Expand Down
30 changes: 16 additions & 14 deletions src/esp/bindings/GfxBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,41 +240,43 @@ void initGfxBindings(
m, "DebugLineRender")
.def(
"set_line_width", &DebugLineRender::setLineWidth,
R"(Set global line width for all lines rendered by DebugLineRender.)")
R"(Set global line width for all lines rendered by DebugLineRender.)",
"width"_a)
.def(
"push_transform", &DebugLineRender::pushTransform,
R"(Push (multiply) a transform onto the transform stack, affecting all line-drawing until popped. Must be paired with popTransform().)")
R"(Push (multiply) a transform onto the transform stack, affecting all line-drawing until popped. Must be paired with popTransform().)",
"transform"_a)
.def("pop_transform", &DebugLineRender::popTransform,
R"(See push_transform.)")
.def("draw_box", &DebugLineRender::drawBox,
R"(Draw a box in world-space or local-space (see pushTransform).)")
.def(
"draw_circle", &DebugLineRender::drawCircle, "translation"_a,
"radius"_a, "color"_a, "num_segments"_a = 24,
"normal"_a = Magnum::Vector3{0.0, 1.0, 0.0},
R"(Draw a circle in world-space or local-space (see pushTransform). The circle is an approximation; see numSegments.)")
"draw_circle", &DebugLineRender::drawCircle,
R"(Draw a circle in world-space or local-space (see pushTransform). The circle is an approximation; see numSegments.)",
"translation"_a, "radius"_a, "color"_a, "num_segments"_a = 24,
"normal"_a = Magnum::Vector3{0.0, 1.0, 0.0})
.def(
"draw_transformed_line",
py::overload_cast<const Magnum::Vector3&, const Magnum::Vector3&,
const Magnum::Color4&, const Magnum::Color4&>(
const Magnum::Color4&>(
&DebugLineRender::drawTransformedLine),
"from"_a, "to"_a, "from_color"_a, "to_color"_a,
R"(Draw a line segment in world-space or local-space (see pushTransform) with interpolated color.)")
R"(Draw a line segment in world-space or local-space (see pushTransform).)",
"fromPt"_a, "toPt"_a, "color"_a)
.def(
"draw_transformed_line",
py::overload_cast<const Magnum::Vector3&, const Magnum::Vector3&,
const Magnum::Color4&>(
const Magnum::Color4&, const Magnum::Color4&>(
&DebugLineRender::drawTransformedLine),
"from"_a, "to"_a, "color"_a,
R"(Draw a line segment in world-space or local-space (see pushTransform).)")
R"(Draw a line segment in world-space or local-space (see pushTransform) with interpolated color.)",
"fromPt"_a, "toPt"_a, "from_color"_a, "to_color"_a)
.def(
"draw_path_with_endpoint_circles",
py::overload_cast<const std::vector<Magnum::Vector3>&, float,
const Magnum::Color4&, int, const Magnum::Vector3&>(
&DebugLineRender::drawPathWithEndpointCircles),
R"(Draw a sequence of line segments with circles at the two endpoints. In world-space or local-space (see pushTransform).)",
"points"_a, "radius"_a, "color"_a, "num_segments"_a = 24,
"normal"_a = Magnum::Vector3{0.0, 1.0, 0.0},
R"(Draw a sequence of line segments with circles at the two endpoints. In world-space or local-space (see pushTransform).)");
"normal"_a = Magnum::Vector3{0.0, 1.0, 0.0});

m.attr("DEFAULT_LIGHTING_KEY") = DEFAULT_LIGHTING_KEY;
m.attr("NO_LIGHT_KEY") = NO_LIGHT_KEY;
Expand Down
2 changes: 1 addition & 1 deletion src/esp/bindings/PhysicsBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void initPhysicsBindings(py::module& m) {
.value("UserGroup7", CollisionGroup::UserGroup7)
.value("UserGroup8", CollisionGroup::UserGroup8)
.value("UserGroup9", CollisionGroup::UserGroup9)
.value("None", CollisionGroup{});
.value("NoneGroup", CollisionGroup{});
pybindEnumOperators(collisionGroups);

// ==== class object CollisionGroupHelper ====
Expand Down
16 changes: 15 additions & 1 deletion src/esp/bindings/SceneBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,16 @@ void initSceneBindings(
.def("index", &LoopRegionCategory::index, "mapping"_a = "")
.def("name", &LoopRegionCategory::name, "mapping"_a = "");

// These two are (cyclically) referenced by multiple classes below, define
// These are (cyclically) referenced by multiple classes below, define
// the classes first so pybind has the type definition available when binding
// functions
py::class_<SemanticObject, SemanticObject::ptr> semanticObject(
m, "SemanticObject");
py::class_<CCSemanticObject, SemanticObject, CCSemanticObject::ptr>
ccSemanticObject(
m, "CCSemanticObject",
"This class exists to facilitate semantic object data access for "
"bboxes derived from connected component analysis.");
py::class_<SemanticRegion, SemanticRegion::ptr> semanticRegion(
m, "SemanticRegion");

Expand Down Expand Up @@ -234,6 +239,15 @@ void initSceneBindings(
.def_property_readonly("obb", &SemanticObject::obb)
.def_property_readonly("category", &SemanticObject::category);

// ==== CCSemanticObject =====
ccSemanticObject
.def_property_readonly("num_src_verts", &CCSemanticObject::getNumSrcVerts,
"The number of vertices in the connected "
"component making up this semantic object.")
.def_property_readonly("vert_set", &CCSemanticObject::getVertSet,
"A set of the vertices in the connected component "
"making up this semantic object.");

// ==== SemanticScene ====
py::class_<SemanticScene, SemanticScene::ptr>(m, "SemanticScene")
.def(py::init(&SemanticScene::create<>))
Expand Down
2 changes: 1 addition & 1 deletion src/esp/metadata/attributes/AttributesEnumMaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ enum class ArticulatedObjectRenderMode {
Skin,
/**
* @brief Render the Articulated Object using urdf-defined meshes/primitives
* to respresent each link.
* to represent each link.
*/
LinkVisuals,
/**
Expand Down
2 changes: 1 addition & 1 deletion src/esp/metadata/attributes/LightLayoutAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ class LightLayoutAttributes : public AbstractAttributes {
std::shared_ptr<Configuration> lightInstConfig_{};

/**
* @brief Deque holding all released IDs to consume for @ref LightInstanceAttributess when
* @brief Deque holding all released IDs to consume for @ref LightInstanceAttributes when
* one is deleted, before using size of lightInstances_ container.
*/
std::deque<int> availableLightIDs_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class AbstractObjectAttributesManager : public AttributesManager<T, Access> {
void setAssetAttributesManager(
AssetAttributesManager::cptr assetAttributesMgr) {
assetAttributesMgr_ = std::move(assetAttributesMgr);
// Create default primitive-based object attributess
// Create default primitive-based object attributes
createDefaultPrimBasedAttributesTemplates();
}

Expand Down