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

hdMaya: Adopt the include directive/order according to coding guideline. #379

Conversation

HamedSabri-adsk
Copy link
Contributor

This PR changes the include directive/order in hdMaya according to guideline.

@HamedSabri-adsk HamedSabri-adsk added the enhancement New feature or request label Mar 24, 2020
@kxl-adsk kxl-adsk added the build Related to building maya-usd repository label Mar 25, 2020
Copy link
Contributor

@mattyjams mattyjams left a comment

Choose a reason for hiding this comment

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

Looks great to me! Just a few super-tiny nit picks.

Thanks @HamedSabri-adsk!

@@ -26,7 +26,7 @@
#include <maya/MFnLight.h>
#include <maya/MFnNonExtendedLight.h>

#include "dagAdapter.h"
#include <hdMaya/adapters/dagAdapter.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this one would go in its own group below <pxr/imaging/hd/light.h>?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks you @mattyjams . Please see 7cb7810

#include <hdMaya/adapters/materialAdapter.h>
#include <hdMaya/adapters/mayaAttrs.h>
#include <hdMaya/adapters/tokens.h>

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this blank line to put all the hdMaya includes in a group together?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see 7cb7810

Comment on lines 4 to 5
#include <hdMaya/delegates/proxyUsdImagingDelegate.h>
#include <hdMaya/adapters/shapeAdapter.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Swap these two so "adapters" is before "delegates"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see 7cb7810

Comment on lines -35 to +38
#include <maya/MDGMessage.h>
#include <maya/MDagPath.h>
#include <maya/MDagPathArray.h>
#include <maya/MDGMessage.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

I always waffle on this, whether to order capital letters before lower case, or to sort case-insensitively. :/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hear you. I honestly don't have a strong preference. I can change it if you guys prefer it the other way any-times.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I don't have a strong preference either. Just maybe a justification as to why it may have been that way. :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I want to go with whatever clang-format does by default for this, since I'd eventually like to start using that to handle header ordering automatically. I wonder if maybe we should just create an initial .clang-format file, which disables everything EXCEPT the header ordering, and then just run that on the whole repo? That way we can at least start having that be standardized, before we come to agreement on all the other nitty-gritty style details.

Copy link
Contributor

@pmolodo pmolodo left a comment

Choose a reason for hiding this comment

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

Really only one change that I'd like to see addressed - the conversion of "" to <> that I noted.

Otherwise, it's a bunch of ordering notes, which might potentially just be better handled by an automated tool...

#include "primReader.h"
#include "primReaderRegistry.h"
#include "mayaUsd/fileio/primReader.h"
#include "mayaUsd/fileio/primReaderRegistry.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that since, these are installed + available from a PUBLIC include dir, that these should use <>

@@ -13,15 +13,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "adapter.h"
#include "adapterDebugCodes.h"
#include <hdMaya/adapters/adapter.h>

#include <pxr/base/tf/type.h>

#include <maya/MNodeMessage.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

According to the style guidelines, Autodesk + Maya comes before pxr + usd headers. So these two would be flipped.

Of course, I think we're eventually planning on automating this via clang-format, so if you want to leave this be until we formalize our clang-format file, that's fine - we just need to make sure absolute/relative + <>/"" is handled (since clang-format won't change that.)

There's a few other places where maya vs pxr order is flipped, so I won't bother commenting on all of them.

@@ -17,15 +17,14 @@
#define HDMAYA_ADAPTER_H

#include <pxr/pxr.h>

#include <pxr/usd/sdf/path.h>

#include <maya/MMessage.h>

#include <vector>
Copy link
Contributor

Choose a reason for hiding this comment

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

vector, as a c++ standard lib, should come first.

Comment on lines -35 to +38
#include <maya/MDGMessage.h>
#include <maya/MDagPath.h>
#include <maya/MDagPathArray.h>
#include <maya/MDGMessage.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

I want to go with whatever clang-format does by default for this, since I'd eventually like to start using that to handle header ordering automatically. I wonder if maybe we should just create an initial .clang-format file, which disables everything EXCEPT the header ordering, and then just run that on the whole repo? That way we can at least start having that be standardized, before we come to agreement on all the other nitty-gritty style details.

@HamedSabri-adsk
Copy link
Contributor Author

@mattyjams Would it be Ok if I close this PR in favor of (#392, #388, #389, #390, #391)? Paul confirmed that he is OK.

@HamedSabri-adsk HamedSabri-adsk mentioned this pull request Mar 27, 2020
@mattyjams
Copy link
Contributor

@HamedSabri-adsk: Sure, works for me. I'll try to make some time to look at those other PRs today. Thanks!

@HamedSabri-adsk HamedSabri-adsk deleted the sabrih/MAYA-103365/header_inclusion_coding_guideline branch March 27, 2020 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to building maya-usd repository enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants