Skip to content

WIP: Add basic delete implementation for component prims#4527

Closed
antonkhelou wants to merge 1 commit intodevfrom
kheloua/dev/EMSUSD-3121_delete_prim_component
Closed

WIP: Add basic delete implementation for component prims#4527
antonkhelou wants to merge 1 commit intodevfrom
kheloua/dev/EMSUSD-3121_delete_prim_component

Conversation

@antonkhelou
Copy link
Collaborator

No description provided.

layer->RemovePrimIfInert(parent);
}
} else if (!routingEditTarget.IsNull()) {
// NOTE: Need to consider the case of edit routing as well probably
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a comment you added?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, just as a note for myself when i was first spiking this.. wip

= UsdUfe::getEditRouterEditTarget(UsdUfe::EditRoutingTokens->RouteDelete, _prim);

#ifdef UFE_V4_FEATURES_AVAILABLE
UsdUfe::UsdAttributes::removeAttributesConnections(_prim);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need anything for this? an cleanReferencedPath below

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be tested but looking at the code i think I think removeAttributesConnections() will partially work work but we need to have EF active for this, assuming UsdShadeConnectableAPI::DisconnectSource() authors something. Then however the calls in there to "RemoveProperty()" wont work.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then again the current code only works if the connection / ref sources are on the same layer as the current edit target, otherwise itll leave broken connections behind... maybe we can for now just leave it be. But just try out what happens to be sure its not too terrible.

if (!_prim.IsValid())
return;

UsdUfe::enforceMutedLayer(_prim, "remove");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prob good to pause ef just in case

// Validate that a prim can be deleted in a component stage.
// Components only allow deleting prims whose path is contained within
// either the material or geometry scope
void validateComponentDelete(const PXR_NS::UsdPrim& prim)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so i guess youll move this to a shared h/cpp

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, exactly!

@antonkhelou antonkhelou marked this pull request as ready for review March 13, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants