Merge pull request #193 from limbonaut/fix-monitor-performance
Fix `monitor_performance` screwing C# exports
This commit is contained in:
commit
f8ab80defa
|
@ -157,18 +157,16 @@ void BTPlayer::restart() {
|
||||||
set_active(true);
|
set_active(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
void BTPlayer::set_monitor_performance(bool p_monitor_performance) {
|
||||||
|
|
||||||
void BTPlayer::_set_monitor_performance(bool p_monitor_performance) {
|
|
||||||
monitor_performance = p_monitor_performance;
|
monitor_performance = p_monitor_performance;
|
||||||
|
|
||||||
|
#ifdef DEBUG_ENABLED
|
||||||
if (bt_instance.is_valid()) {
|
if (bt_instance.is_valid()) {
|
||||||
bt_instance->set_monitor_performance(monitor_performance);
|
bt_instance->set_monitor_performance(monitor_performance);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ! DEBUG_ENABLED
|
|
||||||
|
|
||||||
void BTPlayer::_notification(int p_notification) {
|
void BTPlayer::_notification(int p_notification) {
|
||||||
switch (p_notification) {
|
switch (p_notification) {
|
||||||
case NOTIFICATION_PROCESS: {
|
case NOTIFICATION_PROCESS: {
|
||||||
|
@ -235,6 +233,9 @@ void BTPlayer::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("set_blackboard_plan", "plan"), &BTPlayer::set_blackboard_plan);
|
ClassDB::bind_method(D_METHOD("set_blackboard_plan", "plan"), &BTPlayer::set_blackboard_plan);
|
||||||
ClassDB::bind_method(D_METHOD("get_blackboard_plan"), &BTPlayer::get_blackboard_plan);
|
ClassDB::bind_method(D_METHOD("get_blackboard_plan"), &BTPlayer::get_blackboard_plan);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("set_monitor_performance", "enable"), &BTPlayer::set_monitor_performance);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_monitor_performance"), &BTPlayer::get_monitor_performance);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("update", "delta"), &BTPlayer::update);
|
ClassDB::bind_method(D_METHOD("update", "delta"), &BTPlayer::update);
|
||||||
ClassDB::bind_method(D_METHOD("restart"), &BTPlayer::restart);
|
ClassDB::bind_method(D_METHOD("restart"), &BTPlayer::restart);
|
||||||
|
|
||||||
|
@ -249,6 +250,7 @@ void BTPlayer::_bind_methods() {
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "active"), "set_active", "get_active");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "active"), "set_active", "get_active");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "blackboard", PROPERTY_HINT_NONE, "Blackboard", 0), "set_blackboard", "get_blackboard");
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "blackboard", PROPERTY_HINT_NONE, "Blackboard", 0), "set_blackboard", "get_blackboard");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "blackboard_plan", PROPERTY_HINT_RESOURCE_TYPE, "BlackboardPlan", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT | PROPERTY_USAGE_ALWAYS_DUPLICATE), "set_blackboard_plan", "get_blackboard_plan");
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "blackboard_plan", PROPERTY_HINT_RESOURCE_TYPE, "BlackboardPlan", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT | PROPERTY_USAGE_ALWAYS_DUPLICATE), "set_blackboard_plan", "get_blackboard_plan");
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "monitor_performance"), "set_monitor_performance", "get_monitor_performance");
|
||||||
|
|
||||||
BIND_ENUM_CONSTANT(IDLE);
|
BIND_ENUM_CONSTANT(IDLE);
|
||||||
BIND_ENUM_CONSTANT(PHYSICS);
|
BIND_ENUM_CONSTANT(PHYSICS);
|
||||||
|
@ -259,12 +261,6 @@ void BTPlayer::_bind_methods() {
|
||||||
#ifndef DISABLE_DEPRECATED
|
#ifndef DISABLE_DEPRECATED
|
||||||
ADD_SIGNAL(MethodInfo("behavior_tree_finished", PropertyInfo(Variant::INT, "status")));
|
ADD_SIGNAL(MethodInfo("behavior_tree_finished", PropertyInfo(Variant::INT, "status")));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
|
||||||
ClassDB::bind_method(D_METHOD("_set_monitor_performance", "enable"), &BTPlayer::_set_monitor_performance);
|
|
||||||
ClassDB::bind_method(D_METHOD("_get_monitor_performance"), &BTPlayer::_get_monitor_performance);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "monitor_performance"), "_set_monitor_performance", "_get_monitor_performance");
|
|
||||||
#endif // DEBUG_ENABLED
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BTPlayer::BTPlayer() {
|
BTPlayer::BTPlayer() {
|
||||||
|
|
|
@ -44,6 +44,7 @@ private:
|
||||||
bool active = true;
|
bool active = true;
|
||||||
Ref<Blackboard> blackboard;
|
Ref<Blackboard> blackboard;
|
||||||
Node *scene_root_hint = nullptr;
|
Node *scene_root_hint = nullptr;
|
||||||
|
bool monitor_performance = false;
|
||||||
|
|
||||||
Ref<BTInstance> bt_instance;
|
Ref<BTInstance> bt_instance;
|
||||||
|
|
||||||
|
@ -74,6 +75,9 @@ public:
|
||||||
Ref<Blackboard> get_blackboard() const { return blackboard; }
|
Ref<Blackboard> get_blackboard() const { return blackboard; }
|
||||||
void set_blackboard(const Ref<Blackboard> &p_blackboard) { blackboard = p_blackboard; }
|
void set_blackboard(const Ref<Blackboard> &p_blackboard) { blackboard = p_blackboard; }
|
||||||
|
|
||||||
|
void set_monitor_performance(bool p_monitor_performance);
|
||||||
|
bool get_monitor_performance() const { return monitor_performance; }
|
||||||
|
|
||||||
void update(double p_delta);
|
void update(double p_delta);
|
||||||
void restart();
|
void restart();
|
||||||
|
|
||||||
|
@ -84,16 +88,6 @@ public:
|
||||||
|
|
||||||
BTPlayer();
|
BTPlayer();
|
||||||
~BTPlayer();
|
~BTPlayer();
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED // Performance monitoring
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool monitor_performance = false;
|
|
||||||
|
|
||||||
void _set_monitor_performance(bool p_monitor_performance);
|
|
||||||
bool _get_monitor_performance() const { return monitor_performance; }
|
|
||||||
|
|
||||||
#endif // * DEBUG_ENABLED
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BT_PLAYER_H
|
#endif // BT_PLAYER_H
|
||||||
|
|
|
@ -44,15 +44,15 @@ void BTState::set_scene_root_hint(Node *p_scene_root) {
|
||||||
scene_root_hint = p_scene_root;
|
scene_root_hint = p_scene_root;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
void BTState::set_monitor_performance(bool p_monitor) {
|
||||||
void BTState::_set_monitor_performance(bool p_monitor) {
|
|
||||||
monitor_performance = p_monitor;
|
monitor_performance = p_monitor;
|
||||||
|
|
||||||
|
#ifdef DEBUG_ENABLED
|
||||||
if (bt_instance.is_valid()) {
|
if (bt_instance.is_valid()) {
|
||||||
bt_instance->set_monitor_performance(monitor_performance);
|
bt_instance->set_monitor_performance(monitor_performance);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif // DEBUG_ENABLED
|
|
||||||
|
|
||||||
void BTState::_update_blackboard_plan() {
|
void BTState::_update_blackboard_plan() {
|
||||||
if (get_blackboard_plan().is_null()) {
|
if (get_blackboard_plan().is_null()) {
|
||||||
|
@ -144,17 +144,15 @@ void BTState::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("set_failure_event", "event"), &BTState::set_failure_event);
|
ClassDB::bind_method(D_METHOD("set_failure_event", "event"), &BTState::set_failure_event);
|
||||||
ClassDB::bind_method(D_METHOD("get_failure_event"), &BTState::get_failure_event);
|
ClassDB::bind_method(D_METHOD("get_failure_event"), &BTState::get_failure_event);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("set_monitor_performance", "enable"), &BTState::set_monitor_performance);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_monitor_performance"), &BTState::get_monitor_performance);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_scene_root_hint", "scene_root"), &BTState::set_scene_root_hint);
|
ClassDB::bind_method(D_METHOD("set_scene_root_hint", "scene_root"), &BTState::set_scene_root_hint);
|
||||||
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "behavior_tree", PROPERTY_HINT_RESOURCE_TYPE, "BehaviorTree"), "set_behavior_tree", "get_behavior_tree");
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "behavior_tree", PROPERTY_HINT_RESOURCE_TYPE, "BehaviorTree"), "set_behavior_tree", "get_behavior_tree");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "success_event"), "set_success_event", "get_success_event");
|
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "success_event"), "set_success_event", "get_success_event");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "failure_event"), "set_failure_event", "get_failure_event");
|
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "failure_event"), "set_failure_event", "get_failure_event");
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "monitor_performance"), "set_monitor_performance", "get_monitor_performance");
|
||||||
#ifdef DEBUG_ENABLED
|
|
||||||
ClassDB::bind_method(D_METHOD("_set_monitor_performance", "enable"), &BTState::_set_monitor_performance);
|
|
||||||
ClassDB::bind_method(D_METHOD("_get_monitor_performance"), &BTState::_get_monitor_performance);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "monitor_performance"), "_set_monitor_performance", "_get_monitor_performance");
|
|
||||||
#endif // DEBUG_ENABLED
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BTState::BTState() {
|
BTState::BTState() {
|
||||||
|
|
|
@ -26,6 +26,7 @@ private:
|
||||||
StringName success_event;
|
StringName success_event;
|
||||||
StringName failure_event;
|
StringName failure_event;
|
||||||
Node *scene_root_hint = nullptr;
|
Node *scene_root_hint = nullptr;
|
||||||
|
bool monitor_performance = false;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
@ -51,17 +52,12 @@ public:
|
||||||
void set_failure_event(const StringName &p_failure_event) { failure_event = p_failure_event; }
|
void set_failure_event(const StringName &p_failure_event) { failure_event = p_failure_event; }
|
||||||
StringName get_failure_event() const { return failure_event; }
|
StringName get_failure_event() const { return failure_event; }
|
||||||
|
|
||||||
|
void set_monitor_performance(bool p_monitor);
|
||||||
|
bool get_monitor_performance() const { return monitor_performance; }
|
||||||
|
|
||||||
void set_scene_root_hint(Node *p_node);
|
void set_scene_root_hint(Node *p_node);
|
||||||
|
|
||||||
BTState();
|
BTState();
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
|
||||||
private:
|
|
||||||
bool monitor_performance = false;
|
|
||||||
|
|
||||||
void _set_monitor_performance(bool p_monitor);
|
|
||||||
bool _get_monitor_performance() const { return monitor_performance; }
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BT_STATE_H
|
#endif // BT_STATE_H
|
||||||
|
|
Loading…
Reference in New Issue