重构执行结果
This commit is contained in:
parent
45544cdb0b
commit
4035690976
|
@ -294,7 +294,7 @@ QList<std::shared_ptr<LogicalNode>> BehaviorMapNode::getForwards() const
|
||||||
return children();
|
return children();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BehaviorMapNode::fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste)
|
bool BehaviorMapNode::fallback(std::shared_ptr<LogicalNode> node, ExecuteResult ste)
|
||||||
{
|
{
|
||||||
this->_state_value = ste;
|
this->_state_value = ste;
|
||||||
return true;
|
return true;
|
||||||
|
@ -302,7 +302,7 @@ bool BehaviorMapNode::fallback(std::shared_ptr<LogicalNode> node, LogicalResult
|
||||||
|
|
||||||
void BehaviorMapNode::reset()
|
void BehaviorMapNode::reset()
|
||||||
{
|
{
|
||||||
this->_state_value = LogicalResult::UNDEFINED;
|
this->_state_value = ExecuteResult::UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BehaviorMapNode::typeName() const
|
QString BehaviorMapNode::typeName() const
|
||||||
|
@ -310,7 +310,7 @@ QString BehaviorMapNode::typeName() const
|
||||||
return _map_name;
|
return _map_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogicalResult BehaviorMapNode::execute()
|
ExecuteResult BehaviorMapNode::execute()
|
||||||
{
|
{
|
||||||
return _state_value;
|
return _state_value;
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ QList<std::shared_ptr<LogicalNode>> SequenceNode::getForwards() const
|
||||||
for (auto item : children()) {
|
for (auto item : children()) {
|
||||||
// 子节点执行失败,提前结束
|
// 子节点执行失败,提前结束
|
||||||
if (_state_map.contains(item->getID())) {
|
if (_state_map.contains(item->getID())) {
|
||||||
if (_state_map[item->getID()] != LogicalResult::SUCCESS)
|
if (_state_map[item->getID()] != ExecuteResult::SUCCESS)
|
||||||
return QList<std::shared_ptr<LogicalNode>>();
|
return QList<std::shared_ptr<LogicalNode>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,20 +365,20 @@ QString SequenceNode::typeName() const
|
||||||
return u8"顺序";
|
return u8"顺序";
|
||||||
}
|
}
|
||||||
|
|
||||||
LogicalResult SequenceNode::execute() {
|
ExecuteResult SequenceNode::execute() {
|
||||||
if (children().size() >= _state_map.size())
|
if (children().size() >= _state_map.size())
|
||||||
return LogicalResult::FAILURE;
|
return ExecuteResult::FAILURE;
|
||||||
|
|
||||||
for (auto ste : this->_state_map) {
|
for (auto ste : this->_state_map) {
|
||||||
switch (ste) {
|
switch (ste) {
|
||||||
case LogicalResult::SUCCESS:
|
case ExecuteResult::SUCCESS:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return LogicalResult::FAILURE;
|
return ExecuteResult::FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return LogicalResult::SUCCESS;
|
return ExecuteResult::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<QString, std::shared_ptr<TopicData>> SequenceNode::inputList() const
|
QHash<QString, std::shared_ptr<TopicData>> SequenceNode::inputList() const
|
||||||
|
@ -397,7 +397,7 @@ void SequenceNode::recoveryFrom(const QJsonObject& obj)
|
||||||
STRLIST_PEAK(state_items);
|
STRLIST_PEAK(state_items);
|
||||||
for (auto kv : state_items) {
|
for (auto kv : state_items) {
|
||||||
auto kv_pair = kv.split(u8":");
|
auto kv_pair = kv.split(u8":");
|
||||||
_state_map[kv_pair[0].toInt()] = (LogicalResult)kv_pair[1].toInt();
|
_state_map[kv_pair[0].toInt()] = (ExecuteResult)kv_pair[1].toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ void SequenceNode::saveTo(QJsonObject& obj) const
|
||||||
STRLIST_SAVE(state_items);
|
STRLIST_SAVE(state_items);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SequenceNode::fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste)
|
bool SequenceNode::fallback(std::shared_ptr<LogicalNode> node, ExecuteResult ste)
|
||||||
{
|
{
|
||||||
this->_state_map[node->getID()] = ste;
|
this->_state_map[node->getID()] = ste;
|
||||||
return true;
|
return true;
|
||||||
|
@ -459,7 +459,7 @@ QList<std::shared_ptr<LogicalNode>> SelectorNode::getForwards() const
|
||||||
for (auto item : children()) {
|
for (auto item : children()) {
|
||||||
// 子节点执行失败,提前结束
|
// 子节点执行失败,提前结束
|
||||||
if (_state_map.contains(item->getID())) {
|
if (_state_map.contains(item->getID())) {
|
||||||
if (_state_map[item->getID()] == LogicalResult::SUCCESS)
|
if (_state_map[item->getID()] == ExecuteResult::SUCCESS)
|
||||||
return QList<std::shared_ptr<LogicalNode>>();
|
return QList<std::shared_ptr<LogicalNode>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ QList<std::shared_ptr<LogicalNode>> SelectorNode::getForwards() const
|
||||||
return QList<std::shared_ptr<LogicalNode>>();
|
return QList<std::shared_ptr<LogicalNode>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SelectorNode::fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste)
|
bool SelectorNode::fallback(std::shared_ptr<LogicalNode> node, ExecuteResult ste)
|
||||||
{
|
{
|
||||||
_state_map[node->getID()] = ste;
|
_state_map[node->getID()] = ste;
|
||||||
return true;
|
return true;
|
||||||
|
@ -489,7 +489,7 @@ void SelectorNode::recoveryFrom(const QJsonObject& obj)
|
||||||
STRLIST_PEAK(state_items);
|
STRLIST_PEAK(state_items);
|
||||||
for (auto kv : state_items) {
|
for (auto kv : state_items) {
|
||||||
auto kv_pair = kv.split(u8":");
|
auto kv_pair = kv.split(u8":");
|
||||||
_state_map[kv_pair[0].toInt()] = (LogicalResult)kv_pair[1].toInt();
|
_state_map[kv_pair[0].toInt()] = (ExecuteResult)kv_pair[1].toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,13 +513,13 @@ QString SelectorNode::typeName() const
|
||||||
return u8"选择";
|
return u8"选择";
|
||||||
}
|
}
|
||||||
|
|
||||||
LogicalResult SelectorNode::execute()
|
ExecuteResult SelectorNode::execute()
|
||||||
{
|
{
|
||||||
for (auto value : _state_map) {
|
for (auto value : _state_map) {
|
||||||
if (value == LogicalResult::SUCCESS)
|
if (value == ExecuteResult::SUCCESS)
|
||||||
return LogicalResult::SUCCESS;
|
return ExecuteResult::SUCCESS;
|
||||||
}
|
}
|
||||||
return LogicalResult::FAILURE;
|
return ExecuteResult::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<QString, std::shared_ptr<TopicData>> SelectorNode::inputList() const
|
QHash<QString, std::shared_ptr<TopicData>> SelectorNode::inputList() const
|
||||||
|
@ -539,7 +539,7 @@ QList<std::shared_ptr<LogicalNode>> ParallelNode::getForwards() const
|
||||||
return this->children();
|
return this->children();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParallelNode::fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste)
|
bool ParallelNode::fallback(std::shared_ptr<LogicalNode> node, ExecuteResult ste)
|
||||||
{
|
{
|
||||||
_state_map[node->getID()] = ste;
|
_state_map[node->getID()] = ste;
|
||||||
return children().size() == _state_map.size();
|
return children().size() == _state_map.size();
|
||||||
|
@ -555,13 +555,13 @@ QString ParallelNode::typeName() const
|
||||||
return u8"并行";
|
return u8"并行";
|
||||||
}
|
}
|
||||||
|
|
||||||
LogicalResult ParallelNode::execute()
|
ExecuteResult ParallelNode::execute()
|
||||||
{
|
{
|
||||||
for (auto ste : this->_state_map)
|
for (auto ste : this->_state_map)
|
||||||
if (ste != LogicalResult::SUCCESS)
|
if (ste != ExecuteResult::SUCCESS)
|
||||||
return LogicalResult::FAILURE;
|
return ExecuteResult::FAILURE;
|
||||||
|
|
||||||
return LogicalResult::SUCCESS;
|
return ExecuteResult::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Serializable> ParallelNode::newDefault() const
|
std::shared_ptr<Serializable> ParallelNode::newDefault() const
|
||||||
|
@ -589,7 +589,7 @@ void ParallelNode::recoveryFrom(const QJsonObject& obj)
|
||||||
STRLIST_PEAK(state_items);
|
STRLIST_PEAK(state_items);
|
||||||
for (auto kv : state_items) {
|
for (auto kv : state_items) {
|
||||||
auto kv_pair = kv.split(u8":");
|
auto kv_pair = kv.split(u8":");
|
||||||
_state_map[kv_pair[0].toInt()] = (LogicalResult)kv_pair[1].toInt();
|
_state_map[kv_pair[0].toInt()] = (ExecuteResult)kv_pair[1].toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,15 +611,15 @@ QString CompareNode::typeName() const
|
||||||
return QString(u8"%1<%2>").arg(u8"比较", delegateName());
|
return QString(u8"%1<%2>").arg(u8"比较", delegateName());
|
||||||
}
|
}
|
||||||
|
|
||||||
LogicalResult CompareNode::execute()
|
ExecuteResult CompareNode::execute()
|
||||||
{
|
{
|
||||||
if (this->_bind_delegate) {
|
if (this->_bind_delegate) {
|
||||||
auto vl = _data_map[u8"左值"];
|
auto vl = _data_map[u8"左值"];
|
||||||
auto vb = _data_map[u8"右值"];
|
auto vb = _data_map[u8"右值"];
|
||||||
if (this->_bind_delegate->compare(vl, vb))
|
if (this->_bind_delegate->compare(vl, vb))
|
||||||
return LogicalResult::SUCCESS;
|
return ExecuteResult::SUCCESS;
|
||||||
}
|
}
|
||||||
return LogicalResult::FAILURE;
|
return ExecuteResult::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompareNode::insert(std::shared_ptr<LogicalNode> node, int index /*= -1*/)
|
void CompareNode::insert(std::shared_ptr<LogicalNode> node, int index /*= -1*/)
|
||||||
|
@ -631,7 +631,7 @@ QList<std::shared_ptr<LogicalNode>> CompareNode::getForwards() const
|
||||||
return QList<std::shared_ptr<LogicalNode>>();
|
return QList<std::shared_ptr<LogicalNode>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompareNode::fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste) {
|
bool CompareNode::fallback(std::shared_ptr<LogicalNode> node, ExecuteResult ste) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,14 +820,14 @@ void ExecuteNode::reset()
|
||||||
_bind_delegate->reset();
|
_bind_delegate->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
LogicalResult ExecuteNode::execute()
|
ExecuteResult ExecuteNode::execute()
|
||||||
{
|
{
|
||||||
if (_bind_delegate)
|
if (_bind_delegate)
|
||||||
return _bind_delegate->execute();
|
return _bind_delegate->execute();
|
||||||
return LogicalResult::FAILURE;
|
return ExecuteResult::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExecuteNode::fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste)
|
bool ExecuteNode::fallback(std::shared_ptr<LogicalNode> node, ExecuteResult ste)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -915,7 +915,7 @@ QHash<QString, std::shared_ptr<TopicData>> ModifiedNode::outputList() const
|
||||||
|
|
||||||
void ModifiedNode::reset()
|
void ModifiedNode::reset()
|
||||||
{
|
{
|
||||||
this->_result_store = LogicalResult::UNDEFINED;
|
this->_result_store = ExecuteResult::UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<std::shared_ptr<LogicalNode>> ModifiedNode::getForwards() const
|
QList<std::shared_ptr<LogicalNode>> ModifiedNode::getForwards() const
|
||||||
|
@ -923,28 +923,28 @@ QList<std::shared_ptr<LogicalNode>> ModifiedNode::getForwards() const
|
||||||
return children();
|
return children();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModifiedNode::fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste)
|
bool ModifiedNode::fallback(std::shared_ptr<LogicalNode> node, ExecuteResult ste)
|
||||||
{
|
{
|
||||||
this->_result_store = ste;
|
this->_result_store = ste;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogicalResult ModifiedNode::execute()
|
ExecuteResult ModifiedNode::execute()
|
||||||
{
|
{
|
||||||
switch (_type_appoint)
|
switch (_type_appoint)
|
||||||
{
|
{
|
||||||
case ModifyType::RESULT_INVENTER:
|
case ModifyType::RESULT_INVENTER:
|
||||||
if (_result_store == LogicalResult::SUCCESS) {
|
if (_result_store == ExecuteResult::SUCCESS) {
|
||||||
return LogicalResult::FAILURE;
|
return ExecuteResult::FAILURE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return LogicalResult::SUCCESS;
|
return ExecuteResult::SUCCESS;
|
||||||
}
|
}
|
||||||
case ModifyType::ALWAYS_SUCCESS:
|
case ModifyType::ALWAYS_SUCCESS:
|
||||||
return LogicalResult::SUCCESS;
|
return ExecuteResult::SUCCESS;
|
||||||
case ModifyType::ALWAYS_FAILURE:
|
case ModifyType::ALWAYS_FAILURE:
|
||||||
case ModifyType::NONE:
|
case ModifyType::NONE:
|
||||||
return LogicalResult::FAILURE;
|
return ExecuteResult::FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 执行结果
|
/// 执行结果
|
||||||
/// </summary>
|
/// </summary>
|
||||||
enum class LogicalResult {
|
enum class ExecuteResult {
|
||||||
UNDEFINED, // 未定义
|
UNDEFINED, // 未定义
|
||||||
SUCCESS, // 成功
|
SUCCESS, // 成功
|
||||||
FAILURE // 失败
|
FAILURE // 失败
|
||||||
|
@ -305,7 +305,7 @@ public:
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="core"></param>
|
/// <param name="core"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
virtual LogicalResult execute() = 0;
|
virtual ExecuteResult execute() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -435,13 +435,13 @@ public:
|
||||||
/// <param name="node"></param>
|
/// <param name="node"></param>
|
||||||
/// <param name="ste"></param>
|
/// <param name="ste"></param>
|
||||||
/// <returns>接续执行标志</returns>
|
/// <returns>接续执行标志</returns>
|
||||||
virtual bool fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste) = 0;
|
virtual bool fallback(std::shared_ptr<LogicalNode> node, ExecuteResult ste) = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 执行逻辑节点
|
/// 执行逻辑节点
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="core"></param>
|
/// <param name="core"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
virtual LogicalResult execute() = 0;
|
virtual ExecuteResult execute() = 0;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -469,7 +469,7 @@ private:
|
||||||
/// 地图变量表
|
/// 地图变量表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
QHash<QString, std::pair<IO_TYPE, std::shared_ptr<TopicData>>> _variables;
|
QHash<QString, std::pair<IO_TYPE, std::shared_ptr<TopicData>>> _variables;
|
||||||
LogicalResult _state_value = LogicalResult::FAILURE;
|
ExecuteResult _state_value = ExecuteResult::FAILURE;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BehaviorMapNode(std::shared_ptr<MapKernal> kernal);
|
BehaviorMapNode(std::shared_ptr<MapKernal> kernal);
|
||||||
|
@ -516,13 +516,13 @@ public:
|
||||||
/// <param name="node"></param>
|
/// <param name="node"></param>
|
||||||
/// <param name="ste"></param>
|
/// <param name="ste"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
bool fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste) override;
|
bool fallback(std::shared_ptr<LogicalNode> node, ExecuteResult ste) override;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 执行状态
|
/// 执行状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
LogicalResult execute() override;
|
ExecuteResult execute() override;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 输入变量列表
|
/// 输入变量列表
|
||||||
|
@ -552,7 +552,7 @@ public:
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class COMPONENTBASIC_EXPORT SequenceNode : public LogicalNode {
|
class COMPONENTBASIC_EXPORT SequenceNode : public LogicalNode {
|
||||||
private:
|
private:
|
||||||
QHash<int, LogicalResult> _state_map;
|
QHash<int, ExecuteResult> _state_map;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SequenceNode(std::shared_ptr<MapKernal> kernal);
|
SequenceNode(std::shared_ptr<MapKernal> kernal);
|
||||||
|
@ -564,8 +564,8 @@ public:
|
||||||
QHash<QString, std::shared_ptr<TopicData>> outputList() const override;
|
QHash<QString, std::shared_ptr<TopicData>> outputList() const override;
|
||||||
|
|
||||||
void reset() override;
|
void reset() override;
|
||||||
LogicalResult execute() override;
|
ExecuteResult execute() override;
|
||||||
bool fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste) override;
|
bool fallback(std::shared_ptr<LogicalNode> node, ExecuteResult ste) override;
|
||||||
|
|
||||||
virtual std::shared_ptr<Serializable> newDefault() const override;
|
virtual std::shared_ptr<Serializable> newDefault() const override;
|
||||||
void recoveryFrom(const QJsonObject& obj) override;
|
void recoveryFrom(const QJsonObject& obj) override;
|
||||||
|
@ -577,7 +577,7 @@ public:
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class COMPONENTBASIC_EXPORT SelectorNode : public LogicalNode {
|
class COMPONENTBASIC_EXPORT SelectorNode : public LogicalNode {
|
||||||
private:
|
private:
|
||||||
QHash<int, LogicalResult> _state_map;
|
QHash<int, ExecuteResult> _state_map;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SelectorNode(std::shared_ptr<MapKernal> kernal);
|
SelectorNode(std::shared_ptr<MapKernal> kernal);
|
||||||
|
@ -589,8 +589,8 @@ public:
|
||||||
QHash<QString, std::shared_ptr<TopicData>> outputList() const override;
|
QHash<QString, std::shared_ptr<TopicData>> outputList() const override;
|
||||||
|
|
||||||
void reset() override;
|
void reset() override;
|
||||||
LogicalResult execute() override;
|
ExecuteResult execute() override;
|
||||||
bool fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste) override;
|
bool fallback(std::shared_ptr<LogicalNode> node, ExecuteResult ste) override;
|
||||||
|
|
||||||
virtual std::shared_ptr<Serializable> newDefault() const override;
|
virtual std::shared_ptr<Serializable> newDefault() const override;
|
||||||
void recoveryFrom(const QJsonObject& obj) override;
|
void recoveryFrom(const QJsonObject& obj) override;
|
||||||
|
@ -602,7 +602,7 @@ public:
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class COMPONENTBASIC_EXPORT ParallelNode : public LogicalNode {
|
class COMPONENTBASIC_EXPORT ParallelNode : public LogicalNode {
|
||||||
private:
|
private:
|
||||||
QHash<int, LogicalResult> _state_map;
|
QHash<int, ExecuteResult> _state_map;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ParallelNode(std::shared_ptr<MapKernal> kernal);
|
ParallelNode(std::shared_ptr<MapKernal> kernal);
|
||||||
|
@ -614,8 +614,8 @@ public:
|
||||||
QHash<QString, std::shared_ptr<TopicData>> outputList() const override;
|
QHash<QString, std::shared_ptr<TopicData>> outputList() const override;
|
||||||
|
|
||||||
void reset() override;
|
void reset() override;
|
||||||
LogicalResult execute() override;
|
ExecuteResult execute() override;
|
||||||
bool fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste) override;
|
bool fallback(std::shared_ptr<LogicalNode> node, ExecuteResult ste) override;
|
||||||
|
|
||||||
virtual std::shared_ptr<Serializable> newDefault() const override;
|
virtual std::shared_ptr<Serializable> newDefault() const override;
|
||||||
void recoveryFrom(const QJsonObject& obj) override;
|
void recoveryFrom(const QJsonObject& obj) override;
|
||||||
|
@ -645,8 +645,8 @@ public:
|
||||||
virtual void insert(std::shared_ptr<LogicalNode> node, int index /*= -1*/) override;
|
virtual void insert(std::shared_ptr<LogicalNode> node, int index /*= -1*/) override;
|
||||||
|
|
||||||
void reset() override;
|
void reset() override;
|
||||||
LogicalResult execute() override;
|
ExecuteResult execute() override;
|
||||||
virtual bool fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste) override;
|
virtual bool fallback(std::shared_ptr<LogicalNode> node, ExecuteResult ste) override;
|
||||||
|
|
||||||
virtual std::shared_ptr<Serializable> newDefault() const override;
|
virtual std::shared_ptr<Serializable> newDefault() const override;
|
||||||
void recoveryFrom(const QJsonObject& obj) override;
|
void recoveryFrom(const QJsonObject& obj) override;
|
||||||
|
@ -675,8 +675,8 @@ public:
|
||||||
virtual void insert(std::shared_ptr<LogicalNode> node, int index /*= -1*/) override;
|
virtual void insert(std::shared_ptr<LogicalNode> node, int index /*= -1*/) override;
|
||||||
|
|
||||||
void reset() override;
|
void reset() override;
|
||||||
LogicalResult execute() override;
|
ExecuteResult execute() override;
|
||||||
virtual bool fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste) override;
|
virtual bool fallback(std::shared_ptr<LogicalNode> node, ExecuteResult ste) override;
|
||||||
|
|
||||||
virtual std::shared_ptr<Serializable> newDefault() const override;
|
virtual std::shared_ptr<Serializable> newDefault() const override;
|
||||||
void recoveryFrom(const QJsonObject& obj) override;
|
void recoveryFrom(const QJsonObject& obj) override;
|
||||||
|
@ -695,7 +695,7 @@ enum class ModifyType {
|
||||||
class COMPONENTBASIC_EXPORT ModifiedNode : public LogicalNode {
|
class COMPONENTBASIC_EXPORT ModifiedNode : public LogicalNode {
|
||||||
private:
|
private:
|
||||||
ModifyType _type_appoint = ModifyType::NONE;
|
ModifyType _type_appoint = ModifyType::NONE;
|
||||||
LogicalResult _result_store = LogicalResult::UNDEFINED;
|
ExecuteResult _result_store = ExecuteResult::UNDEFINED;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ModifiedNode(std::shared_ptr<MapKernal> kernal);
|
ModifiedNode(std::shared_ptr<MapKernal> kernal);
|
||||||
|
@ -711,10 +711,10 @@ public:
|
||||||
QHash<QString, std::shared_ptr<TopicData>> outputList() const override;
|
QHash<QString, std::shared_ptr<TopicData>> outputList() const override;
|
||||||
|
|
||||||
QList<std::shared_ptr<LogicalNode>> getForwards() const override;
|
QList<std::shared_ptr<LogicalNode>> getForwards() const override;
|
||||||
bool fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste) override;
|
bool fallback(std::shared_ptr<LogicalNode> node, ExecuteResult ste) override;
|
||||||
|
|
||||||
void reset() override;
|
void reset() override;
|
||||||
LogicalResult execute() override;
|
ExecuteResult execute() override;
|
||||||
|
|
||||||
std::shared_ptr<Serializable> newDefault() const override;
|
std::shared_ptr<Serializable> newDefault() const override;
|
||||||
void recoveryFrom(const QJsonObject& obj) override;
|
void recoveryFrom(const QJsonObject& obj) override;
|
||||||
|
|
|
@ -433,6 +433,8 @@ void BehaviorEditor::new_behavior_map()
|
||||||
if (!_current_fileurl.isValid())
|
if (!_current_fileurl.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
qDebug() << _current_fileurl;
|
||||||
|
|
||||||
// 清空所有子节点内容
|
// 清空所有子节点内容
|
||||||
auto childs = this->_map_root->children();
|
auto childs = this->_map_root->children();
|
||||||
if (childs.size())
|
if (childs.size())
|
||||||
|
@ -463,7 +465,8 @@ BehaviorEditor::BehaviorEditor(QWidget* parent /*= nullptr*/)
|
||||||
|
|
||||||
auto mbar = this->menuBar();
|
auto mbar = this->menuBar();
|
||||||
auto _file = mbar->addMenu(u8"文件");
|
auto _file = mbar->addMenu(u8"文件");
|
||||||
_file->addAction(u8"´ò¿ª", this, &BehaviorEditor::open_behavior_map);
|
_file->addAction(u8"打开行为树", this, &BehaviorEditor::open_behavior_map);
|
||||||
|
_file->addAction(u8"新建行为树", this, &BehaviorEditor::new_behavior_map);
|
||||||
|
|
||||||
auto font = this->font();
|
auto font = this->font();
|
||||||
font.setPixelSize(20);
|
font.setPixelSize(20);
|
||||||
|
|
|
@ -144,6 +144,10 @@ protected:
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QTextBrowser>
|
#include <QTextBrowser>
|
||||||
#include <MessageLoader.h>
|
#include <MessageLoader.h>
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 行为树节点编辑器
|
||||||
|
/// </summary>
|
||||||
class BehaviorEditor : public QMainWindow {
|
class BehaviorEditor : public QMainWindow {
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<MessageLoader> _global_loader;
|
std::shared_ptr<MessageLoader> _global_loader;
|
||||||
|
|
Loading…
Reference in New Issue