added locking to objects based on their userData.

This commit is contained in:
Quicksticks-oss committed 2024-04-30 16:27:57 -04:00
1 parent 1dd0ca75f7
commit 123724971c
4 files changed
+20 -4

No files matched your search

+7 -4
View File
@@ -848,8 +848,9 @@ class Editor {
if (this.cam_obj == undefined) {
this.cam_obj = this.activeScene.get_object_by_name(this.camera_name);
}
}
// Updates debug stats.
if (this.stats != null) {
this.stats.update();
@@ -1464,11 +1465,13 @@ class Editor {
this.publishSelect();
// this.update_properties()
this.activeScene.scene.add(this.control);
this.control.attach(this.selected);
if (this.selected.userData["locked"] !== true) {
this.activeScene.scene.add(this.control);
this.control.attach(this.selected);
}
this.outlinePass.selectedObjects = [this.selected];
this.transform_interaction = true;
// Contact react land
this.dispatchAppUiState({
type: APPUI_ACTION_TYPES.SHOW_CONTROLPANELS_SCENEOBJECT,
+2
View File
@@ -85,6 +85,7 @@ class Scene {
obj.userData["metalness"] = 0.0;
obj.userData["shininess"] = 0.5;
obj.userData["specular"] = 0.0;
obj.userData["locked"] = false;
this.scene.add(obj);
return obj;
}
@@ -280,6 +281,7 @@ class Scene {
child.userData["metalness"] = 0.0;
child.userData["shininess"] = 0.5;
child.userData["specular"] = 0.5;
child.userData["locked"] = false;
child.layers.enable(0);
child.layers.enable(1);
if (auto_add) {
@@ -25,6 +25,7 @@ export interface ObjectJSON {
metalness: number,
shininess: number,
specular: number,
locked: boolean,
}
export class StoryTellerProxy3DObject {
@@ -42,6 +43,7 @@ export class StoryTellerProxy3DObject {
metalness: number;
shininess: number;
specular: number;
locked: boolean;
constructor(
version: number,
@@ -63,6 +65,7 @@ export class StoryTellerProxy3DObject {
this.metalness = 0.0;
this.shininess = 0.0;
this.specular = 0.5;
this.locked = false;
}
getColorAsHexString(object: THREE.Object3D): string {
@@ -84,6 +87,7 @@ export class StoryTellerProxy3DObject {
this.metalness = object.userData["metalness"];
this.shininess = object.userData["shininess"];
this.specular = object.userData["specular"];
this.locked = object.userData["locked"];
}
public async toJSON(): Promise<ObjectJSON> {
@@ -112,6 +116,7 @@ export class StoryTellerProxy3DObject {
metalness: this.metalness,
shininess: this.shininess,
specular: this.specular,
locked: this.locked,
};
return json;
}
@@ -49,6 +49,7 @@ export class StoryTellerProxyScene {
proxyObject3D.metalness = child.userData["metalness"];
proxyObject3D.shininess = child.userData["shininess"];
proxyObject3D.specular = child.userData["specular"];
proxyObject3D.locked = child.userData["locked"];
const json_data = await proxyObject3D.toJSON();
results.push(json_data);
}
@@ -103,6 +104,11 @@ export class StoryTellerProxyScene {
obj.userData.name = json_object.object_user_data_name;
obj.uuid = json_object.object_uuid;
obj.userData["media_id"] = json_object.media_file_token;
obj.userData["locked"] = json_object.locked;
obj.userData["color"] = json_object.color;
obj.userData["metalness"] = json_object.metalness;
obj.userData["shininess"] = json_object.shininess;
obj.userData["specular"] = json_object.specular;
}
}
this.scene._createGrid();