mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 23:39:26 +02:00
conforming to coding standard and better variable naming
This commit is contained in:
parent
a35f28725b
commit
348c0c95e5
3 changed files with 20 additions and 22 deletions
|
@ -1321,7 +1321,7 @@ QVector<QUuid> EntityScriptingInterface::getChildrenIDs(const QUuid& parentID) {
|
|||
bool EntityScriptingInterface::isChildOfParent(QUuid childID, QUuid parentID) {
|
||||
bool isChild = false;
|
||||
|
||||
if(!_entityTree) {
|
||||
if (!_entityTree) {
|
||||
return isChild;
|
||||
}
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ public slots:
|
|||
Q_INVOKABLE QStringList getJointNames(const QUuid& entityID);
|
||||
Q_INVOKABLE QVector<QUuid> getChildrenIDs(const QUuid& parentID);
|
||||
Q_INVOKABLE QVector<QUuid> getChildrenIDsOfJoint(const QUuid& parentID, int jointIndex);
|
||||
Q_INVOKABLE bool isChildOfParent(QUuid childID, QUuid parnetID);
|
||||
Q_INVOKABLE bool isChildOfParent(QUuid childID, QUuid parentID);
|
||||
|
||||
Q_INVOKABLE QUuid getKeyboardFocusEntity() const;
|
||||
Q_INVOKABLE void setKeyboardFocusEntity(QUuid id);
|
||||
|
|
|
@ -1027,26 +1027,24 @@ function selectAllEtitiesInCurrentSelectionBox(keepIfTouching) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function sortDeleteSelected (selected) {
|
||||
var array = selected.slice();
|
||||
function sortSelectedEntities(selected) {
|
||||
var sortedEntities = selected.slice();
|
||||
var begin = 0;
|
||||
while (begin < array.length) {
|
||||
while (begin < sortedEntities.length) {
|
||||
var elementRemoved = false;
|
||||
var next = begin + 1;
|
||||
while (next < array.length) {
|
||||
var beginID = array[begin];
|
||||
var nextID = array[next];
|
||||
while (next < sortedEntities.length) {
|
||||
var beginID = sortedEntities[begin];
|
||||
var nextID = sortedEntities[next];
|
||||
|
||||
if (Entities.isChildOfParent(beginID, nextID)) {
|
||||
var temp = beginID;
|
||||
array[begin] = nextID
|
||||
array[next] = beginID
|
||||
array.splice(next, 1);
|
||||
sortedEntities[begin] = nextID;
|
||||
sortedEntities[next] = beginID;
|
||||
sortedEntities.splice(next, 1);
|
||||
elementRemoved = true;
|
||||
break;
|
||||
} else if (Entities.isChildOfParent(nextID, beginID)) {
|
||||
array.splice(next, 1);
|
||||
sortedEntities.splice(next, 1);
|
||||
elementRemoved = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1056,21 +1054,21 @@ function sortDeleteSelected (selected) {
|
|||
begin++;
|
||||
}
|
||||
}
|
||||
return array;
|
||||
return sortedEntities;
|
||||
}
|
||||
|
||||
function recursiveDelete(entities, list) {
|
||||
function recursiveDelete(entities, childrenList) {
|
||||
var entitiesLength = entities.length;
|
||||
for (var i = 0; i < entitiesLength; i++) {
|
||||
var entityID = entities[i];
|
||||
var children = Entities.getChildrenIDs(entityID);
|
||||
var childList = []
|
||||
recursiveDelete(children, childList);
|
||||
var grandchildrenList = [];
|
||||
recursiveDelete(children, grandchildrenList);
|
||||
var initialProperties = Entities.getEntityProperties(entityID);
|
||||
list.push({
|
||||
childrenList.push({
|
||||
entityID: entityID,
|
||||
properties: initialProperties,
|
||||
children: childList
|
||||
children: grandchildrenList
|
||||
});
|
||||
Entities.deleteEntity(entityID);
|
||||
}
|
||||
|
@ -1082,12 +1080,12 @@ function deleteSelectedEntities() {
|
|||
particleExplorerTool.destroyWebView();
|
||||
SelectionManager.saveProperties();
|
||||
var savedProperties = [];
|
||||
var newSortedSelection = sortDeleteSelected(selectionManager.selections);
|
||||
var newSortedSelection = sortSelectedEntities(selectionManager.selections);
|
||||
for (var i = 0; i < newSortedSelection.length; i++) {
|
||||
var entityID = newSortedSelection[i];
|
||||
var initialProperties = SelectionManager.savedProperties[entityID];
|
||||
var children = Entities.getChildrenIDs(entityID);
|
||||
var childList = []
|
||||
var childList = [];
|
||||
recursiveDelete(children, childList);
|
||||
savedProperties.push({
|
||||
entityID: entityID,
|
||||
|
|
Loading…
Reference in a new issue