Beispiel #1
0
 private void OnEnable()
 {
     targetActor               = (HvrActor)target;
     hvrEditorGUI              = new HvrEditorGUI();
     EditorApplication.update -= EditorUpdate;
     EditorApplication.update += EditorUpdate;
 }
        /// <summary>
        /// Draws one element of the list (ListItemExample)
        /// </summary>
        /// <param name="rect"></param>
        /// <param name="index"></param>
        /// <param name="active"></param>
        /// <param name="focused"></param>
        private void DrawElement(Rect rect, int index, bool active, bool focused)
        {
            PluginReferenceController.PluginReference item = self.references[index];

            EditorGUI.BeginChangeCheck();

            float o = 0;

            float lx    = rect.x;
            float rx    = rect.x + rect.width / 2.0f;
            float wHalf = rect.width / 2;

            item.guid = HvrEditorGUI.DrawObjectSlot(new Rect(rect.x, rect.y + o, rect.width, lineHeight), "Object:", item.guid);
            o        += lineHeight;

            EditorGUI.LabelField(new Rect(lx, rect.y + o, rect.width / 2, lineHeight), "Platform");
            EditorGUI.LabelField(new Rect(rx, rect.y + o, rect.width / 2, lineHeight), "Other");
            o += lineHeight;

            item.platformNone = EditorGUI.ToggleLeft(new Rect(lx, rect.y + o, wHalf, lineHeight), "Support None", item.platformNone);
            o += lineHeight;

            if (!item.platformNone)
            {
                item.platformWindows = EditorGUI.ToggleLeft(new Rect(lx, rect.y + o, wHalf, lineHeight), "Windows", item.platformWindows);
                item.supportEditor   = EditorGUI.ToggleLeft(new Rect(rx, rect.y + o, wHalf, lineHeight), "Use In Editor", item.supportEditor);
                o += lineHeight;

                item.platformMac = EditorGUI.ToggleLeft(new Rect(lx, rect.y + o, wHalf, lineHeight), "Mac", item.platformMac);
                o += lineHeight;

                item.platformLinux = EditorGUI.ToggleLeft(new Rect(lx, rect.y + o, wHalf, lineHeight), "Linux", item.platformLinux);
                o += lineHeight;

                item.platformAndroid = EditorGUI.ToggleLeft(new Rect(lx, rect.y + o, wHalf, lineHeight), "Android", item.platformAndroid);
                o += lineHeight;

                item.platformiOS = EditorGUI.ToggleLeft(new Rect(lx, rect.y + o, wHalf, lineHeight), "iOS", item.platformiOS);
                o += lineHeight;

                item.versionFilter = EditorGUI.TextField(new Rect(lx, rect.y + o, rect.width, lineHeight), "Version Filter", item.versionFilter);
                o += lineHeight;
            }

            if (EditorGUI.EndChangeCheck())
            {
                self.references[index] = item;
                EditorUtility.SetDirty(target);

                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();

                PluginCompatibility.EnsureCompatiblity();
            }
        }
        /// <summary>
        /// Draws one element of the list (ListItemExample)
        /// </summary>
        /// <param name="rect"></param>
        /// <param name="index"></param>
        /// <param name="active"></param>
        /// <param name="focused"></param>
        private void DrawElement(Rect rect, int index, bool active, bool focused)
        {
            HvrDataReference.Data item = self.data[index];

            EditorGUI.BeginChangeCheck();

            float yOffset = 0;

            item.guid = HvrEditorGUI.DrawObjectSlot(new Rect(rect.x, rect.y + yOffset, rect.width, guiLineHeight), "Data:", item.guid);
            yOffset  += guiLineHeight;

            if (EditorGUI.EndChangeCheck())
            {
                self.data[index] = item;
                EditorUtility.SetDirty(target);
            }
        }
        public override void OnInspectorGUI()
        {
            if (m_Instance == null)
            {
                return;
            }

            Undo.RecordObject(target, "HVR Light");

            GUI.color = editorColor;

            Inspector_Utils.DrawHeader();
            GUILayout.Space(4);

            this.DrawDefaultInspector();
            ExposeProperties.Expose(m_fields);

            Light dependentLight = m_Instance.GetComponent <Light>();

            if (dependentLight != null && dependentLight.type == LightType.Directional)
            {
#if UNITY_2017_1_OR_NEWER
                EditorGUI.BeginChangeCheck();

                m_Instance.ShadowDistanceLimit = EditorGUILayout.Slider("Shadow Distance Limit", m_Instance.ShadowDistanceLimit, 0.1f, QualitySettings.shadowDistance);

                if (EditorGUI.EndChangeCheck())
                {
                    HvrEditorGUI.ForceRedrawHvrWorldAndRepaintView();
                }
#else
                EditorGUILayout.HelpBox("Casting shadows from directional lights is not supported in versions before Unity 2017.1.", MessageType.Warning);
#endif
            }

            if (GUI.changed)
            {
                SceneView.RepaintAll();

                EditorUtility.SetDirty(target);

                Repaint();
            }
        }
        /// <summary>
        /// Draws one element of the list (ListItemExample)
        /// </summary>
        /// <param name="rect"></param>
        /// <param name="index"></param>
        /// <param name="active"></param>
        /// <param name="focused"></param>
        private void DrawElement(Rect rect, int index, bool active, bool focused)
        {
            ExtensionsReferenceAsset.Reference reference = self.references[index];

            EditorGUI.BeginChangeCheck();

            float yOffset = 0;

            reference.platform = (RuntimePlatform)EditorGUI.EnumPopup(new Rect(rect.x, rect.y + yOffset, rect.width, HvrEditorGUI.guiLineHeight), "Platform", reference.platform);
            yOffset           += HvrEditorGUI.guiLineHeight;
            reference.guid     = HvrEditorGUI.DrawObjectSlot(new Rect(rect.x, rect.y + yOffset, rect.width, HvrEditorGUI.guiLineHeight), "Data:", reference.guid);
            yOffset           += HvrEditorGUI.guiLineHeight;

            if (EditorGUI.EndChangeCheck())
            {
                self.references[index] = reference;
                EditorUtility.SetDirty(target);
            }
        }
 private void OnEnable()
 {
     hvrEditorGUI = new HvrEditorGUI();
 }