update
This commit is contained in:
parent
c250d01042
commit
f0abd3bc92
|
@ -127,18 +127,18 @@ void LogicalNode::setParent(std::weak_ptr<LogicalNode> pnode)
|
|||
this->_parent_bind = pnode;
|
||||
}
|
||||
|
||||
NodeKind LogicalNode::kind() const
|
||||
NodeKind LogicalNode::nodeKind() const
|
||||
{
|
||||
return _node_type;
|
||||
}
|
||||
|
||||
std::shared_ptr<LogicalNode> LogicalNode::bindParentMap() const
|
||||
std::shared_ptr<LogicalNode> LogicalNode::bindMap() const
|
||||
{
|
||||
auto node_temp = this->getBackwards().lock();
|
||||
auto node_temp = this->parent().lock();
|
||||
if (!node_temp) return nullptr;
|
||||
|
||||
while (node_temp->kind() != NodeKind::MAPNODE) {
|
||||
node_temp = node_temp->getBackwards().lock();
|
||||
while (node_temp->nodeKind() != NodeKind::MAPNODE) {
|
||||
node_temp = node_temp->parent().lock();
|
||||
}
|
||||
return node_temp;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ QString LogicalNode::runtimeName() const
|
|||
return QString("%1(%2)").arg(this->typeName()).arg(getID());
|
||||
}
|
||||
|
||||
std::weak_ptr<LogicalNode> LogicalNode::getBackwards() const
|
||||
std::weak_ptr<LogicalNode> LogicalNode::parent() const
|
||||
{
|
||||
return this->_parent_bind;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,20 @@ class CompareKernel;
|
|||
class ConvertKernel;
|
||||
class LogicalNode;
|
||||
|
||||
/// <summary>
|
||||
/// 通用数据类型
|
||||
/// </summary>
|
||||
struct COMPONENTBASIC_EXPORT GeneralData : public TopicData {
|
||||
QJsonObject _element_bind;
|
||||
|
||||
QString topicString() const override;
|
||||
std::shared_ptr<Serializable> newDefault() const override;
|
||||
|
||||
void recoveryFrom(const QJsonObject& obj) override;
|
||||
void saveTo(QJsonObject& obj) const override;
|
||||
};
|
||||
// ==================================================================================
|
||||
|
||||
/// <summary>
|
||||
/// 行为树实例化节点
|
||||
/// </summary>
|
||||
|
@ -114,7 +128,6 @@ public:
|
|||
void saveTo(QJsonObject& obj) const override{}
|
||||
};
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 比较关系实例
|
||||
/// </summary>
|
||||
|
@ -129,6 +142,7 @@ public:
|
|||
QString name() const;
|
||||
bool compare(std::shared_ptr<TopicData> vleft, std::shared_ptr<TopicData> vright);
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 数据转换实例
|
||||
/// </summary>
|
||||
|
@ -187,6 +201,9 @@ private:
|
|||
std::pair<DATA_TOPIC_STRING, QString> _output_appoint;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 执行结果
|
||||
/// </summary>
|
||||
|
@ -195,7 +212,6 @@ enum class LogicalResult {
|
|||
SUCCESS, // 成功
|
||||
FAILURE // 失败
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 逻辑节点类型
|
||||
/// </summary>
|
||||
|
@ -207,20 +223,6 @@ enum class NodeKind {
|
|||
COMPARENODE, // 比较节点
|
||||
ACTIONNODE, // 动作节点
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 通用数据类型
|
||||
/// </summary>
|
||||
struct COMPONENTBASIC_EXPORT GeneralData : public TopicData {
|
||||
QJsonObject _element_bind;
|
||||
|
||||
QString topicString() const override;
|
||||
std::shared_ptr<Serializable> newDefault() const override;
|
||||
|
||||
void recoveryFrom(const QJsonObject& obj) override;
|
||||
void saveTo(QJsonObject& obj) const override;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 所有逻辑节点的基类
|
||||
/// </summary>
|
||||
|
@ -235,22 +237,27 @@ public:
|
|||
LogicalNode(NodeKind t = NodeKind::ACTIONNODE);
|
||||
virtual ~LogicalNode() = default;
|
||||
|
||||
/// <summary>
|
||||
/// 获取节点类型
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
NodeKind nodeKind() const;
|
||||
|
||||
/// <summary>
|
||||
/// 重置父节点
|
||||
/// </summary>
|
||||
/// <param name="pnode"></param>
|
||||
void setParent(std::weak_ptr<LogicalNode> pnode);
|
||||
|
||||
/// <summary>
|
||||
/// 获取节点类型
|
||||
/// 回退节点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
NodeKind kind() const;
|
||||
std::weak_ptr<LogicalNode> parent() const;
|
||||
/// <summary>
|
||||
/// 获取包含树图节点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
std::shared_ptr<LogicalNode> bindParentMap() const;
|
||||
std::shared_ptr<LogicalNode> bindMap() const;
|
||||
|
||||
/// <summary>
|
||||
/// 设置节点id
|
||||
|
@ -267,11 +274,6 @@ public:
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
QString runtimeName() const;
|
||||
/// <summary>
|
||||
/// 回退节点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
std::weak_ptr<LogicalNode> getBackwards() const;
|
||||
|
||||
/// <summary>
|
||||
/// 重置内部状态
|
||||
|
|
Loading…
Reference in New Issue