Reflection-driven property inspector (DevTools phase C, MVVM). 更多...
#include <Inspector.h>
Public 成员函数 | |
| Inspector ()=default | |
| ~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. | |
| UIHost * | host () 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.h 第 36 行定义.
构造及析构函数说明
◆ Inspector() [1/2]
|
default |
◆ ~Inspector()
| eve::ui::Inspector::~Inspector | ( | ) |
在文件 Inspector.cpp 第 77 行定义.
引用了 eve::ui::UIHost::setTree() , 以及 eve::ui::window().
◆ Inspector() [2/2]
|
delete |
成员函数说明
◆ addInstance()
| bool eve::ui::Inspector::addInstance | ( | ) |
Creates another instance of the selected class and selects it.
在文件 Inspector.cpp 第 180 行定义.
◆ back()
| void eve::ui::Inspector::back | ( | ) |
Returns to the previously inspected instance.
在文件 Inspector.cpp 第 230 行定义.
◆ build()
| WidgetDesc eve::ui::Inspector::build | ( | ) |
Declarative tree of the current selection.
在文件 Inspector.cpp 第 511 行定义.
引用了 eve::ReflectedClass::base, eve::ui::button(), children, cls, eve::ui::collapsingHeader(), eve::ui::combo(), eve::Runtime::readProperty(), eve::Runtime::reflectedClass(), eve::ui::row(), eve::ui::separator(), eve::ui::spacer(), eve::ui::text() , 以及 eve::ui::window().
◆ close()
| void eve::ui::Inspector::close | ( | ) |
◆ host()
|
inline |
The mounted inspector host (nullptr until open()); for embedding.
在文件 Inspector.h 第 52 行定义.
◆ 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 第 159 行定义.
◆ instanceCount()
|
inline |
Number of live instances of the selected class.
在文件 Inspector.h 第 80 行定义.
◆ isOpen()
| bool eve::ui::Inspector::isOpen | ( | ) | const |
True while the inspector host is mounted and visible.
在文件 Inspector.cpp 第 131 行定义.
◆ open()
| void eve::ui::Inspector::open | ( | ) |
Mounts (or updates) the inspector host on the UI ECS world.
在文件 Inspector.cpp 第 120 行定义.
引用了 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.cpp 第 210 行定义.
◆ operator=()
◆ refresh()
| void eve::ui::Inspector::refresh | ( | ) |
Re-scans the active Runtime's reflected classes.
在文件 Inspector.cpp 第 99 行定义.
引用了 cls , 以及 selectClass().
被这些函数引用 open().
◆ selectClass()
| bool eve::ui::Inspector::selectClass | ( | const std::string & | name | ) |
Selects a class, auto-creating its first instance.
在文件 Inspector.cpp 第 135 行定义.
引用了 eve::Runtime::createInstance() , 以及 name.
被这些函数引用 refresh().
◆ selectedClass()
|
inline |
Name of the currently selected class ("" when none).
在文件 Inspector.h 第 64 行定义.
◆ selectedIndex()
|
inline |
Index of the selected instance; -1 when none.
在文件 Inspector.h 第 82 行定义.
◆ selectedInstance()
|
inline |
Live script object of the selected instance (empty when none).
在文件 Inspector.h 第 84 行定义.
◆ selectInstance()
| bool eve::ui::Inspector::selectInstance | ( | int | index | ) |
Selects an instance by index; false when out of range.
在文件 Inspector.cpp 第 202 行定义.
◆ setPickScene()
| void eve::ui::Inspector::setPickScene | ( | std::function< ssq::Object()> | pickScene | ) |
Registers the scene-pick source used by the Pick button.
- 参数
-
pickScene Returns the live script instance under the pick cursor (empty object when nothing was picked).
在文件 Inspector.cpp 第 198 行定义.
◆ sync()
| void eve::ui::Inspector::sync | ( | ) |
Pulls model → view for the selected instance (per-frame).
在文件 Inspector.cpp 第 610 行定义.
引用了 eve::ReflectedValue::asBool(), eve::ReflectedValue::floating, eve::Integer, eve::ReflectedValue::integer, eve::ReflectedValue::kind, eve::Runtime::readProperty(), eve::Runtime::reflectInstance(), eve::String , 以及 eve::ReflectedValue::text.
该类的文档由以下文件生成:
- src/modules/ui/Inspector.h
- src/modules/ui/Inspector.cpp