public static bool ClampDistanceInspector(SerializedProperty cparam, bool changed)
        {
            EditorGUI.BeginChangeCheck();

            var use       = cparam.FindPropertyRelative("useClampDistanceRatio");
            var minRatio  = cparam.FindPropertyRelative("clampDistanceMinRatio");
            var maxRatio  = cparam.FindPropertyRelative("clampDistanceMaxRatio");
            var influence = cparam.FindPropertyRelative("clampDistanceVelocityInfluence");

            const string title = "Clamp Distance";

            StaticStringBuilder.Clear();
            StaticStringBuilder.Append("Clamp Distance", " [", minRatio.floatValue, "/", maxRatio.floatValue, "]");

            Foldout(title, StaticStringBuilder.ToString(),
                    () =>
            {
                EditorGUI.BeginDisabledGroup(!use.boolValue);

                EditorGUILayout.Slider(minRatio, 0.0f, 1.0f, "Min Distance Ratio");
                EditorGUILayout.Slider(maxRatio, 1.0f, 2.0f, "Max Distance Ratio");
                EditorGUILayout.Slider(influence, 0.0f, 1.0f, "Velocity Influence");

                EditorGUI.EndDisabledGroup();
            },
                    (sw) =>
            {
                use.boolValue = sw;
            },
                    use.boolValue,
                    changed
                    );

            return(EditorGUI.EndChangeCheck());
        }
        public static bool ExternalForceInspector(SerializedProperty cparam)
        {
            EditorGUI.BeginChangeCheck();

            var massInfluence   = cparam.FindPropertyRelative("massInfluence");
            var windInfluence   = cparam.FindPropertyRelative("windInfluence");
            var windRandomScale = cparam.FindPropertyRelative("windRandomScale");

            const string title = "External Force";

            StaticStringBuilder.Clear();
            StaticStringBuilder.Append(title);
            Foldout(title, StaticStringBuilder.ToString(),
                    () =>
            {
                EditorGUILayout.Slider(massInfluence, 0.0f, 1.0f, "Mass Influence");
                //EditorGUILayout.LabelField("Wind");
                EditorGUILayout.Space();
                EditorGUILayout.Slider(windInfluence, 0.0f, 3.0f, "Wind Influence");
                EditorGUILayout.Slider(windRandomScale, 0.0f, 2.0f, "Wind Random Scale");
            }
                    );

            return(EditorGUI.EndChangeCheck());
        }
        public static bool AdjustRotationInspector(SerializedProperty cparam, bool changed)
        {
            EditorGUI.BeginChangeCheck();

            //var useAdjustRotation = cparam.FindPropertyRelative("useAdjustRotation");
            var adjustMode          = cparam.FindPropertyRelative("adjustMode");
            var adjustRotationPower = cparam.FindPropertyRelative("adjustRotationPower");
            var enumName            = adjustMode.enumDisplayNames[adjustMode.enumValueIndex];

            const string title = "Adjust Rotation";

            StaticStringBuilder.Clear();
            StaticStringBuilder.Append(title, " [", enumName, "]");
            Foldout(title, StaticStringBuilder.ToString(),
                    () =>
            {
                EditorGUILayout.PropertyField(adjustMode);
                EditorGUI.BeginDisabledGroup(adjustMode.enumValueIndex == 0);
                EditorGUILayout.Slider(adjustRotationPower, -20.0f, 20.0f, "Adjust Rotation Power");
                EditorGUI.EndDisabledGroup();
            },
                    //(sw) =>
                    //{
                    //    useAdjustRotation.boolValue = sw;
                    //},
                    //useAdjustRotation.boolValue,
                    warning: changed
                    );

            return(EditorGUI.EndChangeCheck());
        }
        public static bool SimpleSpringInspector(SerializedProperty cparam, bool changed)
        {
            EditorGUI.BeginChangeCheck();

            var springPower = cparam.FindPropertyRelative("springPower");
            var useSpring   = cparam.FindPropertyRelative("useSpring");

            const string title = "Spring";

            StaticStringBuilder.Clear();
            StaticStringBuilder.Append(title, " [", springPower.floatValue, "]");
            Foldout(title, StaticStringBuilder.ToString(),
                    () =>
            {
                EditorGUI.BeginDisabledGroup(!useSpring.boolValue);
                EditorGUILayout.Slider(springPower, 0.0f, 0.1f, "Spring Power");
                EditorGUI.EndDisabledGroup();
            },
                    (sw) =>
            {
                useSpring.boolValue = sw;
            },
                    useSpring.boolValue,
                    changed
                    );

            return(EditorGUI.EndChangeCheck());
        }
        public override string GetInformation()
        {
            StaticStringBuilder.Clear();

            var err = VerifyData();

            if (err == Define.Error.None)
            {
                // OK
                StaticStringBuilder.AppendLine("Active: ", Status.IsActive);
                StaticStringBuilder.Append("Use Deformer Vertex: ", UseVertexCount);
            }
            else if (err == Define.Error.EmptyData)
            {
                StaticStringBuilder.Append(Define.GetErrorMessage(err));
            }
            else
            {
                // エラー
                StaticStringBuilder.AppendLine("This mesh spring is in a state error!");
                if (Application.isPlaying)
                {
                    StaticStringBuilder.AppendLine("Execution stopped.");
                }
                else
                {
                    StaticStringBuilder.AppendLine("Please recreate the mesh spring data.");
                }
                StaticStringBuilder.Append(Define.GetErrorMessage(err));
            }

            return(StaticStringBuilder.ToString());
        }
        /// <summary>
        /// データ情報
        /// </summary>
        /// <returns></returns>
        public override string GetInformation()
        {
            StaticStringBuilder.Clear();

            var err = VerifyData();

            if (err == Define.Error.None)
            {
                // OK
                StaticStringBuilder.AppendLine("Active: ", Status.IsActive);
                StaticStringBuilder.AppendLine("Skinning: ", MeshData.isSkinning);
                StaticStringBuilder.AppendLine("Vertex: ", MeshData.VertexCount);
                StaticStringBuilder.AppendLine("Triangle: ", MeshData.TriangleCount);
                StaticStringBuilder.Append("Bone: ", MeshData.BoneCount);
            }
            else
            {
                // エラー
                StaticStringBuilder.AppendLine("This mesh data is Invalid!");

                if (Application.isPlaying)
                {
                    StaticStringBuilder.AppendLine("Execution stopped.");
                }
                else
                {
                    StaticStringBuilder.AppendLine("Please create the mesh data.");
                }
                StaticStringBuilder.Append(Define.GetErrorMessage(err));
            }

            return(StaticStringBuilder.ToString());
        }
Exemple #7
0
        public static bool RestoreRotationInspector(SerializedProperty cparam)
        {
            EditorGUI.BeginChangeCheck();

            var use       = cparam.FindPropertyRelative("useRestoreRotation");
            var power     = cparam.FindPropertyRelative("restoreRotation");
            var influence = cparam.FindPropertyRelative("restoreRotationVelocityInfluence");

            const string title = "Restore Rotation";
            float        sv, ev, cv;

            GetBezierValue(power, out sv, out ev, out cv);
            StaticStringBuilder.Clear();
            StaticStringBuilder.Append("Restore Rotation", " [", sv, "/", ev, "]");

            Foldout(title, StaticStringBuilder.ToString(),
                    () =>
            {
                EditorGUI.BeginDisabledGroup(!use.boolValue);

                EditorGUILayout.LabelField("Restore Power");
                BezierInspector("Restore Power", power, 0.0f, 1.0f);
                EditorGUILayout.Slider(influence, 0.0f, 1.0f, "Velocity Influence");

                EditorGUI.EndDisabledGroup();
            },
                    (sw) =>
            {
                use.boolValue = sw;
            },
                    use.boolValue
                    );

            return(EditorGUI.EndChangeCheck());
        }
        /// <summary>
        /// データ検証の結果テキストを取得する
        /// </summary>
        /// <returns></returns>
        public override string GetInformation()
        {
            StaticStringBuilder.Clear();

            var err = VerifyData();

            if (err == Define.Error.None)
            {
                // OK
                var cdata = ClothData;
                StaticStringBuilder.AppendLine("Active: ", Status.IsActive);
                StaticStringBuilder.AppendLine("Transform: ", MeshData.VertexCount);
                StaticStringBuilder.AppendLine("Clamp Position: ", clothParams.UseClampPositionLength ? cdata.VertexUseCount : 0);
                StaticStringBuilder.AppendLine("Spring: ", clothParams.UseSpring ? cdata.VertexUseCount : 0);
                StaticStringBuilder.Append("Adjust Rotation: ", clothParams.UseAdjustRotation ? cdata.VertexUseCount : 0);
            }
            else
            {
                // エラー
                StaticStringBuilder.AppendLine("This bone spring is in a state error!");
                if (Application.isPlaying)
                {
                    StaticStringBuilder.AppendLine("Execution stopped.");
                }
                else
                {
                    StaticStringBuilder.AppendLine("Please recreate the bone spring data.");
                }
                StaticStringBuilder.Append(Define.GetErrorMessage(err));
            }

            return(StaticStringBuilder.ToString());
        }
        public static bool UseTwoSliderInspector(
            string title, SerializedProperty use,
            string name1, SerializedProperty val1, float min1, float max1,
            string name2, SerializedProperty val2, float min2, float max2
            )
        {
            EditorGUI.BeginChangeCheck();

            StaticStringBuilder.Clear();
            StaticStringBuilder.Append(title, " [", val1.floatValue, "/", val2.floatValue, "]");
            bool workuse = use.boolValue;

            Foldout(title, StaticStringBuilder.ToString(),
                    () =>
            {
                EditorGUI.BeginDisabledGroup(!workuse);
                EditorGUILayout.Slider(val1, min1, max1, name1);
                EditorGUILayout.Slider(val2, min2, max2, name2);
                EditorGUI.EndDisabledGroup();
            },
                    (sw) =>
            {
                workuse = sw;
            },
                    workuse
                    );
            use.boolValue = workuse;

            return(EditorGUI.EndChangeCheck());
        }
Exemple #10
0
        /// <summary>
        /// データ検証の結果テキストを取得する
        /// </summary>
        /// <returns></returns>
        public override string GetInformation()
        {
            StaticStringBuilder.Clear();

            var err = VerifyData();

            if (err == Define.Error.None)
            {
                // OK
                var cdata = ClothData;
                StaticStringBuilder.AppendLine("Active: ", Status.IsActive);
                StaticStringBuilder.AppendLine("Transform: ", MeshData.VertexCount);
                StaticStringBuilder.AppendLine("Line: ", MeshData.LineCount);
                StaticStringBuilder.AppendLine("Triangle: ", MeshData.TriangleCount);
                StaticStringBuilder.AppendLine("Clamp Distance: ", cdata.ClampDistanceConstraintCount);
                StaticStringBuilder.AppendLine("Clamp Position: ", clothParams.UseClampPositionLength ? cdata.VertexUseCount : 0);
                StaticStringBuilder.AppendLine("Clamp Rotation: ", cdata.ClampRotationConstraintRootCount, " - ", cdata.ClampRotationConstraintDataCount);
                StaticStringBuilder.AppendLine("Struct Distance: ", cdata.StructDistanceConstraintCount / 2);
                StaticStringBuilder.AppendLine("Bend Distance: ", cdata.BendDistanceConstraintCount / 2);
                StaticStringBuilder.AppendLine("Near Distance: ", cdata.NearDistanceConstraintCount / 2);
                StaticStringBuilder.AppendLine("Restore Rotation: ", cdata.RestoreRotationConstraintCount);
                StaticStringBuilder.AppendLine("Triangle Bend: ", cdata.TriangleBendConstraintCount);
                //StaticStringBuilder.AppendLine("Rotation Interpolation: ", "<Line:", cdata.LineRotationWorkerCount > 0 ? "ON" : "OFF", "> <Triangle:", cdata.TriangleRotationWorkerCount > 0 ? "ON" : "OFF", ">");
                StaticStringBuilder.Append("Rotation Interpolation: ");
                if (cdata.LineRotationWorkerCount > 0)
                {
                    StaticStringBuilder.Append("Line ");
                }
                if (cdata.TriangleRotationWorkerCount > 0)
                {
                    StaticStringBuilder.Append("Triangle ");
                }
                StaticStringBuilder.AppendLine();
                StaticStringBuilder.Append("Collider: ", teamData.ColliderCount);
            }
            else if (err == Define.Error.EmptyData)
            {
                StaticStringBuilder.Append(Define.GetErrorMessage(err));
            }
            else
            {
                // エラー
                StaticStringBuilder.AppendLine("This bone cloth is in a state error!");
                if (Application.isPlaying)
                {
                    StaticStringBuilder.AppendLine("Execution stopped.");
                }
                else
                {
                    StaticStringBuilder.AppendLine("Please recreate the bone cloth data.");
                }
                StaticStringBuilder.Append(Define.GetErrorMessage(err));
            }

            return(StaticStringBuilder.ToString());
        }
Exemple #11
0
        //===============================================================================
        public static bool WorldInfluenceInspector(SerializedProperty cparam, bool changed)
        {
            EditorGUI.BeginChangeCheck();

            var influenceTarget = cparam.FindPropertyRelative("influenceTarget");
            var moveInfluence   = cparam.FindPropertyRelative("worldMoveInfluence");
            var rotInfluence    = cparam.FindPropertyRelative("worldRotationInfluence");
            var maxSpeed        = cparam.FindPropertyRelative("maxMoveSpeed");

            var useTeleport      = cparam.FindPropertyRelative("useResetTeleport");
            var teleportDistance = cparam.FindPropertyRelative("teleportDistance");
            var teleportRotation = cparam.FindPropertyRelative("teleportRotation");
            var teleportMode     = cparam.FindPropertyRelative("teleportMode");

            var stabilizationTime = cparam.FindPropertyRelative("resetStabilizationTime");

            //float sv, ev, cv;
            //GetBezierValue(worldInfluence, out sv, out ev, out cv);

            const string title = "World Influence";

            StaticStringBuilder.Clear();
            StaticStringBuilder.Append(title);
            //StaticStringBuilder.Append(title, " [", sv, "/", ev, "]");
            Foldout(title, StaticStringBuilder.ToString(),
                    () =>
            {
                EditorGUILayout.PropertyField(influenceTarget);
                EditorGUILayout.Slider(maxSpeed, 0.0f, 30.0f, "Max Move Speed");
                EditorGUILayout.LabelField("Movement Influence");
                BezierInspector("Move Influence", moveInfluence, 0.0f, 1.0f);
                EditorGUILayout.LabelField("Rotation Influence");
                BezierInspector("Rotation Influence", rotInfluence, 0.0f, 1.0f);

                useTeleport.boolValue = EditorGUILayout.Toggle("Reset After Teleport", useTeleport.boolValue);

                EditorGUI.BeginDisabledGroup(!useTeleport.boolValue);
                EditorGUILayout.PropertyField(teleportMode);
                EditorGUILayout.Slider(teleportDistance, 0.0f, 1.0f, "Teleport Distance");
                EditorGUILayout.Slider(teleportRotation, 0.0f, 180.0f, "Teleport Rotation");
                EditorGUI.EndDisabledGroup();

                EditorGUILayout.Space();
                //EditorGUILayout.LabelField("Stabilize After Reset");
                //EditorGUILayout.Slider(stabilizationTime, 0.0f, 3.0f, "Stabilization Time");
                EditorGUILayout.Slider(stabilizationTime, 0.0f, 1.0f, "Stabilization Time After Reset");
            },
                    warning: changed
                    );

            return(EditorGUI.EndChangeCheck());
        }
Exemple #12
0
        public static bool GravityInspector(SerializedProperty cparam)
        {
            //return UseMinMaxCurveInspector("Gravity", cparam.FindPropertyRelative("useGravity"), "Gravity Acceleration", cparam.FindPropertyRelative("gravity"), -20.0f, 0.0f);

            EditorGUI.BeginChangeCheck();

            var useGravity       = cparam.FindPropertyRelative("useGravity");
            var gravity          = cparam.FindPropertyRelative("gravity");
            var gravityDirection = cparam.FindPropertyRelative("gravityDirection");
            //var useDirectional = cparam.FindPropertyRelative("useDirectionalDamping");
            //var refObject = cparam.FindPropertyRelative("directionalDampingObject");
            //var directionaDamping = cparam.FindPropertyRelative("directionalDamping");

            float sv, ev, cv;

            GetBezierValue(gravity, out sv, out ev, out cv);

            StaticStringBuilder.Clear();
            StaticStringBuilder.Append("Gravity", " [", sv, "/", ev, "]");

            bool wuse = useGravity.boolValue;

            Foldout("Gravity", StaticStringBuilder.ToString(),
                    () =>
            {
                EditorGUI.BeginDisabledGroup(!wuse);
                EditorGUILayout.LabelField("Gravity Acceleration");
                BezierInspector("Gravity", gravity, -10.0f, 0.0f, "F2");
                EditorGUILayout.PropertyField(gravityDirection, true);

                //useDirectional.boolValue = EditorGUILayout.Toggle("Directional Damping", useDirectional.boolValue);
                //refObject.objectReferenceValue = EditorGUILayout.ObjectField("Reference Object", refObject.objectReferenceValue, typeof(Transform), true);
                //EditorGUILayout.LabelField("Angular Damping");
                //EditorGUILayout.HelpBox("The horizontal axis is the angle 0-90-180.", MessageType.None);
                //BezierInspector("Angular Damping", directionaDamping, 0.0f, 1.0f, "F2");

                EditorGUI.EndDisabledGroup();
            },
                    (sw) =>
            {
                wuse = sw;
            },
                    wuse
                    );
            useGravity.boolValue = wuse;

            return(EditorGUI.EndChangeCheck());
        }
        public override string GetInformation()
        {
            StaticStringBuilder.Clear();

            if (Application.isPlaying)
            {
                // 実行中
                if (Runtime.AvatarPartsCount > 0)
                {
                    StaticStringBuilder.Append("Connection avatar parts:");
                    int cnt = Runtime.AvatarPartsCount;
                    for (int i = 0; i < cnt; i++)
                    {
                        StaticStringBuilder.AppendLine();
                        StaticStringBuilder.Append("    [", Runtime.GetAvatarParts(i).name, "]");
                    }
                }
                else
                {
                    StaticStringBuilder.Append("No avatar parts connected.");
                }
            }
            else
            {
                // エディット中
                // 重複トランスフォームチェック
                var olist = Runtime.CheckOverlappingTransform();
                if (olist.Count > 0)
                {
                    StaticStringBuilder.Append("There are duplicate game object names.");
                    foreach (var t in olist)
                    {
                        StaticStringBuilder.AppendLine();
                        StaticStringBuilder.Append("* ", t.name);
                    }
                }
                else
                {
                    StaticStringBuilder.Append("No problem.");
                }

                StaticStringBuilder.AppendLine();
                StaticStringBuilder.Append("Collider : ", Runtime.GetColliderCount());
            }

            return(StaticStringBuilder.ToString());
        }
        public static bool OneSliderInspector(
            string title,
            string name1, SerializedProperty property1, float min1, float max1
            )
        {
            EditorGUI.BeginChangeCheck();

            StaticStringBuilder.Clear();
            StaticStringBuilder.Append(title, " [", property1.floatValue, "]");
            Foldout(title, StaticStringBuilder.ToString(),
                    () =>
            {
                EditorGUILayout.Slider(property1, min1, max1, name1);
            }
                    );

            return(EditorGUI.EndChangeCheck());
        }
        public static bool ClampPositionInspector(SerializedProperty cparam, bool full, bool changed)
        {
            EditorGUI.BeginChangeCheck();

            var clampPositionLength    = cparam.FindPropertyRelative("clampPositionLength");
            var useClampPositionLength = cparam.FindPropertyRelative("useClampPositionLength");
            var clampPositionRatioX    = cparam.FindPropertyRelative("clampPositionRatioX");
            var clampPositionRatioY    = cparam.FindPropertyRelative("clampPositionRatioY");
            var clampPositionRatioZ    = cparam.FindPropertyRelative("clampPositionRatioZ");
            var influence = cparam.FindPropertyRelative("clampPositionVelocityInfluence");

            float sv, ev, cv;

            GetBezierValue(clampPositionLength, out sv, out ev, out cv);

            const string title = "Clamp Position";

            StaticStringBuilder.Clear();
            StaticStringBuilder.Append(title, " [", sv, "/", ev, "]");
            Foldout(title, StaticStringBuilder.ToString(),
                    () =>
            {
                EditorGUI.BeginDisabledGroup(!useClampPositionLength.boolValue);
                EditorGUILayout.LabelField("Clamp Position Length");
                BezierInspector("Clamp Position Length", clampPositionLength, 0.0f, 1.0f);
                if (full)
                {
                    EditorGUILayout.Slider(clampPositionRatioX, 0.0f, 1.0f, "Clamp Position Ratio X");
                    EditorGUILayout.Slider(clampPositionRatioY, 0.0f, 1.0f, "Clamp Position Ratio Y");
                    EditorGUILayout.Slider(clampPositionRatioZ, 0.0f, 1.0f, "Clamp Position Ratio Z");
                }
                EditorGUILayout.Slider(influence, 0.0f, 1.0f, "Velocity Influence");
                EditorGUI.EndDisabledGroup();
            },
                    (sw) =>
            {
                useClampPositionLength.boolValue = sw;
            },
                    useClampPositionLength.boolValue,
                    changed
                    );

            return(EditorGUI.EndChangeCheck());
        }
        public static bool FullSpringInspector(SerializedProperty cparam, bool changed)
        {
            EditorGUI.BeginChangeCheck();

            var springPower          = cparam.FindPropertyRelative("springPower");
            var useSpring            = cparam.FindPropertyRelative("useSpring");
            var springRadius         = cparam.FindPropertyRelative("springRadius");
            var springScaleX         = cparam.FindPropertyRelative("springScaleX");
            var springScaleY         = cparam.FindPropertyRelative("springScaleY");
            var springScaleZ         = cparam.FindPropertyRelative("springScaleZ");
            var springDirectionAtten = cparam.FindPropertyRelative("springDirectionAtten");
            var springDistanceAtten  = cparam.FindPropertyRelative("springDistanceAtten");
            var springIntensity      = cparam.FindPropertyRelative("springIntensity");

            const string title = "Spring";

            StaticStringBuilder.Clear();
            StaticStringBuilder.Append(title, " [", springPower.floatValue, "]");
            Foldout(title, StaticStringBuilder.ToString(),
                    () =>
            {
                EditorGUI.BeginDisabledGroup(!useSpring.boolValue);
                EditorGUILayout.Slider(springRadius, 0.01f, 0.5f, "Spring Radius");
                EditorGUILayout.Slider(springScaleX, 0.01f, 1.0f, "Spring Radius Scale X");
                EditorGUILayout.Slider(springScaleY, 0.01f, 1.0f, "Spring Radius Scale Y");
                EditorGUILayout.Slider(springScaleZ, 0.01f, 1.0f, "Spring Radius Scale Z");
                EditorGUILayout.Slider(springPower, 0.0f, 0.1f, "Spring Power");
                EditorGUILayout.LabelField("Spring Direction Atten");
                BezierInspector("Spring Direction Atten", springDirectionAtten, 0.0f, 1.0f);
                EditorGUILayout.LabelField("Spring Distance Atten");
                BezierInspector("Spring Distance Atten", springDistanceAtten, 0.0f, 1.0f);
                EditorGUILayout.Slider(springIntensity, 0.1f, 3.0f, "Spring Atten Intensity");
                EditorGUI.EndDisabledGroup();
            },
                    (sw) =>
            {
                useSpring.boolValue = sw;
            },
                    useSpring.boolValue,
                    changed
                    );

            return(EditorGUI.EndChangeCheck());
        }
        static bool UseMinMaxCurveInspector(
            string title,
            SerializedProperty use,
            string valueName,
            SerializedProperty bval, float minval, float maxval,
            string valFmt = "F2",
            bool warning  = false
            )
        {
            EditorGUI.BeginChangeCheck();

            float sv, ev, cv;

            GetBezierValue(bval, out sv, out ev, out cv);

            StaticStringBuilder.Clear();
            StaticStringBuilder.Append(title, " [", sv, "/", ev, "]");

            bool wuse = use.boolValue;

            Foldout(title, StaticStringBuilder.ToString(),
                    () =>
            {
                if (string.IsNullOrEmpty(valueName) == false)
                {
                    EditorGUILayout.LabelField(valueName);
                }
                EditorGUI.BeginDisabledGroup(!wuse);
                BezierInspector(title, bval, minval, maxval, valFmt);
                EditorGUI.EndDisabledGroup();
            },
                    (sw) =>
            {
                wuse = sw;
            },
                    wuse,
                    warning
                    );
            use.boolValue = wuse;

            return(EditorGUI.EndChangeCheck());
        }
Exemple #18
0
        public string GetInformation()
        {
            StaticStringBuilder.Clear();

            if (Application.isPlaying)
            {
                // 実行中
                if (ParentAvatar)
                {
                    StaticStringBuilder.Append("Connection parent avatar:");
                    StaticStringBuilder.AppendLine();
                    StaticStringBuilder.Append("    [", ParentAvatar.name, "]");
                }
                else
                {
                    StaticStringBuilder.Append("No connection.");
                }
            }
            else
            {
                // エディット中
                // 重複トランスフォームチェック
                var olist = CheckOverlappingTransform();
                if (olist.Count > 0)
                {
                    StaticStringBuilder.Append("There are duplicate game object names.");
                    foreach (var t in olist)
                    {
                        StaticStringBuilder.AppendLine();
                        StaticStringBuilder.Append("* ", t.name);
                    }
                }
                else
                {
                    StaticStringBuilder.Append("No problem.");
                }
            }

            return(StaticStringBuilder.ToString());
        }
        //===============================================================================
        static bool MinMaxCurveInspector(string title, string valueName, SerializedProperty bval, float minval, float maxval)
        {
            EditorGUI.BeginChangeCheck();

            float sv, ev, cv;

            GetBezierValue(bval, out sv, out ev, out cv);

            StaticStringBuilder.Clear();
            StaticStringBuilder.Append(title, " [", sv, "/", ev, "]");

            Foldout(title, StaticStringBuilder.ToString(), () =>
            {
                if (string.IsNullOrEmpty(valueName) == false)
                {
                    EditorGUILayout.LabelField(valueName);
                }
                BezierInspector(title, bval, minval, maxval);
            });

            return(EditorGUI.EndChangeCheck());
        }
        public static bool ClampRotationInspector(SerializedProperty cparam, bool changed)
        {
            EditorGUI.BeginChangeCheck();

            var use   = cparam.FindPropertyRelative("useClampRotation");
            var angle = cparam.FindPropertyRelative("clampRotationAngle");
            //var stiffness = cparam.FindPropertyRelative("clampRotationStiffness");
            var influence = cparam.FindPropertyRelative("clampRotationVelocityInfluence");

            const string title = "Clamp Rotation";
            float        sv, ev, cv;

            GetBezierValue(angle, out sv, out ev, out cv);
            StaticStringBuilder.Clear();
            StaticStringBuilder.Append("Clamp Rotation", " [", sv, "/", ev, "]");

            Foldout(title, StaticStringBuilder.ToString(),
                    () =>
            {
                EditorGUI.BeginDisabledGroup(!use.boolValue);

                EditorGUILayout.LabelField("Clamp Angle");
                BezierInspector("Angle", angle, 0.0f, 180.0f);
                //EditorGUILayout.LabelField("Stiffness");
                //BezierInspector("Stiffness", stiffness, 0.0f, 1.0f);
                EditorGUILayout.Slider(influence, 0.0f, 1.0f, "Velocity Influence");

                EditorGUI.EndDisabledGroup();
            },
                    (sw) =>
            {
                use.boolValue = sw;
            },
                    use.boolValue,
                    changed
                    );

            return(EditorGUI.EndChangeCheck());
        }
        public static bool DistanceDisableInspector(SerializedProperty cparam, bool changed)
        {
            EditorGUI.BeginChangeCheck();

            var use             = cparam.FindPropertyRelative("useDistanceDisable");
            var referenceObject = cparam.FindPropertyRelative("disableReferenceObject");
            var disableDisance  = cparam.FindPropertyRelative("disableDistance");
            var fadeDistance    = cparam.FindPropertyRelative("disableFadeDistance");

            const string title = "Distance Disable";

            StaticStringBuilder.Clear();
            StaticStringBuilder.Append(title);
            Foldout(title, StaticStringBuilder.ToString(),
                    () =>
            {
                EditorGUI.BeginDisabledGroup(!use.boolValue);

                EditorGUILayout.HelpBox("If Reference Object is [None], the main camera is referred.", MessageType.None);

                //EditorGUILayout.PropertyField(referenceObject);
                referenceObject.objectReferenceValue = EditorGUILayout.ObjectField("Reference Object", referenceObject.objectReferenceValue, typeof(Transform), true);
                EditorGUILayout.Slider(disableDisance, 0.0f, 100.0f, "Distance");
                EditorGUILayout.Slider(fadeDistance, 0.0f, 10.0f, "Fade Distance");

                EditorGUI.EndDisabledGroup();
            },
                    (sw) =>
            {
                use.boolValue = sw;
            },
                    use.boolValue,
                    changed
                    );

            return(EditorGUI.EndChangeCheck());
        }
Exemple #22
0
        void Information()
        {
            StaticStringBuilder.Clear();

            int teamCnt       = 0;
            int activeTeamCnt = 0;

            int sharedVirtualMeshCnt = 0;
            int virtualMeshCnt       = 0;
            int sharedChildMeshCnt   = 0;
            int sharedRenderMeshCnt  = 0;
            int renderMeshCnt        = 0;

            int virtualMeshVertexCnt   = 0;
            int virtualMeshTriangleCnt = 0;
            int renderMeshVertexCnt    = 0;

            int virtualMeshUseCnt       = 0;
            int virtualMeshVertexUseCnt = 0;
            int renderMeshUseCnt        = 0;
            int renderMeshVertexUseCnt  = 0;

            int particleCnt    = 0;
            int colliderCnt    = 0;
            int restoreBoneCnt = 0;
            int readBoneCnt    = 0;
            int writeBoneCnt   = 0;

            if (EditorApplication.isPlaying && MagicaPhysicsManager.IsInstance())
            {
                var manager = MagicaPhysicsManager.Instance;
                teamCnt       = manager.Team.TeamCount;
                activeTeamCnt = manager.Team.ActiveTeamCount;

                sharedVirtualMeshCnt = manager.Mesh.SharedVirtualMeshCount;
                virtualMeshCnt       = manager.Mesh.VirtualMeshCount;
                sharedChildMeshCnt   = manager.Mesh.SharedChildMeshCount;
                sharedRenderMeshCnt  = manager.Mesh.SharedRenderMeshCount;
                renderMeshCnt        = manager.Mesh.RenderMeshCount;

                virtualMeshVertexCnt   = manager.Mesh.VirtualMeshVertexCount;
                virtualMeshTriangleCnt = manager.Mesh.VirtualMeshTriangleCount;
                renderMeshVertexCnt    = manager.Mesh.RenderMeshVertexCount;

                virtualMeshUseCnt       = manager.Mesh.VirtualMeshUseCount;
                virtualMeshVertexUseCnt = manager.Mesh.VirtualMeshVertexUseCount;
                renderMeshUseCnt        = manager.Mesh.RenderMeshUseCount;
                renderMeshVertexUseCnt  = manager.Mesh.RenderMeshVertexUseCount;

                particleCnt    = manager.Particle.Count;
                colliderCnt    = manager.Particle.ColliderCount;
                restoreBoneCnt = manager.Bone.RestoreBoneCount;
                readBoneCnt    = manager.Bone.ReadBoneCount;
                writeBoneCnt   = manager.Bone.WriteBoneCount;
            }

            StaticStringBuilder.AppendLine("Cloth Team: ", teamCnt);
            StaticStringBuilder.AppendLine("Active Cloth Team: ", activeTeamCnt);
            StaticStringBuilder.AppendLine();

            StaticStringBuilder.AppendLine("Shared Virtual Mesh: ", sharedVirtualMeshCnt);
            StaticStringBuilder.AppendLine("Virtual Mesh: ", virtualMeshCnt);
            StaticStringBuilder.AppendLine("Shared Child Mesh: ", sharedChildMeshCnt);
            StaticStringBuilder.AppendLine("Shared Render Mesh: ", sharedRenderMeshCnt);
            StaticStringBuilder.AppendLine("Render Mesh: ", renderMeshCnt);
            StaticStringBuilder.AppendLine();

            StaticStringBuilder.AppendLine("Virtual Mesh Vertex: ", virtualMeshVertexCnt);
            StaticStringBuilder.AppendLine("Virtual Mesh Triangle: ", virtualMeshTriangleCnt);
            StaticStringBuilder.AppendLine("Render Mesh Vertex: ", renderMeshVertexCnt);
            StaticStringBuilder.AppendLine();

            StaticStringBuilder.AppendLine("Virtual Mesh Used: ", virtualMeshUseCnt);
            StaticStringBuilder.AppendLine("Virtual Mesh Vertex Used: ", virtualMeshVertexUseCnt);
            StaticStringBuilder.AppendLine("Render Mesh Used: ", renderMeshUseCnt);
            StaticStringBuilder.AppendLine("Render Mesh Vertex Used: ", renderMeshVertexUseCnt);
            StaticStringBuilder.AppendLine();

            StaticStringBuilder.AppendLine("Particle: ", particleCnt);
            StaticStringBuilder.AppendLine("Collider: ", colliderCnt);
            StaticStringBuilder.AppendLine("Restore Transform: ", restoreBoneCnt);
            StaticStringBuilder.AppendLine("Read Transform: ", readBoneCnt);
            StaticStringBuilder.Append("Write Transform: ", writeBoneCnt);

            EditorGUILayout.HelpBox(StaticStringBuilder.ToString(), MessageType.Info);
        }