Example #1
0
 private static void CheckNonNegative(GLSerializedProperty property)
 {
     if (property.IntValue < 0)
     {
         property.IntValue = 0;
     }
 }
Example #2
0
        public GLSerializedProperty FindProperty(string propertyName)
        {
            var property = new GLSerializedProperty
            {
                SerializedProperty = serializedObject.FindProperty(propertyName),
                CustomTooltip      = ""
            };

            if (property.SerializedProperty == null)
            {
                Debug.LogError("Could not find property " + propertyName + " in class " + typeof(T).Name);

                return(property);
            }

            Type type = typeof(T);

            FieldInfo field = type.GetField(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

            if (field == null)
            {
                Debug.LogError("Could not find field " + propertyName + " in class " + typeof(T).Name);

                return(property);
            }

            return(property);
        }
Example #3
0
 private static void CheckPositive(GLSerializedProperty property)
 {
     if (property.IntValue < 1)
     {
         property.IntValue = 1;
     }
 }
        public void OnEnable()
        {
            _loadingScene       = FindProperty("loadingScene");
            _buttonPanel        = FindProperty("buttonPanel");
            _useLeapMotion      = FindProperty("useLeapMotion");
            _usePitchGrab       = FindProperty("usePitchGrab");
            _useHapticGlove     = FindProperty("useHapticGlove");
            _useKeyboard        = FindProperty("useKeyboard");
            _useMouse           = FindProperty("useMouse");
            _useJoystick        = FindProperty("useJoystick");
            _PanelBGIIES        = FindProperty("panelBgiies");
            _KinectGestures     = FindProperty("kinectGestures");
            _KinectFace         = FindProperty("kinectFace");
            _visualizationPlane = FindProperty("visualizationPlane");

            _BGIIESMode           = FindProperty("bgiiesMode");
            _childPrefab          = FindProperty("childPrefab");
            _MouseInput           = FindProperty("mouseInput");
            _KinectInput          = FindProperty("kinectInput");
            _BodySrcManager       = FindProperty("bodySrcManager");
            _KinectGestureManager = FindProperty("kinectGestureManager");

            _csvCreatorPath = FindProperty("csvCreatorPath");

            _rayCastingDetector      = FindProperty("rayCastingDetector");
            _lookPointerPrefab       = FindProperty("lookPointerPrefab");
            _lookPointerBgiiesPrefab = FindProperty("lookPointerBgiiesPrefab");
            _lookPointerScale        = FindProperty("lookPointerScale");
            _closeRange = FindProperty("closeRange");

            _leapMotionRig      = FindProperty("leapMotionRig");
            _pinchDetectorLeft  = FindProperty("pinchDetectorLeft");
            _pinchDetectorRight = FindProperty("pinchDetectorRight");

            //_unityOpenGlove = FindProperty("unityOpenGlove");
            _unityHapticGlove = FindProperty("unityHapticGlove");

            _horizontalSpeed = FindProperty("horizontalSpeed");
            _verticalSpeed   = FindProperty("verticalSpeed");
            _radiusFactor    = FindProperty("radiusFactor");
            _radiusSpeed     = FindProperty("radiusSpeed");
            _alphaFactor     = FindProperty("alphaFactor");
            _alphaSpeed      = FindProperty("alphaSpeed");
            _alphaWaitTime   = FindProperty("alphaWaitTime");
            _action1Key      = FindProperty("action1Key");
            _action2Key      = FindProperty("action2Key");
            _action3Key      = FindProperty("action3Key");
            _action4Key      = FindProperty("action4Key");
            _action5Key      = FindProperty("action5Key");

            _autoTuneVisualizationOnPlay = FindProperty("autoTuneVisualizationOnPlay");
            _informationPrefab           = FindProperty("informationPrefab");
            _visualizationCounter        = FindProperty("visualizationCounter");
            _spherePrefab           = FindProperty("spherePrefab");
            _planePrefab            = FindProperty("planePrefab");
            _informationPlanePrefab = FindProperty("informationPlanePrefab");
            _loadImageController    = FindProperty("loadImageController");
            _sphereControllers      = FindProperty("sphereControllers");
            _planeControllers       = FindProperty("planeControllers");
        }
Example #5
0
        protected void AddField(GLSerializedProperty prop)
        {
            if (prop == null)
            {
                return;
            }
            if (prop.SerializedProperty == null)
            {
                return;
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(prop.SerializedProperty,
                                          new GUIContent(prop.SerializedProperty.name.SplitCamelCase(), prop.CustomTooltip), true);
            EditorGUILayout.EndHorizontal();
        }
Example #6
0
        public void OnEnable()
        {
            updateTypeProp    = FindProperty("updateType");
            isInterActiveProp = FindProperty("isInteractive");
            cellPrefabProp    = FindProperty("cellPrefab");
            shapeProp         = FindProperty("shape");
            dimensionsProp    = FindProperty("dimensions");
            sizeProp          = FindProperty("size");

            neighborSetupProp         = HasProperty("neighborSetup") ? FindProperty("neighborSetup") : null;
            polarGridPropertiesProp   = HasProperty("polarGridProperties") ? FindProperty("polarGridProperties") : null;
            pointListProp             = HasProperty("pointList") ? FindProperty("pointList") : null;
            poissonDiskPropertiesProp = HasProperty("poissonDiskProperties") ? FindProperty("poissonDiskProperties") : null;
            mapTypeProp           = FindProperty("mapType");
            planeProp             = FindProperty("plane");
            alignmentProp         = FindProperty("alignment");
            cellSpacingFactorProp = FindProperty("cellSpacingFactor");
            useColorProp          = FindProperty("useColor");
            colorsProp            = FindProperty("colors");
            colorFunctionProp     = FindProperty("colorFunction");
        }
Example #7
0
        public void OnEnable()
        {
            updateTypeProp     = FindProperty("updateType");
            isInterActiveProp  = FindProperty("isInteractive");
            shapeProp          = FindProperty("shape");
            dimensionsProp     = FindProperty("dimensions");
            sizeProp           = FindProperty("size");
            cellDimensionsProp = FindProperty("cellDimensions");
            textureWidthProp   = FindProperty("textureWidth");
            textureHeightProp  = FindProperty("textureHeight");

            neighborSetupProp         = HasProperty("neighborSetup") ? FindProperty("neighborSetup") : null;
            polarGridPropertiesProp   = HasProperty("polarGridProperties") ? FindProperty("polarGridProperties") : null;
            pointListProp             = HasProperty("pointList") ? FindProperty("pointList") : null;
            poissonDiskPropertiesProp = HasProperty("poissonDiskProperties") ? FindProperty("poissonDiskProperties") : null;
            mapTypeProp           = FindProperty("mapType");
            alignmentProp         = FindProperty("alignment");
            cellSpacingFactorProp = FindProperty("cellSpacingFactor");
            useColorProp          = FindProperty("useColor");
            colorsProp            = FindProperty("colors");
            colorFunctionProp     = FindProperty("colorFunction");

            colorList = new ReorderableList(serializedObject, colorsProp.SerializedProperty, true, true, true, true);
            colorList.drawHeaderCallback += rect => GUI.Label(rect, "Colors");

            colorList.drawElementCallback += (rect, index, active, focused) =>
            {
                rect.height = 16;
                rect.y     += 2;
                if (index >= colorsProp.SerializedProperty.arraySize)
                {
                    return;
                }
                var color = colorsProp.SerializedProperty.GetArrayElementAtIndex(index).colorValue;

                color = EditorGUI.ColorField(rect, color);

                colorsProp.SerializedProperty.GetArrayElementAtIndex(index).colorValue = color;
            };
        }
Example #8
0
        public GLSerializedProperty FindProperty(string propertyName)
        {
            var property = new GLSerializedProperty
            {
                SerializedProperty = serializedObject.FindProperty(propertyName),
                CustomTooltip      = ""
            };

            if (property.SerializedProperty == null)
            {
                Debug.LogError("Could not find property " + propertyName + " in class " + typeof(T).Name);

                return(property);
            }

            Type type = typeof(T);

            FieldInfo field = type.GetField(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

            if (field == null)
            {
                Debug.LogError("Could not find field " + propertyName + " in class " + typeof(T).Name);

                return(property);
            }

            /*
             * var descriptions = field.GetCustomAttributes(typeof (DescriptionAttribute), true);
             *
             * if (descriptions.Any())
             * {
             *      property.CustomTooltip = (descriptions.First() as DescriptionAttribute).Description;
             * }
             */
            return(property);
        }
Example #9
0
 private static void CheckColorFunction(GLSerializedProperty property)
 {
     CheckPositive(property.FindPropertyRelative("x0"));
     CheckNonNegative(property.FindPropertyRelative("x1"));
     CheckPositive(property.FindPropertyRelative("y1"));
 }
Example #10
0
 private static void CheckDimensions(GLSerializedProperty property)
 {
     CheckPositive(property.FindPropertyRelative("x"));
     CheckPositive(property.FindPropertyRelative("y"));
 }