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

feat(Navisworks): CNX-1043 Enable shared ribbon for v2 and v3 Navisworks connectors #504

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from

Conversation

jsdbroughton
Copy link
Contributor

@jsdbroughton jsdbroughton commented Jan 18, 2025

Speckle Manager now offers installation of both V2 and V3 versions. While both versions are fully functional, having them appear in separate ribbon tabs creates unnecessary UI clutter. This change unifies the experience by bringing both versions into a clean interface.

Technical Details

  • Maintains full V2 functionality.
  • Leveraged Navisworks APIs to manage plugin visibility and lifecycle events.
  • Caches plugin state to minimise redundant checks.
  • Centralised plugin and ribbon management logic in reusable utilities.

What Changed

  • Introduced a unified ribbon tab for Speckle V2 and V3.
  • Automatically hides V2’s separate tab when V3 is installed, retaining all V2 functionality.
  • Dynamically enables ribbon buttons based on installed versions and their states.

Added:

  • PluginUtilities.cs: Adds Common methods for detecting plugins and managing ribbon state.
  • SpeckleV2Tool.cs: Constants for identifying V2 plugin components.
  • SpeckleV3Tool.cs: Constants for V3, including version details.

Modified:

NavisworksRibbon.xaml:

  • A V2 button was added alongside V3 in the unified ribbon tab layout.
  • Separated panel definitions for V2 and V3.

NavisworksRibbon.xaml.cs:

  • Implemented logic to hide the V2 ribbon tab when V3 is installed dynamically.
  • Enhanced state management to enable/disable buttons based on installed versions.
  • Used the PluginRecordsChanged event to dynamically update the ribbon tab visibility and button states when plugins are added or removed.
  • Refactored redundant plugin-checking logic into PluginUtilities.

NavisworksRibbon.name:

  • Added localisation strings for the new unified V2/V3 ribbon tab.
  • Updated display names for buttons and tab titles.

All changes maintain V2's original functionality while adding controls to show it cleanly alongside V3. The new utility classes centralize what was previously scattered plugin management code.

Testing

Verified all installation combinations work correctly:

  • Clean V2 install
    Screenshot 2025-01-18 174533

  • Clean V3 install
    Screenshot 2025-01-18 174609

  • Both versions
    Screenshot 2025-01-18 174638

Related

  • Speckle Manager unified installer updates

- Added `LaunchSpeckleConnector` class with constants for command and plugin names
- Updated `NavisworksRibbon.name` file to include display names for Speckle v2 and v3
- Updated `NavisworksRibbon.xaml` file to include ribbon panels and buttons for Speckle v2 and v3
- Updated `NavisworksRibbon.xaml.cs` file to include commands for launching Speckle v2 and v3 connectors
- Added resources for the icons of the new buttons
- Delete AppUtils.cs and Commands.cs (Replaced by v2 and v3 Tools)
- Add Utilities.cs for plugin utilities functionality
…plugin and developer ID. Also, initialize the services with the correct version of Navisworks.
- Refactor the CanExecuteCommand method to handle different commandIds.
- Add a static constructor to subscribe to the PluginRecordsChanged event.
- Implement OnPluginRecordsChanged method to reset the cached state of V2 plugin availability.
- Modify ExecuteCommand method to load and activate the appropriate plugin based on the commandId.
- Add a new IsValidVersion method to check if the current version of Navisworks is compatible with the plugin.
- Find the v2 plugin and update the availability state
- Hide the v2 ribbon tab if it exists
Refactor the code in `RibbonHandler` to improve the handling of commands for Speckle v3 and v2 tools. The changes include:
- Extracting a new method `HandleCommand` to handle the loading and activation of plugins
- Removing duplicated code by calling `HandleCommand` for both Speckle v3 and v2 tools
- Adding null checks when finding plugin records
- Returning early if plugin loading should be skipped
- Added two summary comments to describe the purpose of the methods `CanExecuteCommand()` and `ExecuteCommand()`.
Copy link

linear bot commented Jan 18, 2025

Copy link

codecov bot commented Jan 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 9.15%. Comparing base (db4d2f7) to head (c3fda42).

Additional details and impacted files
@@          Coverage Diff          @@
##             dev    #504   +/-   ##
=====================================
  Coverage   9.15%   9.15%           
=====================================
  Files        228     228           
  Lines       4306    4306           
  Branches     542     542           
=====================================
  Hits         394     394           
  Misses      3896    3896           
  Partials      16      16           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jsdbroughton jsdbroughton marked this pull request as ready for review January 18, 2025 18:14
@jsdbroughton jsdbroughton requested review from didimitrie, oguzhankoral and bimgeek and removed request for bimgeek January 18, 2025 18:15
@jsdbroughton jsdbroughton enabled auto-merge (squash) January 18, 2025 18:21
- Added `SpeckleV2Tool.cs` file with constants for Speckle V2 tool
- Added `SpeckleV3Tool.cs` file with constants for Speckle V3 tool
- Add conditional compilation for DEBUG mode
- Remove debug code that prints available plugins to the Debug output window
- Remove unused using statement for System.Text
…ities.cs

- Simplify ActivatePluginPane method in Utilities.cs
- Remove unused parameter 'command' from ActivatePluginPane method
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.

1 participant