mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 03:58:07 +02:00
Added check to remove persisting reticle entities on script startup
This commit is contained in:
parent
b40d5658e3
commit
022d1aee8e
4 changed files with 16 additions and 51 deletions
|
@ -192,27 +192,6 @@ function addEmoji(emojiFilename) {
|
||||||
|
|
||||||
|
|
||||||
// creating the actual emoji that isn't an animation
|
// 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 ABOVE_HEAD = 0.61;
|
||||||
var EMOJI_X_OFFSET = 0.0;
|
var EMOJI_X_OFFSET = 0.0;
|
||||||
var DEFAULT_EMOJI_SIZE = 0.37;
|
var DEFAULT_EMOJI_SIZE = 0.37;
|
||||||
|
|
|
@ -52,20 +52,6 @@ Rectangle {
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
emojiSearchTextField.forceActiveFocus();
|
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
|
EmojiList.emojiList
|
||||||
.filter(emoji => {
|
.filter(emoji => {
|
||||||
return emoji.mainCategory === "Smileys & Emotion" ||
|
return emoji.mainCategory === "Smileys & Emotion" ||
|
||||||
|
|
|
@ -178,16 +178,23 @@ function beginReactionWrapper(reaction) {
|
||||||
startClappingSounds();
|
startClappingSounds();
|
||||||
break;
|
break;
|
||||||
case ("point"):
|
case ("point"):
|
||||||
|
deleteOldReticles();
|
||||||
if (pointReticle) {
|
|
||||||
Entities.deleteEntity(pointReticle);
|
|
||||||
pointReticle = null;
|
|
||||||
}
|
|
||||||
Controller.mouseMoveEvent.connect(mouseMoveEvent);
|
Controller.mouseMoveEvent.connect(mouseMoveEvent);
|
||||||
mouseMoveEventsConnected = true;
|
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;
|
var MAX_INTERSECTION_DISTANCE_M = 50;
|
||||||
function mouseMoveEvent(event) {
|
function mouseMoveEvent(event) {
|
||||||
|
@ -210,10 +217,7 @@ function mouseMoveEvent(event) {
|
||||||
reticlePosition = entityIntersectionData.intersection;
|
reticlePosition = entityIntersectionData.intersection;
|
||||||
} else {
|
} else {
|
||||||
print("ERROR: No intersected avatar or entity found or the distance is too far.");
|
print("ERROR: No intersected avatar or entity found or the distance is too far.");
|
||||||
if (pointReticle) {
|
deleteOldReticles();
|
||||||
Entities.deleteEntity(pointReticle);
|
|
||||||
pointReticle = null;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,10 +265,7 @@ function endReactionWrapper(reaction) {
|
||||||
Controller.mouseMoveEvent.disconnect(mouseMoveEvent);
|
Controller.mouseMoveEvent.disconnect(mouseMoveEvent);
|
||||||
}
|
}
|
||||||
intersectedEntityOrAvatarID = null;
|
intersectedEntityOrAvatarID = null;
|
||||||
if (pointReticle) {
|
deleteOldReticles()
|
||||||
Entities.deleteEntity(pointReticle);
|
|
||||||
pointReticle = null;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,7 +273,6 @@ function endReactionWrapper(reaction) {
|
||||||
|
|
||||||
var EMOTE_APP_BAR_MESSAGE_SOURCE = "EmoteAppBar.qml";
|
var EMOTE_APP_BAR_MESSAGE_SOURCE = "EmoteAppBar.qml";
|
||||||
function onMessageFromEmoteAppBar(message) {
|
function onMessageFromEmoteAppBar(message) {
|
||||||
console.log("MESSAGE From emote app bar: ", JSON.stringify(message));
|
|
||||||
if (message.source !== EMOTE_APP_BAR_MESSAGE_SOURCE) {
|
if (message.source !== EMOTE_APP_BAR_MESSAGE_SOURCE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,6 @@ function onMessageFromEmoteAppBar(message) {
|
||||||
|
|
||||||
function getEmojiURLFromCode(code) {
|
function getEmojiURLFromCode(code) {
|
||||||
var emojiObject = emojiList[emojiCodeMap[code]];
|
var emojiObject = emojiList[emojiCodeMap[code]];
|
||||||
print(JSON.stringify(emojiObject));
|
|
||||||
var emojiFilename;
|
var emojiFilename;
|
||||||
// If `emojiObject` isn't defined here, that probably means we're looking for a custom emoji
|
// If `emojiObject` isn't defined here, that probably means we're looking for a custom emoji
|
||||||
if (!emojiObject) {
|
if (!emojiObject) {
|
||||||
|
@ -444,6 +443,8 @@ var emojiAPI = new EmojiAPI();
|
||||||
var keyPressSignalsConnected = false;
|
var keyPressSignalsConnected = false;
|
||||||
var emojiCodeMap;
|
var emojiCodeMap;
|
||||||
function init() {
|
function init() {
|
||||||
|
deleteOldReticles();
|
||||||
|
|
||||||
// make a map of just the utf codes to help with accesing
|
// make a map of just the utf codes to help with accesing
|
||||||
emojiCodeMap = emojiList.reduce(function (codeMap, currentEmojiInList, index) {
|
emojiCodeMap = emojiList.reduce(function (codeMap, currentEmojiInList, index) {
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -253,7 +253,6 @@ Rectangle {
|
||||||
|
|
||||||
switch (message.method) {
|
switch (message.method) {
|
||||||
case "updateEmoteIndicator":
|
case "updateEmoteIndicator":
|
||||||
print("CHANGING INDICATOR TO: ", JSON.stringify(message));
|
|
||||||
if (message.data.iconURL) {
|
if (message.data.iconURL) {
|
||||||
emoteIndicator.source = message.data.iconURL;
|
emoteIndicator.source = message.data.iconURL;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue