Implement Check for missing reference parent action

This commit is contained in:
Brenden Harrell committed 2021-08-06 21:51:25 -05:00
1 parent 9870d01354
commit a5a9d933bf
4 files changed
+23 -7

No files matched your search

@@ -41,7 +41,6 @@
{
"action": "Check For Missing References",
"label": "Check For Missing References",
"workDoneLabel": "Done",
"relatedUiObject": "Workspace",
"actionFunction": "payload.executeAction"
}
@@ -726,7 +726,7 @@ function newFoundationsActionSwitch() {
break
case 'Check For Missing References':
{
UI.projects.foundations.functionLibraries.workspaceFunctions.checkForMissingReferences()
UI.projects.foundations.functionLibraries.workspaceFunctions.checkForMissingReferences(action.rootNodes)
}
break
case 'Switch To Forward Testing':
@@ -383,9 +383,6 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() {
}
}
}
}
if (node.payload.referenceParent === undefined) {
console.log('[WARN]' + node.type + ' ' + node.name + ' reference parent lost during re-binding phase.')
}
}
@@ -28,7 +28,27 @@ function newFoundationsFunctionLibraryWorkspaceFunctions() {
}
}
function checkForMissingReferences() {
console.log("this action is working")
// This function scales the current workspace and highlights any nodes that have unresolved references
function checkForMissingReferences(rootNodes) {
let nodes
for (let i = 0; i < rootNodes.length; i++) {
if (rootNodes[i] !== undefined) {
nodes = UI.projects.foundations.utilities.hierarchy.getHiriarchyMap(rootNodes[i])
for (let [key, value] of nodes) {
// Check nodes that have a saved reference parent
if (value.savedPayload.referenceParent !== undefined) {
// Highlight nodes that do not have an active reference connected to their referance parent
if (value.payload.referenceParent === undefined) {
console.log("[WARN] Reference Parent not found in the current workspace.\n Node:", value.name, " Type:", value.type, " ID:", key, " Node Object:", value)
UI.projects.foundations.spaces.floatingSpace.inMapMode = true
value.payload.uiObject.setWarningMessage('Reference Parent not found in the current workspace.', 10)
}
}
}
}
}
}
}