Exemple #1
0
 private void GenerateInternalEditor()
 {
     UnityEngine.Object[] array = new UnityEngine.Object[base.targets.Length];
     for (int i = 0; i < base.targets.Length; i++)
     {
         Preset preset = (Preset)base.targets[i];
         PresetEditor.ReferenceCount referenceCount = null;
         if (!PresetEditor.s_References.TryGetValue(preset.GetInstanceID(), out referenceCount))
         {
             referenceCount = new PresetEditor.ReferenceCount
             {
                 count     = 0,
                 reference = preset.GetReferenceObject()
             };
             if (referenceCount.reference == null)
             {
                 this.m_NotSupportedEditorName = preset.GetTargetTypeName();
                 return;
             }
             PresetEditor.s_References.Add(preset.GetInstanceID(), referenceCount);
         }
         referenceCount.count++;
         array[i] = referenceCount.reference;
     }
     this.m_InternalEditor = Editor.CreateEditor(array);
 }
Exemple #2
0
        static string CreatePresetDialog(ref Preset preset, Object target)
        {
            if (target is AssetImporter && ApplyImportSettingsBeforeSavingPreset(ref preset, target))
            {
                return(null);
            }

            return(EditorUtility.SaveFilePanelInProject("New Preset",
                                                        preset.GetTargetTypeName(),
                                                        "preset",
                                                        "",
                                                        ProjectWindowUtil.GetActiveFolderPath()));
        }
        private static string CreatePresetDialog(ref Preset preset, UnityEngine.Object target)
        {
            string result;

            if (target is AssetImporter && PresetSelector.ApplyImportSettingsBeforeSavingPreset(ref preset, target))
            {
                result = null;
            }
            else
            {
                result = EditorUtility.SaveFilePanelInProject("New Preset", preset.GetTargetTypeName(), "preset", "", ProjectWindowUtil.GetActiveFolderPath());
            }
            return(result);
        }
Exemple #4
0
 internal override void OnHeaderControlsGUI()
 {
     using (new EditorGUI.DisabledScope(base.targets.Length != 1 || Preset.IsPresetExcludedFromDefaultPresets(base.target as Preset)))
     {
         Preset preset = (Preset)base.target;
         if (Preset.GetDefaultForPreset(preset) == preset)
         {
             if (GUILayout.Button(string.Format("Remove from {0} Default", preset.GetTargetTypeName()), EditorStyles.miniButton, new GUILayoutOption[]
             {
                 GUILayout.ExpandWidth(false)
             }))
             {
                 Preset.RemoveFromDefault(preset);
             }
         }
         else if (GUILayout.Button(string.Format("Set as {0} Default", preset.GetTargetTypeName()), EditorStyles.miniButton, new GUILayoutOption[]
         {
             GUILayout.ExpandWidth(false)
         }))
         {
             Preset.SetAsDefault(preset);
         }
     }
 }