Skip to content

ofParameter<void>::trigger() does not notify parents. #6467

@eduardfrigola

Description

@eduardfrigola

When listening to parameterChangedE() event from an ofParameterGroup, ofParameter triggers does not get caught by this event.

Is there a reason for the trigger() method not implementing notifying events to parents? similar to what ofParameter::eventsSetValue(...) does:

if(!obj->parents.empty())
{
// Erase each invalid parent
obj->parents.erase(std::remove_if(obj->parents.begin(),
obj->parents.end(),
[this](const std::weak_ptr<ofParameterGroup::Value> & p){ return p.expired(); }),
obj->parents.end());
// notify all leftover (valid) parents of this object's changed value.
// this can't happen in the same iterator as above, because a notified listener
// might perform similar cleanups that would corrupt our iterator
// (which appens for example if the listener calls getFirstParent on us)
for(auto & parent: obj->parents){
auto p = parent.lock();
if(p){
p->notifyParameterChanged(*this);
}
}
}

I can send a PR implementing this if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions