Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAYA-106780 - Editing USD should mark scene as dirty #1061

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions lib/mayaUsd/ufe/StagesSubject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,21 +273,30 @@ void StagesSubject::stageChanged(
auto ufePath = stagePath(sender) + Ufe::PathSegment(usdPrimPathStr, g_USDRtid, '/');

#ifdef UFE_V2_FEATURES_AVAILABLE
bool sendValueChangedFallback = true;

// isPrimPropertyPath() does not consider relational attributes
// isPropertyPath() does consider relational attributes
// isRelationalAttributePath() considers only relational attributes
if (changedPath.IsPrimPropertyPath()) {
if (inAttributeChangedNotificationGuard()) {
pendingAttributeChangedNotifications[ufePath] = changedPath.GetName();
} else {
#if UFE_PREVIEW_VERSION_NUM >= 2036
Ufe::AttributeValueChanged vc(ufePath, changedPath.GetName());
Ufe::Attributes::notify(vc);
#else
Ufe::Attributes::notify(ufePath, changedPath.GetName());
#endif
}
sendValueChangedFallback = false;
}

// Send a special message when visibility has changed.
if (changedPath.GetNameToken() == UsdGeomTokens->visibility) {
Ufe::VisibilityChanged vis(ufePath);
Ufe::Object3d::notify(vis);
sendValueChangedFallback = false;
}
#endif

Expand All @@ -296,9 +305,40 @@ void StagesSubject::stageChanged(
const TfToken nameToken = changedPath.GetNameToken();
if (nameToken == UsdGeomTokens->xformOpOrder || UsdGeomXformOp::IsXformOp(nameToken)) {
Ufe::Transform3d::notify(ufePath);
#ifdef UFE_V2_FEATURES_AVAILABLE
sendValueChangedFallback = false;
#endif
}
}

#ifdef UFE_V2_FEATURES_AVAILABLE
if (sendValueChangedFallback) {
// We didn't send any other UFE notif above, so send a UFE
// attribute value changed as a fallback notification.
if (inAttributeChangedNotificationGuard()) {
pendingAttributeChangedNotifications[ufePath] = changedPath.GetName();
} else {
#if UFE_PREVIEW_VERSION_NUM >= 2036
Ufe::AttributeValueChanged vc(ufePath, changedPath.GetName());
Ufe::Attributes::notify(vc);
#else
Ufe::Attributes::notify(ufePath, changedPath.GetName());
#endif
}
}
#endif
}

#ifdef UFE_V2_FEATURES_AVAILABLE
#if UFE_PREVIEW_VERSION_NUM >= 2036
// Special case when we are notified, but no paths given.
if (notice.GetResyncedPaths().empty() && notice.GetChangedInfoOnlyPaths().empty()) {
auto ufePath = stagePath(sender);
Ufe::AttributeValueChanged vc(ufePath, "/");
Ufe::Attributes::notify(vc);
}
#endif
#endif
}

#if UFE_PREVIEW_VERSION_NUM >= 2025
Expand Down Expand Up @@ -387,7 +427,12 @@ AttributeChangedNotificationGuard::~AttributeChangedNotificationGuard()
}

for (const auto& notificationInfo : pendingAttributeChangedNotifications) {
#if UFE_PREVIEW_VERSION_NUM >= 2036
Ufe::AttributeValueChanged vc(notificationInfo.first, notificationInfo.second);
Ufe::Attributes::notify(vc);
#else
Ufe::Attributes::notify(notificationInfo.first, notificationInfo.second);
#endif
}

pendingAttributeChangedNotifications.clear();
Expand Down
2 changes: 1 addition & 1 deletion test/lib/ufe/testAttribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self):
self._notifications = 0

def __call__(self, notification):
if isinstance(notification, ufe.AttributeChanged):
if isinstance(notification, ufe.AttributeValueChanged):
self._notifications += 1

@property
Expand Down