stashed changes commit.

This commit is contained in:
Quicksticks-oss committed 2024-04-20 18:39:26 -04:00
1 parent ae3deca064
commit c98b91a658
4 files changed
+44 -7

No files matched your search

+1
View File
@@ -488,6 +488,7 @@ class Editor {
this.activeScene,
);
const scene_json = await proxyScene.saveToScene();
console.log("scene_json", scene_json);
const proxyTimeline = new StoryTellerProxyTimeline(
this.version,
+10 -7
View File
@@ -51,6 +51,10 @@ class Scene {
//obj.type = "Object3D";
obj.name = name;
obj.position.copy(pos);
obj.userData["color"] = "#FFFFFF";
obj.userData["metalness"] = 0.0;
obj.userData["shininess"] = 0.5;
obj.userData["specular"] = 0.0;
this.scene.add(obj);
return obj.uuid;
}
@@ -138,21 +142,19 @@ class Scene {
if (c instanceof THREE.Mesh) {
c.material.metalness = 0.0;
c.material.specular = 0.5;
c.material.shininess = 0.0;
c.castShadow = true;
c.receiveShadow = true;
c.frustumCulled = false;
c.material.transparent = false;
}
});
//console.log(child);
//if (child.type == "Group") {
// if (auto_add) { child.children.forEach(element => {
// this.scene.add(element);
// }); }
// resolve(child);
//}
child.frustumCulled = false;
child.userData["media_id"] = media_id;
child.userData["color"] = "#FFFFFF";
child.userData["metalness"] = 0.0;
child.userData["shininess"] = 0.5;
child.userData["specular"] = 0.5;
if (auto_add) { this.scene.add(child); }
resolve(child);
});
@@ -179,6 +181,7 @@ class Scene {
resolve(child.children[0]);
return;
}
child.userData["color"] = "#FFFFFF";
if (auto_add) { this.scene.add(child); }
resolve(child);
});
@@ -21,6 +21,10 @@ export interface ObjectJSON {
object_uuid: string;
object_user_data_name: string;
media_file_token: string;
color: string;
metalness: number,
shininess: number,
specular: number,
}
export class StoryTellerProxy3DObject {
@@ -34,6 +38,10 @@ export class StoryTellerProxy3DObject {
object_name: string;
object_user_data_name: string; // changable name
media_file_token: string;
color: string;
metalness: number;
shininess: number;
specular: number;
constructor(
version: number,
@@ -49,6 +57,19 @@ export class StoryTellerProxy3DObject {
this.object_name = "";
this.object_user_data_name = "";
this.object_uuid = "";
this.color = "";
this.metalness = 0.0;
this.shininess = 0.0;
this.specular = 0.5;
}
getColorAsHexString(object: THREE.Object3D): string {
if (object instanceof THREE.Mesh && object.material instanceof THREE.MeshBasicMaterial) {
return '#' + object.material.color.getHexString();
}
return "#FFFFFF"
}
public async initialize(object: THREE.Object3D) {
@@ -59,6 +80,10 @@ export class StoryTellerProxy3DObject {
this.object_name = object.name;
this.object_user_data_name = object.userData.name;
this.object_uuid = object.uuid;
this.color = object.userData["color"];
this.metalness = object.userData["metalness"];
this.shininess = object.userData["shininess"];
this.specular = object.userData["specular"];
}
public async toJSON(): Promise<ObjectJSON> {
@@ -83,6 +108,10 @@ export class StoryTellerProxy3DObject {
object_uuid: this.object_uuid,
object_user_data_name: this.object_user_data_name,
media_file_token: this.media_file_token,
color: this.color,
metalness: this.metalness,
shininess: this.shininess,
specular: this.specular,
};
return json;
}
@@ -38,6 +38,10 @@ export class StoryTellerProxyScene {
proxyObject3D.object_user_data_name = child.userData.name;
proxyObject3D.object_name = child.name;
proxyObject3D.object_uuid = child.uuid;
proxyObject3D.color = child.userData["color"];
proxyObject3D.metalness = child.userData["metalness"];
proxyObject3D.shininess = child.userData["shininess"];
proxyObject3D.specular = child.userData["specular"];
const json_data = await proxyObject3D.toJSON();
results.push(json_data);
}