UI: Fix filter props. getting recreated unnecessarily
Closes obsproject/obs-studio#5846
This commit is contained in:
parent
4b355192e7
commit
f0e631df17
@ -170,4 +170,20 @@ public:
|
||||
inline bool DeferUpdate() const { return deferUpdate; }
|
||||
|
||||
inline OBSObject GetObject() const { return OBSGetStrongRef(weakObj); }
|
||||
|
||||
#define Def_IsObject(type) \
|
||||
inline bool IsObject(obs_##type##_t *type) const \
|
||||
{ \
|
||||
OBSObject obj = OBSGetStrongRef(weakObj); \
|
||||
return obj.Get() == (obs_object_t *)type; \
|
||||
}
|
||||
|
||||
/* clang-format off */
|
||||
Def_IsObject(source)
|
||||
Def_IsObject(output)
|
||||
Def_IsObject(encoder)
|
||||
Def_IsObject(service)
|
||||
/* clang-format off */
|
||||
|
||||
#undef Def_IsObject
|
||||
};
|
||||
|
@ -263,6 +263,15 @@ void FilterChangeUndoRedo(void *vp, obs_data_t *nd_old_settings,
|
||||
|
||||
void OBSBasicFilters::UpdatePropertiesView(int row, bool async)
|
||||
{
|
||||
OBSSource filter = GetFilter(row, async);
|
||||
if (filter && view && view->IsObject(filter)) {
|
||||
/* do not recreate properties view if already using a view
|
||||
* with the same object */
|
||||
return;
|
||||
}
|
||||
|
||||
ui->propertiesFrame->setVisible(false);
|
||||
|
||||
if (view) {
|
||||
updatePropertiesSignal.Disconnect();
|
||||
ui->propertiesFrame->setVisible(false);
|
||||
@ -271,7 +280,6 @@ void OBSBasicFilters::UpdatePropertiesView(int row, bool async)
|
||||
view = nullptr;
|
||||
}
|
||||
|
||||
OBSSource filter = GetFilter(row, async);
|
||||
if (!filter)
|
||||
return;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user