Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ export const TransformSourceEffectType: EffectType<{
categories: ["common"]
},
optionsTemplate: `
<eos-container ng-if="isUsingInvalidItemId" pad-top="true">
<div class="alert alert-danger">
<p style="margin: 0">
<b>Error:</b> Due to a previous bug with duplicating Preset Effect Lists, you will need to set the Scene Item again, this shouldn't be necessary again in the future.
</p>
</div>
</eos-container>
<eos-container header="OBS Scene" pad-top="true">
<div>
<button class="btn btn-link" ng-click="getScenes()">Refresh Scene Data</button>
Expand Down Expand Up @@ -101,10 +108,12 @@ export const TransformSourceEffectType: EffectType<{
<div style="display: flex; gap: 20px; margin-bottom: 20px">
<firebot-input
input-title="End X"
placeholder-text="Position in pixels"
model="effect.endTransform.positionX"
style="flex-basis: 50%" />
<firebot-input
input-title="End Y"
placeholder-text="Position in pixels"
model="effect.endTransform.positionY"
style="flex-basis: 50%" />
</div>
Expand All @@ -129,12 +138,12 @@ export const TransformSourceEffectType: EffectType<{
<div style="display: flex; gap: 20px; margin-bottom: 20px;">
<firebot-input
input-title="End X Scale"
placeholder-text="0.0 - 1.0"
placeholder-text="eg. 0.5 = 50% scale"
model="effect.endTransform.scaleX"
style="flex-basis: 50%" />
<firebot-input
input-title="End Y Scale"
placeholder-text="0.0 - 1.0"
placeholder-text="eg. 0.5 = 50% scale"
model="effect.endTransform.scaleY"
style="flex-basis: 50%" />
</div>
Expand Down Expand Up @@ -162,6 +171,7 @@ export const TransformSourceEffectType: EffectType<{
`,
optionsController: ($scope: any, backendCommunicator: any) => {
$scope.isObsConfigured = false;
$scope.isUsingInvalidItemId = false;

$scope.scenes = [];
$scope.sceneItems = [];
Expand All @@ -177,13 +187,25 @@ export const TransformSourceEffectType: EffectType<{
[10]: "Bottom Right"
});

// If legacy property sceneItem.id exists, we need to fix it
if (!!$scope.effect.sceneItem?.id) {
if (typeof ($scope.effect.sceneItem.id) !== "number") {
$scope.isUsingInvalidItemId = true;
delete $scope.effect.sceneItem;
} else {
$scope.effect.sceneItem.itemId = $scope.effect.sceneItem.id;
delete $scope.effect.sceneItem.id;
}
}

$scope.selectScene = (sceneName: string) => {
$scope.effect.sceneItem = undefined;
$scope.getSources(sceneName);
};

$scope.selectSceneItem = (sceneItem: OBSSceneItem) => {
$scope.effect.sceneItem = sceneItem;
$scope.isUsingInvalidItemId = false;
};

$scope.getScenes = () => {
Expand Down Expand Up @@ -259,7 +281,7 @@ export const TransformSourceEffectType: EffectType<{

await transformSceneItem(
effect.sceneItem.groupName ?? effect.sceneName,
effect.sceneItem.id,
effect.sceneItem.id ?? effect.sceneItem.itemId,
Number(effect.duration) * 1000,
parsedStart,
parsedEnd,
Expand Down
7 changes: 4 additions & 3 deletions src/backend/integrations/builtin/obs/obs-remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,8 @@ export type OBSSource = {
};

export type OBSSceneItem = {
id: number;
id?: number; // this is for legacy support, swapped to itemId to avoid breaking on duplicating Preset Effect Lists
itemId: number;
name: string;
groupName?: string;
};
Expand Down Expand Up @@ -890,7 +891,7 @@ export async function getAllSceneItemsInGroup(groupName: string): Promise<Array<
try {
const response = await obs.call("GetGroupSceneItemList", { sceneName: groupName });
return response.sceneItems.map(item => ({
id: item.sceneItemId as number,
itemId: item.sceneItemId as number,
name: item.sourceName as string,
groupName
}));
Expand All @@ -907,7 +908,7 @@ export async function getAllSceneItemsInScene(sceneName: string): Promise<Array<

for (const item of response.sceneItems) {
sceneItems.push({
id: item.sceneItemId as number,
itemId: item.sceneItemId as number,
name: item.sourceName as string
});

Expand Down