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

Default DisconnectedSpaces boolean to true in Python #3760

Merged
merged 8 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ struct DisconnectedSpace (
"attr.python.array_aliases": "bool, npt.NDArray[np.bool_]",
"attr.rust.derive": "Copy, PartialEq, Eq"
) {
/// Whether the entity path at which this is logged is disconnected from its parent.
is_disconnected: bool (order: 100);
}
5 changes: 4 additions & 1 deletion crates/re_types/src/components/disconnected_space.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rerun_cpp/src/rerun/components/disconnected_space.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 3 additions & 12 deletions rerun_py/rerun_sdk/rerun/archetypes/disconnected_space.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions rerun_py/rerun_sdk/rerun/archetypes/disconnected_space_ext.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from __future__ import annotations

from typing import TYPE_CHECKING, Any

if TYPE_CHECKING:
from ..components import DisconnectedSpaceLike


class DisconnectedSpaceExt:
"""Extension for [DisconnectedSpace][rerun.archetypes.DisconnectedSpace]."""

def __init__(
self: Any,
disconnected: bool | DisconnectedSpaceLike,
emilk marked this conversation as resolved.
Show resolved Hide resolved
):
"""
Disconnect an entity from its parent.

Parameters
----------
disconnected:
Wether or not the entity should be disconnected from the rest of the scene.

Check warning on line 22 in rerun_py/rerun_sdk/rerun/archetypes/disconnected_space_ext.py

View workflow job for this annotation

GitHub Actions / Checks / Spell Check

"Wether" should be "Weather" or "Whether".
Set to `True` to disconnect the entity from its parent.
Set to `False` to disable the effects of this archetype, (re-)connecting the entity to its parent again.
"""

self.__attrs_init__(disconnected=disconnected)
9 changes: 4 additions & 5 deletions rerun_py/rerun_sdk/rerun/components/disconnected_space.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion rerun_py/rerun_sdk/rerun/components/disconnected_space_ext.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any

import numpy as np
import pyarrow as pa
Expand All @@ -12,6 +12,22 @@
class DisconnectedSpaceExt:
"""Extension for [DisconnectedSpace][rerun.components.DisconnectedSpace]."""

def __init__(
self: Any,
disconnected: bool = True,
emilk marked this conversation as resolved.
Show resolved Hide resolved
):
"""
Disconnect an entity from its parent.

Parameters
----------
disconnected:
Wether or not the entity should be disconnected from the rest of the scene.

Check warning on line 25 in rerun_py/rerun_sdk/rerun/components/disconnected_space_ext.py

View workflow job for this annotation

GitHub Actions / Checks / Spell Check

"Wether" should be "Weather" or "Whether".
Set to `True` to disconnect the entity from its parent.
Set to `False` to disable the effects of this component, (re-)connecting the entity to its parent again.
"""
self.__attrs_init__(disconnected=disconnected)

@staticmethod
def native_to_pa_array_override(data: DisconnectedSpaceArrayLike, data_type: pa.DataType) -> pa.Array:
array = np.asarray(data, dtype=np.bool_).flatten()
Expand Down
Loading