mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-13 21:32:18 +00:00
Merge branch 'test' into feature/make-scene-serialization-great-again
This commit is contained in:
commit
9ea209f7bf
4 files changed
+79
-35
No files matched your search
@@ -81,11 +81,46 @@ export const TrackProvider = ({ children }: Props) => {
|
||||
useEffect(() => {
|
||||
setAnimationClips([{
|
||||
version: 1,
|
||||
media_id: "m_w5t517krrf63f3tj2288vsffmj87zw",
|
||||
media_id: "m_s7d4ems68sb2vqj4pdje1rc15q3ycp",
|
||||
type: ClipType.ANIMATION,
|
||||
length: 25,
|
||||
name: "Walk",
|
||||
},
|
||||
{
|
||||
version: 1,
|
||||
media_id: "m_yzreg1494d08aepezj74607d2ascep",
|
||||
type: ClipType.ANIMATION,
|
||||
length: 100,
|
||||
name: "Sitting",
|
||||
},
|
||||
{
|
||||
version: 1,
|
||||
media_id: "m_qepzjytd4ahd5askdt2ngrwzj2aa3f",
|
||||
type: ClipType.ANIMATION,
|
||||
length: 100,
|
||||
name: "Idle",
|
||||
},
|
||||
{
|
||||
version: 1,
|
||||
media_id: "m_v06h821hj4dvst0mzm575jdka31f41",
|
||||
type: ClipType.ANIMATION,
|
||||
length: 100,
|
||||
name: "Punch",
|
||||
},
|
||||
{
|
||||
version: 1,
|
||||
media_id: "m_q92keqa05gds69zyd8mkep7z9338t8",
|
||||
type: ClipType.ANIMATION,
|
||||
length: 100,
|
||||
name: "Jump",
|
||||
},
|
||||
{
|
||||
version: 1,
|
||||
media_id: "m_0qmgsyxh5ng9c9ac3m0snzdqqs5q60",
|
||||
type: ClipType.ANIMATION,
|
||||
length: 100,
|
||||
name: "Dance",
|
||||
},
|
||||
]);
|
||||
setAudioClips([
|
||||
{
|
||||
|
||||
@@ -11,14 +11,14 @@ export class AnimationEngine {
|
||||
}
|
||||
|
||||
load_object(object_uuid: string, media_id:string, clip_name: string) {
|
||||
this.clips[object_uuid] = new AnimationClip(
|
||||
this.clips[object_uuid+media_id] = new AnimationClip(
|
||||
this.version,
|
||||
media_id,
|
||||
"glb",
|
||||
object_uuid,
|
||||
1.0, 1.0,
|
||||
clip_name);
|
||||
this.clips[object_uuid]._load_animation();
|
||||
this.clips[object_uuid+media_id]._load_animation();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,15 +346,6 @@ class Editor {
|
||||
);
|
||||
|
||||
this.cam_obj = this.activeScene.get_object_by_name("::CAM::");
|
||||
if (this.cam_obj) {
|
||||
this.addTransformClipBase(
|
||||
"Camera Object",
|
||||
"camera",
|
||||
this.cam_obj,
|
||||
0,
|
||||
150,
|
||||
);
|
||||
}
|
||||
|
||||
this.dispatchAppUiState({
|
||||
type: APPUI_ACTION_TYPES.UPDATE_EDITOR_LOADINGBAR,
|
||||
@@ -650,7 +641,7 @@ class Editor {
|
||||
// note the database from the server is the source of truth for all the data.
|
||||
// Test code here
|
||||
const object: THREE.Object3D = await this.activeScene.load_glb(
|
||||
"m_r7w1tmkx2jg8nznr3hyzj4k6zhfh7d",
|
||||
"m_77z28zfaxc3sdtt5cc68vpz2n40qed",
|
||||
);
|
||||
|
||||
object.uuid = "CH1";
|
||||
@@ -823,15 +814,6 @@ class Editor {
|
||||
updateLoop(time: number) {
|
||||
if (this.cam_obj == undefined) {
|
||||
this.cam_obj = this.activeScene.get_object_by_name("::CAM::");
|
||||
if (this.cam_obj) {
|
||||
this.addTransformClipBase(
|
||||
"Camera Object",
|
||||
"camera",
|
||||
this.cam_obj,
|
||||
0,
|
||||
150,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Updates debug stats.
|
||||
@@ -1032,10 +1014,29 @@ class Editor {
|
||||
URL.revokeObjectURL(url);
|
||||
document.body.removeChild(downloadLink);
|
||||
|
||||
const data = await this.api_manager.uploadMedia(blob, "render.mp4");
|
||||
const data: any = await this.api_manager.uploadMedia(blob, "render.mp4");
|
||||
console.log("data", data)
|
||||
|
||||
if (data == null) { return; }
|
||||
let upload_token = data['upload_token'];
|
||||
console.log(upload_token);
|
||||
// Create a link to download the file stylize video using api ..
|
||||
//{"success":true,"upload_token":"mu_x9kr5cfafn512pjbygdszvbdpktrr"} payload
|
||||
|
||||
const result = await this.api_manager
|
||||
.stylizeVideo(
|
||||
upload_token,
|
||||
this.art_style,
|
||||
this.positive_prompt,
|
||||
this.negative_prompt,
|
||||
Visibility.Public,
|
||||
)
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
console.log(result);
|
||||
|
||||
}
|
||||
|
||||
async generateFrame() {
|
||||
|
||||
@@ -64,7 +64,7 @@ export class TimeLine {
|
||||
) {
|
||||
this.timeline_items = [];
|
||||
this.absolute_end = 60 * 12;
|
||||
this.timeline_limit = this.absolute_end; // 5 seconds
|
||||
this.timeline_limit = 0; // 5 seconds
|
||||
|
||||
this.is_playing = false;
|
||||
this.scrubber_frame_position = 0; // in frames into the tl
|
||||
@@ -203,7 +203,6 @@ export class TimeLine {
|
||||
end_offset));
|
||||
return;
|
||||
} else {
|
||||
console.log("Audio!")
|
||||
this.audio_engine.loadClip(media_id);
|
||||
}
|
||||
break;
|
||||
@@ -239,8 +238,6 @@ export class TimeLine {
|
||||
|
||||
public async updateClip(data: any) {
|
||||
// only length and offset changes here.
|
||||
console.log(data);
|
||||
|
||||
let object_uuid = data["data"]["object_uuid"];
|
||||
const media_id = data["data"]["media_id"];
|
||||
const offset = data["data"]["offset"];
|
||||
@@ -253,10 +250,22 @@ export class TimeLine {
|
||||
}
|
||||
}
|
||||
}
|
||||
public async deleteClip(data: any) {
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
public async deleteClip(data: any) {
|
||||
let json_data = data['data'];
|
||||
let object_uuid = data["data"]["object_uuid"];
|
||||
let media_id = data["data"]["media_id"];
|
||||
let type = data['type']
|
||||
|
||||
for (let i = 0; i < this.timeline_items.length; i++) {
|
||||
const element = this.timeline_items[i];
|
||||
if (element.media_id == media_id && element.object_uuid == object_uuid) {
|
||||
this.timeline_items.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async scrubberUpdate(data: any) {
|
||||
console.log(data);
|
||||
}
|
||||
@@ -308,7 +317,6 @@ export class TimeLine {
|
||||
}
|
||||
|
||||
private async resetScene() {
|
||||
this.timeline_limit = this.getEndPoint();
|
||||
for (const element of this.timeline_items) {
|
||||
if (element.type == "transform") {
|
||||
const object = this.scene.get_object_by_uuid(element.object_uuid);
|
||||
@@ -318,7 +326,7 @@ export class TimeLine {
|
||||
} else if (element.type == "audio") {
|
||||
this.audio_engine.loadClip(element.media_id);
|
||||
} else if (element.type == "animation") {
|
||||
this.animation_engine.clips[element.object_uuid].stop();
|
||||
this.animation_engine.clips[element.object_uuid+element.media_id].stop();
|
||||
} else if (element.type == "lipsync") {
|
||||
this.lipSync_engine.clips[element.object_uuid].reset();
|
||||
} else {
|
||||
@@ -341,7 +349,7 @@ export class TimeLine {
|
||||
// called by the editor update loop on each frame
|
||||
public async update() {
|
||||
//if (this.is_playing == false) return; // start and stop
|
||||
|
||||
this.timeline_limit = this.getEndPoint();
|
||||
if (this.is_playing) {
|
||||
this.current_time += 1;
|
||||
this.pushEvent(fromEngineActions.UPDATE_TIME, {
|
||||
@@ -390,8 +398,8 @@ export class TimeLine {
|
||||
}
|
||||
} else if (element.type === ClipType.ANIMATION) {
|
||||
if (object) {
|
||||
await this.animation_engine.clips[object.uuid].play(object);
|
||||
this.animation_engine.clips[object.uuid].step(
|
||||
await this.animation_engine.clips[object.uuid+element.media_id].play(object);
|
||||
this.animation_engine.clips[object.uuid+element.media_id].step(
|
||||
this.scrubber_frame_position / 120, // Double FPS for best result.
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user