diff --git a/src/compute.geometry/FixedEndpoints.cs b/src/compute.geometry/FixedEndpoints.cs index 17746aff..06d3fdbc 100644 --- a/src/compute.geometry/FixedEndpoints.cs +++ b/src/compute.geometry/FixedEndpoints.cs @@ -55,7 +55,7 @@ static async Task GetInstalledPluginsRhino(HttpContext ctx) { var info = Rhino.PlugIns.PlugIn.GetPlugInInfo(k); //Could also use: info.IsLoaded - if (info != null && !info.ShipsWithRhino && !rhPluginInfo.ContainsKey(info.Name)) + if (info != null && !rhPluginInfo.ContainsKey(info.Name) && !info.ShipsWithRhino) { rhPluginInfo.Add(info.Name, info.Version); } diff --git a/src/compute.geometry/Startup.cs b/src/compute.geometry/Startup.cs index c6b49b35..736fce5d 100644 --- a/src/compute.geometry/Startup.cs +++ b/src/compute.geometry/Startup.cs @@ -8,9 +8,12 @@ namespace compute.geometry { public class Startup { - // https://github.com/mcneel/rhino/blob/e1192835cbf03f662d0cf857ee9239b84109eeed/src4/rhino4/Plug-ins/RhinoCodePlugins/RhinoCodePlugin/AssemblyInfo.cs + //https://github.com/mcneel/rhino/blob/e1192835cbf03f662d0cf857ee9239b84109eeed/src4/rhino4/Plug-ins/RhinoCodePlugins/RhinoCodePlugin/AssemblyInfo.cs static readonly Guid s_rhinoCodePluginId = new Guid("c9cba87a-23ce-4f15-a918-97645c05cde7"); + //https://github.com/mcneel/rhino/blob/8.x/src4/rhino4/Plug-ins/Commands/Properties/AssemblyInfo.cs + static readonly Guid s_rhinoCommandsPluginId = new Guid("02bf604d-799c-4cc2-830e-8d72f21b14b7"); + public void ConfigureServices(IServiceCollection services) { services.AddCors(options => @@ -54,6 +57,20 @@ void RhinoCoreStartup() Logging.LogExceptionData(ex); }; + // NOTE: + // andyopayne 11/19/2024 (RH-84777) + // The commands.rhp needs to be loaded so that some features suchs as the gltf exporter will work. + // This is a temporary solution until the gltf exporter is moved into Rhinocommon or Rhino.UI + Log.Information("(1/4) Loading rhino commands plugin"); + if (Rhino.PlugIns.PlugIn.LoadPlugIn(s_rhinoCommandsPluginId)) + { + Log.Information("Successfully loaded commands plugin"); + } + else + { + Log.Error("Error loading rhino commands plugin."); + } + // NOTE: // eirannejad 10/02/2024 (COMPUTE-268) // Ensure RhinoCode plugin (Rhino plugin) is loaded. This plugin registers scripting @@ -67,7 +84,7 @@ void RhinoCoreStartup() // eirannejad 12/3/2024 (COMPUTE-268) // This load is placed before Grasshopper in case GH needs to load any plugins published by the // new scripting tools in Rhino >= 8 - Log.Information("(1/3) Loading rhino scripting plugin"); + Log.Information("(2/4) Loading rhino scripting plugin"); if (Rhino.PlugIns.PlugIn.LoadPlugIn(s_rhinoCodePluginId)) { Log.Information("Successfully loaded scripting plugin"); @@ -88,20 +105,18 @@ void RhinoCoreStartup() } // Load GH at startup so it can get initialized on the main thread - Log.Information("(2/3) Loading grasshopper"); + Log.Information("(3/4) Loading grasshopper"); var pluginObject = Rhino.RhinoApp.GetPlugInObject("Grasshopper"); var runheadless = pluginObject?.GetType().GetMethod("RunHeadless"); if (runheadless != null) runheadless.Invoke(pluginObject, null); - Log.Information("(3/3) Loading compute plug-ins"); + Log.Information("(4/4) Loading compute plug-ins"); var loadComputePlugins = typeof(Rhino.PlugIns.PlugIn).GetMethod("LoadComputeExtensionPlugins"); if (loadComputePlugins != null) loadComputePlugins.Invoke(null, null); - //ApiKey.Initialize(pipelines); - //Rhino.Runtime.HostUtils.RegisterComputeEndpoint("grasshopper", typeof(Endpoints.GrasshopperEndpoint)); } }