//----------------------------------------------------------------------------------
        public override void RenderGUI(Rect area, bool isEditable)
        {
            GUILayout.BeginArea(area);

            RenderTitle(isEditable, true, false);
            scroller_ = EditorGUILayout.BeginScrollView(scroller_);

            EditorGUI.BeginDisabledGroup(!isEditable);

            RenderFieldObjects("Originals", FieldControllerA, true, false, CNFieldWindow.Type.extended);
            EditorGUILayout.Space();
            RenderFieldObjects("Substitutes", FieldControllerB, true, false, CNFieldWindow.Type.extended);

            CRGUIUtils.Splitter();
            EditorGUILayout.Space();
            DrawTimer();
            EditorGUILayout.Space();
            DrawProbabilitySeed();
            DrawProbability();

            EditorGUILayout.Space();

            EditorGUI.EndDisabledGroup();

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

            EditorGUILayout.EndScrollView();

            GUILayout.EndArea();
        }
示例#2
0
        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();

            CRGUIUtils.DrawSeparator();
            CRGUIUtils.Splitter();

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            bool currentMode = EditorGUIUtility.wideMode;

            EditorGUIUtility.wideMode = true;
            DrawTimer();
            EditorGUILayout.Space();
            DrawGravity();
            EditorGUIUtility.wideMode = currentMode;

            EditorGUILayout.Space();
            EditorGUI.EndDisabledGroup();
            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("Explosions", FieldControllerExplosions, true, false, CNFieldWindow.Type.extended);
            RenderFieldObjects("Bodies", FieldControllerBodies, true, false, CNFieldWindow.Type.extended);

            EditorGUILayout.Space();
            CRGUIUtils.Splitter();

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

            RenderFieldObjects("Attentive Nodes", FieldController, true, false, CNFieldWindow.Type.extended);
            EditorGUILayout.Space();
            CRGUIUtils.Splitter();

            EditorGUI.EndDisabledGroup();

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

            EditorGUILayout.EndScrollView();

            GUILayout.EndArea();
        }
示例#4
0
        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("Weld", GUILayout.Height(30f)))
            {
                Weld();
            }
            if (GUILayout.Button("Save asset...", GUILayout.Height(30f), GUILayout.Width(100f)))
            {
                SaveWeldResult();
            }
            EditorGUILayout.EndHorizontal();

            EditorGUI.EndDisabledGroup();
            CRGUIUtils.DrawSeparator();

            scroller_ = EditorGUILayout.BeginScrollView(scroller_);

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

            float originalLabelwidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 200f;

            CRGUIUtils.Splitter();
            GUIStyle centerLabel = new GUIStyle(EditorStyles.largeLabel);

            centerLabel.alignment = TextAnchor.MiddleCenter;
            centerLabel.fontStyle = FontStyle.Bold;
            EditorGUILayout.LabelField("Output", centerLabel);

            EditorGUI.BeginDisabledGroup(Data.WeldGameObject == null);

            EditorGUILayout.Space();

            if (GUILayout.Button("Select welded object"))
            {
                Selection.activeGameObject = Data.WeldGameObject;
            }
            EditorGUILayout.Space();

            EditorGUI.EndDisabledGroup();

            EditorGUIUtility.labelWidth = originalLabelwidth;

            EditorGUILayout.EndScrollView();

            GUILayout.EndArea();
        } // RenderGUI
示例#5
0
        public override void RenderGUI(Rect area, bool isEditable)
        {
            GUILayout.BeginArea(area);

            RenderTitle(isEditable);

            EditorGUILayout.Space();
            float originalLabelwidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 100f;

            EditorGUI.BeginDisabledGroup(!isEditable);
            EditorGUI.BeginChangeCheck();
            selectedScopeIdx_ = EditorGUILayout.Popup("Effect Scope", selectedScopeIdx_, scopeStrings);
            if (EditorGUI.EndChangeCheck())
            {
                ChangeScope((CNGroup.CARONTEFX_SCOPE)selectedScopeIdx_);
            }

            EditorGUI.EndDisabledGroup();
            EditorGUILayout.Space();
            EditorGUILayout.Space();
            if (GUILayout.Button(new GUIContent("Select scope GameObjects"), GUILayout.Height(30f)))
            {
                SceneSelection();
            }
            EditorGUIUtility.labelWidth = originalLabelwidth;

            CRGUIUtils.DrawSeparator();
            CRGUIUtils.Splitter();
            DrawEffectGUIWindow(isEditable);

            GUILayout.EndArea();
        }
示例#6
0
    public void RenderStatistics()
    {
      GUIStyle styleStats = 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);
      CRGUIUtils.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();

      EditorGUILayout.LabelField("RigidBodies: ",  nrigid,        styleStats );
      EditorGUILayout.LabelField("Irresponsive: ", nirresponsive, styleStats );
      EditorGUILayout.LabelField("SoftBodies: ",   nsoftbody,     styleStats );
      EditorGUILayout.LabelField("ClothBodies: ",  ncloth,        styleStats );
      
      EditorGUILayout.Space();

      EditorGUILayout.LabelField("Joints: ", statistics_.jointGroupsInf_.nJoints_.ToString(), styleStats );
      EditorGUILayout.LabelField("Servos: ", statistics_.nServos_.ToString(), styleStats );
    }
示例#7
0
        private void DrawEffectGUIWindow(bool isEditable)
        {
            tabIndex = GUILayout.SelectionGrid(tabIndex, tabNames, 2);
            CRGUIUtils.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();
        }
示例#8
0
        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("Child/Brother includible FXs:", styleTitle);
            }
            EditorGUILayout.EndHorizontal();

            CRGUIUtils.Splitter();
            EditorGUILayout.Space();


            scrollPos_ = GUILayout.BeginScrollView(scrollPos_);
            {
                for (int i = 0; i < listCaronteFx_.Count; i++)
                {
                    Caronte_Fx fx = listCaronteFx_[i].First;
                    if (fx != Controller.FxData)
                    {
                        GUILayout.BeginHorizontal();
                        {
                            string name = fx.name;
                            arrEffectsToInclude[i] = EditorGUILayout.ToggleLeft(name, arrEffectsToInclude[i]);
                        }
                        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();
                {
                    if (GUILayout.Button("Ok"))
                    {
                        Close();
                        ModifyInclusions();
                    }
                    if (GUILayout.Button("Cancel"))
                    {
                        Close();
                    }
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndArea();
        }
示例#9
0
        //-----------------------------------------------------------------------------------
        public override void RenderGUI(Rect area, bool isEditable)
        {
            GUILayout.BeginArea(area);

            RenderTitle(isEditable);

            EditorGUI.BeginDisabledGroup(!isEditable);
            {
                RenderFieldObjects("ObjectsA", FieldControllerA, true, true, CNFieldWindow.Type.extended);
                RenderFieldObjects("ObjectsB", FieldControllerB, true, true, CNFieldWindow.Type.extended);

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

                if (GUILayout.Button(Data.NeedsUpdate ? "Create/Recreate(*)" : "Create/Recreate", GUILayout.Height(30f)))
                {
                    RecreateEntities();
                }
            }
            EditorGUI.EndDisabledGroup();

            CRGUIUtils.DrawSeparator();
            CRGUIUtils.Splitter();

            scroller_ = EditorGUILayout.BeginScrollView(scroller_);

            float originalLabelwidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 200f;
            bool currentMode = EditorGUIUtility.wideMode;

            EditorGUIUtility.wideMode = true;

            EditorGUI.BeginDisabledGroup(!isEditable);

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUI.BeginChangeCheck();
            RenderCreationParams();
            if (EditorGUI.EndChangeCheck() && eManager.IsServosCreated(Data))
            {
                DestroyEntities();
            }

            CRGUIUtils.Splitter();
            EditorGUILayout.Space();

            RenderEditParams();

            EditorGUIUtility.labelWidth = originalLabelwidth;
            EditorGUIUtility.wideMode   = currentMode;

            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndScrollView();
            GUILayout.EndArea();
        } // RenderGUI
示例#10
0
 private void GenerateJointsMeshes( uint idJointGroups )
 {
   CRGUIUtils.GenerateBoxMeshesWithId(idJointGroups, listJointPivotNormalIn_,      fxData_.listMeshJointBoxesNormalIn_);
   CRGUIUtils.GenerateBoxMeshesWithId(idJointGroups, listJointPivotNormalOut_,     fxData_.listMeshJointBoxesNormalOut_);
   CRGUIUtils.GenerateBoxMeshesWithId(idJointGroups, listJointPivotDeformatedIn_,  fxData_.listMeshJointBoxesDeformatedIn_);
   CRGUIUtils.GenerateBoxMeshesWithId(idJointGroups, listJointPivotDeformatedOut_, fxData_.listMeshJointBoxesDeformatedOut_);
   CRGUIUtils.GenerateBoxMeshesWithId(idJointGroups, listJointPivotBreakingIn_,    fxData_.listMeshJointBoxesBreakingIn_);
   CRGUIUtils.GenerateBoxMeshesWithId(idJointGroups, listJointPivotBreakingOut_,   fxData_.listMeshJointBoxesBreakingOut_);
   CRGUIUtils.GenerateBoxMeshesWithId(idJointGroups, listJointPivotBrokenIn_,      fxData_.listMeshJointBoxesBrokenIn_);
   CRGUIUtils.GenerateBoxMeshesWithId(idJointGroups, listJointPivotBrokenOut_,     fxData_.listMeshJointBoxesBrokenOut_);
 }
示例#11
0
        //----------------------------------------------------------------------------------
        protected override void RenderFieldsBody(bool isEditable)
        {
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            CRGUIUtils.DrawSeparator();
            CRGUIUtils.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();
            DrawAnimationClip();
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            DrawTimeStart();

            GUILayout.BeginHorizontal();
            DrawTimeLength();
            DrawTimeLengthReset();
            GUILayout.EndHorizontal();
            EditorGUILayout.Space();

            CRGUIUtils.Splitter();
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            DrawRestitution();
            DrawFrictionKinetic();

            GUILayout.BeginHorizontal();
            EditorGUI.BeginDisabledGroup(Data.FromKinetic);
            DrawFrictionStatic();
            EditorGUI.EndDisabledGroup();
            DrawFrictionStaticFromKinetic();
            GUILayout.EndHorizontal();

            EditorGUIUtility.labelWidth = originalLabelWidth;

            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndScrollView();
        }
 void DrawGUIGeometry()
 {
     DrawGUIUniform();
     EditorGUILayout.Space();
     CRGUIUtils.Splitter();
     EditorGUILayout.Space();
     EditorGUILayout.Space();
     DrawChopGeometry();
     DrawGridResolution();
     DrawFocusMode();
     DrawDensityRate();
     DrawTransitionLength();
 }
        void DrawGUIRadial()
        {
            DrawGlobalPattern();
            DrawSeed();
            DrawInteriorMaterial();
            EditorGUILayout.Space();
            DrawDoExtrussionEffect();
            DrawDoCoordinate();
            EditorGUILayout.Space();
            DrawHideParentObjectAuto();

            EditorGUILayout.Space();
            CRGUIUtils.Splitter();
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            DrawReferenceSystem();
            DrawReferenceSystemAxis();

            EditorGUILayout.Space();
            DrawRaysNumber();
            DrawRaysRateRand();

            EditorGUILayout.Space();
            CRGUIUtils.Splitter();
            EditorGUILayout.Space();
            EditorGUILayout.Space();
            DrawIntRadius();
            DrawRingsIntTransitionLength();
            DrawRingsIntTransitionDecay();

            EditorGUILayout.Space();
            DrawRingsExtRadius();
            DrawRingsExtTransitionLength();
            DrawRingsExtTransitionDecay();

            EditorGUILayout.Space();
            CRGUIUtils.Splitter();
            EditorGUILayout.Space();
            EditorGUILayout.Space();
            DrawRingsNumberInsideAnnulus();
            DrawRingsRateRand();
            DrawDoCentralPiece();
            EditorGUILayout.Space();
            DrawNoiseRate();
            DrawTwistRate();
        }
        //----------------------------------------------------------------------------------
        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();

            CRGUIUtils.DrawSeparator();
            CRGUIUtils.Splitter();

            scroller_ = EditorGUILayout.BeginScrollView(scroller_);

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

            Data.Timer        = EditorGUILayout.FloatField("Timer (s)", Data.Timer);
            Data.TimeDuration = EditorGUILayout.FloatField("Duration (s)", Data.TimeDuration);

            EditorGUILayout.Space();

            Data.Multiplier_r = EditorGUILayout.FloatField("Position multiplier", Data.Multiplier_r);
            Data.Multiplier_q = EditorGUILayout.FloatField("Rotation multiplier", Data.Multiplier_q);

            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);

            EditorGUI.BeginDisabledGroup(!isEditable);
            RenderFieldObjects("Scope", FieldController, true, true, CNFieldWindow.Type.normal);
            EditorGUI.EndDisabledGroup();

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

            CRGUIUtils.DrawSeparator();
            CRGUIUtils.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();

            if (GUILayout.Button("Select", GUILayout.Height(30f)))
            {
                ClassifySelection();
            }

            EditorGUI.EndDisabledGroup();
            CRGUIUtils.DrawSeparator();

            scroller_ = EditorGUILayout.BeginScrollView(scroller_);

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

            float originalLabelwidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 200f;

            DrawSelectorGO();
            DrawSelectionMode();
            DrawComplementarySelection();

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

            EditorGUIUtility.labelWidth = originalLabelwidth;

            EditorGUILayout.EndScrollView();

            GUILayout.EndArea();
        } // RenderGUI
示例#17
0
        //----------------------------------------------------------------------------------
        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();
            CRGUIUtils.Splitter();

            float originalLabelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 200f;

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

            RenderFieldObjects("Attentive Nodes", FieldController, true, false, CNFieldWindow.Type.extended);
            EditorGUILayout.Space();
            CRGUIUtils.Splitter();
            EditorGUILayout.Space();
            DrawTriggeringMode();
            EditorGUILayout.Space();
            DrawSpeedMinN();
            DrawSpeedMinT();
            EditorGUI.EndDisabledGroup();

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

            EditorGUIUtility.labelWidth = originalLabelWidth;

            EditorGUILayout.EndScrollView();

            GUILayout.EndArea();
        }
        //----------------------------------------------------------------------------------
        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();
            CRGUIUtils.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();
        }
示例#19
0
    private void GenerateBodyBoxMeshes()
    {
      CREditorUtils.GetListBoundsFromListGO( listBodyGOEnabledVisible_, listTmpBounds_ );
      CRGUIUtils.GenerateBoxMeshes( listTmpBounds_, fxData_.listMeshBodyBoxesEnabledVisible_ );

      CREditorUtils.GetListBoundsFromListGO( listBodyGODisabledVisible_, listTmpBounds_ );
      CRGUIUtils.GenerateBoxMeshes( listTmpBounds_, fxData_.listMeshBodyBoxesDisabledVisible_ );

      if ( fxData_.DrawSleepingState )
      {
        CREditorUtils.GetListBoundsFromListGO( listBodyGOSleeping_, listTmpBounds_ );
        CRGUIUtils.GenerateBoxMeshes( listTmpBounds_, fxData_.listMeshBodyBoxesSleeping_ );
      }

      if ( fxData_.ShowInvisibles )
      {
        CREditorUtils.GetListBoundsFromListGO( listBodyGOEnabledHide_, listTmpBounds_ );
        CRGUIUtils.GenerateBoxMeshes( listTmpBounds_, fxData_.listMeshBodyBoxesEnabledHide_ );

        CREditorUtils.GetListBoundsFromListGO( listBodyGODisabledHide_, listTmpBounds_ );
        CRGUIUtils.GenerateBoxMeshes( listTmpBounds_, fxData_.listMeshBodyBoxesDisabledHide_ );
      }
    }
示例#20
0
        //----------------------------------------------------------------------------------
        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();

            CRGUIUtils.DrawSeparator();
            CRGUIUtils.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();
        }
示例#21
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            if (ac_.activeAnimation != ac_.animationLastLoaded_)
            {
                previewInEditor_ = false;
                ac_.CloseAnimation();
            }

            DrawDefaultInspector();
            CRGUIUtils.Splitter();

            /*
             * EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
             * EditorGUI.BeginChangeCheck();
             * previewInEditor_ = EditorGUILayout.Toggle("Preview", previewInEditor_);
             * if ( EditorGUI.EndChangeCheck() )
             * {
             * AnimationPreview( previewInEditor_ );
             * }
             * EditorGUI.EndDisabledGroup();
             */


            bool isPlayingOrPreviewInEditor = EditorApplication.isPlayingOrWillChangePlaymode || previewInEditor_;

            EditorGUI.BeginDisabledGroup(!isPlayingOrPreviewInEditor);
            EditorGUI.BeginChangeCheck();

            editorFrame_ = Mathf.Clamp(ac_.lastReadFrame_, 0, ac_.lastFrame_);
            editorFrame_ = EditorGUILayout.Slider(new GUIContent("Frame"), editorFrame_, ac_.firstFrame_, ac_.lastFrame_);
            if (EditorGUI.EndChangeCheck() && isPlayingOrPreviewInEditor)
            {
                ac_.SetFrame(editorFrame_);
                SceneView.RepaintAll();
            }

            EditorGUI.EndDisabledGroup();
            EditorGUILayout.LabelField(new GUIContent("Time"), new GUIContent(ac_.time_.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()));
            CRGUIUtils.Splitter();

            EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);

            CRGUIUtils.Splitter();
            if (GUILayout.Button(new GUIContent("Record screenshots in play mode")))
            {
                MakeCameraScreenshots();
            }

            if (GUILayout.Button(new GUIContent("Remove camera recorder component")))
            {
                RemoveCameraRecorder();
            }

            EditorGUI.EndDisabledGroup();

            Repaint();
        }
示例#22
0
        //-----------------------------------------------------------------------------------
        private void RenderEditParams()
        {
            DrawTargetExternalLocal();
            EditorGUILayout.Space();

            //Data.ReactionTime         = EditorGUILayout.FloatField( "Reaction time", Data.ReactionTime );
            //Data.OverreactionDelta    = EditorGUILayout.FloatField( "Overreaction delta", Data.OverreactionDelta );

            EditorGUILayout.Space();

            EditorGUI.BeginDisabledGroup(unlimitedAction_);

            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();
            CRGUIUtils.Splitter();
            EditorGUILayout.Space();

            Data.MultiplierFoldOut = EditorGUILayout.Foldout(Data.MultiplierFoldOut, "Multiplier depending on distance");

            if (Data.MultiplierFoldOut)
            {
                GUILayout.Space(10f);
                DrawDistanceRange();
                DrawDistanceFunction();
            }

            CRGUIUtils.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();
            }

            CRGUIUtils.Splitter();
            EditorGUILayout.Space();
        }
        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();

            CRGUIUtils.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();

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            if (GUILayout.Button("Bake!"))
            {
                EditorApplication.delayCall += () =>
                {
                    simulationBaker_.BakeCurrentFrame();
                    Close();
                };
            }


            GUILayout.EndArea();
        }
示例#24
0
        //-----------------------------------------------------------------------------------
        public override void RenderGUI(Rect area, bool isEditable)
        {
            GUILayout.BeginArea(area);

            RenderTitle(isEditable, true, true, true);

            EditorGUI.BeginDisabledGroup(!isEditable);
            {
                RenderFieldObjects("ObjectsA", FieldControllerA, true, true, CNFieldWindow.Type.extended);
                RenderFieldObjects("ObjectsB", FieldControllerB, true, true, CNFieldWindow.Type.extended);

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

                if (GUILayout.Button(Data.NeedsUpdate ? "Create/Recreate(*)" : "Create/Recreate", GUILayout.Height(30f)))
                {
                    RecreateEntities();
                }
            }
            EditorGUI.EndDisabledGroup();

            CRGUIUtils.DrawSeparator();
            CRGUIUtils.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();

                CRGUIUtils.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();

            CRGUIUtils.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();

            CRGUIUtils.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();

            CRGUIUtils.Splitter();
            EditorGUIUtility.labelWidth = originalLabelwidth;

            EditorGUILayout.EndScrollView();
            GUILayout.EndArea();
        } // RenderGUI
示例#25
0
        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();

            CRGUIUtils.DrawSeparator();
            CRGUIUtils.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();
            CRGUIUtils.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();
        }
        //----------------------------------------------------------------------------------
        public void RenderGUI(Rect area, bool isEditable)
        {
            GUILayout.BeginArea(area);

            EditorGUILayout.Space();

            DrawTimeLine();

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

            EditorGUILayout.BeginHorizontal();

            bool isSimulating            = player_.IsSimulating;
            bool isReplaying             = player_.IsReplaying;
            bool isSimulatingOrReplaying = isSimulating || isReplaying;

            GUILayout.Space(40f);

            #region Player
            EditorGUI.BeginDisabledGroup(!isSimulatingOrReplaying);

            EditorGUI.BeginDisabledGroup(player_.IsSimulating);
            if (GUILayout.Button(new GUIContent("", first_), EditorStyles.miniButton, buttonLayoutWidth, buttonLayoutHeight))
            {
                player_.frw();
            }
            if (GUILayout.Button(new GUIContent("", prev_), EditorStyles.miniButtonLeft, buttonLayoutWidth, buttonLayoutHeight))
            {
                player_.rw();
            }
            EditorGUI.EndDisabledGroup();

            EditorGUI.EndDisabledGroup();


            if (player_.IsSimulating)
            {
                EditorGUI.BeginDisabledGroup(player_.StopRequested);
                if (GUILayout.Button(new GUIContent("", stop_), EditorStyles.miniButtonMid, buttonLayoutWidth, buttonLayoutHeight))
                {
                    player_.stop();
                }
                EditorGUI.EndDisabledGroup();
            }
            else if (player_.IsReplaying)
            {
                if (player_.IsPause && !player_.UserPlaying)
                {
                    if (GUILayout.Button(new GUIContent("", play_), EditorStyles.miniButtonMid, buttonLayoutWidth, buttonLayoutHeight))
                    {
                        player_.play();
                    }
                }
                else
                {
                    if (GUILayout.Button(new GUIContent("", pause_), EditorStyles.miniButtonMid, buttonLayoutWidth, buttonLayoutHeight))
                    {
                        player_.pause();
                    }
                }
            }

            EditorGUI.BeginDisabledGroup(!isSimulatingOrReplaying);
            EditorGUI.BeginDisabledGroup(player_.IsSimulating);
            if (GUILayout.Button(new GUIContent("", next_), EditorStyles.miniButtonRight, buttonLayoutWidth, buttonLayoutHeight))
            {
                player_.fw();
            }

            if (GUILayout.Button(new GUIContent("", last_), EditorStyles.miniButton, buttonLayoutWidth, buttonLayoutHeight))
            {
                player_.ffw();
            }

            GUILayout.Space(10f);

            EditorGUI.BeginChangeCheck();
            player_.Loop = GUILayout.Toggle(player_.Loop, new GUIContent("", loop_), buttonStyle_, buttonLayoutWidth, buttonLayoutHeight);
            if (EditorGUI.EndChangeCheck())
            {
                player_.ResetUserPlaying();
            }

            EditorGUI.EndDisabledGroup();

            #endregion

            GUILayout.Space(47f);

            #region Statistics
            GUILayout.Label("Time: ", EditorStyles.miniLabel, GUILayout.Width(50f));
            GUILayout.Label(player_.Time.ToString("F2"), EditorStyles.miniLabel, GUILayout.Width(50f));
            GUILayout.Label("of ", EditorStyles.miniLabel);
            GUILayout.FlexibleSpace();
            GUILayout.Label(player_.MaxTimeString, EditorStyles.miniLabel);
            #endregion

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            CRGUIUtils.Splitter();
            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();

            GUILayout.Space(10f);

            GUIStyle style = new GUIStyle(EditorStyles.miniButton);
            style.alignment = TextAnchor.MiddleLeft;

            EditorGUI.BeginDisabledGroup(isSimulating);
            if (GUILayout.Button(new GUIContent(" Bake simulation", rec_), style, GUILayout.Width(135f), GUILayout.Height(25f)))
            {
                if (!CRBakeSimulationMenu.IsOpen)
                {
                    CRBakeSimulationMenu bakeSimMenu = ScriptableObject.CreateInstance <CRBakeSimulationMenu>();
                    bakeSimMenu.titleContent = new GUIContent("CaronteFX - Bake Simulation Menu");
                }
                CRBakeSimulationMenu.Instance.ShowUtility();
                CRBakeFrameMenu.CloseIfOpen();
            }

            if (GUILayout.Button(new GUIContent("Bake current frame", rec_), style, GUILayout.Width(135f), GUILayout.Height(25f)))
            {
                if (!CRBakeFrameMenu.IsOpen)
                {
                    CRBakeFrameMenu bakeFrameMenu = ScriptableObject.CreateInstance <CRBakeFrameMenu>();
                    bakeFrameMenu.titleContent = new GUIContent("CaronteFX - Bake Current Frame Menu");
                }
                CRBakeFrameMenu.Instance.ShowUtility();
                CRBakeSimulationMenu.CloseIfOpen();
            }
            EditorGUI.EndDisabledGroup();

            GUILayout.Space(10f);
            if (GUILayout.Button("Change to edit mode", EditorStyles.miniButton, GUILayout.Width(125f), GUILayout.Height(25f)))
            {
                CRPlayerWindow.CloseIfOpen();
            }
            GUILayout.Space(10f);

            DrawProgressBox();

            GUILayout.Space(6f);

            EditorGUILayout.EndHorizontal();

            GUILayout.EndArea();
        }
        void OnGUI()
        {
            Rect nodesArea    = new Rect(5, 5, width - 10, ((height - 10) / 2));
            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();

            CRGUIUtils.DrawSeparator();

            GUILayout.BeginHorizontal();

            int bodyNodeCount = listBodyNode_.Count;

            EditorGUILayout.BeginHorizontal();
            DrawToggleMixed(bodyNodeCount);
            Rect rect = GUILayoutUtility.GetLastRect();

            GUILayout.Space(65f);
            EditorGUILayout.LabelField("Collapse");
            EditorGUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();

            GUILayout.EndHorizontal();

            Rect boxRect      = new Rect(nodesAreaBox.xMin - 5, rect.yMax, nodesAreaBox.width - 70f, nodesAreaBox.yMax - rect.yMax);
            Rect collapseRect = new Rect(boxRect.xMax, boxRect.yMin, 70f, 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(40f);

                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();

            Rect optionsArea = new Rect(5, nodesArea.yMax, width - 10, (height - 10) / 2);

            GUILayout.BeginArea(optionsArea);

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

            EditorGUILayout.LabelField("Frame Start : " + StartFrame);
            EditorGUILayout.LabelField("Frame End   : " + EndFrame);

            float start = StartFrame;
            float end   = EndFrame;

            EditorGUILayout.MinMaxSlider(new GUIContent("Frames:"), ref start, ref end, 0, MaxFrames);

            SetStartEndFrames((int)start, (int)end);

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            simulationBaker_.sbCompression_ = EditorGUILayout.Toggle("Vertex compression", simulationBaker_.sbCompression_);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            simulationBaker_.sbTangents_ = EditorGUILayout.Toggle("Save tangents", simulationBaker_.sbTangents_);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            simulationBaker_.bakeEvents_ = EditorGUILayout.Toggle("Save events", simulationBaker_.bakeEvents_);
            GUILayout.EndHorizontal();

            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();
            EditorGUILayout.Space();
            if (GUILayout.Button("Bake!"))
            {
                EditorApplication.delayCall += () =>
                {
                    simulationBaker_.BakeSimulationAsAnim();
                    Close();
                };
            }

            GUILayout.BeginHorizontal();

            GUILayout.EndHorizontal();

            GUILayout.EndArea();
        }
        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();

            CRGUIUtils.DrawSeparator();
            CRGUIUtils.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: ");

            CRGUIUtils.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();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            bool isEditing = false;

            if (CRManagerEditor.IsOpen)
            {
                window_              = CRManagerEditor.Instance;
                window_.WantRepaint -= Repaint;
                window_.WantRepaint += Repaint;
            }

            if (CNManager.IsInitedStatic)
            {
                manager_   = CNManager.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
            {
                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();
            CRGUIUtils.Splitter();

            if (!CRManagerEditor.IsOpen)
            {
                EditorGUILayout.Space();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.Space();

                if (GUILayout.Button("Open CaronteFx Editor", GUILayout.Height(30f)))
                {
                    window_ = (CRManagerEditor)CRManagerEditor.Init();
                }

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

            serializedObject.ApplyModifiedProperties();
        }
示例#30
0
        //-----------------------------------------------------------------------------------
        protected override void RenderFieldsBody(bool isEditable)
        {
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            CRGUIUtils.DrawSeparator();
            CRGUIUtils.Splitter();

            float originalLabelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = label_width;

            scroller_ = EditorGUILayout.BeginScrollView(scroller_);
            EditorGUI.BeginDisabledGroup(!isEditable);
            EditorGUILayout.Space();
            DrawDoCollide();
            EditorGUILayout.Space();

            EditorGUI.BeginDisabledGroup(!Data.IsFiniteMass);
            DrawGUIMassOptions();
            EditorGUI.EndDisabledGroup();

            GUILayout.Space(simple_space);

            DrawRestitution();
            DrawFrictionKinetic();

            GUILayout.BeginHorizontal();
            EditorGUI.BeginDisabledGroup(Data.FromKinetic);
            DrawFrictionStatic();
            EditorGUI.EndDisabledGroup();
            DrawFrictionStaticFromKinetic();
            GUILayout.EndHorizontal();

            EditorGUI.BeginDisabledGroup(!Data.IsFiniteMass);

            GUILayout.Space(simple_space);
            DrawDampingPerSecondWorld();
            GUILayout.Space(simple_space);

            bool currentMode = EditorGUIUtility.wideMode;

            EditorGUIUtility.wideMode = true;

            EditorGUI.EndDisabledGroup();

            DrawLinearVelocity();
            DrawAngularVelocity();

            EditorGUILayout.Space();
            CRGUIUtils.Splitter();
            EditorGUILayout.Space();

            DrawExplosionOpacity();

            EditorGUI.BeginDisabledGroup(!Data.IsFiniteMass);
            DrawExplosionResponsiveness();
            EditorGUI.EndDisabledGroup();

            EditorGUIUtility.labelWidth = originalLabelWidth;
            EditorGUIUtility.wideMode   = currentMode;

            EditorGUILayout.Space();
            EditorGUI.EndDisabledGroup();

            EditorGUILayout.EndScrollView();
        }