Skip to content

Commit

Permalink
Rename NametagEntity to LabelEntity for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
Gigabyte5671 committed Oct 24, 2023
1 parent b83a14d commit c3e407f
Show file tree
Hide file tree
Showing 7 changed files with 548 additions and 548 deletions.
12 changes: 6 additions & 6 deletions src/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -514,14 +514,14 @@ export default defineComponent({
},
{
icon: "badge",
label: "Nametags",
label: "Labels",
action: () => {
userStore.avatar.showNametags = !userStore.avatar.showNametags;
Log.info(Log.types.OTHER, "Toggle Avatar Nametags");
userStore.avatar.showLabels = !userStore.avatar.showLabels;
Log.info(Log.types.OTHER, "Toggle Labels");
},
isCategory: false,
separator: true,
caption: "nametag_setting"
caption: "boolean"
},
{
icon: "lightbulb",
Expand Down Expand Up @@ -722,8 +722,8 @@ export default defineComponent({
},
formatMenuItemCaption(caption: string) {
switch (caption) {
case "nametag_setting":
return this.userStore.avatar.showNametags ? "On" : "Off";
case "boolean":
return this.userStore.avatar.showLabels ? "On" : "Off";
default:
return caption;
}
Expand Down
4 changes: 2 additions & 2 deletions src/modules/avatar/controller/inputController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -904,8 +904,8 @@ export class InputController extends ScriptComponent {
// Set the visibility of the avatar.
this._gameObject.isVisible = visible;

// Set the visibility of the avatar's nametag.
const meshes = this._gameObject.getChildMeshes(true, (mesh) => mesh.name === "Nametag");
// Set the visibility of the avatar's label.
const meshes = this._gameObject.getChildMeshes(true, (mesh) => mesh.name === "Label");
if (meshes.length > 0) {
meshes[0].isVisible = visible;
}
Expand Down
30 changes: 15 additions & 15 deletions src/modules/entity/components/components/ModelComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
Node,
} from "@babylonjs/core";
import { IModelEntity } from "../../EntityInterfaces";
import { NametagEntity } from "@Modules/entity/entities";
import { LabelEntity } from "@Modules/entity/entities";
import { updateContentLoadingProgress } from "@Modules/scene/LoadingScreen";
import { applicationStore } from "@Stores/index";
import Log from "@Modules/debugging/log";
Expand Down Expand Up @@ -74,10 +74,10 @@ export class ModelComponent extends MeshComponent {
this.mesh = meshes[0];
this.renderGroupId = DEFAULT_MESH_RENDER_GROUP_ID;

// Add a nametag to any of the model's children if they match any of the InteractiveModelTypes.
const defaultNametagHeight = 0.6;
const nametagOffset = 0.25;
const nametagPopDistance =
// Add a label to any of the model's children if they match any of the InteractiveModelTypes.
const defaultLabelHeight = 0.6;
const labelOffset = 0.25;
const labelPopDistance =
applicationStore.interactions.interactionDistance;
const childNodes = this.mesh.getChildren(
(node) => "getBoundingInfo" in node,
Expand All @@ -96,13 +96,13 @@ export class ModelComponent extends MeshComponent {
const boundingInfo = childNode.getBoundingInfo();
const height =
boundingInfo.maximum.y - boundingInfo.minimum.y;
NametagEntity.create(
LabelEntity.create(
childNode,
height + nametagOffset,
height + labelOffset,
genericModelType.name,
true,
undefined,
nametagPopDistance,
labelPopDistance,
() => !applicationStore.interactions.isInteracting
);
});
Expand All @@ -113,29 +113,29 @@ export class ModelComponent extends MeshComponent {
if (!genericModelType) {
return;
}
NametagEntity.create(
LabelEntity.create(
childNode,
defaultNametagHeight,
defaultLabelHeight,
genericModelType.name,
true,
undefined,
nametagPopDistance,
labelPopDistance,
() => !applicationStore.interactions.isInteracting
);
});

// Add a nametag to the model itself if it matches any of the InteractiveModelTypes.
// Add a label to the model itself if it matches any of the InteractiveModelTypes.
const genericModelType = InteractiveModelTypes.find((type) =>
type.condition.test(this.mesh?.name ?? "")
);
if (genericModelType) {
NametagEntity.create(
LabelEntity.create(
this.mesh,
defaultNametagHeight,
defaultLabelHeight,
genericModelType.name,
true,
undefined,
nametagPopDistance,
labelPopDistance,
() => !applicationStore.interactions.isInteracting
);
}
Expand Down
Loading

0 comments on commit c3e407f

Please sign in to comment.