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

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

#include <Inspector.h>

Public 成员函数

 Inspector ()=default
 Inspector.
 
 ~Inspector ()
 Inspector.
 
 Inspector (const Inspector &)=delete
 
Inspector & operator= (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.
 
UIHostHandle host () const noexcept
 Returns the mounted inspector host handle, or an empty handle until open().
 
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
</ editor = "color" />                        → RGBA composite (float array)
</ editor = "vec2"|"vec3"|"vec4" />           → Vector composite (float array)
Array / table members                         → Expandable PropertyView editors
Nested instance                               → Open navigation button
Other controls                                → InputText

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

在文件 Inspector.h 第 43 行定义.

构造及析构函数说明

◆ Inspector() [1/2]

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

◆ ~Inspector()

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

Inspector.

在文件 Inspector.cpp 第 33 行定义.

引用了 host(), eve::ui::UIHost::resolve() , 以及 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.cpp 第 142 行定义.

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

被这些函数引用 build().

◆ back()

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

Returns to the previously inspected instance.

在文件 Inspector.cpp 第 192 行定义.

引用了 current , 以及 previous.

被这些函数引用 build().

◆ build()

◆ close()

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

Hides the inspector host.

在文件 Inspector.cpp 第 88 行定义.

引用了 host() , 以及 eve::ui::UIHost::resolve().

◆ host()

UIHostHandle eve::ui::Inspector::host ( ) const
inlinenoexcept

Returns the mounted inspector host handle, or an empty handle until open().

在文件 Inspector.h 第 61 行定义.

被这些函数引用 close(), isOpen(), open(), sync() , 以及 ~Inspector().

◆ 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.cpp 第 121 行定义.

引用了 eve::Runtime::classNameOf() , 以及 object.

被这些函数引用 build().

◆ instanceCount()

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

Number of live instances of the selected class.

在文件 Inspector.h 第 89 行定义.

◆ isOpen()

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

True while the inspector host is mounted and visible.

在文件 Inspector.cpp 第 92 行定义.

引用了 host() , 以及 eve::ui::UIHost::resolve().

◆ open()

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

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

在文件 Inspector.cpp 第 76 行定义.

引用了 eve::ui::UIHost::createHost(), host(), refresh() , 以及 eve::ui::UIHost::resolve().

◆ openNested()

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

Navigates into a nested script instance (reference editing).

在文件 Inspector.cpp 第 172 行定义.

引用了 current , 以及 object.

◆ operator=()

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

◆ refresh()

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

Re-scans the active Runtime's reflected classes.

在文件 Inspector.cpp 第 55 行定义.

引用了 cls , 以及 selectClass().

被这些函数引用 open().

◆ selectClass()

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

Selects a class, auto-creating its first instance.

在文件 Inspector.cpp 第 97 行定义.

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

被这些函数引用 build() , 以及 refresh().

◆ selectedClass()

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

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

在文件 Inspector.h 第 73 行定义.

◆ selectedIndex()

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

Index of the selected instance; -1 when none.

在文件 Inspector.h 第 91 行定义.

◆ selectedInstance()

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

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

Returns the size of t.

Object.

在文件 Inspector.h 第 93 行定义.

◆ selectInstance()

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

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

在文件 Inspector.cpp 第 164 行定义.

引用了 index.

被这些函数引用 build().

◆ 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 an empty object when nothing was picked.

在文件 Inspector.cpp 第 160 行定义.

◆ sync()

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

Pulls model → view for the selected instance (per-frame).

在文件 Inspector.cpp 第 350 行定义.

引用了 host(), eve::ui::UIHost::resolve() , 以及 eve::ui::syncPropertyView().


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