obs-tablet-remote icon indicating copy to clipboard operation
obs-tablet-remote copied to clipboard

Hidden scenes feature

Open Robson-Rocha opened this issue 5 years ago • 4 comments

Added the cpability to set a prefix which, when found in the names scene, will hide it from the scenes button selection, which is useful for hiding scenes not intended for direct broadcasting, but only to compose in other scenes

Robson-Rocha avatar Dec 13 '19 04:12 Robson-Rocha

BUG REPORT: I realize there's probably a more official way of doing this, but I have no idea what I'm doing on GitHub.

Feature-wise this is a great addition, but I have run into a bug with two phases.

  1. Entering a tag value into the field works as advertised, but once you've put something into the field, resetting the field to blank results in no scenes being displayed... because all scene names begin with... nothing, I guess?

You can easily fix this right now by simply entering nonsense into that field again, like "asdfasdfasdfasdf" (or anything that wouldn't be at the beginning of your scene names), and all scenes that don't begin with that will show up again.

  1. However, if you reload the page while no scenes are visible in an attempt to reset it that way, you no longer have access to the settings button within the scenes panel, and at that point the only way to have your scenes again is to delete the whole panel, then add it again, and re-enter your scene settings.

Aside from the styleguide issue mentioned by t2t2, I feel the best way to fix this is a toggle, so that you don't need to keep entering legit tags and nonsense. Just set your tag once and flip a switch on and off.

That being said, I'm still probably going to use this, because it's exactly a feature I've been needing to weed things out, so thank you!

mateohhh avatar Apr 30 '20 08:04 mateohhh

Someone who knows what they're doing can make this change on github, but I found that both issues I encountered above seem to be eliminated if you change line 9 to the following:

	v-if="!(scene.name.startsWith(hidePrefix) && (hidePrefix != '') && (hidePrefix != null))"

This doesn't address the styleguide issue, but at least this is a simple fix for this codebase.

mateohhh avatar Apr 30 '20 10:04 mateohhh

I've been messing with the code, and after duplicating and changing the added code from this pull, we can now also choose to specifically show only scenes starting with a certain tag... with the mild caveat that the problems I described above for the "hide" field now exist in reverse for the "show" field.

If you enter an invalid "show" tag that isn't at the beginning of any scene name, with no value entered in the "hide" field, it will hide all scenes, and you will need to delete the scenes panel and add it again to reset. Otherwise, I think it properly ignores both fields when they are both empty or both contain values, and generally seems to handle the hide function without bugs now.

Line 9 is now this for me (no longer checking for null, as I'm providing an empty char '' as the default return value for the hidePrefix and showPrefix functions starting at Line 134):

                 v-if="((!(scene.name.startsWith(hidePrefix)) && (hidePrefix != '')) ||
                 (scene.name.startsWith(showPrefix) && (showPrefix != '')) || 
                 ((hidePrefix == '') && (showPrefix == '')) || 
                 ((hidePrefix != '') && (showPrefix != '')))"

Lines 78-91 now replaced with this:

		<h3 class="text-xl mb-2" style="padding-top: 20px;">
			Filter Scenes <span style="font-size: .8em;">&nbsp;&nbsp;(case-sensitive... choose one, or both are ignored)</span>
		</h3>
		<div class="field">
			<label
				:for="`settings-${id}-hide-prefix`"
				class="label"
			>Hide scenes with this prefix:</label>
			<input
				:id="`settings-${id}-hide-prefix`"
				v-model="hidePrefix"
				class="input"
			>
		</div>
		<div class="field">
			<label
				:for="`settings-${id}-show-prefix`"
				class="label"
			>Only Show scenes starting with this prefix (WARNING: a non-existent tag will hide all scenes, then you must delete and add the panel again to fix it):</label>
			<input
				:id="`settings-${id}-show-prefix`"
				v-model="showPrefix"
				class="input"
			>
		</div>

Lines 134-141 now:

	hidePrefix: {
		get() {
			if (this.settings.hidePrefix){
				return this.settings.hidePrefix
			}
			return ''	
		},
		set(value) {
			this.setSetting('hidePrefix', value)
		}
	},
	showPrefix: {
		get() {
			if (this.settings.showPrefix){
				return this.settings.showPrefix
			}
			return ''
		},
		set(value) {
			this.setSetting('showPrefix', value)
		}
	},

mateohhh avatar Apr 30 '20 12:04 mateohhh

Great addition

Niek avatar May 14 '20 06:05 Niek