-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Array curve #1724
base: master
Are you sure you want to change the base?
Array curve #1724
Conversation
3ea0f4a
to
4c2b2f3
Compare
is there any chance array curve should be an array of base curves instead of an array of key frame containers? |
4c2b2f3
to
0b01820
Compare
The base curves would have a bunch of duplicate info that we would want to avoid, e.g. they would all have shared pointer to the event loop, their own IDs, and ID strings. Basically, the curve array container should only have this information once. |
Then the IDs wouldn't be unique which would be a problem for the event system. Since all curves are event entities, duplicating the information would either lead to all contained curves being updated or worse, only one curve being tracked by the event loop. It would also be a waste of space, since we have to store a bunch of redundant data which is what we want to avoid with a dedicated Array class. Also, |
0b01820
to
1d653cd
Compare
79e5549
to
f68ec30
Compare
f68ec30
to
0e637b0
Compare
Some additional remarks:
|
alright, currently implementing the changes, really appreciate all the feedback. |
bffc8a5
to
22d7740
Compare
22d7740
to
dda1518
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.
I think I found everything I wanted to comment on :D
Array(const std::shared_ptr<event::EventLoop> &loop, | ||
size_t id, | ||
const std::string &idstr = "", | ||
const EventEntity::single_change_notifier ¬ifier = nullptr) : | ||
EventEntity(loop, notifier), _id{id}, _idstr{idstr}, loop{loop} {} |
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 are missing a constructor for types T
that cannot/shouldn't be default-initialized. For these types, you have to pass an initial array of values std::array<T, Size>
to the curve that the KeyframeContainer is initialized with.
*/ | ||
std::array<T, Size> get(const time::time_t &t) const; | ||
|
||
// Get the amount of KeyframeContainers in array curve |
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.
//
does not create a docstring as it is used for code comments. ///
creates a docstring.
Although it's much better to keep the comments consistens and always use /** ... */
.
// Get the amount of KeyframeContainers in array curve | |
/** | |
* Get the amount of KeyframeContainers in array curve. | |
*/ |
// get a copy to the KeyframeContainer at index | ||
KeyframeContainer<T> operator[](size_t index) const { | ||
return this->container.at(index); | ||
} |
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 method should not be public because KeyframeContainers should not be exposed by the curve.
#include "event/evententity.h" | ||
|
||
|
||
// remember to update docs |
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.
If you want a TODO for something that is necessary before merging, you should prefix it with ASDF. This will create a CI failure in the sanity check stage.
// remember to update docs | |
// ASDF: remember to update docs |
} | ||
|
||
// Array::Iterator is used to iterate over KeyframeContainers contained in a curve at a given time. | ||
class Iterator { |
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.
Is there a reason why this class doesn't implement CurveIterator
and uses a different strategy for iterating?
// returns a copy of the keyframe at the current offset and time | ||
const T operator*() { | ||
return this->curve->frame(this->time, this->offset).second; | ||
} |
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 method doesn't return a keyframe, it returns
T
- If it only returns
T
, you should useat()
instead offrame()
to retrieve the value.
Closes #1678