Exemple #1
0
        private static void DrawHandles(SuperColliderComponent component, GizmoType gizmoType)
        {
            // Only draw gizmos for the SuperObject if we have it in our set
            // This way users can disable gizmos for the SuperObject through the Gizmos menu
            if (!SuperColliderComponent.GizmoDrawCommands.Contains(component))
            {
                return;
            }
            else
            {
                SuperColliderComponent.GizmoDrawCommands.Remove(component);
            }

            if (m_Settings == null)
            {
                m_Settings = ST2USettings.GetOrCreateST2USettings();

                if (m_Settings == null)
                {
                    // If something goes wrong use some dummy settings
                    m_Settings = CreateInstance <ST2USettings>();
                }
            }

            if (m_Settings != null)
            {
                ColliderGizmos.DrawColliders(component.gameObject, m_Settings);
            }
        }
        public override void OnActivate(string searchContext, VisualElement rootElement)
        {
            base.OnActivate(searchContext, rootElement);

            m_ST2USettings       = ST2USettings.GetOrCreateST2USettings();
            m_S2TUSettingsObject = new SerializedObject(m_ST2USettings);

            // Prepare our list of material matchings
            var matchings = m_S2TUSettingsObject.FindProperty("m_MaterialMatchings");

            m_MaterialMatchingsList = new ReorderableList(m_S2TUSettingsObject, matchings, true, false, true, true)
            {
                headerHeight        = 0,
                drawElementCallback = OnDrawMaterialMatchingElement,
            };

            // Prepare our list of prefab replacements
            var replacements = m_S2TUSettingsObject.FindProperty("m_PrefabReplacements");

            m_PrefabReplacementList = new ReorderableList(m_S2TUSettingsObject, replacements, true, false, true, true)
            {
                headerHeight        = 0,
                drawElementCallback = OnDrawPrefabReplacementElement,
            };
        }
        private void DoCustomPropertySettings()
        {
            var xmlProperty = m_S2TUSettingsObject.FindProperty("m_ObjectTypesXml");

            EditorGUILayout.LabelField("Custom Property Settings", EditorStyles.boldLabel);

            EditorGUILayout.PropertyField(xmlProperty, SettingsContent.m_ObjectTypesXmlContent);

            if (!string.IsNullOrEmpty(m_ST2USettings.ParseXmlError))
            {
                EditorGUILayout.HelpBox(m_ST2USettings.ParseXmlError, MessageType.Error);
            }

            EditorGUILayout.Space();
            using (new GUILayout.HorizontalScope())
            {
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Refresh"))
                {
                    ST2USettings.GetOrCreateST2USettings().RefreshCustomObjectTypes();
                }

                if (GUILayout.Button("View Custom Properties"))
                {
                    CustomPropertiesWindow.ShowCustomPropertiesWindow();
                }
            }
        }
Exemple #4
0
        public void ApplyDefaultSettings()
        {
            var settings = ST2USettings.GetOrCreateST2USettings();

            m_PixelsPerUnit   = settings.PixelsPerUnit;
            m_EdgesPerEllipse = settings.EdgesPerEllipse;
            EditorUtility.SetDirty(this);
        }
        public static SettingsProvider CreateCustomSettingsProvider()
        {
            if (ST2USettings.GetOrCreateST2USettings())
            {
                var provider = new ST2USettingsProvider();
                provider.keywords = GetSearchKeywordsFromGUIContentProperties <SettingsContent>();
                return(provider);
            }

            // Settings Asset doesn't exist yet; no need to display anything in the Settings window.
            return(null);
        }
Exemple #6
0
        private void OnGUICustomProperties()
        {
            EditorGUILayout.LabelField(m_TitleContent, EditorStyles.boldLabel);

            var settings = ST2USettings.GetOrCreateST2USettings();

            foreach (var obj in settings.CustomObjectTypes)
            {
                EditorGUILayout.Space();
                OnGUICustomObjectType(obj);
                EditorGUILayout.Space();
            }
        }
Exemple #7
0
        private void OnGUIButtons()
        {
            EditorGUILayout.Space();
            using (new GUILayout.HorizontalScope())
            {
                GUILayout.FlexibleSpace();

                if (GUILayout.Button("Refresh Properties"))
                {
                    ST2USettings.GetOrCreateST2USettings().RefreshCustomObjectTypes();
                }

                if (GUILayout.Button("Close Custom Properties Viewer"))
                {
                    Close();
                    return;
                }
            }
        }
        public override void OnGUI(string searchContext)
        {
            EditorGUIUtility.labelWidth = 200;

            m_S2TUSettingsObject.Update();

            using (new GuiScopedIndent())
            {
                DoGuiVersion();
                EditorGUILayout.Space();
                EditorGUILayout.Space();

                DoGuiSettings();
                EditorGUILayout.Space();
                EditorGUILayout.Space();

                DoGuiPrefabReplacements();
                EditorGUILayout.Space();
                EditorGUILayout.Space();

                DoGuiColliders();
                EditorGUILayout.Space();
                EditorGUILayout.Space();

                DoCustomPropertySettings();
                EditorGUILayout.Space();
                EditorGUILayout.Space();

                EditorGUILayout.Space();
                DoGuiReimportAssets();
            }

            if (m_S2TUSettingsObject.ApplyModifiedProperties())
            {
                ST2USettings.GetOrCreateST2USettings().RefreshCustomObjectTypes();
            }
        }
        private void WrapImportContext(AssetImportContext ctx)
        {
            var settings = ST2USettings.GetOrCreateST2USettings();

            settings.RefreshCustomObjectTypes();

            // Create a copy of our settings that we can override based on importer settings
            settings = Instantiate(settings);

            if (m_PixelsPerUnit == 0)
            {
                m_PixelsPerUnit = settings.PixelsPerUnit;
            }

            if (m_EdgesPerEllipse == 0)
            {
                m_EdgesPerEllipse = settings.EdgesPerEllipse;
            }

            settings.PixelsPerUnit   = m_PixelsPerUnit;
            settings.EdgesPerEllipse = m_EdgesPerEllipse;

            SuperImportContext = new SuperImportContext(ctx, settings);
        }
Exemple #10
0
 public static void ShowCustomPropertiesWindow()
 {
     ST2USettings.GetOrCreateST2USettings().RefreshCustomObjectTypes();
     GetWindow <CustomPropertiesWindow>("SuperTiled2Unity Custom Properties Viewer");
 }