-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ApplyEffect implementation #1688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
fe0e630
to
5b96a18
Compare
03fd671
to
61d409b
Compare
8449c6d
to
51416c3
Compare
d79f834
to
26bac42
Compare
30c0ef0
to
35d4f37
Compare
35d4f37
to
63bc382
Compare
Hey @heinezen , what's the state of this PR? Is it ready-ish or faraway? Maybe you can add some details in here |
b1ac0c6
to
a4b8864
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 95 out of 96 changed files in this pull request and generated no comments.
Files not reviewed (1)
- libopenage/curve/CMakeLists.txt: Language not supported
Comments suppressed due to low confidence (1)
libopenage/curve/continuous.h:77
- The 'compress' parameter in set_insert is declared but not used; if compression is intended for insertions, consider incorporating this flag into the implementation or removing it to avoid confusion.
void Continuous<T>::set_insert(const time::time_t &t, const T &value, bool /* compress */) {
6023b34
to
2f0e318
Compare
635b0f5
to
fd5ea13
Compare
be52171
to
6dc3ca7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, this is really great 😄
just a few remarks and questions, but the generalized implementation of effect application looks truly well designed.
template <KeyframeValueLike T> | ||
void Continuous<T>::set_insert(const time::time_t &t, | ||
const T &value, | ||
bool /* compress */) { | ||
this->set_replace(t, value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not pass on compress?
// Store elements that should be kept | ||
std::vector<Keyframe<T>> to_keep; | ||
auto last_kept = e; | ||
for (auto current = e + 1; current < this->container.size() - 1; ++current) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has to be size - 2, otherwise the last element is doubled?
typename KeyframeContainer<T>::elem_ptr | ||
KeyframeContainer<T>::sync(const KeyframeContainer<T> &other, | ||
const time::time_t &start) { | ||
// Delete elements after start time | ||
// Delete elements from this container after start time | ||
elem_ptr at = this->last_before(start, this->container.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could use the default last_before
which uses the container size anyway.
at = this->insert_after(other.get(i), at); | ||
} | ||
} | ||
this->container.insert(this->container.end(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this assumes sync always is done on future content only, maybe we should remember for a synced-to curve which point it synced at, so we can also handle changes that happened before the last sync.
is probably nasty to figure out later, but easy to at least error when such a sync happens as we see it now.
* Check the type of the next command in the queue and return its associated key | ||
* value. | ||
* | ||
* The key value is the result of a static_cast of the \p command_t enum value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not return the command_t
value directly then?
std::pair("engine.util.command.type.Move", | ||
component::command::command_t::MOVE), | ||
std::pair("engine.util.command.type.ApplyEffect", | ||
component::command::command_t::APPLY_EFFECT)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be able to define these lookup aliases within nyan somehow?
auto path_angle = path_vector.to_angle(); | ||
|
||
if (not turn_speed->is_infinite_positive()) { | ||
auto angle_diff = path_angle - effector_angle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::abs
?
} | ||
|
||
|
||
const component::attribute_value_t ApplyEffect::get_applied_discrete_flac(const std::vector<nyan::Object> &effects, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/flac/flat
?
else if (std::holds_alternative<coord::phys3>(target.value())) { | ||
auto target_pos = std::get<coord::phys3>(target.value()); | ||
return Move::move_default(entity, state, target_pos, start_time); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can select the variant alternatives without a funny if block using std::visit
like this:
using value_t = std::variant<int, long, double, std::string>;
template<class... Ts>
struct overloaded : Ts... { using Ts::operator()...; };
std::vector<value_t> vec = {10, 15l, 1.5, "hello"};
for (auto &v : vec) {
std::visit(overloaded{
[](auto arg) { std::cout << arg << ' '; },
[](double arg) { std::cout << std::fixed << arg << ' '; },
[](const std::string& arg) { std::cout << std::quoted(arg) << ' '; }
}, v);
}
{"target", target_entity_id}, | ||
{"entity_ids", controller->get_selected()}, | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is just awesome
Implements a system to use the
ApplyEffect
ability of the nyan API.Resolves #671
Depends on SFTtech/nyan#124
Depends on #1778
Other Features