-
Notifications
You must be signed in to change notification settings - Fork 202
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
Returning an enum from UI delegate #1259
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
#include <pxr/pxr.h> | ||
#include <pxr/usd/sdf/path.h> | ||
#include <pxr/usd/usd/attribute.h> | ||
#include <pxr/usd/usd/stage.h> | ||
#include <pxr/usd/usd/timeCode.h> | ||
|
||
#include <maya/MArgDatabase.h> | ||
|
@@ -180,6 +181,10 @@ MString GetUniqueNameOfDagNode(const MObject& node); | |
MAYAUSD_CORE_PUBLIC | ||
MStatus GetMObjectByName(const std::string& nodeName, MObject& mObj); | ||
|
||
/// Gets the UsdStage for the proxy shape node named \p nodeName. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would add a comment pointer here to lib/mayaUsd/ufe/Utils.h There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, you just want me to mention in the comments that there is a similar function that uses UFE over in a different utilities file? The only issue with the Maya way is what the performance is when you have a unique dag path and want the depend node, which I don't think is all that bad. Once you have the node then it's just a cast to our base class and we call the function on it to return the stage ptr. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That seems very roundabout... If you have an MDagPath, you don't need to go through UFE! You can just get the MObject from the tail of the path, and get a pointer from that. And yes, just add a comment saying if you already have a dependence on UFE, then lib/mayaUsd/ufe/Utils.h is better. |
||
MAYAUSD_CORE_PUBLIC | ||
UsdStageRefPtr GetStageByProxyName(const std::string& nodeName); | ||
|
||
/// Gets the Maya MDagPath for the node named \p nodeName. | ||
MAYAUSD_CORE_PUBLIC | ||
MStatus GetDagPathByName(const std::string& nodeName, MDagPath& dagPath); | ||
|
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.
I get that this is to remove dependence on UFE, but in doing so this is adding a by-name lookup of a proxy shape. If it's not called a lot, this is fine.
Also, I think it would be good to steer readers of this code to lib/mayaUsd/ufe/Utils.h, which will have much better performance, if a dependence on UFE is not an issue.
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.
Couple thoughts:
Do you think lookup performance would be bad given a unique path? It might not be as fast as some of the structures in UFE, but I would hope that when looking for a single object given a unique string that it would be fairly quick. Right now this function will be called once per proxy shape when saving, so it shouldn't be too many and definitely not called interactively.
We are going to have to revisit the utility function that I am replacing soon anyways, since it will no longer be valid to map between proxies and stages like we have it now. The stage cache map code that can go from UsdStage ptr to proxy is the one that will have to change.
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.
Once per proxy shape when saving is fine, not an issue.