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

Integration with 3Dconnexion input devices #396

Merged
merged 4 commits into from
Sep 1, 2023

Conversation

pskowronskiTDx
Copy link

Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file.

I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

Signed-off-by: Patryk Skowroński <[email protected]>
Copy link
Member

@ghutchis ghutchis left a comment

Choose a reason for hiding this comment

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

These are mostly minor, since the main aspect is your code itself.

This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/

#pragma once
Copy link
Member

Choose a reason for hiding this comment

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

For consistency, can we please stick to #ifndef like the other headers? Thanks.

Copy link
Author

Choose a reason for hiding this comment

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

Of course, corrected.

Copy link
Member

Choose a reason for hiding this comment

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

If it's useful API, just add it, not #ifdef

Copy link
Member

Choose a reason for hiding this comment

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

This seems kind of small. Does this work okay on a high-resolution / Retina screen?

Copy link
Author

@pskowronskiTDx pskowronskiTDx Jul 4, 2023

Choose a reason for hiding this comment

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

Yes, it is fine, this icon is meant to be so small.

@ghutchis
Copy link
Member

@pskowronskiTDx - comments on the requested changes? I'd certainly love to merge these.

Signed-off-by: Patryk Skowroński <[email protected]>
}
}

for (auto& pNode : pNode->m_children) {

Check warning

Code scanning / Cppcheck (reported by Codacy)

Local variable 'pNode' shadows outer argument Warning

Local variable 'pNode' shadows outer argument
}
}

for (auto& pNode : pNode->m_children) {

Check warning

Code scanning / Cppcheck (reported by Codacy)

Variable 'pNode' can be declared as reference to const Warning

Variable 'pNode' can be declared as reference to const
}

for (auto& pNode : pNode->m_children) {
if (pNode->m_nodeName == childName) {

Check warning

Code scanning / Cppcheck (reported by Codacy)

Consider using std::find_if algorithm instead of a raw loop. Warning

Consider using std::find_if algorithm instead of a raw loop.
avogadro/tdxcontroller.h Outdated Show resolved Hide resolved
@@ -0,0 +1,3 @@
This directory contains part of the the 3Dconnexion 3DxWare_SDK v4
The full sdk can be obtained from https://3dconnexion.com/software-developer-program/
Copy link
Member

Choose a reason for hiding this comment

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

Is there a good way to keep this up-to-date (e.g., when v5 comes out?)

Copy link
Author

Choose a reason for hiding this comment

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

No, as we are shipping some SDK's headers with the solution they will need to be updated manually when a new release comes out.


std::vector<bool> flags;

m_pGLRenderer->scene().getBoundingBox(extents.min.x,
Copy link
Member

Choose a reason for hiding this comment

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

See, I think you can get this from the molecule here and avoid having to save all those spheres in the render pipeline.

Just implement core/molecule.*:getBoundingBox() instead.

Copy link
Author

Choose a reason for hiding this comment

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

Done as suggested.

for (uint32_t i = 0u; i < (*m_ppMolecule)->atomCount(); i++)
flags[i] = (*m_ppMolecule)->atomSelected(i);

m_pGLRenderer->scene().getBoundingBox(extents.min.x,
Copy link
Member

Choose a reason for hiding this comment

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

Ditto. You're already going through the atoms in the loop above.

for (Index i = 0; i < molecule->atomCount(); ++i) {
   if (molecule->atomSelected(i) {
     // calculate the bounding box directly
   }
}


long Avogadro::TDxController::GetIsSelectionEmpty(navlib::bool_t &empty) const
{
if (*m_ppMolecule == nullptr)
Copy link
Member

Choose a reason for hiding this comment

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

Use Molecule:isSelectionEmpty()

avogadro/tdxcontroller.h Outdated Show resolved Hide resolved
@ghutchis
Copy link
Member

Looks pretty close - sorry for the delay. If you could run clang-format on your changed files in avogadro (i.e. outside of thirdparty) it would be appreciated.

@pskowronskiTDx
Copy link
Author

Thank you for your sugesstions, I have introduced some changes. The double pointer for Molecule object was used to keep track on the active molecule (selected in the explorer). However, I have reworked it by introducing updateMolecule method, connected to the moleculeChanged signal. The pointer to the active molecule updates automatically now, without referencing "pp" anymore.

Patryk Skowroński added 2 commits August 3, 2023 11:51
@ghutchis
Copy link
Member

Assuming this builds cleanly, I'll merge this as well. Thanks!

@ghutchis
Copy link
Member

ghutchis commented Sep 1, 2023

Sorry for the delay - I thought I had previously merged this before leaving for a conference. I'll update the clang-format myself in a new pull.

Thanks!

@ghutchis ghutchis merged commit 17b8ff9 into OpenChemistry:master Sep 1, 2023
23 of 26 checks passed
@welcome
Copy link

welcome bot commented Sep 1, 2023

Congrats on merging your first pull request! 🎉 Thanks for making Avogadro better for everyone!

@pskowronskiTDx
Copy link
Author

No problem, I am happy to see the changes finally merged. Hope the integration will be useful. Thank you as well!

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.

2 participants