Added check to remove persisting reticle entities on script startup

This commit is contained in:
RebeccaStankus 2019-08-19 15:36:21 -07:00
parent b40d5658e3
commit 022d1aee8e
4 changed files with 16 additions and 51 deletions

View file

@ -192,27 +192,6 @@ function addEmoji(emojiFilename) {
// creating the actual emoji that isn't an animation
/*
MILAD NOTE:
The Above head should be what you need to control how high the distance is.
The calcuation might need to be played with more depending on what kind of avatar is brought in and what
their scale maybe. So far this seems to be ok.
EntityMaker is a helper library I made. Don't be too scared about it, you just make an entity wrapper
with new, use .add to gather properties, .create to add those property, you can also send in a quick edit with .edit
then .destroy to kill the entity
The images come from the entity object compiled from entityList.json. Right now code is an array where just one index
which is why there is a const UTF_CODE that represents 0.
This can probably be fixed by just editing that .code to not be an array,
but as long as you know what that is, I think it is fine and not worth the trouble.
There was a note about falling back to other joints in the spec,
but I don't think that is necessary if this is meant for simplified
as we can guarentee an avatar that is supported has to have a head joint.
That is unless we are future proofing for the ability
to use any kind of avatar.
*/
var ABOVE_HEAD = 0.61;
var EMOJI_X_OFFSET = 0.0;
var DEFAULT_EMOJI_SIZE = 0.37;

View file

@ -52,20 +52,6 @@ Rectangle {
Component.onCompleted: {
emojiSearchTextField.forceActiveFocus();
/*
MILAD NOTE:
The emoji list we have is a node transformed list of all the UTF emojis with meta info.
To cut down on the list, this is a good place to start as they will be 90% of the emojis anyone would
want to use.
To save some space, we should probably remove any images from the current ones that aren't the below emojis.
Let's make a separate ticket for this as this is going to need a little work in the current node app. Not much
but I didn't want to focus on it for this sprint.
I can also prune that large emoji json as well to have only the ones we want listed. That can be added to that
ticket as well. This is something I can probably knock out on the plane to Italy becaues I don't want those large
files to be in the repo or loading that big config.json file.
*/
EmojiList.emojiList
.filter(emoji => {
return emoji.mainCategory === "Smileys & Emotion" ||

View file

@ -178,16 +178,23 @@ function beginReactionWrapper(reaction) {
startClappingSounds();
break;
case ("point"):
if (pointReticle) {
Entities.deleteEntity(pointReticle);
pointReticle = null;
}
deleteOldReticles();
Controller.mouseMoveEvent.connect(mouseMoveEvent);
mouseMoveEventsConnected = true;
}
}
// Checks to see if there are any reticle entities already to delete
function deleteOldReticles() {
MyAvatar.getAvatarEntitiesVariant()
.forEach(function (avatarEntity) {
if (avatarEntity && avatarEntity.properties.name.toLowerCase().indexOf("reticle") > -1) {
Entities.deleteEntity(avatarEntity.id);
}
});
pointReticle = null;
}
var MAX_INTERSECTION_DISTANCE_M = 50;
function mouseMoveEvent(event) {
@ -210,10 +217,7 @@ function mouseMoveEvent(event) {
reticlePosition = entityIntersectionData.intersection;
} else {
print("ERROR: No intersected avatar or entity found or the distance is too far.");
if (pointReticle) {
Entities.deleteEntity(pointReticle);
pointReticle = null;
}
deleteOldReticles();
return;
}
@ -261,10 +265,7 @@ function endReactionWrapper(reaction) {
Controller.mouseMoveEvent.disconnect(mouseMoveEvent);
}
intersectedEntityOrAvatarID = null;
if (pointReticle) {
Entities.deleteEntity(pointReticle);
pointReticle = null;
}
deleteOldReticles()
break;
}
}
@ -272,7 +273,6 @@ function endReactionWrapper(reaction) {
var EMOTE_APP_BAR_MESSAGE_SOURCE = "EmoteAppBar.qml";
function onMessageFromEmoteAppBar(message) {
console.log("MESSAGE From emote app bar: ", JSON.stringify(message));
if (message.source !== EMOTE_APP_BAR_MESSAGE_SOURCE) {
return;
}
@ -301,7 +301,6 @@ function onMessageFromEmoteAppBar(message) {
function getEmojiURLFromCode(code) {
var emojiObject = emojiList[emojiCodeMap[code]];
print(JSON.stringify(emojiObject));
var emojiFilename;
// If `emojiObject` isn't defined here, that probably means we're looking for a custom emoji
if (!emojiObject) {
@ -444,6 +443,8 @@ var emojiAPI = new EmojiAPI();
var keyPressSignalsConnected = false;
var emojiCodeMap;
function init() {
deleteOldReticles();
// make a map of just the utf codes to help with accesing
emojiCodeMap = emojiList.reduce(function (codeMap, currentEmojiInList, index) {
if (

View file

@ -253,7 +253,6 @@ Rectangle {
switch (message.method) {
case "updateEmoteIndicator":
print("CHANGING INDICATOR TO: ", JSON.stringify(message));
if (message.data.iconURL) {
emoteIndicator.source = message.data.iconURL;
} else {