mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-15 22:32:13 +00:00
Inital changes
This commit is contained in:
1 parent
805b424b25
commit
984349c1ce
4 files changed
+40
-19
No files matched your search
@@ -22,12 +22,8 @@ export const PageEnigma = () => {
|
||||
useSignals();
|
||||
useEffect(() => {
|
||||
function setPage() {
|
||||
const pxRatioWidth =
|
||||
window.screen.availWidth / document.documentElement.clientWidth;
|
||||
const pxRatioHeight =
|
||||
window.screen.availHeight / document.documentElement.clientHeight;
|
||||
pageHeight.value = window.outerHeight / pxRatioHeight;
|
||||
pageWidth.value = window.outerWidth / pxRatioWidth;
|
||||
pageHeight.value = window.innerHeight / window.devicePixelRatio;
|
||||
pageWidth.value = window.outerWidth / window.devicePixelRatio;
|
||||
}
|
||||
timelineHeight.value = window.innerHeight * 0.25;
|
||||
sidePanelWidth.value = 443;
|
||||
|
||||
@@ -53,7 +53,6 @@ export const PageEnigmaComponent = () => {
|
||||
const width = sidePanelVisible.value
|
||||
? pageWidth.value - dndWidth - 66
|
||||
: pageWidth.value - 66;
|
||||
|
||||
const height =
|
||||
dndTimelineHeight.value > -1
|
||||
? pageHeight.value - dndTimelineHeight.value - 68
|
||||
|
||||
@@ -1,21 +1,49 @@
|
||||
import { fromEngineActions } from "~/pages/PageEnigma/Queue/fromEngineActions";
|
||||
import { useSignals } from "@preact/signals-react/runtime";
|
||||
import { useCallback, useContext, useEffect } from "react";
|
||||
import { currentTime } from "~/pages/PageEnigma/store";
|
||||
import { characterGroups, currentTime } from "~/pages/PageEnigma/store";
|
||||
import Queue from "~/pages/PageEnigma/Queue/Queue";
|
||||
import { QueueNames } from "~/pages/PageEnigma/Queue/QueueNames";
|
||||
import { toEngineActions } from "~/pages/PageEnigma/Queue/toEngineActions";
|
||||
import {
|
||||
CharacterGroup,
|
||||
ClipGroup,
|
||||
QueueClip,
|
||||
QueueKeyframe,
|
||||
UpdateTime,
|
||||
} from "~/pages/PageEnigma/models";
|
||||
import { TrackContext } from "~/pages/PageEnigma/contexts/TrackContext/TrackContext";
|
||||
import { toTimelineActions } from "~/pages/PageEnigma/Queue/toTimelineActions";
|
||||
import { ClipUI } from "~/pages/PageEnigma/datastructures/clips/clip_ui";
|
||||
|
||||
interface Arguments {
|
||||
action: fromEngineActions | toEngineActions | toTimelineActions;
|
||||
data: QueueClip | UpdateTime | QueueKeyframe;
|
||||
data: QueueClip | UpdateTime | QueueKeyframe | ClipUI[];
|
||||
}
|
||||
|
||||
function addCharacter(item: ClipUI) {
|
||||
const existingCharacter = characterGroups.value.find(
|
||||
(character) => character.id === item.object_uuid,
|
||||
);
|
||||
|
||||
if (existingCharacter) {
|
||||
return;
|
||||
}
|
||||
|
||||
const newCharacter = {
|
||||
id: item.object_uuid,
|
||||
muted: false,
|
||||
animationClips: [],
|
||||
positionKeyframes: [],
|
||||
lipSyncClips: [],
|
||||
} as CharacterGroup;
|
||||
|
||||
characterGroups.value = [
|
||||
...characterGroups.value.filter(
|
||||
(character) => character.id !== item.object_uuid,
|
||||
),
|
||||
newCharacter,
|
||||
].sort((charA, charB) => (charA.id < charB.id ? -1 : 1));
|
||||
}
|
||||
|
||||
export function useQueueHandler() {
|
||||
@@ -29,7 +57,13 @@ export function useQueueHandler() {
|
||||
currentTime.value = (data as UpdateTime).currentTime;
|
||||
break;
|
||||
case fromEngineActions.UPDATE_TIME_LINE:
|
||||
console.log(action)
|
||||
console.log(data);
|
||||
// (data as ClipUI[]).forEach((item) => {
|
||||
// addCharacter(item);
|
||||
// if (item.group === ClipGroup.CHARACTER) {
|
||||
// }
|
||||
// });
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown action ${action}`);
|
||||
}
|
||||
|
||||
@@ -13,15 +13,7 @@ import { QueueNames } from "~/pages/PageEnigma/Queue/QueueNames";
|
||||
import { toEngineActions } from "~/pages/PageEnigma/Queue/toEngineActions";
|
||||
import * as uuid from "uuid";
|
||||
|
||||
export const characterGroups = signal<CharacterGroup[]>([
|
||||
{
|
||||
id: "CH1",
|
||||
muted: false,
|
||||
animationClips: [],
|
||||
positionKeyframes: [],
|
||||
lipSyncClips: [],
|
||||
},
|
||||
]);
|
||||
export const characterGroups = signal<CharacterGroup[]>([]);
|
||||
|
||||
export function updateCharacters({
|
||||
type,
|
||||
|
||||
Reference in new issue
Block a user