pandora icon indicating copy to clipboard operation
pandora copied to clipboard

👀 Customizable entity preview

Open bitbrain opened this issue 2 years ago • 0 comments
trafficstars

Any entity in Pandora is theoretically data that represents a concept or entity in the game itself. Usually, someone would write something like this in their "world object":

@tool
class_name WorldObject extends Node2D

@export var entity:PandoraEntity

to then display the entity inside the world, e.g. via some 2D sprite or 3D model. This works fine but when tweaking entities or creating new ones, it would be great to see if everything is correctly configured as soon as possible. One does not want to navigate back and forth between the 2D (or 3D) and Pandora editor view to check how changing attributes transforms the appearance of a world object.

Entity Preview

On categories, introduce a new boolean option called "Enable entity preview" - toggling that on defaults to a scene that simply shows a 2D sprite of the entity icon (as that is always present). However, users can define a custom scene path to a scene that looks like this:

@tool
extends PandoraEntityPreview2D

func ready():
   # entity will be available here injected by Pandora
   print(self.entity.get_entity_name())

This means users can create their own scenes to preview their entities by inheriting one of the following:

  • PandoraEntityPreview2D (which extends Node2D)
  • PandoraEntityPreview3D (which extends Node3D)

The preview would be displayed on entities above the property list (and above the property bar). Optionally, introduce a button to popout the preview into its own window (closing the window reverts back to the in-editor preview). Also add an option to hide/collapse the preview for all entities.

bitbrain avatar Sep 23 '23 17:09 bitbrain