public override void OnInspectorGUI() { serializedObject.UpdateIfRequiredOrScript(); int oldMaxParticles = solver.maxParticles; if (solver.allocatedParticles != null) { EditorGUILayout.HelpBox("Used particles:" + solver.allocatedParticles.Count, MessageType.Info); } Editor.DrawPropertiesExcluding(serializedObject, "m_Script"); constraintOrderList.DoLayoutList(); // Apply changes to the serializedProperty if (GUI.changed) { serializedObject.ApplyModifiedProperties(); if (oldMaxParticles != solver.maxParticles) { solver.Initialize(); } solver.UpdateParameters(); } }
public override void OnInspectorGUI() { serializedObject.UpdateIfDirtyOrScript(); int oldMaxParticles = solver.maxParticles; Editor.DrawPropertiesExcluding(serializedObject, "m_Script"); // Apply changes to the serializedProperty if (GUI.changed) { serializedObject.ApplyModifiedProperties(); if (oldMaxParticles != solver.maxParticles) { solver.Initialize(); } solver.UpdateParameters(); } }
public void OnEnable() { solver = (ObiSolver)target; constraintOrderList = new ReorderableList(serializedObject, serializedObject.FindProperty("constraintsOrder"), true, true, false, false); constraintOrderList.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "Constraint enforce order"); }; constraintOrderList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { int element = constraintOrderList.serializedProperty.GetArrayElementAtIndex(index).intValue; EditorGUI.LabelField(new Rect(rect.x, rect.y + 2, rect.width, EditorGUIUtility.singleLineHeight), ((Oni.ConstraintType)element).ToString()); }; constraintOrderList.onReorderCallback = (ReorderableList l) => { solver.UpdateParameters(); }; }
public override void OnInspectorGUI() { serializedObject.UpdateIfRequiredOrScript(); EditorGUILayout.HelpBox("Used particles:" + solver.AllocParticleCount, MessageType.Info); EditorGUILayout.PropertyField(simulateWhenInvisible); EditorGUILayout.PropertyField(parameters); EditorGUILayout.PropertyField(worldLinearInertiaScale); EditorGUILayout.PropertyField(worldAngularInertiaScale); constraintsFoldout = EditorGUILayout.Foldout(constraintsFoldout, "Constraints"); if (constraintsFoldout) { EditorGUILayout.PropertyField(distanceConstraintParameters); EditorGUILayout.PropertyField(bendingConstraintParameters); EditorGUILayout.PropertyField(particleCollisionConstraintParameters); EditorGUILayout.PropertyField(particleFrictionConstraintParameters); EditorGUILayout.PropertyField(collisionConstraintParameters); EditorGUILayout.PropertyField(frictionConstraintParameters); EditorGUILayout.PropertyField(skinConstraintParameters); EditorGUILayout.PropertyField(volumeConstraintParameters); EditorGUILayout.PropertyField(shapeMatchingConstraintParameters); EditorGUILayout.PropertyField(tetherConstraintParameters); EditorGUILayout.PropertyField(pinConstraintParameters); EditorGUILayout.PropertyField(stitchConstraintParameters); EditorGUILayout.PropertyField(densityConstraintParameters); EditorGUILayout.PropertyField(stretchShearConstraintParameters); EditorGUILayout.PropertyField(bendTwistConstraintParameters); EditorGUILayout.PropertyField(chainConstraintParameters); } // Apply changes to the serializedProperty if (GUI.changed) { serializedObject.ApplyModifiedProperties(); solver.UpdateParameters(); } }
public override void OnInspectorGUI() { serializedObject.UpdateIfRequiredOrScript(); EditorGUILayout.HelpBox("Used particles:" + solver.AllocParticleCount, MessageType.None); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(backend); #if !(OBI_BURST && OBI_MATHEMATICS && OBI_COLLECTIONS) if (backend.enumValueIndex == (int)ObiSolver.BackendType.Burst) { EditorGUILayout.HelpBox("The Burst backend depends on the following packages: Mathematics, Collections and Burst. The default backend (Oni) will be used instead, if possible.", MessageType.Warning); } #endif #if !(OBI_ONI_SUPPORTED) if (backend.enumValueIndex == (int)ObiSolver.BackendType.Oni) { EditorGUILayout.HelpBox("The Oni backend is not compatible with the target platform. Please switch to a compatible platform, or use the Burst backend instead.", MessageType.Warning); } #endif if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); foreach (var t in targets) { (t as ObiSolver).UpdateBackend(); } } EditorGUILayout.PropertyField(parameters); EditorGUILayout.PropertyField(worldLinearInertiaScale); EditorGUILayout.PropertyField(worldAngularInertiaScale); EditorGUILayout.PropertyField(simulateWhenInvisible); constraintsFoldout = EditorGUILayout.Foldout(constraintsFoldout, "Constraints"); if (constraintsFoldout) { EditorGUILayout.PropertyField(distanceConstraintParameters); EditorGUILayout.PropertyField(bendingConstraintParameters); EditorGUILayout.PropertyField(particleCollisionConstraintParameters); EditorGUILayout.PropertyField(particleFrictionConstraintParameters); EditorGUILayout.PropertyField(collisionConstraintParameters); EditorGUILayout.PropertyField(frictionConstraintParameters); EditorGUILayout.PropertyField(skinConstraintParameters); EditorGUILayout.PropertyField(volumeConstraintParameters); EditorGUILayout.PropertyField(shapeMatchingConstraintParameters); EditorGUILayout.PropertyField(tetherConstraintParameters); EditorGUILayout.PropertyField(pinConstraintParameters); EditorGUILayout.PropertyField(stitchConstraintParameters); EditorGUILayout.PropertyField(densityConstraintParameters); EditorGUILayout.PropertyField(stretchShearConstraintParameters); EditorGUILayout.PropertyField(bendTwistConstraintParameters); EditorGUILayout.PropertyField(chainConstraintParameters); } // Apply changes to the serializedProperty if (GUI.changed) { serializedObject.ApplyModifiedProperties(); solver.UpdateParameters(); } }