//---------------------------------------------------------------------------------- public override void RenderGUI(Rect area, bool isEditable) { GUILayout.BeginArea(area); RenderTitle(isEditable, true, false); EditorGUI.BeginDisabledGroup(!isEditable); RenderFieldObjects("Bodies", FieldController, true, true, CNFieldWindow.Type.extended); EditorGUILayout.Space(); EditorGUILayout.Space(); CarGUIUtils.DrawSeparator(); CarGUIUtils.Splitter(); scroller_ = EditorGUILayout.BeginScrollView(scroller_); EditorGUILayout.Space(); EditorGUILayout.Space(); DrawTimer(); EditorGUILayout.Space(); DrawSpeedRate(); DrawReleaseThreshold(); EditorGUILayout.Space(); EditorGUILayout.Space(); RenderFieldObjects("Target objects", FieldControllerAimGameObjects, true, false, CNFieldWindow.Type.normal); EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.EndScrollView(); GUILayout.EndArea(); }
//---------------------------------------------------------------------------------- public override void RenderGUI(Rect area, bool isEditable) { GUILayout.BeginArea(area); RenderTitle(isEditable, true, false); scroller_ = EditorGUILayout.BeginScrollView(scroller_); EditorGUI.BeginDisabledGroup(!isEditable); RenderFieldObjects("Bodies A", FieldControllerA, true, false, CNFieldWindow.Type.extended); RenderFieldObjects("Bodies B", FieldControllerB, true, false, CNFieldWindow.Type.extended); EditorGUILayout.Space(); CarGUIUtils.Splitter(); float originalLabelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 200f; EditorGUILayout.Space(); EditorGUILayout.Space(); RenderFieldObjects("Attentive Nodes", FieldController, true, false, CNFieldWindow.Type.extended); EditorGUILayout.Space(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); DrawTriggeringMode(); EditorGUILayout.Space(); DrawSpeedMinN(); DrawSpeedMinT(); EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUIUtility.labelWidth = originalLabelWidth; EditorGUILayout.EndScrollView(); GUILayout.EndArea(); }
public void RenderStatistics() { GUIStyle styleStats = new GUIStyle(EditorStyles.miniBoldLabel); styleStats.normal.textColor = Color.blue; EditorGUILayout.LabelField("Statistics: "); Rect rect = GUILayoutUtility.GetRect(new GUIContent("Stats: "), EditorStyles.label ); Rect testRect = new Rect(rect.xMin, rect.yMin, 110, 1); CarGUIUtils.Splitter( Color.black, testRect); uint built_nRigids_ = statistics_.built_nRigids_; uint built_nBodyMesh_ = statistics_.built_nBodyMesh_; uint built_nSoftbody_ = statistics_.built_nSoftbodies_; uint build_nCloth_ = statistics_.built_nCloth_; string nrigid = built_nRigids_.ToString(); string nirresponsive = built_nBodyMesh_.ToString(); string nsoftbody = built_nSoftbody_.ToString(); string ncloth = build_nCloth_.ToString(); string nCorpuscles = nCorpuscles_.ToString(); EditorGUILayout.LabelField("RigidBodies: ", nrigid, styleStats ); EditorGUILayout.LabelField("Irresponsive: ", nirresponsive, styleStats ); EditorGUILayout.LabelField("SoftBodies: ", nsoftbody, styleStats ); EditorGUILayout.LabelField("ClothBodies: ", ncloth, styleStats ); EditorGUILayout.LabelField("Corpuscles: ", nCorpuscles, styleStats ); EditorGUILayout.Space(); EditorGUILayout.LabelField("Joints: ", statistics_.jointGroupsInf_.nJoints_.ToString(), styleStats ); EditorGUILayout.LabelField("Servos: ", statistics_.nServos_.ToString(), styleStats ); GUILayout.FlexibleSpace(); DrawTimers( styleStats ); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); }
//---------------------------------------------------------------------------------- public override void RenderGUI(Rect area, bool isEditable) { GUILayout.BeginArea(area); RenderTitle(isEditable, true, false); EditorGUI.BeginDisabledGroup(!isEditable); RenderFieldObjects("Bodies A", FieldControllerA, true, false, CNFieldWindow.Type.extended); RenderFieldObjects("Bodies B", FieldControllerB, true, false, CNFieldWindow.Type.extended); EditorGUILayout.Space(); CarGUIUtils.Splitter(); float originalLabelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 200f; scroller_ = EditorGUILayout.BeginScrollView(scroller_); //EditorGUILayout.Space(); //DrawEmitMode(); EditorGUILayout.Space(); DrawMaxNumberOfEventsPerSecond(); EditorGUILayout.Space(); DrawRelativeSpeedMin_N(); DrawRelativeSpeedMin_T(); //EditorGUILayout.Space(); //DrawRelativeMomentumMin_N(); //DrawRelativeMomentumMin_T(); //EditorGUILayout.Space(); //DrawLifeTimeMin(); //DrawCollapseRadius(); EditorGUILayout.EndScrollView(); EditorGUIUtility.labelWidth = originalLabelWidth; GUILayout.EndArea(); }
public override void OnInspectorGUI() { Rect rect = GUILayoutUtility.GetRect(80f, 80f); GUI.DrawTexture(rect, ic_logoCaronte_, ScaleMode.ScaleToFit); CarGUIUtils.Splitter(); EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Open in CaronteFX Editor", GUILayout.Height(30f))) { CarManagerEditor editor = (CarManagerEditor)CarManagerEditor.Init(); editor.Controller.SetFxDataActive(fxData_); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.Space(); }
public override void RenderGUI(Rect area, bool isEditable) { GUILayout.BeginArea(area); RenderTitle(isEditable, true, false); EditorGUI.BeginDisabledGroup(!isEditable); RenderFieldObjects("Bodies", FieldController, true, true, CNFieldWindow.Type.extended); EditorGUILayout.Space(); EditorGUILayout.Space(); CarGUIUtils.DrawSeparator(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); EditorGUILayout.Space(); bool currentMode = EditorGUIUtility.wideMode; EditorGUIUtility.wideMode = true; DrawTimer(); EditorGUILayout.Space(); DrawIsRepulsorVsAttractor(); EditorGUILayout.Space(); DrawIsForceVsAcceleration(); DrawMagnitude(); DrawRadius(); DrawDecay(); EditorGUILayout.Space(); DrawAttractorGameObject(); EditorGUIUtility.wideMode = currentMode; EditorGUILayout.Space(); EditorGUI.EndDisabledGroup(); GUILayout.EndArea(); }
//---------------------------------------------------------------------------------- public override void RenderGUI(Rect area, bool isEditable) { GUILayout.BeginArea(area); RenderTitle(isEditable, true, false); EditorGUI.BeginDisabledGroup(!isEditable); RenderFieldObjects("Bodies", FieldController, true, true, CNFieldWindow.Type.extended); RenderFieldObjects("Locators", FieldControllerLocators, true, true, CNFieldWindow.Type.normal); EditorGUILayout.Space(); EditorGUILayout.Space(); CarGUIUtils.DrawSeparator(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); EditorGUILayout.Space(); bool currentMode = EditorGUIUtility.wideMode; EditorGUIUtility.wideMode = true; DrawTimer(); EditorGUILayout.Space(); DrawForce(); DrawSpeedLimit(); EditorGUILayout.Space(); DrawForceDeltaMax(); DrawAngleDeltaMax(); EditorGUILayout.Space(); DrawPeriodTime(); DrawPeriodSpace(); EditorGUIUtility.wideMode = currentMode; EditorGUILayout.Space(); EditorGUI.EndDisabledGroup(); GUILayout.EndArea(); }
//---------------------------------------------------------------------------------- public override void RenderGUI(Rect area, bool isEditable) { GUILayout.BeginArea(area); RenderTitle(isEditable); float originalLabelwidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 100f; EditorGUI.BeginDisabledGroup(!isEditable); EditorGUI.BeginChangeCheck(); selectedScopeIdx_ = EditorGUILayout.Popup(efScopeCt_, selectedScopeIdx_, arrScopeTypeCt_); if (EditorGUI.EndChangeCheck()) { ChangeScope((CNGroup.CARONTEFX_SCOPE)selectedScopeIdx_); } EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); EditorGUILayout.Space(); if (GUILayout.Button(efSelectScopeCt_, GUILayout.Height(30f))) { SceneSelection(); } EditorGUIUtility.labelWidth = originalLabelwidth; CarGUIUtils.DrawSeparator(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); GUILayout.EndArea(); }
public override void RenderGUI(Rect area, bool isEditable) { GUILayout.BeginArea(area); RenderTitle(isEditable, false, false); EditorGUI.BeginDisabledGroup(!isEditable); RenderFieldObjects("Objects", FieldController, true, true, CNFieldWindow.Type.normal); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Tessellate", GUILayout.Height(30f))) { Tessellate(); } if (GUILayout.Button("Save assets...", GUILayout.Height(30f), GUILayout.Width(100f))) { SaveAssets(); } EditorGUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); CarGUIUtils.DrawSeparator(); scroller_ = EditorGUILayout.BeginScrollView(scroller_); EditorGUILayout.Space(); EditorGUILayout.Space(); float originalLabelwidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 200f; DrawMaxEdgeLength(); DrawLimitByMeshDimensions(); EditorGUILayout.Space(); CarGUIUtils.Splitter(); GUIStyle centerLabel = new GUIStyle(EditorStyles.largeLabel); centerLabel.alignment = TextAnchor.MiddleCenter; centerLabel.fontStyle = FontStyle.Bold; EditorGUILayout.LabelField("Output", centerLabel); EditorGUI.BeginDisabledGroup(Data.NodeGO == null); EditorGUILayout.Space(); DrawOutputButton(); EditorGUILayout.Space(); EditorGUI.EndDisabledGroup(); EditorGUIUtility.labelWidth = originalLabelwidth; EditorGUILayout.EndScrollView(); GUILayout.EndArea(); } // RenderGUI
public override void OnInspectorGUI() { serializedObject.Update(); bool isEditing = false; if (CarManagerEditor.IsOpen) { window_ = CarManagerEditor.Instance; window_.WantRepaint -= Repaint; window_.WantRepaint += Repaint; } if (CarManager.IsInitedStatic) { manager_ = CarManager.Instance; hierarchy_ = manager_.Hierarchy; manager_.GetBodiesData(listBodyData_); isEditing = manager_.Player.IsEditing; } else { listBodyData_.Clear(); } CRBodyData bdData = null; uint idBody = uint.MaxValue; int nBodyData = listBodyData_.Count; BodyType bodyType; string bodyTypeText; string bodyIdText; if (nBodyData == 0) { bodyType = BodyType.None; bodyTypeText = "-"; bodyIdText = "-"; } else { bdData = listBodyData_[0]; bodyType = bdData.bodyType_; bodyTypeText = GetBodyTypeString(bdData.bodyType_); idBody = bdData.idBody_; for (int i = 1; i < nBodyData; i++) { bdData = listBodyData_[i]; if (bdData.bodyType_ != bodyType) { bodyType = BodyType.None; bodyTypeText = "-"; bodyIdText = "-"; break; } } if (idBody == uint.MaxValue || nBodyData > 1) { bodyIdText = "-"; } else { bodyIdText = idBody.ToString(); } } HashSet <CommandNode> setBodyDefinition = new HashSet <CommandNode>(); HashSet <CommandNode> setBodyReference = new HashSet <CommandNode>(); for (int i = 0; i < nBodyData; i++) { bdData = listBodyData_[i]; List <CommandNode> bdDataNodes = bdData.listNode_; int nDataNodes = bdDataNodes.Count; for (int j = 0; j < nDataNodes; j++) { CommandNode node = bdDataNodes[j]; if (j == 0) { setBodyDefinition.Add(node); } else { setBodyReference.Add(node); } } } EditorGUILayout.Space(); EditorGUILayout.LabelField("Body type: ", bodyTypeText); EditorGUILayout.LabelField("Body id:", bodyIdText); EditorGUILayout.Space(); if (bodyType == BodyType.None) { DrawFullBodySection(); } else if (bodyType == BodyType.Ropebody) { DrawRopeColliderSection(isEditing); } else if (IsNotBodyMesh(bodyType)) { DrawBodyColliderSection(); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Body Definition: "); scrollVecDefinition_ = GUILayout.BeginScrollView(scrollVecDefinition_, GUILayout.ExpandHeight(false)); DrawNodeGUI(setBodyDefinition); GUILayout.EndScrollView(); EditorGUILayout.Space(); EditorGUILayout.LabelField("Referenced in: "); scrollVecReferenced_ = GUILayout.BeginScrollView(scrollVecReferenced_, GUILayout.ExpandHeight(false)); DrawNodeGUI(setBodyReference); GUILayout.EndScrollView(); CarGUIUtils.Splitter(); if (!CarManagerEditor.IsOpen) { EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Open CaronteFx Editor", GUILayout.Height(30f))) { window_ = (CarManagerEditor)CarManagerEditor.Init(); } EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } serializedObject.ApplyModifiedProperties(); }
public void DrawRebake() { EditorGUI.BeginDisabledGroup(true); if (crAnimation_.animationFileType == CRAnimation.AnimationFileType.CRAnimationAsset) { EditorGUILayout.ObjectField("Active animation", crAnimation_.activeAnimation, typeof(CRAnimationAsset), true); } else if (crAnimation_.animationFileType == CRAnimation.AnimationFileType.TextAsset) { EditorGUILayout.ObjectField("Active animation", crAnimation_.activeAnimationText, typeof(TextAsset), true); } EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); float start = EditorGUILayout.IntField("Frame Start : ", trimFrameStart_); float end = EditorGUILayout.IntField("Frame End : ", trimFrameEnd_); EditorGUILayout.MinMaxSlider(new GUIContent("Frames:"), ref start, ref end, 0, trimFrameLast_); SetStartEndFrames((int)start, (int)end); EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(true); int actualFrameStart = createLoopableBake_ ? trimFrameStart_ + transitionFrames_ : trimFrameStart_; EditorGUILayout.IntField("Actual frame start", actualFrameStart); EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(true); int actualFrameCount = createLoopableBake_ ? trimFrameEnd_ - trimFrameStart_ - transitionFrames_ : trimFrameEnd_ - trimFrameStart_; EditorGUILayout.IntField("Actual frame count", actualFrameCount); EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(true); EditorGUILayout.FloatField("Actual time", actualFrameCount * crAnimation_.FrameTime); EditorGUI.EndDisabledGroup(); if (CarVersionChecker.IsPremiumVersion()) { EditorGUILayout.Space(); createLoopableBake_ = EditorGUILayout.Toggle("Create loop", createLoopableBake_); EditorGUI.BeginDisabledGroup(!createLoopableBake_); int frameCount = trimFrameEnd_ - trimFrameStart_ + 1; int maxLoopFrames = frameCount / 2; transitionFrames_ = Mathf.Clamp(Mathf.Min(EditorGUILayout.IntField("Loop frames", transitionFrames_), maxLoopFrames), 0, int.MaxValue); EditorGUI.EndDisabledGroup(); } EditorGUILayout.Space(); vertexCompression_ = EditorGUILayout.Toggle("Vertex compression", vertexCompression_); EditorGUI.BeginDisabledGroup(!vertexCompression_); vertexCompressionIdx_ = EditorGUILayout.Popup("Compression mode", vertexCompressionIdx_, arrVertexCompressionModes_); EditorGUI.EndDisabledGroup(); bool isFiberCompression = vertexCompression_ && vertexCompressionIdx_ == 1; EditorGUI.BeginDisabledGroup(isFiberCompression); saveTangents_ = EditorGUILayout.Toggle("Save tangents", saveTangents_); EditorGUI.EndDisabledGroup(); alignData_ = EditorGUILayout.Toggle("Align data", alignData_); EditorGUI.BeginDisabledGroup(createLoopableBake_); bakeEvents_ = EditorGUILayout.Toggle("Bake events", bakeEvents_); EditorGUI.EndDisabledGroup(); GUILayout.FlexibleSpace(); CarGUIUtils.Splitter(); if (GUILayout.Button("Rebake animation")) { if (trimFrameEnd_ <= trimFrameStart_) { EditorUtility.DisplayDialog("CaronteFX - Invalid frames", "Frame End must be above Frame Start", "Ok"); return; } bool isTextAsset = crAnimation_.animationFileType == CRAnimation.AnimationFileType.TextAsset; RebakeClip(isTextAsset); } }
//----------------------------------------------------------------------------------- protected override void RenderFieldsBody(bool isEditable) { EditorGUILayout.Space(); EditorGUILayout.Space(); CarGUIUtils.DrawSeparator(); CarGUIUtils.Splitter(); float originalLabelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = label_width; scroller_ = EditorGUILayout.BeginScrollView(scroller_); EditorGUI.BeginDisabledGroup(!isEditable); EditorGUILayout.Space(); DrawDoCollide(); EditorGUILayout.Space(); if (Data.IsFiniteMass) { DrawGUIMassOptions(); DrawIsShell(); } GUILayout.Space(simple_space); DrawRestitution(); DrawFrictionKinetic(); GUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(Data.FromKinetic); DrawFrictionStatic(); EditorGUI.EndDisabledGroup(); DrawFrictionStaticFromKinetic(); GUILayout.EndHorizontal(); GUILayout.Space(simple_space); if (Data.IsFiniteMass) { DrawDampingPerSecondWorld(); } GUILayout.Space(simple_space); bool currentMode = EditorGUIUtility.wideMode; EditorGUIUtility.wideMode = true; DrawLinearVelocity(); DrawAngularVelocity(); EditorGUILayout.Space(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); DrawExplosionOpacity(); if (Data.IsFiniteMass) { DrawExplosionResponsiveness(); } CarGUIUtils.Splitter(); EditorGUILayout.Space(); EditorGUIUtility.labelWidth = originalLabelWidth; EditorGUIUtility.wideMode = currentMode; EditorGUI.EndDisabledGroup(); EditorGUILayout.EndScrollView(); }
//----------------------------------------------------------------------------------- public override void RenderGUI(Rect area, bool isEditable) { GUILayout.BeginArea(area); RenderTitle(isEditable, true, true, true); EditorGUI.BeginDisabledGroup(!isEditable); { RenderFieldObjects(jgObjectsAFieldCt_, FieldControllerA, true, true, CNFieldWindow.Type.extended); RenderFieldObjects(jgObjectsBFieldCt_, FieldControllerB, true, true, CNFieldWindow.Type.extended); EditorGUILayout.Space(); EditorGUILayout.Space(); if (GUILayout.Button(Data.NeedsUpdate ? CarStringManager.GetString("CreateRecreate*") : CarStringManager.GetString("CreateRecreate"), GUILayout.Height(30f))) { RecreateEntities(); } } EditorGUI.EndDisabledGroup(); CarGUIUtils.DrawSeparator(); CarGUIUtils.Splitter(); scroller_ = EditorGUILayout.BeginScrollView(scroller_); float originalLabelwidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 200f; EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(!isEditable); { EditorGUI.BeginChangeCheck(); { RenderCreationParams(); } if (EditorGUI.EndChangeCheck() && eManager.IsMultiJointCreated(Data)) { DestroyEntities(); } EditorGUILayout.Space(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); //FORCES EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(MaximumForce); DrawForceMax(); EditorGUI.EndDisabledGroup(); DrawMaximumForce(); EditorGUILayout.EndHorizontal(); EditorGUI.BeginDisabledGroup(MaximumForce); DrawForceMaxRand(); DrawForceRange(); DrawForceProfile(); EditorGUI.EndDisabledGroup(); } EditorGUI.EndDisabledGroup(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); //BREAK EditorGUILayout.BeginHorizontal(); Data.BreakFoldout = EditorGUILayout.Foldout(Data.BreakFoldout, "Break if distance exceeded"); EditorGUI.BeginDisabledGroup(!isEditable); { GUILayout.Space(145f); DrawBreakIfDistanceExceeded(); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); { if (Data.BreakFoldout) { EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(!Data.BreakIfDistExcedeed); DrawDistanceForBreak(); DrawDistanceForBreakRand(); EditorGUI.EndDisabledGroup(); DrawEnableCollisionIfBreak(); } } } EditorGUI.EndDisabledGroup(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); //PLASTICITY EditorGUILayout.BeginHorizontal(); Data.PlasticityFoldout = EditorGUILayout.Foldout(Data.PlasticityFoldout, "Plasticity"); EditorGUI.BeginDisabledGroup(!isEditable); { GUILayout.Space(145f); DrawPlasticity(); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); if (Data.PlasticityFoldout) { EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(!Data.Plasticity); DrawDistanceForPlasticity(); DrawDistanceForPlasticityRand(); DrawPlasticityRateAcquired(); EditorGUI.EndDisabledGroup(); } } EditorGUI.EndDisabledGroup(); CarGUIUtils.Splitter(); EditorGUIUtility.labelWidth = originalLabelwidth; EditorGUILayout.EndScrollView(); GUILayout.EndArea(); } // RenderGUI
public override void RenderGUI(Rect area, bool isEditable) { GUILayout.BeginArea(area); RenderTitle(isEditable, true, false); EditorGUI.BeginDisabledGroup(!isEditable); RenderFieldObjects("Objects", FieldController, true, true, CNFieldWindow.Type.extended); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUI.EndDisabledGroup(); CarGUIUtils.DrawSeparator(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(!isEditable); List <ParameterModifierCommand> listPmCommand = Data.ListPmCommand; EditorGUILayout.Space(); DrawTimer(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.LabelField("Object parameters to modify: "); CarGUIUtils.Splitter(); scroller_ = EditorGUILayout.BeginScrollView(scroller_); GUILayout.Space(10f); ParameterModifierCommand pmCommandToRemove = null; ParameterModifierCommand pmCommandToAdd = null; int addPosition = 0; int nPmCommand = listPmCommand.Count; for (int i = 0; i < nPmCommand; i++) { ParameterModifierCommand pmCommand = listPmCommand[i]; DrawPmCommand(i, pmCommand, ref pmCommandToRemove, ref pmCommandToAdd, ref addPosition); } if (pmCommandToRemove != null && listPmCommand.Count > 1) { Undo.RecordObject(Data, "Remove parameter - " + Data.Name); listPmCommand.Remove(pmCommandToRemove); pmCommandToRemove = null; EditorUtility.SetDirty(Data); } if (pmCommandToAdd != null) { Undo.RecordObject(Data, "Add parameter - " + Data.Name); listPmCommand.Insert(addPosition, pmCommandToAdd); pmCommandToAdd = null; EditorUtility.SetDirty(Data); } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndScrollView(); GUILayout.EndArea(); }
//----------------------------------------------------------------------------------- protected override void RenderFieldsBody(bool isEditable) { EditorGUILayout.Space(); EditorGUILayout.Space(); CarGUIUtils.DrawSeparator(); CarGUIUtils.Splitter(); scroller_ = EditorGUILayout.BeginScrollView(scroller_); EditorGUILayout.Space(); float originalLabelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 180f; EditorGUI.BeginDisabledGroup(!isEditable); { DrawDoCollide(); DrawDoAutocollide(); EditorGUILayout.Space(); DrawGUIMassOptions(); DrawIsShell(); GUILayout.Space(simple_space); DrawResolution(); GUILayout.Space(simple_space); DrawLengthStiffness(); DrawVolumeStiffness(); GUILayout.Space(simple_space); DrawDampingPerSecondCM(); GUILayout.Space(simple_space); CarGUIUtils.Splitter(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); DrawPlasticityFoldout(); EditorGUI.BeginDisabledGroup(!isEditable); { DrawPlasticity(); EditorGUILayout.EndHorizontal(); if (Data.PlasticityFoldout) { EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(!Data.Plasticity); DrawThreshold(); DrawAcquired(); DrawCompressionLimit(); DrawExpansionLimit(); EditorGUI.EndDisabledGroup(); } } EditorGUI.EndDisabledGroup(); CarGUIUtils.Splitter(); GUILayout.Space(simple_space); DrawRestitution(); DrawFrictionKinetic(); GUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(Data.FromKinetic); DrawFrictionStatic(); EditorGUI.EndDisabledGroup(); DrawFrictionStaticFromKinetic(); GUILayout.EndHorizontal(); GUILayout.Space(simple_space); DrawDampingPerSecondWorld(); GUILayout.Space(simple_space); bool currentMode = EditorGUIUtility.wideMode; EditorGUIUtility.wideMode = true; DrawLinearVelocity(); DrawAngularVelocity(); EditorGUIUtility.wideMode = currentMode; } EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(!isEditable); { DrawExplosionOpacity(); DrawExplosionResponsiveness(); } EditorGUI.EndDisabledGroup(); EditorGUIUtility.labelWidth = originalLabelWidth; EditorGUILayout.Space(); EditorGUILayout.EndScrollView(); }
//----------------------------------------------------------------------------------- private void RenderEditParams() { EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(unlimitedAction_); if (!Data.IsLinearOrAngular) { EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(Data.MaximumAngle); DrawMaxAngle(); EditorGUI.EndDisabledGroup(); DrawMaximumAngle(); EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(Data.MaximumSpeed); DrawSpeedMax(); EditorGUI.EndDisabledGroup(); DrawMaximumSpeed(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(Data.MaximumPower); DrawPowerMax(); EditorGUI.EndDisabledGroup(); DrawMaximumPower(); EditorGUILayout.EndHorizontal(); string fieldNameForce; string fieldNameBrakeForce; GetForceFieldNames(out fieldNameForce, out fieldNameBrakeForce); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(Data.MaximumForce); DrawForceMax(fieldNameForce); EditorGUI.EndDisabledGroup(); DrawMaximumForce(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(Data.MaximumBrakePowerMax); BrakePowerMax(); EditorGUI.EndDisabledGroup(); DrawMaximumBrakePowerMax(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(Data.MaximumBrakeForceMax); DrawBrakeForceMax(fieldNameBrakeForce); EditorGUI.EndDisabledGroup(); DrawMaximumBrakeForce(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); DrawDampingForce(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); Data.MultiplierFoldOut = EditorGUILayout.Foldout(Data.MultiplierFoldOut, "Power/force multiplier depending on distance"); if (Data.MultiplierFoldOut) { GUILayout.Space(10f); DrawDistanceFunction(); DrawDistanceRange(); DrawMultiplierRange(); } CarGUIUtils.Splitter(); EditorGUILayout.Space(); EditorGUI.EndDisabledGroup(); Data.BreakFoldout = EditorGUILayout.Foldout(Data.BreakFoldout, "Break"); if (Data.BreakFoldout) { GUILayout.Space(10f); DrawBreakIfDistExceeded(); EditorGUI.BeginDisabledGroup(!Data.IsBreakIfDist); DrawBreakDistance(); EditorGUI.EndDisabledGroup(); DrawBreakIfAngle(); EditorGUI.BeginDisabledGroup(!Data.IsBreakIfAng); DrawBreakAngle(); EditorGUI.EndDisabledGroup(); } CarGUIUtils.Splitter(); EditorGUILayout.Space(); }
//----------------------------------------------------------------------------------- protected void RenderTitle(bool isEditable, bool drawEnabledToggle = true, bool drawVisibleToggle = true, bool isDebugRender = false) { currentFocusedControlName_ = GUI.GetNameOfFocusedControl(); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); string title; if (Data.NeedsUpdate) { title = Data.Name + "(*)"; } else { title = Data.Name; } GUILayout.Space(5f); Rect iconRect = GUILayoutUtility.GetRect(30f, 30f); GUI.Label(iconRect, new GUIContent(TexIcon)); EditorGUI.BeginDisabledGroup(!IsEnabledInHierarchy); GUILayout.Label(new GUIContent(title), styleTitle); EditorGUI.EndDisabledGroup(); GUILayout.FlexibleSpace(); EditorGUILayout.BeginVertical(); EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); EditorGUI.BeginDisabledGroup(!(isEditable)); float width = ((Enabled == IsEnabledInHierarchy) && (Visible == IsVisibleInHierarchy)) ? 100f : 170f; if (drawEnabledToggle) { GUIContent nameEnabledCt = (Enabled == IsEnabledInHierarchy) ? enabledToggleCt_ : enabledToggleOverridenCt_; Enabled = EditorGUILayout.ToggleLeft(nameEnabledCt, Data.IsNodeEnabled, GUILayout.Width(width)); } EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(!(isEditable || isDebugRender)); if (drawVisibleToggle) { GUIContent nameVisibleCt = (Visible == IsVisibleInHierarchy) ? visibleToggleCt_ : visibleToggleOverridenCt_; Visible = EditorGUILayout.ToggleLeft(nameVisibleCt, Data.IsNodeVisible, GUILayout.Width(width)); } EditorGUI.EndDisabledGroup(); if (EditorGUI.EndChangeCheck()) { SceneView.RepaintAll(); } EditorGUILayout.EndVertical(); GUILayout.EndHorizontal(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); }
//---------------------------------------------------------------------------------- protected override void RenderFieldsBody(bool isEditable) { EditorGUILayout.Space(); EditorGUILayout.Space(); CarGUIUtils.DrawSeparator(); CarGUIUtils.Splitter(); float originalLabelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = label_width; scroller_ = EditorGUILayout.BeginScrollView(scroller_); EditorGUI.BeginDisabledGroup(!isEditable); EditorGUILayout.Space(); DrawDoCollide(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); DrawAnimationTypeEnum(); EditorGUILayout.Space(); if (Data.AnimationType == CNAnimatedbody.EAnimationType.Animator) { DrawAnimationClip(); } EditorGUILayout.Space(); EditorGUILayout.Space(); DrawTimeStart(); GUILayout.BeginHorizontal(); DrawTimeLength(); DrawTimeLengthReset(); GUILayout.EndHorizontal(); EditorGUILayout.Space(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); EditorGUILayout.Space(); DrawRestitution(); DrawFrictionKinetic(); GUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(Data.FromKinetic); DrawFrictionStatic(); EditorGUI.EndDisabledGroup(); DrawFrictionStaticFromKinetic(); GUILayout.EndHorizontal(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); DrawExplosionOpacity(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); EditorGUIUtility.labelWidth = originalLabelWidth; EditorGUI.EndDisabledGroup(); EditorGUILayout.EndScrollView(); }
//---------------------------------------------------------------------------------- public override void RenderGUI(Rect area, bool isEditable) { GUILayout.BeginArea(area); RenderTitle(isEditable, true, false); EditorGUI.BeginDisabledGroup(!isEditable); RenderFieldObjects("Bodies", FieldController, true, true, CNFieldWindow.Type.extended); EditorGUILayout.Space(); EditorGUILayout.Space(); CarGUIUtils.DrawSeparator(); CarGUIUtils.Splitter(); scroller_ = EditorGUILayout.BeginScrollView(scroller_); bool currentMode = EditorGUIUtility.wideMode; EditorGUIUtility.wideMode = true; float originalLabelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 180f; EditorGUILayout.Space(); EditorGUILayout.Space(); DrawTimer(); EditorGUILayout.Space(); DrawFluidDensity(); EditorGUILayout.Space(); DrawVelocity(); EditorGUILayout.Space(); DrawSpeedDeltaMax(); DrawAngleDeltaMax(); EditorGUILayout.Space(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); Data.NoiseFoldout = EditorGUILayout.Foldout(Data.NoiseFoldout, "Noise"); if (Data.NoiseFoldout) { GUILayout.Space(10f); DrawPeriodTime(); DrawPeriodSpace(); } CarGUIUtils.Splitter(); EditorGUILayout.Space(); Data.HfFoldout = EditorGUILayout.Foldout(Data.HfFoldout, "High frequency"); if (Data.HfFoldout) { GUILayout.Space(10f); DrawHighFrequencyAM(); DrawHighFrequencySP(); } CarGUIUtils.Splitter(); EditorGUIUtility.labelWidth = originalLabelWidth; EditorGUIUtility.wideMode = currentMode; EditorGUILayout.EndScrollView(); GUILayout.EndArea(); }
//----------------------------------------------------------------------------------- protected override void RenderFieldsBody(bool isEditable) { EditorGUILayout.Space(); EditorGUILayout.Space(); CarGUIUtils.DrawSeparator(); CarGUIUtils.Splitter(); scroller_ = EditorGUILayout.BeginScrollView(scroller_); EditorGUILayout.Space(); float originalLabelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 180f; EditorGUI.BeginDisabledGroup(!isEditable); { DrawDoCollide(); DrawDoAutocollide(); DrawDisableCollisionsAtJoints(); EditorGUILayout.Space(); DrawGUIMassOptions(); GUILayout.Space(simple_space); DrawCollisionRadius(); DrawSafeModeIntegration(); if (CarVersionChecker.IsPremiumVersion()) { DrawClothGrouping(); } GUILayout.Space(simple_space); DrawBendStiffness(); DrawStretchStiffness(); GUILayout.Space(simple_space); DrawDampingBend(); DrawDampingStretch(); GUILayout.Space(simple_space); CarGUIUtils.Splitter(); GUILayout.Space(simple_space); DrawRestitution(); DrawFrictionKinetic(); GUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(Data.FromKinetic); DrawFrictionStatic(); EditorGUI.EndDisabledGroup(); DrawFrictionStaticFromKinetic(); GUILayout.EndHorizontal(); GUILayout.Space(simple_space); DrawDampingPerSecondWorld(); GUILayout.Space(simple_space); bool currentMode = EditorGUIUtility.wideMode; EditorGUIUtility.wideMode = true; DrawLinearVelocity(); DrawAngularVelocity(); CarGUIUtils.Splitter(); GUILayout.Space(simple_space); DrawExplosionOpacity(); DrawExplosionResponsiveness(); EditorGUIUtility.wideMode = currentMode; } EditorGUI.EndDisabledGroup(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); EditorGUIUtility.labelWidth = originalLabelWidth; EditorGUILayout.Space(); EditorGUILayout.EndScrollView(); }
public override void OnInspectorGUI() { serializedObject.Update(); bool isPlayingOrWillChangePlaymode = EditorApplication.isPlayingOrWillChangePlaymode; Rect rect = GUILayoutUtility.GetRect(80f, 80f); GUI.DrawTexture(rect, ic_logoCaronte_, ScaleMode.ScaleToFit); CarGUIUtils.Splitter(); if (Selection.gameObjects.Length > 1) { EditorGUILayout.PropertyField(activeAnimationTextProp_, new GUIContent("Active animation (TextAsset)")); EditorGUILayout.PropertyField(activeAnimationAssetProp_, new GUIContent("Active animation (CRAnimationAsset)")); serializedObject.ApplyModifiedProperties(); DrawDefaultInspector(); EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(isPlayingOrWillChangePlaymode || ac_.PreviewInEditor || !SystemInfo.supportsComputeShaders); DrawDecodeInGPU(); EditorGUI.BeginDisabledGroup(!decondeInGPUProp_.boolValue); DrawBufferAllFrames(); EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(bufferAllFramesProp_.boolValue); DrawGPUBufferSize(); EditorGUI.EndDisabledGroup(); DrawOverrideShaderForVA(); DrawUseDoubleSidedShader(); EditorGUI.EndDisabledGroup(); if (playerPremiumVersion_) { EditorGUILayout.Space(); DrawRecomputeNormals(isPlayingOrWillChangePlaymode); } serializedObject.ApplyModifiedProperties(); return; } EditorGUILayout.Space(); EditorGUILayout.Space(); DrawAnimationFileType(); DrawAnimationFiles(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); EditorGUILayout.Space(); DrawDefaultInspector(); EditorGUILayout.Space(); if (CarCompressedPose.CanBeDecompressedByGPU() && !CarCompressedPose.CanBeDecompressedByCPU()) { EditorGUILayout.HelpBox("Only GPU decoding of FiberCompression animations is allowed in this version of the plugin.", MessageType.Info); } else if (CarCompressedPose.CanBeDecompressedByCPU() && !CarCompressedPose.CanBeDecompressedByGPU()) { EditorGUILayout.HelpBox("Only CPU decoding of FiberCompression animations is allowed in this version of the plugin.", MessageType.Info); } EditorGUI.BeginDisabledGroup(isPlayingOrWillChangePlaymode || ac_.PreviewInEditor || !SystemInfo.supportsComputeShaders); DrawDecodeInGPU(); EditorGUI.BeginDisabledGroup(!decondeInGPUProp_.boolValue); DrawBufferAllFrames(); EditorGUI.EndDisabledGroup(); EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(!ac_.DecodeInGPU || isPlayingOrWillChangePlaymode || ac_.PreviewInEditor); EditorGUI.BeginDisabledGroup(bufferAllFramesProp_.boolValue); DrawGPUBufferSize(); EditorGUI.EndDisabledGroup(); DrawOverrideShaderForVA(); DrawUseDoubleSidedShader(); EditorGUI.EndDisabledGroup(); if (playerPremiumVersion_) { EditorGUILayout.Space(); DrawRecomputeNormals(isPlayingOrWillChangePlaymode); } serializedObject.ApplyModifiedProperties(); EditorGUILayout.Space(); GameObject go = ac_.gameObject; PrefabType pType = PrefabUtility.GetPrefabType(go); bool isPrefab = pType == PrefabType.Prefab || pType == PrefabType.PrefabInstance; EditorGUI.BeginDisabledGroup(isPlayingOrWillChangePlaymode || isPrefab); DrawIsPreviewInEditor(); if (ac_.PreviewInEditor && ac_.DecodeInGPU) { EditorGUILayout.HelpBox("GPU Vertex Animation decoding is not available in editor preview mode. Standard CPU decoding will be used.", MessageType.Info); } if (isPrefab) { EditorGUILayout.HelpBox("Preview in editor is disabled on prefab and prefab instances due to performance reasons. Use play mode or break the prefab connection through the GameObject menu.", MessageType.Info); } EditorGUI.EndDisabledGroup(); bool isPlayingOrPreviewInEditor = isPlayingOrWillChangePlaymode || ac_.PreviewInEditor; EditorGUI.BeginDisabledGroup(!isPlayingOrPreviewInEditor); EditorGUI.BeginChangeCheck(); editorFrame_ = Mathf.Clamp(ac_.LastReadFrame, 0, ac_.LastFrame); if (ac_.interpolate) { editorFrame_ = EditorGUILayout.Slider(new GUIContent("Frame"), editorFrame_, 0, ac_.LastFrame); } else { editorFrame_ = EditorGUILayout.IntSlider(new GUIContent("Frame"), (int)editorFrame_, 0, ac_.LastFrame); } if (EditorGUI.EndChangeCheck() && isPlayingOrPreviewInEditor) { ac_.SetFrame(editorFrame_); SceneView.RepaintAll(); } EditorGUI.EndDisabledGroup(); EditorGUILayout.LabelField(new GUIContent("Time"), new GUIContent(ac_.AnimationTime.ToString("F3"))); EditorGUILayout.LabelField(new GUIContent("Frame Count"), new GUIContent(ac_.FrameCount.ToString())); EditorGUILayout.LabelField(new GUIContent("FPS"), new GUIContent(ac_.Fps.ToString())); EditorGUILayout.LabelField(new GUIContent("Animation Length"), new GUIContent(ac_.AnimationLength.ToString())); EditorGUILayout.LabelField(new GUIContent("Compression type"), new GUIContent(GetCompressionTypeString())); EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(ac_.AnimatorSync != null); DrawStartTimeOffset(); EditorGUI.EndDisabledGroup(); DrawSyncWithAnimator(); CarGUIUtils.Splitter(); EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode); CarGUIUtils.Splitter(); EditorGUILayout.Space(); DrawRebakeAnimation(); DrawAddDefaultParticleSystem(); if (playerPremiumVersion_) { DrawExportToFbx(); } DrawRecordScreenshots(); EditorGUI.EndDisabledGroup(); if (isPlayingOrWillChangePlaymode) { Repaint(); } }
void OnGUI() { Rect nodesArea = new Rect(5, 5, width - 10, Mathf.CeilToInt((height - 10f) / 3)); Rect nodesAreaBox = new Rect(nodesArea.xMin, nodesArea.yMin, nodesArea.width + 1, nodesArea.height + 1); GUI.Box(nodesAreaBox, ""); GUILayout.BeginArea(nodesArea); GUILayout.BeginHorizontal(); GUIStyle styleTitle = new GUIStyle(GUI.skin.label); styleTitle.fontStyle = FontStyle.Bold; GUILayout.Label("Nodes to bake:", styleTitle); GUILayout.EndHorizontal(); CarGUIUtils.DrawSeparator(); GUILayout.BeginHorizontal(); int bodyNodeCount = listBodyNode_.Count; EditorGUILayout.BeginHorizontal(); DrawToggleMixed(bodyNodeCount); Rect rect = GUILayoutUtility.GetLastRect(); GUILayout.Space(40f); EditorGUILayout.LabelField("Collapse/Skin"); EditorGUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); Rect boxRect = new Rect(nodesAreaBox.xMin - 5, rect.yMax, nodesAreaBox.width - 90f, nodesAreaBox.yMax - rect.yMax); Rect collapseRect = new Rect(boxRect.xMax, boxRect.yMin, 90f, boxRect.height); GUI.Box(boxRect, ""); GUI.Box(collapseRect, ""); scroller_ = GUILayout.BeginScrollView(scroller_); for (int i = 0; i < bodyNodeCount; i++) { GUILayout.BeginHorizontal(); CNBody bodyNode = listBodyNode_[i]; string name = bodyNode.Name; bitArrNeedsBaking_[i] = EditorGUILayout.ToggleLeft(name, bitArrNeedsBaking_[i], GUILayout.Width(250f)); GUILayout.Space(35f); bool isRigid = bodyNode is CNRigidbody; bool isAnimated = bodyNode is CNAnimatedbody; if (isRigid && !isAnimated) { bitArrNeedsCollapsing_[i] = EditorGUILayout.Toggle(bitArrNeedsCollapsing_[i]); } GUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); GUILayout.EndArea(); GUILayout.FlexibleSpace(); EditorGUILayout.Space(); EditorGUILayout.Space(); float start = EditorGUILayout.IntField("Frame Start : ", StartFrame); float end = EditorGUILayout.IntField("Frame End : ", EndFrame); EditorGUILayout.MinMaxSlider(new GUIContent("Frames:"), ref start, ref end, 0, MaxFrames); SetStartEndFrames((int)start, (int)end); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); simulationBaker_.animationFileType_ = (CarAnimationBaker.AnimationFileType)EditorGUILayout.EnumPopup("File type", simulationBaker_.animationFileType_); GUILayout.EndHorizontal(); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); simulationBaker_.skinRopes_ = EditorGUILayout.Toggle("Skin ropes", simulationBaker_.skinRopes_); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); simulationBaker_.skinClothes_ = EditorGUILayout.Toggle("Skin clothes", simulationBaker_.skinClothes_); GUILayout.EndHorizontal(); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); simulationBaker_.vertexCompression_ = EditorGUILayout.Toggle("Vertex compression", simulationBaker_.vertexCompression_); GUILayout.EndHorizontal(); EditorGUI.BeginDisabledGroup(!simulationBaker_.vertexCompression_); simulationBaker_.vertexCompressionIdx_ = EditorGUILayout.Popup("Compression mode", simulationBaker_.vertexCompressionIdx_, arrVertexCompressionModes_); EditorGUI.EndDisabledGroup(); bool isFiberCompression = simulationBaker_.vertexCompression_ && simulationBaker_.vertexCompressionIdx_ == 1; EditorGUI.BeginDisabledGroup(isFiberCompression); GUILayout.BeginHorizontal(); simulationBaker_.vertexTangents_ = EditorGUILayout.Toggle("Save tangents", simulationBaker_.vertexTangents_); GUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); GUILayout.BeginHorizontal(); simulationBaker_.alignData_ = EditorGUILayout.Toggle("Align data", simulationBaker_.alignData_); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); simulationBaker_.bakeEvents_ = EditorGUILayout.Toggle("Save events", simulationBaker_.bakeEvents_); GUILayout.EndHorizontal(); //simulationBaker_.bakeVisibility_ = EditorGUILayout.Toggle("Save visibility", simulationBaker_.bakeVisibility_); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); simulationBaker_.animationName_ = EditorGUILayout.TextField("Animation name", simulationBaker_.animationName_); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); simulationBaker_.bakeObjectName_ = EditorGUILayout.TextField("Root gameobject name", simulationBaker_.bakeObjectName_); GUILayout.EndHorizontal(); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); simulationBaker_.optionalRootTransform_ = (Transform)EditorGUILayout.ObjectField("Optional root transform", simulationBaker_.optionalRootTransform_, typeof(Transform), true); GUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.Space(); if (GUILayout.Button("Bake!", GUILayout.Height(20f))) { if (simulationBaker_.FrameEnd <= simulationBaker_.FrameStart) { EditorUtility.DisplayDialog("CaronteFX - Invalid frames", "Frame End must be above Frame Start", "Ok"); return; } EditorApplication.delayCall += () => { simulationBaker_.BakeSimulationAsAnim(); Close(); }; } GUILayout.BeginHorizontal(); GUILayout.EndHorizontal(); GUILayout.Space(5f); }
void OnGUI() { Rect effectsArea = new Rect(5, 5, width_ - 10, (height_ - 10) * 0.9f); GUILayout.BeginArea(effectsArea, GUI.skin.box); EditorGUILayout.BeginHorizontal(); { GUIStyle styleTitle = new GUIStyle(GUI.skin.label); styleTitle.fontStyle = FontStyle.Bold; GUILayout.Label("Scene FXs:", styleTitle); } EditorGUILayout.EndHorizontal(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); scrollPos_ = GUILayout.BeginScrollView(scrollPos_); { for (int i = 0; i < listCaronteFx_.Count; i++) { Caronte_Fx fx = listCaronteFx_[i].First; bool cannotBeAdded = listCaronteFx_[i].Fourth; if (fx != cnManager_.FxData) { GUILayout.BeginHorizontal(); { string name = fx.name; if (cannotBeAdded) { name += " - (Recursive inclusion detected)"; } EditorGUI.BeginDisabledGroup(cannotBeAdded); arrEffectsToInclude[i] = EditorGUILayout.ToggleLeft(name, arrEffectsToInclude[i]); EditorGUI.EndDisabledGroup(); } GUILayout.EndHorizontal(); } } } GUILayout.EndScrollView(); GUILayout.EndArea(); Rect buttonsArea = new Rect(effectsArea.xMin, effectsArea.yMax, width_ - 10, (height_ - 10) * 0.1f); GUILayout.BeginArea(buttonsArea); { EditorGUILayout.Space(); GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); if (GUILayout.Button("Ok", GUILayout.Width(165f))) { Close(); ModifyInclusions(); } GUILayout.FlexibleSpace(); if (GUILayout.Button("Cancel", GUILayout.Width(165f))) { Close(); } GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); } GUILayout.EndArea(); }
void OnGUI() { Rect nodesArea = new Rect(5, 5, width - 10, ((height - 10) * 0.70f)); Rect nodesAreaBox = new Rect(nodesArea.xMin, nodesArea.yMin, nodesArea.width + 1, nodesArea.height + 1); GUI.Box(nodesAreaBox, ""); GUILayout.BeginArea(nodesArea); GUILayout.BeginHorizontal(); GUIStyle styleTitle = new GUIStyle(GUI.skin.label); styleTitle.fontStyle = FontStyle.Bold; GUILayout.Label("Nodes to bake:", styleTitle); GUILayout.EndHorizontal(); CarGUIUtils.DrawSeparator(); GUILayout.BeginHorizontal(); int bodyNodeCount = listBodyNode_.Count; EditorGUILayout.BeginHorizontal(); DrawToggleMixed(bodyNodeCount); Rect rect = GUILayoutUtility.GetLastRect(); GUILayout.Space(65f); EditorGUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); Rect boxRect = new Rect(nodesAreaBox.xMin - 5f, rect.yMax, nodesAreaBox.width, (nodesAreaBox.yMax - rect.yMax) + 1f); GUI.Box(boxRect, ""); scroller_ = GUILayout.BeginScrollView(scroller_); for (int i = 0; i < bodyNodeCount; i++) { CNBody bodyNode = listBodyNode_[i]; string name = bodyNode.Name; bitArrNeedsBaking_[i] = EditorGUILayout.ToggleLeft(name, bitArrNeedsBaking_[i], GUILayout.Width(250f)); } EditorGUILayout.EndScrollView(); GUILayout.EndArea(); GUILayout.FlexibleSpace(); Rect optionsArea = new Rect(5f, nodesArea.yMax + 15f, width - 10f, ((height - 10f) * 0.30f)); GUILayout.BeginArea(optionsArea); EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); simulationBaker_.combineMeshesInFrame_ = EditorGUILayout.Toggle("Combine meshes", simulationBaker_.combineMeshesInFrame_); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); simulationBaker_.bakeObjectName_ = EditorGUILayout.TextField("Bake object name", simulationBaker_.bakeObjectName_); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); simulationBaker_.bakeObjectPrefix_ = EditorGUILayout.TextField("Bake object prefix", simulationBaker_.bakeObjectPrefix_); GUILayout.EndHorizontal(); EditorGUI.BeginDisabledGroup(simulationBaker_.combineMeshesInFrame_); GUILayout.BeginHorizontal(); simulationBaker_.preserveCFXInFrameBake_ = EditorGUILayout.Toggle("Keep body components", simulationBaker_.preserveCFXInFrameBake_); GUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); EditorGUILayout.Space(); if (GUILayout.Button("Bake!")) { EditorApplication.delayCall += () => { simulationBaker_.BakeCurrentFrame(); Close(); }; } GUILayout.EndArea(); }
public override void RenderGUI(Rect area, bool isEditable) { GUILayout.BeginArea(area); RenderTitle(isEditable, false, false); EditorGUI.BeginDisabledGroup(!isEditable); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Create helper mesh", GUILayout.Height(30f))) { CreateHelperMesh(); } if (GUILayout.Button("Save asset...", GUILayout.Height(30f), GUILayout.Width(100f))) { SaveAssets(); } EditorGUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); CarGUIUtils.DrawSeparator(); scroller_ = EditorGUILayout.BeginScrollView(scroller_); EditorGUILayout.Space(); EditorGUILayout.Space(); float originalLabelwidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 200f; DrawRandomSeed(); DrawResolution(); DrawNBumps(); DrawRadiusMin(); DrawRadiusMax(); CarGUIUtils.Splitter(); GUIStyle centerLabel = new GUIStyle(EditorStyles.largeLabel); centerLabel.alignment = TextAnchor.MiddleCenter; centerLabel.fontStyle = FontStyle.Bold; EditorGUILayout.LabelField("Output", centerLabel); EditorGUI.BeginDisabledGroup(Data.HelperGO == null); EditorGUILayout.Space(); DrawOutputButton(); EditorGUILayout.Space(); EditorGUI.EndDisabledGroup(); EditorGUIUtility.labelWidth = originalLabelwidth; EditorGUILayout.EndScrollView(); GUILayout.EndArea(); } // RenderGUI
public override void RenderGUI(Rect area, bool isEditable) { GUILayout.BeginArea(area); RenderTitle(isEditable, true, true, true); EditorGUI.BeginDisabledGroup(!isEditable); RenderFieldObjects("Bodies", FieldController, true, true, CNFieldWindow.Type.extended); EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); EditorGUILayout.Space(); CarGUIUtils.DrawSeparator(); CarGUIUtils.Splitter(); scroller_ = EditorGUILayout.BeginScrollView(scroller_); bool currentMode = EditorGUIUtility.wideMode; EditorGUIUtility.wideMode = true; EditorGUI.BeginDisabledGroup(!isEditable); EditorGUILayout.Space(); EditorGUILayout.Space(); DrawTimer(); EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); DrawExplosionTransform(); EditorGUILayout.Space(); DrawResolution(); DrawWavefronteSpeed(); DrawRange(); DrawDecay(); DrawMomentum(); EditorGUILayout.Space(); DrawObjectsLimitSpeed(); EditorGUILayout.Space(); DrawAsymmetry(); CarGUIUtils.Splitter(); EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(!Data.Asymmetry); DrawAsymmetryRandomSeed(); DrawAsymmetryBumpNumber(); DrawAsymmetryAdditionalSpeedRatio(); EditorGUI.EndDisabledGroup(); if (EditorGUI.EndChangeCheck()) { ApplyEntity(); EditorUtility.SetDirty(Data); } EditorGUI.EndDisabledGroup(); EditorGUIUtility.wideMode = currentMode; EditorGUILayout.Space(); EditorGUILayout.EndScrollView(); GUILayout.EndArea(); }
private void DrawEffectGUIWindow(bool isEditable) { GUIStyle styleTabButton = new GUIStyle(EditorStyles.toolbarButton); styleTabButton.fontSize = 10; styleTabButton.fixedHeight = 18f; styleTabButton.onNormal.background = styleTabButton.onActive.background; tabIndex = GUILayout.SelectionGrid(tabIndex, arrTabNameCt_, 2, styleTabButton); CarGUIUtils.Splitter(); scroller_ = EditorGUILayout.BeginScrollView(scroller_); EditorGUI.BeginDisabledGroup(!isEditable); EditorGUILayout.Space(); #region General if (tabIndex == (int)tabType.General) { //TIME EditorGUILayout.BeginHorizontal(); DrawTotalTime(); DrawTotalTimeReset(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); //QUALITY DrawQuality(); GUILayout.Space(20f); //ANTI-JITTERING DrawAntiJittering(); GUILayout.Space(20f); //FRAMERATE DrawFrameRate(); } #endregion #region Advanced else if (tabIndex == (int)tabType.Advanced) { EditorGUILayout.Space(); DrawByUserDetalTime(); GUILayout.Space(10f); DrawDeltaTime(); GUILayout.Space(20f); DrawByUserCharacteristicObjectProperties(); GUILayout.Space(10f); DrawThickness(); DrawLength(); } EditorGUILayout.Space(); #endregion EditorGUILayout.Space(); EditorGUI.EndDisabledGroup(); EditorGUILayout.EndScrollView(); }