Skip to content
This repository was archived by the owner on Dec 2, 2025. It is now read-only.

Commit 4bfc985

Browse files
committed
Allow more control of Controllers property
In case of new SD+ plugins, they may be allowed on either a KeyPad or a Dial (via Encoder). Adding this property `keyPad` allows us to disable the options of installing an Action to the KeyPad, forcing it to be Encoder (Dial) only.
1 parent 3ad0120 commit 4bfc985

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

src/Action.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,21 @@ export class Action<
9191
*/
9292
public device = "";
9393

94+
/**
95+
* Defines how the action interacts with Dial buttons on the SD+
96+
* By default this is not set and actions don't list Encoder as a Controller.
97+
* @type {Encoder}
98+
*/
9499
public encoder: Encoder = undefined as unknown as Encoder;
95100

101+
/**
102+
* Defines if the Action is allowed on a KeyPad button.
103+
* `true` by default for backwards compatibility.
104+
*
105+
* @type {boolean}
106+
*/
107+
public keyPad = true;
108+
96109
constructor(params: {
97110
name: string;
98111
inspectorName?: string;
@@ -120,6 +133,18 @@ export class Action<
120133
States: this.states.map((s) => s.toManifest()),
121134
};
122135

136+
const controllers: string[] = [];
137+
138+
if (this.encoder !== undefined) {
139+
controllers.push("Encoder");
140+
}
141+
142+
if (this.keyPad === true) {
143+
controllers.push("KeyPad");
144+
}
145+
146+
snippet.Controllers = controllers as unknown as string[];
147+
123148
const optionals: [string, unknown, unknown][] = [
124149
[
125150
"PropertyInspectorPath",
@@ -132,7 +157,7 @@ export class Action<
132157
this.hasMultiActionSupport === false,
133158
this.hasMultiActionSupport,
134159
],
135-
["Controllers", this.encoder !== undefined, ["KeyPad", "Encoder"]],
160+
// ["Controllers", controllers],
136161
["Encoder", this.encoder !== undefined, this.encoder.toManifest()],
137162
];
138163

0 commit comments

Comments
 (0)