Implement source removal via GUI
- When the remove source tool icon is clicked, it will now remove the source from the scene. - Fixed a bug where the scene item removal callback would add the scene item to the list instead of removing it. - Changed AddSourcePopup to AddSourcePopupMenu. Name actually confused me once despite being the writer, so it was clearly a bad name.
This commit is contained in:
parent
dcde1dcf2a
commit
717a2538f4
@ -131,7 +131,7 @@ void OBSBasic::SceneItemRemoved(void *data, calldata_t params)
|
||||
obs_sceneitem_t item = (obs_sceneitem_t)calldata_ptr(params, "item");
|
||||
|
||||
if (window->GetCurrentScene() == scene)
|
||||
window->AddSceneItem(item);
|
||||
window->RemoveSceneItem(item);
|
||||
}
|
||||
|
||||
void OBSBasic::SourceAdded(void *data, calldata_t params)
|
||||
@ -408,7 +408,7 @@ void OBSBasic::AddSource(obs_scene_t scene, const char *id)
|
||||
}
|
||||
}
|
||||
|
||||
void OBSBasic::AddSourcePopup()
|
||||
void OBSBasic::AddSourcePopupMenu()
|
||||
{
|
||||
int sceneSel = scenes->GetSelection();
|
||||
size_t idx = 0;
|
||||
@ -443,11 +443,21 @@ void OBSBasic::AddSourcePopup()
|
||||
|
||||
void OBSBasic::sourceAddClicked(wxCommandEvent &event)
|
||||
{
|
||||
AddSourcePopup();
|
||||
AddSourcePopupMenu();
|
||||
}
|
||||
|
||||
void OBSBasic::sourceRemoveClicked(wxCommandEvent &event)
|
||||
{
|
||||
int sel = sources->GetSelection();
|
||||
if (sel == wxNOT_FOUND)
|
||||
return;
|
||||
|
||||
obs_sceneitem_t item = (obs_sceneitem_t)sources->GetClientData(sel);
|
||||
obs_source_t source = obs_sceneitem_getsource(item);
|
||||
int ref = obs_sceneitem_destroy(item);
|
||||
|
||||
if (ref == 1)
|
||||
obs_source_remove(source);
|
||||
}
|
||||
|
||||
void OBSBasic::sourcePropertiesClicked(wxCommandEvent &event)
|
||||
|
@ -40,7 +40,7 @@ class OBSBasic : public OBSBasicBase {
|
||||
void ResizePreview(uint32_t cx, uint32_t cy);
|
||||
|
||||
void AddSource(obs_scene_t scene, const char *id);
|
||||
void AddSourcePopup();
|
||||
void AddSourcePopupMenu();
|
||||
|
||||
bool InitGraphics();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user