コード例 #1
0
 public void Draw(object value, Rect fullRect, bool selected, IconStyle style)
 {
     if (!(value is Texture2D tex))
     {
         return;
     }
     PvCustomizerGUI.DrawTexture(style.DrawRect, tex, style.Material, style.Tint, style.ScaleMode);
 }
コード例 #2
0
 public void Draw(object value, Rect fullRect, bool selected, IconStyle style)
 {
     if (!(value is GridSample asset))
     {
         return;
     }
     PvCustomizerGUI.DrawBackground(style.DrawRect);
     PvCustomizerGUI.DrawTexture(style.DrawRect, asset.texture1, style.Material, style.Tint, style.ScaleMode);
 }
コード例 #3
0
ファイル: AudioDrawer.cs プロジェクト: h-sigma/PvCustomizer
 public void Draw(object value, Rect fullRect, bool selected, IconStyle style)
 {
     if (!(value is AudioClip clip))
     {
         return;
     }
     if (!AssetDatabase.Contains(clip))
     {
         //TODO
     }
     else
     {
         var tex = AssetPreview.GetAssetPreview(clip);
         PvCustomizerGUI.DrawTexture(style.DrawRect, tex, PvCustomizerGUI.AssetPreviewClipMaterial, style.Tint, style.ScaleMode);
     }
 }
コード例 #4
0
        public void Draw(object value, Rect fullRect, bool selected, IconStyle style)
        {
            if (!(value is Material material))
            {
                return;
            }
            if (!AssetDatabase.Contains(material) || material.GetTag("PreviewType", false) == "Plane")
            {
                PvCustomizerGUI.DrawTexture(style.DrawRect, Texture2D.whiteTexture, material, style.Tint,
                                            style.ScaleMode);
            }
            else
            {
                var tex = AssetPreview.GetAssetPreview(material);
                PvCustomizerGUI.DrawTexture(style.DrawRect, tex, material, style.Tint, style.ScaleMode);
            }

            /*
             * Mesh mesh = PvCustomizerUtility.GetPrimitiveMesh(material.GetTag("PreviewType", false, "Sphere"));
             *
             * foreach (Type type in TypeCache.GetTypesDerivedFrom<ObjectPreview>())
             * {
             *  foreach (object attr in type.GetCustomAttributes(typeof(CustomPreviewAttribute), false))
             *  {
             *      if (!(attr is CustomPreviewAttribute cust)) continue;
             *      FieldInfo fieldInfo =
             *          typeof(CustomPreviewAttribute).GetField("m_Type",
             *              BindingFlags.Instance | BindingFlags.NonPublic);
             *      Type held = fieldInfo.
             *          GetValue(cust) as Type;
             *      if (held != typeof(Material)) continue;
             *      Debug.Log($"Found material preview: {held.Name}.");
             *
             *      var preview = Activator.CreateInstance(held) as ObjectPreview;
             *      preview.OnPreviewGUI(style.DrawRect, GUIStyle.none);
             *  }
             * }*/
        }