Move dirty filter state from AnimationNode to AnimationNodeInstance
This commit is contained in:
@@ -349,18 +349,25 @@ void AnimationNode::set_filter_path(const NodePath &p_path, bool p_enable) {
|
||||
} else {
|
||||
filter.erase(p_path);
|
||||
}
|
||||
filters_dirty = true;
|
||||
_mark_filters_dirty();
|
||||
}
|
||||
|
||||
void AnimationNode::set_filter_enabled(bool p_enable) {
|
||||
filter_enabled = p_enable;
|
||||
filters_dirty = true;
|
||||
_mark_filters_dirty();
|
||||
}
|
||||
|
||||
bool AnimationNode::is_filter_enabled() const {
|
||||
return filter_enabled;
|
||||
}
|
||||
|
||||
void AnimationNode::_mark_filters_dirty() {
|
||||
filters_version++;
|
||||
if (unlikely(filters_version == 0)) {
|
||||
filters_version = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void AnimationNode::set_deletable(bool p_closable) {
|
||||
closable = p_closable;
|
||||
}
|
||||
@@ -408,6 +415,7 @@ void AnimationNode::_set_filters(const Array &p_filters) {
|
||||
}
|
||||
|
||||
void AnimationNode::_update_filter_cache(const ProcessState &p_process_state, const AnimationNodeInstance &p_instance) {
|
||||
bool filters_dirty = p_instance.filters_version != filters_version;
|
||||
if (!p_process_state.track_map_updated && !filters_dirty) {
|
||||
return; // Cache is valid.
|
||||
}
|
||||
@@ -422,7 +430,7 @@ void AnimationNode::_update_filter_cache(const ProcessState &p_process_state, co
|
||||
p_instance.filtered_track_indices_cache.push_back(*p);
|
||||
}
|
||||
}
|
||||
filters_dirty = false;
|
||||
p_instance.filters_version = filters_version;
|
||||
}
|
||||
|
||||
void AnimationNode::_validate_property(PropertyInfo &p_property) const {
|
||||
|
||||
@@ -66,7 +66,6 @@ public:
|
||||
LocalVector<Input> inputs;
|
||||
HashSet<NodePath> filter;
|
||||
bool filter_enabled = false;
|
||||
bool filters_dirty = true;
|
||||
|
||||
// To propagate information from upstream for use in estimation of playback progress.
|
||||
// These values must be taken from the result of blend_node() or blend_input() and must be essentially read-only.
|
||||
@@ -179,6 +178,9 @@ protected:
|
||||
GDVIRTUAL4R(double, _process, double, bool, bool, bool)
|
||||
GDVIRTUAL0RC(String, _get_caption)
|
||||
GDVIRTUAL0RC(bool, _has_filter)
|
||||
private:
|
||||
mutable uint32_t filters_version = 1;
|
||||
void _mark_filters_dirty();
|
||||
|
||||
public:
|
||||
virtual void get_parameter_list(LocalVector<PropertyInfo> *r_list) const;
|
||||
@@ -266,6 +268,7 @@ struct AnimationNodeInstance {
|
||||
mutable LocalVector<AnimationNodeInstance *> connection_instances; // AnimationNodeInstance* | nullptr
|
||||
mutable LocalVector<real_t> track_weights;
|
||||
mutable LocalVector<int> filtered_track_indices_cache;
|
||||
mutable uint32_t filters_version = 0;
|
||||
mutable AHashMap<StringName, AnimationNodeInstance *> child_instances; // Child Name -> AnimationNodeInstance*
|
||||
|
||||
// Multiple AnimationNodeInstances can share the same resource btw.
|
||||
|
||||
Reference in New Issue
Block a user