Skip to content

Commit d0e9312

Browse files
committed
update
1 parent 63f22ab commit d0e9312

File tree

3 files changed

+43
-43
lines changed

3 files changed

+43
-43
lines changed

include/behaviortree_cpp_v3/config.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "Body/Plant.h"
1616
#include "Engine/Behavior/IvyBehavior.h"
1717
#include "Engine/IvyEngine.h"
18-
#include "Anim/drivers/EmoDriver.h"
18+
//#include "Anim/drivers/EmoDriver.h"
1919

2020
#endif
2121

@@ -139,17 +139,19 @@ namespace BT {
139139

140140
std::string get_interrupted_anim_name() {
141141
#ifdef Ivy
142-
return EmoDriver::instance().get_interrupted_anim_name();
142+
//return EmoDriver::instance().get_interrupted_anim_name();
143143
// return EmoDriver::instance().get_current_anim_unit_name();
144144
// return EventDispatcher::instance().get_interrupted_anim_name();
145+
return "";
145146
#else
146147
return "";
147148
#endif
148149
}
149150

150151
std::string get_current_anim_name() {
151152
#ifdef Ivy
152-
return EmoDriver::instance().get_current_anim_unit_name();
153+
//return EmoDriver::instance().get_current_anim_unit_name();
154+
return "";
153155
#else
154156
return "";
155157
#endif

include/behaviortree_cpp_v3/controls/ControlAnim.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
#ifdef Ivy
1414

15-
#include "Anim/Anim.h"
16-
1715
#endif
1816
namespace BT {
1917
class ControlAnim : public ControlNode {
@@ -27,9 +25,9 @@ namespace BT {
2725
private:
2826
#ifdef Ivy
2927

30-
void set_status(Anim::anim_complete_ret t_status);
28+
// void set_status(Anim::anim_complete_ret t_status);
3129

32-
std::weak_ptr<Anim> anim;
30+
// std::weak_ptr<Anim> anim;
3331
#endif
3432

3533
NodeStatus onStart();

src/controls/ControlAnim.cpp

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,44 @@
66

77
#ifdef Ivy
88

9-
#include "Anim/drivers/EmoDriver.h"
9+
//#include "Anim/drivers/EmoDriver.h"
1010
#include "Engine/Behavior/EventDispatcher.h"
1111

12-
BT::NodeStatus BT::ControlAnim::onStart() {
13-
auto a = Anim::create({}, [this](Anim::anim_complete_ret ret) { this->set_status(ret); });
14-
for (auto child: children()) {
15-
Optional<int> ret = child->getInput<int>(ANIMATION_NODE_N);
16-
if (!ret) {
17-
return NodeStatus::FAILURE;
18-
}
19-
a->add_unit(AnimUnit(child->name(), ret.value()));
20-
log_v("debug-bt add %s | %d", child->name().c_str(), n.value());
21-
}
22-
anim = a;
23-
bool ret = EmoDriver::instance().set_current_anim(a);
24-
if (ret) {
25-
return NodeStatus::RUNNING;
26-
} else {
27-
return NodeStatus::FAILURE;
28-
}
29-
}
30-
31-
32-
void BT::ControlAnim::onHalted() {
33-
std::shared_ptr<Anim> a = anim.lock();
34-
if (a) {
35-
a->set_complete(Anim::interrupted);
36-
}
37-
}
38-
39-
void BT::ControlAnim::set_status(Anim::anim_complete_ret t_status) {
40-
if (t_status == Anim::success) {
41-
setStatus(NodeStatus::SUCCESS);
42-
} else if (t_status == Anim::failure || t_status == Anim::interrupted) {
43-
setStatus(NodeStatus::FAILURE);
44-
}
45-
EventDispatcher::instance().dispatch(blank_tick);
46-
}
12+
//BT::NodeStatus BT::ControlAnim::onStart() {
13+
// auto a = Anim::create({}, [this](Anim::anim_complete_ret ret) { this->set_status(ret); });
14+
// for (auto child: children()) {
15+
// Optional<int> ret = child->getInput<int>(ANIMATION_NODE_N);
16+
// if (!ret) {
17+
// return NodeStatus::FAILURE;
18+
// }
19+
// a->add_unit(AnimUnit(child->name(), ret.value()));
20+
// log_v("debug-bt add %s | %d", child->name().c_str(), n.value());
21+
// }
22+
// anim = a;
23+
// bool ret = EmoDriver::instance().set_current_anim(a);
24+
// if (ret) {
25+
// return NodeStatus::RUNNING;
26+
// } else {
27+
// return NodeStatus::FAILURE;
28+
// }
29+
//}
30+
31+
32+
//void BT::ControlAnim::onHalted() {
33+
// std::shared_ptr<Anim> a = anim.lock();
34+
// if (a) {
35+
// a->set_complete(Anim::interrupted);
36+
// }
37+
//}
38+
39+
//void BT::ControlAnim::set_status(Anim::anim_complete_ret t_status) {
40+
// if (t_status == Anim::success) {
41+
// setStatus(NodeStatus::SUCCESS);
42+
// } else if (t_status == Anim::failure || t_status == Anim::interrupted) {
43+
// setStatus(NodeStatus::FAILURE);
44+
// }
45+
// EventDispatcher::instance().dispatch(blank_tick);
46+
//}
4747

4848
#else
4949

0 commit comments

Comments
 (0)