Selecting parent node returns Error: Cannot select node outside the current edit context's scope

I’m attempting to set the selection to the parent scene node and getting this error:

Error: Cannot select node outside the current edit context’s scope

I know there was some updates with the edit context. Is there a work around for this?

A related feature request would be an API to exitCurrentContext().

For example, if you were making your own layers panel, and then you selected the parent scene node, it wouldn’t be an edit operation it would be a new selection.

Possibly related to Select (single) nodes outside the edit context programmatically?

In my case, my problem might be solved using something like:

// Example: i am in an edit context and i want to select an ancestor
// check if it's ok to select node and if not exit
if (selection.isInContext(sceneNode.parent)==false) {
    selection.exitContext(); // or apply any changes
}

selection.items = [sceneNode.parent];

But for your case, it looks like it’s possible to select out of context already. At some point, I think recently, you were able to select multiple nodes from multiple contexts with the Selection tool. So it seems like you should be able to select multiple nodes in different contexts programatically.

I think it has (or had) to do with how to move or resize objects in different edit contexts visually. So it was disabled altogether. It might be easier to apply or set properties programmatically (as opposed to showing a live update in the design view) and if it matters then apply the properties from inside out last to first (or first to last) and then have the document walker run through the document again.

We’d have to hear from the developers though because they were able to update the selection tool to select across contexts.

But I don’t see why it wouldn’t be possible to set properties across scene nodes (no need to select them first) and then not have to even deal with an edit context. Or if there’s an issue with how to set properties, reorder the nodes internally to set properties on the nodes in the current edit context first and then after that, set properties on the other nodes in other contexts and throw an error or anchor the values when applying the properties with the knowledge that it may not work ahead of time.

1 Like