载入中...
搜索中...
未找到
eve::ui::Inspector类 参考

Reflection-driven property inspector (DevTools phase C, MVVM). 更多...

#include <Inspector.h>

Public 成员函数

 Inspector ()=default
 
 ~Inspector ()
 
 Inspector (const Inspector &)=delete
 
Inspectoroperator= (const Inspector &)=delete
 
void refresh ()
 Re-scans the active Runtime's reflected classes.
 
void open ()
 Mounts (or updates) the inspector host on the UI ECS world.
 
void close ()
 Hides the inspector host.
 
bool isOpen () const
 True while the inspector host is mounted and visible.
 
UIHosthost () const
 The mounted inspector host (nullptr until open()); for embedding.
 
bool selectClass (const std::string &name)
 Selects a class, auto-creating its first instance.
 
bool inspectObject (const ssq::Object &object)
 Inspects a caller-provided live script instance (the game model).
 
const std::string & selectedClass () const
 Name of the currently selected class ("" when none).
 
bool addInstance ()
 Creates another instance of the selected class and selects it.
 
void setPickScene (std::function< ssq::Object()> pickScene)
 Registers the scene-pick source used by the Pick button.
 
bool selectInstance (int index)
 Selects an instance by index; false when out of range.
 
void openNested (const std::string &className, const ssq::Object &object)
 Navigates into a nested script instance (reference editing).
 
void back ()
 Returns to the previously inspected instance.
 
int instanceCount () const
 Number of live instances of the selected class.
 
int selectedIndex () const
 Index of the selected instance; -1 when none.
 
ssq::Object selectedInstance () const
 Live script object of the selected instance (empty when none).
 
void sync ()
 Pulls model → view for the selected instance (per-frame).
 
WidgetDesc build ()
 Declarative tree of the current selection.
 

详细描述

Reflection-driven property inspector (DevTools phase C, MVVM).

ViewModel: script class instances registered in the active eve Runtime. View: a declarative UIHost ("eve_inspector") rebuilt from reflected members. Binding: widget change callbacks write back to the script instance and sync() pulls model values into the tree (two-way).

Script classes are auto-scanned from Runtime::reflectedClasses(); members become editable widgets using Squirrel attribute metadata:

</ editor = "slider", min = 0, max = 100 />   → Slider
</ editor = "checkbox" />                     → Checkbox (bool)
</ editor = "combo", options = "a,b,c" />     → Combo
(default)                                     → InputText

Inherited members are grouped under their owning (base) class header, so parent properties are editable side-by-side (see docs/dev/界面设计.md).

在文件 Inspector.h36 行定义.

构造及析构函数说明

◆ Inspector() [1/2]

eve::ui::Inspector::Inspector ( )
default

◆ ~Inspector()

eve::ui::Inspector::~Inspector ( )

在文件 Inspector.cpp77 行定义.

引用了 eve::ui::UIHost::setTree() , 以及 eve::ui::window().

◆ Inspector() [2/2]

eve::ui::Inspector::Inspector ( const Inspector )
delete

成员函数说明

◆ addInstance()

bool eve::ui::Inspector::addInstance ( )

Creates another instance of the selected class and selects it.

在文件 Inspector.cpp180 行定义.

引用了 eve::Runtime::createInstance().

◆ back()

void eve::ui::Inspector::back ( )

Returns to the previously inspected instance.

在文件 Inspector.cpp230 行定义.

◆ build()

◆ close()

void eve::ui::Inspector::close ( )

Hides the inspector host.

在文件 Inspector.cpp127 行定义.

引用了 eve::ui::UIHost::setVisible().

◆ host()

UIHost * eve::ui::Inspector::host ( ) const
inline

The mounted inspector host (nullptr until open()); for embedding.

在文件 Inspector.h52 行定义.

◆ inspectObject()

bool eve::ui::Inspector::inspectObject ( const ssq::Object &  object)

Inspects a caller-provided live script instance (the game model).

The panel binds to this exact object: edits write back to it and sync() pulls its values into the view. The class must already be reflected.

在文件 Inspector.cpp159 行定义.

引用了 eve::Runtime::classNameOf().

◆ instanceCount()

int eve::ui::Inspector::instanceCount ( ) const
inline

Number of live instances of the selected class.

在文件 Inspector.h80 行定义.

◆ isOpen()

bool eve::ui::Inspector::isOpen ( ) const

True while the inspector host is mounted and visible.

在文件 Inspector.cpp131 行定义.

◆ open()

void eve::ui::Inspector::open ( )

Mounts (or updates) the inspector host on the UI ECS world.

在文件 Inspector.cpp120 行定义.

引用了 eve::ui::UIHost::createHost(), refresh(), eve::ui::UIHost::setLayer() , 以及 eve::ui::UIHost::setVisible().

◆ openNested()

void eve::ui::Inspector::openNested ( const std::string &  className,
const ssq::Object &  object 
)

Navigates into a nested script instance (reference editing).

在文件 Inspector.cpp210 行定义.

◆ operator=()

Inspector & eve::ui::Inspector::operator= ( const Inspector )
delete

◆ refresh()

void eve::ui::Inspector::refresh ( )

Re-scans the active Runtime's reflected classes.

在文件 Inspector.cpp99 行定义.

引用了 cls , 以及 selectClass().

被这些函数引用 open().

◆ selectClass()

bool eve::ui::Inspector::selectClass ( const std::string &  name)

Selects a class, auto-creating its first instance.

在文件 Inspector.cpp135 行定义.

引用了 eve::Runtime::createInstance() , 以及 name.

被这些函数引用 refresh().

◆ selectedClass()

const std::string & eve::ui::Inspector::selectedClass ( ) const
inline

Name of the currently selected class ("" when none).

在文件 Inspector.h64 行定义.

◆ selectedIndex()

int eve::ui::Inspector::selectedIndex ( ) const
inline

Index of the selected instance; -1 when none.

在文件 Inspector.h82 行定义.

◆ selectedInstance()

ssq::Object eve::ui::Inspector::selectedInstance ( ) const
inline

Live script object of the selected instance (empty when none).

在文件 Inspector.h84 行定义.

◆ selectInstance()

bool eve::ui::Inspector::selectInstance ( int  index)

Selects an instance by index; false when out of range.

在文件 Inspector.cpp202 行定义.

◆ setPickScene()

void eve::ui::Inspector::setPickScene ( std::function< ssq::Object()>  pickScene)

Registers the scene-pick source used by the Pick button.

参数
pickSceneReturns the live script instance under the pick cursor (empty object when nothing was picked).

在文件 Inspector.cpp198 行定义.

◆ sync()

void eve::ui::Inspector::sync ( )

该类的文档由以下文件生成: