コード例 #1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorHelpers.DrawLogoAndVersion();

            if (bSoftBodyTarget is BSoftBodyWMesh)
            {
                DrawCustomMeshSettingsOptions();
            }

            DrawPropertiesExcluding(serializedObject, hideMe); //Draw settings after the default inspector

            if (target is BSoftBodyPartOnSkinnedMesh)
            {
                BSoftBodyPartOnSkinnedMesh sb = (BSoftBodyPartOnSkinnedMesh)target;
                if (EditorHelpers.InspectorButton("Bind Bones To Soft Body & Nodes To Anchors", 300, 15, GUIBlue))
                {
                    sb.BindBonesToSoftBodyAndNodesToAnchors();
                }
                EditorGUILayout.HelpBox(sb.DescribeBonesAndAnchors(), MessageType.Info);
                if (sb.SoftBodySettings.sBpresetSelect != SBSettingsPresets.ShapeMatching)
                {
                    EditorGUILayout.HelpBox("For a soft body mesh the preset should probably be 'shape matching' or 'Volume'", MessageType.Warning);
                }
            }

            EditorGUILayout.BeginHorizontal();
            if (EditorHelpers.InspectorButton("Apply Preset", 100, 15, GUIBlue))
            {
                //SBSettingsPresets saveMe = bSoftBodyTarget.SoftBodySettings.sBpresetSelect;
                bSoftBodyTarget.SoftBodySettings.ResetToSoftBodyPresets(bSoftBodyTarget.SoftBodySettings.sBpresetSelect);
                //bSoftBodyTarget.SoftBodySettings.sBpresetSelect = saveMe;
            }

            bSoftBodyTarget.SoftBodySettings.sBpresetSelect = (SBSettingsPresets)EditorGUILayout.EnumPopup(bSoftBodyTarget.SoftBodySettings.sBpresetSelect);

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            //bitmask field for collisions
            bSoftBodyTarget.SoftBodySettings.config.Collisions = (BulletSharp.SoftBody.CollisionFlags)EditorGUILayout.EnumMaskField(gcCollisionTooltip, bSoftBodyTarget.SoftBodySettings.config.Collisions);

            EditorGUILayout.PropertyField(softBodySettings, gcSoftBodySettings, true);

            serializedObject.ApplyModifiedProperties();

            if (GUI.changed) //Can apply settings on editor change
            {
                bSoftBodyTarget.BuildSoftBody();
            }

            serializedObject.ApplyModifiedProperties();
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            //Color GUIBlue = new Color32(82, 140, 255, 255);

            EditorHelpers.DrawLogoAndVersion();

            //BSoftBody sb = (BSoftBody)target;
            //sb.m_collisionFlags = BCollisionObjectEditor.RenderEnumMaskCollisionFlagsField(BCollisionObjectEditor.gcCollisionFlags, sb.m_collisionFlags);
            //sb.m_groupsIBelongTo = BCollisionObjectEditor.RenderEnumMaskCollisionFilterGroupsField(BCollisionObjectEditor.gcGroupsIBelongTo, sb.m_groupsIBelongTo);
            //sb.m_collisionMask = BCollisionObjectEditor.RenderEnumMaskCollisionFilterGroupsField(BCollisionObjectEditor.gcCollisionMask, sb.m_collisionMask);

            if (bSoftBodyTarget is BSoftBodyWMesh)
            {
                DrawCustomMeshSettingsOptions();
            }

            DrawPropertiesExcluding(serializedObject, hideMe); //Draw settings after the default inspector
            //DrawDefaultInspector();//Items custom to this type of SoftBody

            EditorGUILayout.BeginHorizontal();
            if (EditorHelpers.InspectorButton("Apply Preset", 100, 15, GUIBlue))
            {
                //SBSettingsPresets saveMe = bSoftBodyTarget.SoftBodySettings.sBpresetSelect;
                bSoftBodyTarget.SoftBodySettings.ResetToSoftBodyPresets(bSoftBodyTarget.SoftBodySettings.sBpresetSelect);
                //bSoftBodyTarget.SoftBodySettings.sBpresetSelect = saveMe;
            }

            bSoftBodyTarget.SoftBodySettings.sBpresetSelect = (SBSettingsPresets)EditorGUILayout.EnumPopup(bSoftBodyTarget.SoftBodySettings.sBpresetSelect);

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            //bitmask field for collisions
            bSoftBodyTarget.SoftBodySettings.config.Collisions = (BulletSharp.SoftBody.CollisionFlags)EditorGUILayout.EnumMaskField(gcCollisionTooltip, bSoftBodyTarget.SoftBodySettings.config.Collisions);

            EditorGUILayout.PropertyField(softBodySettings, gcSoftBodySettings, true);

            serializedObject.ApplyModifiedProperties();

            if (GUI.changed) //Can apply settings on editor change
            {
                bSoftBodyTarget.BuildSoftBody();
            }
        }
コード例 #3
0
 public bool AddSoftBody(BSoftBody softBody)
 {
     if (!(World is BulletSharp.SoftBody.SoftRigidDynamicsWorld))
     {
         Debug.LogError("The Physics World must be a BSoftBodyWorld for adding soft bodies");
         return(false);
     }
     if (!_isDisposed)
     {
         Debug.LogFormat("Adding softbody {0} to world", softBody);
         if (softBody.BuildSoftBody())
         {
             ((BulletSharp.SoftBody.SoftRigidDynamicsWorld)World).AddSoftBody(softBody.GetSoftBody());
         }
         return(true);
     }
     return(false);
 }
コード例 #4
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            //Color GUIBlue = new Color32(82, 140, 255, 255);

            EditorHelpers.DrawLogoAndVersion();

            if (bSoftBodyTarget is BSoftBodyWMesh)
            {
                DrawCustomMeshSettingsOptions();
            }

            //DrawPropertiesExcluding(serializedObject, hideMe); //Draw settings after the default inspector

            EditorGUILayout.LabelField("Collision", EditorStyles.boldLabel);

            //bSoftBodyTarget.tickPriority = (byte)EditorGUILayout.IntField("Tick Priority", bSoftBodyTarget.tickPriority);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Collision Shape");
            bSoftBodyTarget.collisionShape = (BCollisionShape)EditorGUILayout.ObjectField(bSoftBodyTarget.collisionShape, typeof(BCollisionShape), true);
            EditorGUILayout.EndHorizontal();

            bSoftBodyTarget.collisionFlags  = BCollisionObjectEditor.RenderEnumMaskCollisionFlagsField(BCollisionObjectEditor.gcCollisionFlags, bSoftBodyTarget.collisionFlags);
            bSoftBodyTarget.groupsIBelongTo = BCollisionObjectEditor.RenderEnumMaskCollisionFilterGroupsField(BCollisionObjectEditor.gcGroupsIBelongTo, bSoftBodyTarget.groupsIBelongTo);
            bSoftBodyTarget.collisionMask   = BCollisionObjectEditor.RenderEnumMaskCollisionFilterGroupsField(BCollisionObjectEditor.gcCollisionMask, bSoftBodyTarget.collisionMask);

            //bSoftBodyTarget.activationState = (BulletSharp.ActivationState)EditorGUILayout.EnumPopup(BCollisionObjectEditor.gcActivationState, bSoftBodyTarget.activationState);

            EditorGUILayout.Separator();

            if (target is BSoftBodyPartOnSkinnedMesh)
            {
                BSoftBodyPartOnSkinnedMesh sb = (BSoftBodyPartOnSkinnedMesh)target;
                if (EditorHelpers.InspectorButton("Bind Bones To Soft Body & Nodes To Anchors", 300, 15, GUIBlue))
                {
                    sb.BindBonesToSoftBodyAndNodesToAnchors();
                }
                EditorGUILayout.HelpBox(sb.DescribeBonesAndAnchors(), MessageType.Info);
                if (sb.SoftBodySettings.sBpresetSelect != SBSettingsPresets.ShapeMatching)
                {
                    EditorGUILayout.HelpBox("For a soft body mesh the preset should probably be 'shape matching' or 'Volume'", MessageType.Warning);
                }
            }

            EditorGUILayout.BeginHorizontal();
            if (EditorHelpers.InspectorButton("Apply Preset", 100, 15, GUIBlue))
            {
                //SBSettingsPresets saveMe = bSoftBodyTarget.SoftBodySettings.sBpresetSelect;
                bSoftBodyTarget.SoftBodySettings.ResetToSoftBodyPresets(bSoftBodyTarget.SoftBodySettings.sBpresetSelect);
                //bSoftBodyTarget.SoftBodySettings.sBpresetSelect = saveMe;
            }

            bSoftBodyTarget.SoftBodySettings.sBpresetSelect = (SBSettingsPresets)EditorGUILayout.EnumPopup(bSoftBodyTarget.SoftBodySettings.sBpresetSelect);

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            //bitmask field for collisions
            bSoftBodyTarget.SoftBodySettings.config.Collisions =
                (BulletSharp.SoftBody.CollisionFlags)EditorGUILayout.EnumFlagsField(gcCollisionTooltip, bSoftBodyTarget.SoftBodySettings.config.Collisions);

            EditorGUILayout.PropertyField(softBodySettings, gcSoftBodySettings, true);

            serializedObject.ApplyModifiedProperties();

            if (GUI.changed)             //Can apply settings on editor change
            {
                bSoftBodyTarget.BuildSoftBody();
            }

            serializedObject.ApplyModifiedProperties();
        }
コード例 #5
0
 public bool AddSoftBody(BSoftBody softBody)
 {
     if (!(World is BulletSharp.SoftBody.SoftRigidDynamicsWorld)) {
         Debug.LogError("The Physics World must be a BSoftBodyWorld for adding soft bodies");
         return false;
     }
     if (!_isDisposed) {
         Debug.LogFormat("Adding softbody {0} to world", softBody);
         if (softBody.BuildSoftBody()) {
             ((BulletSharp.SoftBody.SoftRigidDynamicsWorld)World).AddSoftBody(softBody.GetSoftBody());
         }
         return true;
     }
     return false;
 }