stop findGroupParent at cloneable

This commit is contained in:
David Back 2018-07-16 18:21:58 -07:00
parent 43435bdeae
commit 98a8d3361b
4 changed files with 8 additions and 3 deletions

View file

@ -3676,6 +3676,7 @@ bool EntityItemProperties::verifyStaticCertificateProperties() {
void EntityItemProperties::convertToCloneProperties(const EntityItemID& entityIDToClone) {
setName(getName() + "-clone-" + entityIDToClone.toString());
setLocked(false);
setParentID(QUuid());
setLifetime(getCloneLifetime());
setDynamic(getCloneDynamic());
setClientOnly(getCloneAvatarEntity());

View file

@ -47,7 +47,7 @@
var canGrabEntity = false;
if (dispatcherUtils.entityIsGrabbable(props) || entityIsCloneable(props)) {
// if we've attempted to grab a child, roll up to the root of the tree
var groupRootProps = dispatcherUtils.findGroupParent(controllerData, props);
var groupRootProps = dispatcherUtils.findGroupParent(controllerData, props, false);
canGrabEntity = true;
if (!dispatcherUtils.entityIsGrabbable(groupRootProps)) {
canGrabEntity = false;

View file

@ -254,7 +254,8 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
this.hapticTargetID = props.id;
}
// if we've attempted to grab a child, roll up to the root of the tree
var groupRootProps = findGroupParent(controllerData, props);
var stopAtCloneable = true;
var groupRootProps = findGroupParent(controllerData, props, stopAtCloneable);
if (entityIsGrabbable(groupRootProps)) {
return groupRootProps;
}

View file

@ -355,10 +355,13 @@ ensureDynamic = function (entityID) {
}
};
findGroupParent = function (controllerData, targetProps) {
findGroupParent = function (controllerData, targetProps, stopAtCloneable) {
while (targetProps.parentID &&
targetProps.parentID !== Uuid.NULL &&
Entities.getNestableType(targetProps.parentID) == "entity") {
if (stopAtCloneable && entityIsCloneable(targetProps)) {
break;
}
var parentProps = Entities.getEntityProperties(targetProps.parentID, DISPATCHER_PROPERTIES);
if (!parentProps) {
break;