[Bugfix] Entity3D.viewport returns None instead of parent Viewport3D #244

Closed
opened 2026-02-06 02:55:59 +00:00 by john · 0 comments
Owner

Description

After adding an Entity3D to a Viewport3D's entity collection, reading entity.viewport returns None instead of a reference to the owning viewport.

Reproduction

import mcrfpy
viewport = mcrfpy.Viewport3D(pos=(0,0), size=(100,100))
viewport.set_grid_size(16, 16)
entity = mcrfpy.Entity3D(pos=(5,5), scale=1.0)
viewport.entities.append(entity)

print(entity.viewport)       # None
print(entity.viewport is None)  # True

Expected Behavior

entity.viewport should return the Viewport3D that owns this entity, similar to how 2D entities can reference their parent grid.

Impact

Cannot navigate from an entity back to its viewport for operations like pathfinding or FOV from entity context. Workaround: keep a separate reference to the viewport.

Found during village integration demo development.

## Description After adding an `Entity3D` to a `Viewport3D`'s entity collection, reading `entity.viewport` returns `None` instead of a reference to the owning viewport. ## Reproduction ```python import mcrfpy viewport = mcrfpy.Viewport3D(pos=(0,0), size=(100,100)) viewport.set_grid_size(16, 16) entity = mcrfpy.Entity3D(pos=(5,5), scale=1.0) viewport.entities.append(entity) print(entity.viewport) # None print(entity.viewport is None) # True ``` ## Expected Behavior `entity.viewport` should return the `Viewport3D` that owns this entity, similar to how 2D entities can reference their parent grid. ## Impact Cannot navigate from an entity back to its viewport for operations like pathfinding or FOV from entity context. Workaround: keep a separate reference to the viewport. Found during village integration demo development.
john closed this issue 2026-02-09 12:47:41 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
john/McRogueFace#244
No description provided.