-
Notifications
You must be signed in to change notification settings - Fork 6
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
HYDRA-951 : Add Maya command plugin to query build info #163
Merged
roopavr-adsk
merged 8 commits into
dev
from
roopavr/HYDRA-951/queryMayaHydraPluginInfoCmd
Aug 30, 2024
+303
−60
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
22b2e14
Add Maya command plugin to querry build info
roopavr-adsk 94a36a2
fix indentation
roopavr-adsk 96d1c05
Update copyright year
roopavr-adsk c421c40
misc
roopavr-adsk 6480442
Removed duplicate command args. Updated tests
roopavr-adsk e661515
Remove help string from viewCommand plugin cmd.
roopavr-adsk c313c5c
Move help string to a Markdown file
roopavr-adsk 7fe78e1
Update test file
roopavr-adsk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# Maya command plugins used in MayaHydra | ||
|
||
# MayaHydra Command Plugin | ||
|
||
The `MayaHydra` command plugin provides a set of utilities for interacting with the Hydra rendering framework within Maya. Below are the available flags and their descriptions. | ||
|
||
## Basic Usage | ||
|
||
```bash | ||
mayaHydra [flags] | ||
``` | ||
Available Flags | ||
``` | ||
-listDelegates / -ld: | ||
``` | ||
Returns the names of available scene delegates. | ||
``` | ||
-listRenderers / -lr: | ||
``` | ||
Returns the names of available render delegates. | ||
``` | ||
-listActiveRenderers / -lar: | ||
``` | ||
Returns the names of render delegates that are in use in at least one viewport. | ||
|
||
Renderer-Specific Commands | ||
``` | ||
-renderer / -r [RENDERER]: | ||
``` | ||
Specifies the renderer to target for the commands below. | ||
``` | ||
-getRendererDisplayName / -gn: | ||
``` | ||
Returns the display name for the given render delegate. | ||
``` | ||
-createRenderGlobals / -crg: | ||
``` | ||
Creates the render globals, optionally targeting a specific renderer. | ||
``` | ||
-userDefaults / -ud: | ||
``` | ||
A flag for -createRenderGlobals to restore user defaults on create. | ||
``` | ||
-updateRenderGlobals / -urg [ATTRIBUTE]: | ||
``` | ||
Forces the update of the render globals for the viewport, optionally targeting a specific renderer or setting. | ||
|
||
Advanced / Debugging Flags | ||
To access advanced and debugging flags, use the -verbose / -v flag. | ||
|
||
Debug Flags | ||
``` | ||
-listRenderIndex / -lri -r [RENDERER]: | ||
``` | ||
Returns a list of all the rprims in the render index for the given render delegate. | ||
``` | ||
-visibleOnly / -vo: | ||
``` | ||
Affects the behavior of -listRenderIndex. If provided, only visible items in the render index are returned. | ||
``` | ||
-sceneDelegateId / -sid [SCENE_DELEGATE] -r [RENDERER]: | ||
``` | ||
Returns the path ID corresponding to the given render delegate and scene delegate pair. | ||
|
||
# MayaHydra Versioning and Build Information Flags | ||
|
||
The following flags are used to retrieve versioning and build information for the `MayaHydra` plugin. Each flag has both a short and a long form. | ||
|
||
## Usage Example | ||
|
||
To retrieve the full version of the `MayaHydra` plugin, use the following command: | ||
|
||
```bash | ||
mayaHydraBuildInfo [-flags] | ||
``` | ||
## Version Information | ||
|
||
- **`-mjv` / `-majorVersion`**: | ||
Returns the major version number of the plugin. | ||
|
||
- **`-mnv` / `-minorVersion`**: | ||
Returns the minor version number of the plugin. | ||
|
||
- **`-pv` / `-patchVersion`**: | ||
Returns the patch version number of the plugin. | ||
|
||
- **`-v` / `-version`**: | ||
Returns the full version string of the plugin, which may include major, minor, and patch version numbers. | ||
|
||
## Build Information | ||
|
||
This information is expected to be set by a parent build system that has access and/or generates the following information. | ||
|
||
- **`-c` / `-cutIdentifier`**: | ||
Returns the cut identifier associated with this build of the plugin. | ||
|
||
- **`-bn` / `-buildNumber`**: | ||
Returns the build number for the plugin, typically representing the incremental number assigned during the build process. | ||
|
||
- **`-gc` / `-gitCommit`**: | ||
Returns the Git commit hash that the build is based on, useful for tracing the exact source code used. | ||
|
||
- **`-gb` / `-gitBranch`**: | ||
Returns the Git branch name that the build was created from. | ||
|
||
- **`-bd` / `-buildDate`**: | ||
Returns the date on which the plugin was built. | ||
|
||
|
||
### Summary | ||
- **Version Information Flags**: Cover major, minor, and patch version details, as well as the full version string. | ||
- **Build Information Flags**: Include cut identifier, build number, Git commit, Git branch, and build date. | ||
- **Usage Examples**: Show how to retrieve specific pieces of information using the provided flags. | ||
|
||
This Markdown document provides a clear and concise reference for users who need to access versioning and build information for the `MayaHydra` plugin. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
// | ||
// Copyright 2024 Autodesk | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#include "pluginBuildInfoCommand.h" | ||
|
||
#include <mayaHydraLib/mhBuildInfo.h> | ||
|
||
#include <maya/MArgParser.h> | ||
#include <maya/MSyntax.h> | ||
|
||
#define XSTR(x) STR(x) | ||
#define STR(x) #x | ||
|
||
namespace MAYAHYDRA_NS_DEF { | ||
|
||
const MString MayaHydraPluginInfoCommand::commandName("mayaHydraBuildInfo"); | ||
|
||
namespace { | ||
|
||
// Versioning and build information. | ||
constexpr auto kMajorVersion = "-mjv"; | ||
constexpr auto kMajorVersionLong = "-majorVersion"; | ||
|
||
constexpr auto kMinorVersion = "-mnv"; | ||
constexpr auto kMinorVersionLong = "-minorVersion"; | ||
|
||
constexpr auto kPatchVersion = "-pv"; | ||
constexpr auto kPatchVersionLong = "-patchVersion"; | ||
|
||
constexpr auto kVersion = "-v"; | ||
constexpr auto kVersionLong = "-version"; | ||
|
||
constexpr auto kCutId = "-c"; | ||
constexpr auto kCutIdLong = "-cutIdentifier"; | ||
|
||
constexpr auto kBuildNumber = "-bn"; | ||
constexpr auto kBuildNumberLong = "-buildNumber"; | ||
|
||
constexpr auto kGitCommit = "-gc"; | ||
constexpr auto kGitCommitLong = "-gitCommit"; | ||
|
||
constexpr auto kGitBranch = "-gb"; | ||
constexpr auto kGitBranchLong = "-gitBranch"; | ||
|
||
constexpr auto kBuildDate = "-bd"; | ||
constexpr auto kBuildDateLong = "-buildDate"; | ||
|
||
} // namespace | ||
|
||
MSyntax MayaHydraPluginInfoCommand::createSyntax() | ||
{ | ||
MSyntax syntax; | ||
syntax.enableQuery(false); | ||
syntax.enableEdit(false); | ||
|
||
// Versioning and build information flags. | ||
syntax.addFlag(kMajorVersion, kMajorVersionLong); | ||
syntax.addFlag(kMinorVersion, kMinorVersionLong); | ||
syntax.addFlag(kPatchVersion, kPatchVersionLong); | ||
syntax.addFlag(kVersion, kVersionLong); | ||
syntax.addFlag(kCutId, kCutIdLong); | ||
syntax.addFlag(kBuildNumber, kBuildNumberLong); | ||
syntax.addFlag(kGitCommit, kGitCommitLong); | ||
syntax.addFlag(kGitBranch, kGitBranchLong); | ||
syntax.addFlag(kBuildDate, kBuildDateLong); | ||
|
||
return syntax; | ||
} | ||
|
||
MStatus MayaHydraPluginInfoCommand::doIt(const MArgList& args) | ||
{ | ||
MStatus st; | ||
MArgParser argData(syntax(), args, &st); | ||
if (!st) | ||
return st; | ||
|
||
if (argData.isFlagSet(kMajorVersion)) { | ||
setResult(MAYAHYDRA_MAJOR_VERSION); // int | ||
} else if (argData.isFlagSet(kMinorVersion)) { | ||
setResult(MAYAHYDRA_MINOR_VERSION); // int | ||
} else if (argData.isFlagSet(kPatchVersion)) { | ||
setResult(MAYAHYDRA_PATCH_LEVEL); // int | ||
} else if (argData.isFlagSet(kVersion)) { | ||
setResult(XSTR(MAYAHYDRA_VERSION)); // convert to string | ||
} else if (argData.isFlagSet(kCutId)) { | ||
setResult(MhBuildInfo::cutId()); | ||
} else if (argData.isFlagSet(kBuildNumber)) { | ||
setResult(MhBuildInfo::buildNumber()); | ||
} else if (argData.isFlagSet(kGitCommit)) { | ||
setResult(MhBuildInfo::gitCommit()); | ||
} else if (argData.isFlagSet(kGitBranch)) { | ||
setResult(MhBuildInfo::gitBranch()); | ||
} else if (argData.isFlagSet(kBuildDate)) { | ||
setResult(MhBuildInfo::buildDate()); | ||
} | ||
|
||
return MS::kSuccess; | ||
} | ||
|
||
} // namespace MAYAHYDRA_NS_DEF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// Copyright 2024 Autodesk | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#ifndef MAYAHYDRA_PULINGINFO_CMD_H | ||
#define MAYAHYDRA_PULINGINFO_CMD_H | ||
|
||
#include <mayaHydraLib/mayaHydra.h> | ||
#include <maya/MPxCommand.h> | ||
|
||
namespace MAYAHYDRA_NS_DEF { | ||
|
||
class MayaHydraPluginInfoCommand : public MPxCommand | ||
{ | ||
public: | ||
static void* creator() { return new MayaHydraPluginInfoCommand(); } | ||
static MSyntax createSyntax(); | ||
|
||
static const MString commandName; | ||
|
||
MStatus doIt(const MArgList& args) override; | ||
}; | ||
|
||
} // namespace MAYAHYDRA_NS_DEF | ||
#endif // MAYAHYDRA_PULINGINFO_CMD_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where this member was used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you mean to ask about commandName ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, commandName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have a ticket to remove it from the mayaHydra command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. A file was missed to be added to this PR. Added now.