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-127428 - Missing metadata notification. #2846

Merged
merged 6 commits into from
Feb 16, 2023

Conversation

alicedegirolamo
Copy link
Collaborator

Description

This PR solves the issue described in Jira Ticket MAYA-127428

Type of change

  • Bug fix (non-breaking change which fixes an issue)

We were parsing erroneously the string with all the metadata keys and values.
As an example, with the following metadata string: "'uifolder':,'uisoftmin':0.0, 'uihide':1, 'uiorder':0"
we got the list with the following string: "uifolder':,'uisoftmin':0.0, 'uihide':1, 'uiorder"
With the proposed solution we get the populated list: "uifolder","uisoftmin", "uihide", "uiorder" which triggers the correct notification for the metadatas.

@@ -216,6 +216,13 @@ Ufe::Selection recreateDescendants(const Ufe::Selection& src, const Ufe::Path& f
MAYAUSD_CORE_PUBLIC
std::vector<std::string> splitString(const std::string& str, const std::string& separators);

//! Gets the sub strings surrounded by separators.
MAYAUSD_CORE_PUBLIC
std::vector<std::string> getSubStrings(
Copy link
Collaborator

Choose a reason for hiding this comment

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

To me the name of this method makes it sound like this is a generic function, but it really seems kind of specific to the metadata stream, no? Do you think this method is generic enough to warrant it being in Utils.h, or should it just be a helper function in StagesSubject.cpp where it is being used?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with Jonathan. The example string you give above "'uifolder':,'uisoftmin':0.0, 'uihide':1, 'uiorder':0" is very metadata specific. I would move it like Jonathan suggests and also rename it with metadata in name.

@@ -321,12 +321,15 @@ void processAttributeChanges(
sendMetadataChanged = true;
std::stringstream newMetadataStream;
newMetadataStream << infoChanged.second.second;
std::string newMetadataKey = newMetadataStream.str();
if (!newMetadataKey.empty()) {
std::string newMetadataKeys = newMetadataStream.str();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can newMetadataKeys be const?

Copy link
Collaborator

@seando-adsk seando-adsk left a comment

Choose a reason for hiding this comment

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

Waiting for changes requested by Jonathan.

@@ -321,13 +341,12 @@ void processAttributeChanges(
sendMetadataChanged = true;
std::stringstream newMetadataStream;
newMetadataStream << infoChanged.second.second;
std::string newMetadataKeys = newMetadataStream.str();
const std::string newMetadataKeys = newMetadataStream.str();
Copy link
Collaborator

Choose a reason for hiding this comment

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

(minor) I'd probably rename this to strMetadata for consistency.

- var renaming
feldstj
feldstj previously approved these changes Jan 27, 2023
Copy link
Collaborator

@feldstj feldstj left a comment

Choose a reason for hiding this comment

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

LGTM!

seando-adsk
seando-adsk previously approved these changes Jan 27, 2023
@seando-adsk seando-adsk added the ufe-usd Related to UFE-USD plugin in Maya-Usd label Jan 27, 2023
@alicedegirolamo alicedegirolamo added the ready-for-merge Development process is finished, PR is ready for merge label Jan 30, 2023
@seando-adsk seando-adsk removed the ready-for-merge Development process is finished, PR is ready for merge label Jan 30, 2023
@JGamache-autodesk
Copy link
Collaborator

There is a build failure on Linux and OS/X platforms:

13:19:06      FAILED: lib/mayaUsd/CMakeFiles/mayaUsd.dir/ufe/StagesSubject.cpp.o
13:19:06      /opt/rh/devtoolset-6/root/usr/bin/c++ -DBUILD_HDMAYA -DGLX_GLXEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES -DHAS_DEFAULT_MATERIAL_SUPPORT_API=1 -DHAS_ORPHANED_NODES_MANAGER=1 -DLINUX -DMATERIALX_BUILD_SHARED_LIBS -DMAYAUSD_CORE_EXPORT -DMAYAUSD_MACROS_EXPORT -DMAYAUSD_VERSION=0.22.0 -DMAYA_ARRAY_ITERATOR_DIFFERENCE_TYPE_SUPPORT=1 -DMAYA_CURRENT_UFE_CAMERA_SUPPORT=1 -DMAYA_ENABLE_NEW_PRIM_DELETE -DMAYA_HAS_CRASH_DETECTION=1 -DMAYA_HAS_DISPLAY_LAYER_API=1 -DMAYA_HAS_DISPLAY_STYLE_ALL_VIEWPORTS=1 -DMAYA_HAS_GET_MEMBER_PATHS=1 -DMAYA_HAS_NEW_DISPLAY_LAYER_MESSAGING_API=1 -DMAYA_HAS_RENDER_ITEM_HIDE_ON_PLAYBACK_API=1 -DMAYA_LIGHTAPI_VERSION_2=3 -DMAYA_MRENDERITEM_UFE_IDENTIFIER_SUPPORT=1 -DMAYA_NEW_POINT_SNAPPING_SUPPORT=1 -DMAYA_PY_VERSION=3 -DMAYA_UPDATE_UFE_IDENTIFIER_SUPPORT=1 -DMAYA_USD_VERSION=0.21.11 -DMFB_ALT_PACKAGE_NAME=\"mayaUsd\" -DMFB_PACKAGE_MODULE=\"mayaUsd\" -DMFB_PACKAGE_NAME=\"mayaUsd\" -DMaterialX_DIR=\"/local/S/jenkins/workspace/shared/Artifactory/Linux/USD/e2b89ce/lib/cmake/MaterialX\" -DPXR_PLUGINPATH_NAME=PXR_PLUGINPATH_NAME -DPXR_PYTHON_ENABLED=1 -DTBB_SUPPRESS_DEPRECATED_MESSAGES -DUFE_LIGHTS_SUPPORT=1 -DUFE_SCENE_SEGMENT_SUPPORT=1 -DWANT_MATERIALX_BUILD -DWANT_QT_BUILD -DWANT_UFE_BUILD -D_GLIBCXX_USE_CXX11_ABI=0 -DmayaUsd_EXPORTS -I/local/S/jenkins/workspace/shared/Artifactory/Linux/rundev-2023/202301271415/runtime/e2e2066/runTime/include -I/local/S/jenkins/workspace/shared/Artifactory/Linux/rundev-2023/202301271415/runtime/e2e2066/devkitBase/devkit/ufe/include -Iinclude -I_deps/gulrak-src/include -isystem /local/S/jenkins/workspace/shared/Artifactory/Linux/USD/e2b89ce/include -isystem /local/S/jenkins/workspace/shared/Artifactory/Linux/rundev-2023/202301271415/runtime/e2e2066/runTime/include/Python39/Python -O2 -g -DNDEBUG -fPIC -Wall -Werror -msse4.2 -Wno-deprecated -Wno-deprecated-declarations -Wno-unused-local-typedefs -std=c++14 -MD -MT lib/mayaUsd/CMakeFiles/mayaUsd.dir/ufe/StagesSubject.cpp.o -MF lib/mayaUsd/CMakeFiles/mayaUsd.dir/ufe/StagesSubject.cpp.o.d -o lib/mayaUsd/CMakeFiles/mayaUsd.dir/ufe/StagesSubject.cpp.o -c /home/S/jenkins/workspace/ECP/ecg-maya-usd/ecg-mayausd-branch-preflight-2023-python3-linux/ecg-maya-usd/maya-usd/lib/mayaUsd/ufe/StagesSubject.cpp
13:19:06      /home/S/jenkins/workspace/ECP/ecg-maya-usd/ecg-mayausd-branch-preflight-2023-python3-linux/ecg-maya-usd/maya-usd/lib/mayaUsd/ufe/StagesSubject.cpp:290:26: error: 'std::vector<std::basic_string<char> > {anonymous}::getMetadataKeys(const string&)' defined but not used [-Werror=unused-function]
13:19:06       std::vector<std::string> getMetadataKeys(const std::string& strMetadata)
13:19:06                                ^~~~~~~~~~~~~~~
13:19:06      cc1plus: all warnings being treated as errors

@alicedegirolamo alicedegirolamo dismissed stale reviews from seando-adsk and feldstj via d45ae66 January 31, 2023 09:47
@alicedegirolamo
Copy link
Collaborator Author

There is a build failure on Linux and OS/X platforms:

13:19:06      FAILED: lib/mayaUsd/CMakeFiles/mayaUsd.dir/ufe/StagesSubject.cpp.o
13:19:06      /opt/rh/devtoolset-6/root/usr/bin/c++ -DBUILD_HDMAYA -DGLX_GLXEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES -DHAS_DEFAULT_MATERIAL_SUPPORT_API=1 -DHAS_ORPHANED_NODES_MANAGER=1 -DLINUX -DMATERIALX_BUILD_SHARED_LIBS -DMAYAUSD_CORE_EXPORT -DMAYAUSD_MACROS_EXPORT -DMAYAUSD_VERSION=0.22.0 -DMAYA_ARRAY_ITERATOR_DIFFERENCE_TYPE_SUPPORT=1 -DMAYA_CURRENT_UFE_CAMERA_SUPPORT=1 -DMAYA_ENABLE_NEW_PRIM_DELETE -DMAYA_HAS_CRASH_DETECTION=1 -DMAYA_HAS_DISPLAY_LAYER_API=1 -DMAYA_HAS_DISPLAY_STYLE_ALL_VIEWPORTS=1 -DMAYA_HAS_GET_MEMBER_PATHS=1 -DMAYA_HAS_NEW_DISPLAY_LAYER_MESSAGING_API=1 -DMAYA_HAS_RENDER_ITEM_HIDE_ON_PLAYBACK_API=1 -DMAYA_LIGHTAPI_VERSION_2=3 -DMAYA_MRENDERITEM_UFE_IDENTIFIER_SUPPORT=1 -DMAYA_NEW_POINT_SNAPPING_SUPPORT=1 -DMAYA_PY_VERSION=3 -DMAYA_UPDATE_UFE_IDENTIFIER_SUPPORT=1 -DMAYA_USD_VERSION=0.21.11 -DMFB_ALT_PACKAGE_NAME=\"mayaUsd\" -DMFB_PACKAGE_MODULE=\"mayaUsd\" -DMFB_PACKAGE_NAME=\"mayaUsd\" -DMaterialX_DIR=\"/local/S/jenkins/workspace/shared/Artifactory/Linux/USD/e2b89ce/lib/cmake/MaterialX\" -DPXR_PLUGINPATH_NAME=PXR_PLUGINPATH_NAME -DPXR_PYTHON_ENABLED=1 -DTBB_SUPPRESS_DEPRECATED_MESSAGES -DUFE_LIGHTS_SUPPORT=1 -DUFE_SCENE_SEGMENT_SUPPORT=1 -DWANT_MATERIALX_BUILD -DWANT_QT_BUILD -DWANT_UFE_BUILD -D_GLIBCXX_USE_CXX11_ABI=0 -DmayaUsd_EXPORTS -I/local/S/jenkins/workspace/shared/Artifactory/Linux/rundev-2023/202301271415/runtime/e2e2066/runTime/include -I/local/S/jenkins/workspace/shared/Artifactory/Linux/rundev-2023/202301271415/runtime/e2e2066/devkitBase/devkit/ufe/include -Iinclude -I_deps/gulrak-src/include -isystem /local/S/jenkins/workspace/shared/Artifactory/Linux/USD/e2b89ce/include -isystem /local/S/jenkins/workspace/shared/Artifactory/Linux/rundev-2023/202301271415/runtime/e2e2066/runTime/include/Python39/Python -O2 -g -DNDEBUG -fPIC -Wall -Werror -msse4.2 -Wno-deprecated -Wno-deprecated-declarations -Wno-unused-local-typedefs -std=c++14 -MD -MT lib/mayaUsd/CMakeFiles/mayaUsd.dir/ufe/StagesSubject.cpp.o -MF lib/mayaUsd/CMakeFiles/mayaUsd.dir/ufe/StagesSubject.cpp.o.d -o lib/mayaUsd/CMakeFiles/mayaUsd.dir/ufe/StagesSubject.cpp.o -c /home/S/jenkins/workspace/ECP/ecg-maya-usd/ecg-mayausd-branch-preflight-2023-python3-linux/ecg-maya-usd/maya-usd/lib/mayaUsd/ufe/StagesSubject.cpp
13:19:06      /home/S/jenkins/workspace/ECP/ecg-maya-usd/ecg-mayausd-branch-preflight-2023-python3-linux/ecg-maya-usd/maya-usd/lib/mayaUsd/ufe/StagesSubject.cpp:290:26: error: 'std::vector<std::basic_string<char> > {anonymous}::getMetadataKeys(const string&)' defined but not used [-Werror=unused-function]
13:19:06       std::vector<std::string> getMetadataKeys(const std::string& strMetadata)
13:19:06                                ^~~~~~~~~~~~~~~
13:19:06      cc1plus: all warnings being treated as errors

Thanks for looking in the build logs, now it should be fixed.

std::vector<std::string> getMetadataKeys(const std::string& strMetadata)
{
std::vector<std::string> metadataKeys;
const std::regex rgx("(')([^ ]*)(':)");
Copy link
Collaborator

Choose a reason for hiding this comment

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

You are using the power of regular expressions, but not to their full extent. Please read more about capture groups. The function can be rewritten as:

std::vector<std::string> getMetadataKeys(const std::string& strMetadata)
{
    std::vector<std::string> metadataKeys;
    const std::regex         rgx("'([^ ]*)':");
    for (std::sregex_iterator it(strMetadata.begin(), strMetadata.end(), rgx), it_end; it != it_end;
         ++it) {
        metadataKeys.push_back(std::string((*it)[1]));
    }
    return metadataKeys;
}

And work exactly as requested by extracting the captured strings.

@alicedegirolamo alicedegirolamo added the ready-for-merge Development process is finished, PR is ready for merge label Feb 16, 2023
@seando-adsk seando-adsk merged commit 687ec05 into dev Feb 16, 2023
@seando-adsk seando-adsk deleted the degiroa/MAYA-127428/missing-metadata-notification branch February 16, 2023 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Development process is finished, PR is ready for merge ufe-usd Related to UFE-USD plugin in Maya-Usd
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants