Skip to content

Commit

Permalink
Feat: Boolean feedbacks for scene preview/program (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryce-seifert committed Mar 24, 2023
1 parent 7311bc5 commit 473dd7d
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 10 deletions.
46 changes: 46 additions & 0 deletions feedbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,52 @@ export function getFeedbacks() {
},
}

feedbacks['sceneProgram'] = {
type: 'boolean',
name: 'Scene in Program',
description: 'If a scene is in program, change the style of the button',
defaultStyle: {
color: ColorWhite,
bgcolor: ColorRed,
},
options: [
{
type: 'dropdown',
label: 'Scene',
id: 'scene',
default: this.sceneListDefault,
choices: this.sceneChoices,
minChoicesForSearch: 5,
},
],
callback: (feedback) => {
return this.states.programScene === feedback.options.scene
},
}

feedbacks['scenePreview'] = {
type: 'boolean',
name: 'Scene in Preview',
description: 'If a scene is in preview, change the style of the button',
defaultStyle: {
color: ColorWhite,
bgcolor: ColorGreen,
},
options: [
{
type: 'dropdown',
label: 'Scene',
id: 'scene',
default: this.sceneListDefault,
choices: this.sceneChoices,
minChoicesForSearch: 5,
},
],
callback: (feedback) => {
return this.states.previewScene === feedback.options.scene
},
}

feedbacks['scene_item_active'] = {
type: 'boolean',
name: 'Source Visible in Program',
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,13 @@ class OBSInstance extends InstanceBase {
this.states.programScene = data.sceneName
this.setVariableValues({ scene_active: this.states.programScene })
this.checkFeedbacks('scene_active')
this.checkFeedbacks('sceneProgram')
})
this.obs.on('CurrentPreviewSceneChanged', (data) => {
this.states.previewScene = data.sceneName ? data.sceneName : 'None'
this.setVariableValues({ scene_preview: this.states.previewScene })
this.checkFeedbacks('scene_active')
this.checkFeedbacks('scenePreview')
})
this.obs.on('SceneListChanged', () => {})
//Inputs
Expand Down
20 changes: 10 additions & 10 deletions presets.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ export function getPresets() {
],
feedbacks: [
{
feedbackId: 'scene_active',
feedbackId: 'sceneProgram',
options: {
bg: ColorRed,
fg: ColorWhite,
bg_preview: ColorGreen,
fg_preview: ColorWhite,
scene: scene.id,
},
style: {
bgcolor: ColorRed,
color: ColorWhite,
},
},
],
}
Expand Down Expand Up @@ -74,14 +74,14 @@ export function getPresets() {
],
feedbacks: [
{
feedbackId: 'scene_active',
feedbackId: 'scenePreview',
options: {
bg: ColorRed,
fg: ColorWhite,
bg_preview: ColorGreen,
fg_preview: ColorWhite,
scene: scene.id,
},
style: {
bgcolor: ColorGreen,
color: ColorWhite,
},
},
],
}
Expand Down

0 comments on commit 473dd7d

Please sign in to comment.