Skip to content

Commit 71f5bd1

Browse files
authored
Merge pull request mcneel#694 from mcneel/AndyPayne/RH84777
forcing commands.rhp to be loaded
2 parents eb81091 + 4cd7234 commit 71f5bd1

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

src/compute.geometry/FixedEndpoints.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static async Task GetInstalledPluginsRhino(HttpContext ctx)
5555
{
5656
var info = Rhino.PlugIns.PlugIn.GetPlugInInfo(k);
5757
//Could also use: info.IsLoaded
58-
if (info != null && !info.ShipsWithRhino && !rhPluginInfo.ContainsKey(info.Name))
58+
if (info != null && !rhPluginInfo.ContainsKey(info.Name) && !info.ShipsWithRhino)
5959
{
6060
rhPluginInfo.Add(info.Name, info.Version);
6161
}

src/compute.geometry/Startup.cs

+21-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ namespace compute.geometry
88
{
99
public class Startup
1010
{
11-
// https://github.com/mcneel/rhino/blob/e1192835cbf03f662d0cf857ee9239b84109eeed/src4/rhino4/Plug-ins/RhinoCodePlugins/RhinoCodePlugin/AssemblyInfo.cs
11+
//https://github.com/mcneel/rhino/blob/e1192835cbf03f662d0cf857ee9239b84109eeed/src4/rhino4/Plug-ins/RhinoCodePlugins/RhinoCodePlugin/AssemblyInfo.cs
1212
static readonly Guid s_rhinoCodePluginId = new Guid("c9cba87a-23ce-4f15-a918-97645c05cde7");
1313

14+
//https://github.com/mcneel/rhino/blob/8.x/src4/rhino4/Plug-ins/Commands/Properties/AssemblyInfo.cs
15+
static readonly Guid s_rhinoCommandsPluginId = new Guid("02bf604d-799c-4cc2-830e-8d72f21b14b7");
16+
1417
public void ConfigureServices(IServiceCollection services)
1518
{
1619
services.AddCors(options =>
@@ -54,6 +57,20 @@ void RhinoCoreStartup()
5457
Logging.LogExceptionData(ex);
5558
};
5659

60+
// NOTE:
61+
// andyopayne 11/19/2024 (RH-84777)
62+
// The commands.rhp needs to be loaded so that some features suchs as the gltf exporter will work.
63+
// This is a temporary solution until the gltf exporter is moved into Rhinocommon or Rhino.UI
64+
Log.Information("(1/4) Loading rhino commands plugin");
65+
if (Rhino.PlugIns.PlugIn.LoadPlugIn(s_rhinoCommandsPluginId))
66+
{
67+
Log.Information("Successfully loaded commands plugin");
68+
}
69+
else
70+
{
71+
Log.Error("Error loading rhino commands plugin.");
72+
}
73+
5774
// NOTE:
5875
// eirannejad 10/02/2024 (COMPUTE-268)
5976
// Ensure RhinoCode plugin (Rhino plugin) is loaded. This plugin registers scripting
@@ -67,7 +84,7 @@ void RhinoCoreStartup()
6784
// eirannejad 12/3/2024 (COMPUTE-268)
6885
// This load is placed before Grasshopper in case GH needs to load any plugins published by the
6986
// new scripting tools in Rhino >= 8
70-
Log.Information("(1/3) Loading rhino scripting plugin");
87+
Log.Information("(2/4) Loading rhino scripting plugin");
7188
if (Rhino.PlugIns.PlugIn.LoadPlugIn(s_rhinoCodePluginId))
7289
{
7390
Log.Information("Successfully loaded scripting plugin");
@@ -88,20 +105,18 @@ void RhinoCoreStartup()
88105
}
89106

90107
// Load GH at startup so it can get initialized on the main thread
91-
Log.Information("(2/3) Loading grasshopper");
108+
Log.Information("(3/4) Loading grasshopper");
92109
var pluginObject = Rhino.RhinoApp.GetPlugInObject("Grasshopper");
93110
var runheadless = pluginObject?.GetType().GetMethod("RunHeadless");
94111
if (runheadless != null)
95112
runheadless.Invoke(pluginObject, null);
96113

97114

98-
Log.Information("(3/3) Loading compute plug-ins");
115+
Log.Information("(4/4) Loading compute plug-ins");
99116
var loadComputePlugins = typeof(Rhino.PlugIns.PlugIn).GetMethod("LoadComputeExtensionPlugins");
100117
if (loadComputePlugins != null)
101118
loadComputePlugins.Invoke(null, null);
102119

103-
//ApiKey.Initialize(pipelines);
104-
//Rhino.Runtime.HostUtils.RegisterComputeEndpoint("grasshopper", typeof(Endpoints.GrasshopperEndpoint));
105120
}
106121

107122
}

0 commit comments

Comments
 (0)