Skip to content

Conversation

@samuelliu-adsk
Copy link
Collaborator

No description provided.

@samuelliu-adsk samuelliu-adsk force-pushed the samuelliu-adsk/EMSUSD-2761/search_path_ui branch 3 times, most recently from ef1b73b to 9c85fd4 Compare September 24, 2025 05:30
text -label `getMayaUsdString("KArMappingFile")` -ann `getMayaUsdString("KArMappingFileAnn")`;
textField -text (`optionVar -q mayaUsd_AdskAssetResolverMappingFile`) -cc ("mayaUsdArMappingFilePathUpdate") mayaUsdArMappingFilePath;
symbolButton -image "navButtonBrowse.png" -c "mayaUsdArMappingFileBrowser()" browseBtn;
button
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is there a way for us to get CMake variables in .mel? If AR_FOUND is false we dont want to show this UI

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not directly no. You can configure the file, which I don't think we want to do here.

Another way I can think of is to add a new flag to mayaUsdInfoCommand.cpp which lives in adsk plugin. The flag could be something like "-ar" which returns true when the Asset Resolver is there. You can use the define WANT_AR_BUILD which you set above to know when to return true/false. Then in both MEL you can use the command

if `mayaUsdInfo -ar`

And in python:

if cmds.mayaUsdInfo(ar=True)

@samuelliu-adsk samuelliu-adsk force-pushed the samuelliu-adsk/EMSUSD-2761/search_path_ui branch from 9c85fd4 to b170ea1 Compare September 24, 2025 15:07
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.

I only looked at the cmake and changes to our existing code. I didn't review the new AR files as I assume they were reviewed previously in the shared code.

message(STATUS " AR include dir is ${AR_INCLUDE_DIR}")
message(STATUS " AR library is ${AR_LIBRARY}")
else()
message(ERROR "AR not found")
Copy link
Collaborator

Choose a reason for hiding this comment

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

You shouldn't need this error message. The line 37 above will output a cmake error if the two required vars are not set.


add_subdirectory(layerEditor)
add_subdirectory(importDialog)
add_subdirectory(assetResolver)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
add_subdirectory(assetResolver)
if (AR_FOUND)
add_subdirectory(assetResolver)
endif()

Comment on lines 63 to 64
message(STATUS "AR include dir is ${AR_INCLUDE_DIR}")
target_include_directories(${PROJECT_NAME} PRIVATE ${AR_INCLUDE_DIR})
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't need the message here. Its already in your FindAR.cmake.

Suggested change
message(STATUS "AR include dir is ${AR_INCLUDE_DIR}")
target_include_directories(${PROJECT_NAME} PRIVATE ${AR_INCLUDE_DIR})
if (AR_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${AR_INCLUDE_DIR})
endif()

Qt::Core
Qt::Gui
Qt::Widgets
${AR_LIBRARY}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be okay even if AR_FOUND is false, since this will just be empty.

Comment on lines 18 to 20
if(NOT AR_FOUND)
return()
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove this as the check should be one level higher in the parent CMakeLists.txt

#if defined(WANT_QT_BUILD)
#include <mayaUsdUI/ui/USDImportDialogCmd.h>
#include <mayaUsdUI/ui/initStringResources.h>
#include <mayaUsdUI/ui/AssetResolverDialogCmd.h>
Copy link
Collaborator

Choose a reason for hiding this comment

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

In the CMakeLists.txt you need to set a define when AR_FOUND is true, so that you can check it in cpp files. See how WANT_QT_BUILD is set. You could make yours WANT_AR_BUILD.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added a variable called WANT_AR_BUILD

Comment on lines +354 to +363
status = MayaUsd::AssetResolverDialogCmd::initialize(plugin);
if (!status) {
MString err("registerCommand");
err += MayaUsd::AssetResolverDialogCmd::name;
status.perror(err);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This code should be wrapped in you new define.

text -label `getMayaUsdString("KArMappingFile")` -ann `getMayaUsdString("KArMappingFileAnn")`;
textField -text (`optionVar -q mayaUsd_AdskAssetResolverMappingFile`) -cc ("mayaUsdArMappingFilePathUpdate") mayaUsdArMappingFilePath;
symbolButton -image "navButtonBrowse.png" -c "mayaUsdArMappingFileBrowser()" browseBtn;
button
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not directly no. You can configure the file, which I don't think we want to do here.

Another way I can think of is to add a new flag to mayaUsdInfoCommand.cpp which lives in adsk plugin. The flag could be something like "-ar" which returns true when the Asset Resolver is there. You can use the define WANT_AR_BUILD which you set above to know when to return true/false. Then in both MEL you can use the command

if `mayaUsdInfo -ar`

And in python:

if cmds.mayaUsdInfo(ar=True)

@samuelliu-adsk samuelliu-adsk marked this pull request as ready for review September 24, 2025 15:09
@samuelliu-adsk samuelliu-adsk force-pushed the samuelliu-adsk/EMSUSD-2761/search_path_ui branch 3 times, most recently from a6c7dd0 to 87b88ce Compare September 30, 2025 05:56
const char* MayaUsdBuildInfo::buildDate() { return MAYAUSD_BUILD_DATE; }
bool MayaUsdBuildInfo::buildAR()
{
#ifdef WANT_AR_BUILD
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Declared this buildAR method to check if AdskAssetResolver is built

PrimUpdaterManager::getInstance();
#endif

#ifdef WANT_AR_BUILD
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

AR related code is wrapped in WANT_AR_BUILD

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.

Just a couple of small changes to make.

CMakeLists.txt Outdated

find_package(AR)
if (AR_FOUND)
message(STATUS "Found AdskAssetResolver")
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't really need this message here since you have the message in FindAR.cmake.

@@ -0,0 +1,123 @@
//
// Copyright 2019 Autodesk
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this 2019?

@@ -0,0 +1,53 @@
#
# Copyright 2021 Autodesk
Copy link
Collaborator

Choose a reason for hiding this comment

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

2025?

target_compile_definitions(${TARGET_NAME}
PRIVATE
MAYAUSD_PLUGIN_EXPORT
$<$<BOOL:${AR_FOUND}>:WANT_AR_BUILD>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just add this line 61 under line 55 below.

${UFE_INCLUDE_DIR}
)
if (AR_FOUND)
target_include_directories(${TARGET_NAME} PRIVATE ${AR_INCLUDE_DIR})
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can add this in the target_include_directories just above, using the generator expression again. Put this just after line 92.
$<$BOOL:${AR_FOUND}:${AR_INCLUDE_DIR}>

@samuelliu-adsk samuelliu-adsk force-pushed the samuelliu-adsk/EMSUSD-2761/search_path_ui branch from 719b684 to 3df9135 Compare October 2, 2025 16:27
@samuelliu-adsk samuelliu-adsk self-assigned this Oct 2, 2025
@samuelliu-adsk samuelliu-adsk force-pushed the samuelliu-adsk/EMSUSD-2761/search_path_ui branch from 3df9135 to a015695 Compare October 2, 2025 19:41
seando-adsk
seando-adsk previously approved these changes Oct 2, 2025
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.

Looks better. You can still fix plugin/adsk/plugin/CMakeLists.txt using a generator expression instead of the extra if.

@samuelliu-adsk samuelliu-adsk force-pushed the samuelliu-adsk/EMSUSD-2761/search_path_ui branch from 4a5b288 to e226140 Compare October 2, 2025 20:29
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.

All good. Thanks.

@samuelliu-adsk samuelliu-adsk merged commit 86135bf into dev Oct 2, 2025
11 checks passed
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.

3 participants