ソースを参照

Bugfix: Properly use inner RRef resource types when looking up inspector fields and creating a resource field

BearishSun 7 年 前
コミット
2f834aeb69

+ 1 - 2
Source/Scripting/MBansheeEditor/MBansheeEditor.csproj

@@ -241,11 +241,10 @@
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\MBansheeEngine\MBansheeEngine.csproj">
     <ProjectReference Include="..\MBansheeEngine\MBansheeEngine.csproj">
-      <Project>{876EB338-489E-4727-84DA-8CBBF0DA5B5E}</Project>
+      <Project>{876eb338-489e-4727-84da-8cbbf0da5b5e}</Project>
       <Name>MBansheeEngine</Name>
       <Name>MBansheeEngine</Name>
     </ProjectReference>
     </ProjectReference>
   </ItemGroup>
   </ItemGroup>
-  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
   <PropertyGroup>
     <PostBuildEvent Condition=" '$(OS)' != 'Unix' ">"$(ProjectDir)..\..\..\Scripts\pdb2mdb.bat" "$(TargetPath)" "$(ConfigurationName)"</PostBuildEvent>
     <PostBuildEvent Condition=" '$(OS)' != 'Unix' ">"$(ProjectDir)..\..\..\Scripts\pdb2mdb.bat" "$(TargetPath)" "$(ConfigurationName)"</PostBuildEvent>

+ 5 - 1
Source/Scripting/MBansheeEditor/Windows/Inspector/InspectableField.cs

@@ -137,7 +137,11 @@ namespace BansheeEditor
         {
         {
             InspectableField field = null;
             InspectableField field = null;
 
 
-            Type customInspectable = InspectorUtility.GetCustomInspectable(property.InternalType);
+            Type type = property.InternalType;
+            if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(RRef<>))
+                type = type.GenericTypeArguments[0];
+
+            Type customInspectable = InspectorUtility.GetCustomInspectable(type);
             if (customInspectable != null)
             if (customInspectable != null)
             {
             {
                 field = (InspectableField) Activator.CreateInstance(customInspectable, depth, title, property);
                 field = (InspectableField) Activator.CreateInstance(customInspectable, depth, title, property);

+ 5 - 1
Source/Scripting/MBansheeEditor/Windows/Inspector/InspectableRRef.cs

@@ -38,7 +38,11 @@ namespace BansheeEditor
         {
         {
             if (property.Type == SerializableProperty.FieldType.RRef)
             if (property.Type == SerializableProperty.FieldType.RRef)
             {
             {
-                guiField = new GUIResourceField(property.InternalType, new GUIContent(title));
+                System.Type type = property.InternalType;
+                if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(RRef<>))
+                    type = type.GenericTypeArguments[0];
+
+                guiField = new GUIResourceField(type, new GUIContent(title));
                 guiField.OnChanged += OnFieldValueChanged;
                 guiField.OnChanged += OnFieldValueChanged;
 
 
                 layout.AddElement(layoutIndex, guiField);
                 layout.AddElement(layoutIndex, guiField);

+ 1 - 1
Source/bsf

@@ -1 +1 @@
-Subproject commit 1e6d53620375b2cb6b9416268bb70e23cd70a354
+Subproject commit 99911edd1b115c6fa03a6314729b3c40bc5167db