Ejemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            LockedTrack cp = (LockedTrack)target;

            EditorGUI.BeginChangeCheck();

            EConUtil.DrawActiveLine(cp);

            //constraint target
            cp.Target = (Transform)EditorGUILayout.ObjectField("Target Obj", cp.Target, typeof(Transform), true);

            EUtil.DrawSplitter();

            EUtil.PushGUIEnable(cp.IsActiveConstraint && cp.Target);
            {
                cp.LookAxis = (EAxisD)EConUtil.DrawEnumBtns(EConUtil.AxisDs, EConUtil.AxisDStrs, cp.LookAxis, "LookAxis", "Owner's local axis used to aim at the target", 80f);
                GUILayout.Space(5f);

                cp.RotateAxis = (EAxisD)EConUtil.DrawEnumBtns(EConUtil.AxisDsPositive, EConUtil.AxisDStrsPositive, cp.RotateAxis, "Rotate Axis", "Owner's local axis used to rotate around", 80f);
                GUILayout.Space(5f);

                cp.RotateAxis = ConUtil.EnsureAxisNotColinear(cp.LookAxis, cp.RotateAxis);

                // influence
                cp.Influence = EUtil.ProgressBar(cp.Influence, 0, 1f, "Influence: {0:F2}");
            }
            EUtil.PopGUIEnable();

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(cp); //so ConstraintStack.Update can be called in edit-mode
            }
        }
Ejemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            LookAt cp = (LookAt)target;

            EditorGUI.BeginChangeCheck();

            EConUtil.DrawActiveLine(cp);

            //constraint target
            cp.Target = (Transform)EditorGUILayout.ObjectField("Target Obj", cp.Target, typeof(Transform), true);

            EUtil.DrawSplitter();

            EUtil.PushGUIEnable(cp.IsActiveConstraint && cp.Target);
            {
                cp.LookAxis = (EAxisD)EConUtil.DrawEnumBtns(AllLookAxis, AllLookAxisStr, cp.LookAxis, "LookAxis", "the axis to point towards target");
                cp.UpAxis   = (EAxisD)EConUtil.DrawEnumBtns(AllLookAxis, AllLookAxisStr, cp.UpAxis, "UpAxis", "the axis to point upward");

                cp.UpAxis = ConUtil.EnsureAxisNotColinear(cp.LookAxis, cp.UpAxis);

                GUILayout.Space(5f);

                //influence
                cp.Influence = EUtil.ProgressBar(cp.Influence, 0, 1f, "Influence: {0:F2}");
            }
            EUtil.PopGUIEnable();

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(cp); //so ConstraintStack.Update can be called in edit-mode
            }
        }
Ejemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            FollowPath cp = (FollowPath)target;

            EditorGUI.BeginChangeCheck();

            EConUtil.DrawActiveLine(cp);

            //constraint target
            cp.Spline = (BaseSplineBehaviour)EditorGUILayout.ObjectField("Target Spline", cp.Spline, typeof(BaseSplineBehaviour), true);

            EUtil.DrawSplitter();

            EUtil.PushGUIEnable(cp.IsActiveConstraint && cp.Spline);
            {
                EUtil.PushLabelWidth(100f);
                cp.Offset = EditorGUILayout.Slider(new GUIContent("Offset", "t parameter for the spline"), cp.Offset, 0, 1f);

                //axis and offset
                cp.FollowCurve = EditorGUILayout.Toggle(new GUIContent("Follow Curve", "owner's rotation will follow the spline"), cp.FollowCurve);
                if (cp.FollowCurve)
                {
                    cp.ForwardDir = (EAxisD)EConUtil.DrawEnumBtns(AllAxis, AllAxisStr, cp.ForwardDir, "Forward Axis", "the axis of owner, which will be taken as the forward direction when follow the spline");
                    cp.UpDir      = (EAxisD)EConUtil.DrawEnumBtns(AllAxis, AllAxisStr, cp.UpDir, "Up Axis", "the axis of owner, which will be taken as the up direction when follow the spline");

                    cp.UpDir = ConUtil.EnsureAxisNotColinear(cp.ForwardDir, cp.UpDir);

                    GUILayout.Space(5f);
                }
                EUtil.PopLabelWidth();

                // influence
                cp.Influence = EUtil.ProgressBar(cp.Influence, 0, 1f, "Influence: {0:F2}");
            }
            EUtil.PopGUIEnable();

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(cp); //so ConstraintStack.Update can be called in edit-mode
            }
        }