Skip to content

Commit

Permalink
Merge pull request #1197 from mcneel/1.25
Browse files Browse the repository at this point in the history
1.25
  • Loading branch information
kike-garbo authored Oct 11, 2024
2 parents e9e3b34 + 6b7d002 commit f858b88
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public DataCulling Culling
protected virtual Bitmap GetItemIcon(T value, Size size)
{
var type = value.GetType();
if (TypeIcons.TryGetValue(GetType(), out var icon))
if (TypeIcons.TryGetValue(type, out var icon))
return icon;

var bitmap = default(Bitmap);
Expand All @@ -251,19 +251,19 @@ protected virtual Bitmap GetItemIcon(T value, Size size)
{
// Try with a parameter that has the same name.
var typeName = value.TypeName;
var location = value.GetType().Assembly.Location;
var proxy = Instances.ComponentServer.ObjectProxies.
var assembly = type.Assembly;
var proxies = Instances.ComponentServer.ObjectProxies.
Where
(
x => typeof(IGH_Param).IsAssignableFrom(x.Type) &&
string.Equals(x.Desc.Name, typeName, StringComparison.OrdinalIgnoreCase) &&
string.Equals(x.Location, location, StringComparison.OrdinalIgnoreCase)
x => x.Kind == GH_ObjectType.CompiledObject &&
typeof(IGH_Param).IsAssignableFrom(x.Type) &&
Equals(x.Type?.Assembly, assembly) &&
string.Equals(x.Desc.Name, typeName, StringComparison.OrdinalIgnoreCase)
).
OrderBy(x => !x.SDKCompliant).
ThenBy(x => x.Obsolete).
FirstOrDefault();
ThenBy(x => x.Obsolete);

bitmap = proxy?.Icon;
bitmap = proxies.FirstOrDefault()?.Icon;
}

return TypeIcons[type] = bitmap;
Expand Down
9 changes: 5 additions & 4 deletions src/RhinoInside.Revit.GH/Types/Reference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,14 @@ Bitmap IGH_ItemDescription.GetTypeIcon(Size size)
if (typeName.StartsWith("Revit "))
typeName = typeName.Substring(6);

var location = GetType().Assembly.Location;
var assembly = GetType().Assembly;
var proxy = Instances.ComponentServer.ObjectProxies.
Where
(
x => typeof(IGH_Param).IsAssignableFrom(x.Type) &&
string.Equals(x.Desc.Name, typeName, StringComparison.OrdinalIgnoreCase) &&
string.Equals(x.Location, location, StringComparison.OrdinalIgnoreCase)
x => x.Kind == GH_ObjectType.CompiledObject &&
typeof(IGH_Param).IsAssignableFrom(x.Type) &&
Equals(x.Type?.Assembly, assembly) &&
string.Equals(x.Desc.Name, typeName, StringComparison.OrdinalIgnoreCase)
).
OrderBy(x => !x.SDKCompliant).
ThenBy(x => x.Obsolete).
Expand Down

0 comments on commit f858b88

Please sign in to comment.