Explorar el Código

Feature: Decals now usable in editor
- Various decal related fixes in bsf
- Add scene gizmo drawing
- Correct decal variation is shown in inspector when a decal is initially selected

BearishSun hace 6 años
padre
commit
05b3ddecd8

+ 19 - 19
Source/EditorManaged/Generated/info.xml

@@ -230,6 +230,25 @@
 			<doc>Draws curves and the area between them. Only relevant if only two curves are provided for drawing.</doc>
 		</enumentry>
 	</enum>
+	<enum native="SceneViewIcon" script="SceneViewIcon">
+		<doc>Types of icons that are used as 3D icons in the scene view.</doc>
+		<enumentry native="Camera" script="Camera">
+		</enumentry>
+		<enumentry native="Light" script="Light">
+		</enumentry>
+		<enumentry native="AudioSource" script="AudioSource">
+		</enumentry>
+		<enumentry native="AudioListener" script="AudioListener">
+		</enumentry>
+		<enumentry native="Decal" script="Decal">
+		</enumentry>
+		<enumentry native="ParticleSystem" script="ParticleSystem">
+		</enumentry>
+		<enumentry native="LightProbes" script="LightProbes">
+		</enumentry>
+		<enumentry native="ReflectionProbe" script="ReflectionProbe">
+		</enumentry>
+	</enum>
 	<enum native="FontRenderMode" script="FontRenderMode">
 		<doc>Determines how is a font rendered into the bitmap texture.</doc>
 		<enumentry native="Smooth" script="Smooth">
@@ -520,25 +539,6 @@
 		<enumentry native="VectorField" script="VectorField">
 		</enumentry>
 	</enum>
-	<enum native="SceneViewIcon" script="SceneViewIcon">
-		<doc>Types of icons that are used as 3D icons in the scene view.</doc>
-		<enumentry native="Camera" script="Camera">
-		</enumentry>
-		<enumentry native="Light" script="Light">
-		</enumentry>
-		<enumentry native="AudioSource" script="AudioSource">
-		</enumentry>
-		<enumentry native="AudioListener" script="AudioListener">
-		</enumentry>
-		<enumentry native="Decal" script="Decal">
-		</enumentry>
-		<enumentry native="ParticleSystem" script="ParticleSystem">
-		</enumentry>
-		<enumentry native="LightProbes" script="LightProbes">
-		</enumentry>
-		<enumentry native="ReflectionProbe" script="ReflectionProbe">
-		</enumentry>
-	</enum>
 	<enum native="SceneWindowIcon" script="SceneWindowIcon">
 		<doc>Types of icons that may be displayed in the scene window.</doc>
 		<enumentry native="MoveSnap" script="MoveSnap">

+ 10 - 0
Source/EditorManaged/Inspectors/MaterialInspector.cs

@@ -252,6 +252,16 @@ namespace bs.Editor
                     material.Variation = variation;
                 };
 
+                int curValue = variation.GetInt(param.identifier);
+                for (int j = 0; j < values.Length; j++)
+                {
+                    if (curValue == values[j])
+                    {
+                        listBox.Index = j;
+                        break;
+                    }
+                }
+
                 layout.AddElement(listBox);
             }
         }

+ 14 - 0
Source/EditorManaged/Windows/Scene/Gizmos/DecalGizmos.cs

@@ -13,6 +13,20 @@ namespace bs.Editor
     /// </summary>
     internal class DecalGizmos
     {
+        /// <summary>
+        /// Draws decal shape gizmo when a decal is selected.
+        /// </summary>
+        /// <param name="decal">Decal to draw the gizmos for.</param>
+        [DrawGizmo(DrawGizmoFlags.Selected)]
+        private static void Draw(Decal decal)
+        {
+            Gizmos.Color = Color.Yellow;
+            Gizmos.Transform = decal.SceneObject.WorldTransform;
+            Gizmos.DrawWireCube(
+                new Vector3(0.0f, 0.0f, -decal.MaxDistance * 0.5f), 
+                new Vector3(decal.Size.x, decal.Size.y, decal.MaxDistance) * 0.5f);
+        }
+
         /// <summary>
         /// Draws decal icon in scene view.
         /// </summary>

+ 1 - 1
Source/bsf

@@ -1 +1 @@
-Subproject commit 5059c2b9287eed5fe1aee2e17c34f1b626bb7520
+Subproject commit 37e05b20b30af5b9d7013204a09d14b137af0e63