2023-04-13 07:29:45 +00:00
|
|
|
/* behavior_tree_view.h */
|
|
|
|
|
2023-04-27 07:41:59 +00:00
|
|
|
#ifdef TOOLS_ENABLED
|
|
|
|
|
2023-04-13 07:29:45 +00:00
|
|
|
#ifndef BEHAVIOR_TREE_VIEW_H
|
|
|
|
#define BEHAVIOR_TREE_VIEW_H
|
|
|
|
|
|
|
|
#include "behavior_tree_data.h"
|
2023-07-20 16:35:36 +00:00
|
|
|
|
2023-04-13 07:29:45 +00:00
|
|
|
#include "core/object/class_db.h"
|
|
|
|
#include "core/object/object.h"
|
|
|
|
#include "scene/gui/control.h"
|
|
|
|
#include "scene/gui/tree.h"
|
2023-04-14 08:16:26 +00:00
|
|
|
#include "scene/resources/style_box.h"
|
2023-04-14 11:18:23 +00:00
|
|
|
#include "scene/resources/texture.h"
|
2023-04-13 07:29:45 +00:00
|
|
|
|
|
|
|
class BehaviorTreeView : public Control {
|
|
|
|
GDCLASS(BehaviorTreeView, Control);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Tree *tree;
|
2023-04-14 08:16:26 +00:00
|
|
|
StyleBoxFlat sbf_running;
|
|
|
|
StyleBoxFlat sbf_success;
|
|
|
|
StyleBoxFlat sbf_failure;
|
|
|
|
Vector<int> collapsed_ids;
|
2023-04-13 07:29:45 +00:00
|
|
|
|
2023-04-14 11:18:23 +00:00
|
|
|
Ref<Texture2D> icon_running;
|
|
|
|
Ref<Texture2D> icon_success;
|
|
|
|
Ref<Texture2D> icon_failure;
|
|
|
|
|
2023-04-14 08:16:26 +00:00
|
|
|
void _draw_success_status(Object *p_obj, Rect2 p_rect);
|
|
|
|
void _draw_running_status(Object *p_obj, Rect2 p_rect);
|
|
|
|
void _draw_failure_status(Object *p_obj, Rect2 p_rect);
|
|
|
|
void _item_collapsed(Object *p_obj);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
2023-04-13 07:29:45 +00:00
|
|
|
|
2023-04-14 11:18:23 +00:00
|
|
|
void _notification(int p_notification);
|
|
|
|
|
2023-04-14 08:16:26 +00:00
|
|
|
public:
|
2023-04-13 07:29:45 +00:00
|
|
|
void update_tree(const BehaviorTreeData &p_data);
|
|
|
|
void clear();
|
2023-04-14 08:16:26 +00:00
|
|
|
|
|
|
|
BehaviorTreeView();
|
2023-04-13 07:29:45 +00:00
|
|
|
};
|
|
|
|
|
2023-04-27 07:41:59 +00:00
|
|
|
#endif // BEHAVIOR_TREE_VIEW
|
|
|
|
|
|
|
|
#endif // TOOLS_ENABLED
|