//-----------------------------------------------------------------------------------
        public void RenderFieldObjects(string labelText, CNFieldController fieldController, bool enabled, bool showScope, CNFieldWindow.Type windowType)
        {
            if (objects_rect_width == 1)
            {
                CRManagerEditor.RepaintIfOpen();
            }

            EditorGUI.BeginDisabledGroup(!enabled);
            Event     ev     = Event.current;
            EventType evType = ev.type;

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.LabelField(labelText, GUILayout.MaxWidth(showScope ? short_label_width : long_label_width));

            GUILayout.Label("", EditorStyles.objectField);
            Rect objectsRect = GUILayoutUtility.GetLastRect();

            if (evType == EventType.Repaint)
            {
                objects_rect_width = objectsRect.width;
            }

            fieldController.DrawFieldItems(objectsRect, tex_icon_size);

            if (evType == EventType.MouseDown && ev.button == 0 &&
                objectsRect.Contains(ev.mousePosition))
            {
                if (windowType == CNFieldWindow.Type.normal)
                {
                    CNFieldWindowSmall.ShowWindow <CNFieldWindowSmall>(labelText, fieldController, this);
                }
                else if (windowType == CNFieldWindow.Type.extended)
                {
                    CNFieldWindowBig.ShowWindow <CNFieldWindowBig>(labelText, fieldController, this);
                }
            }
            if (showScope)
            {
                GUILayout.Space(10f);
                EditorGUILayout.LabelField("Scope", GUILayout.Width(40f));
                CNField.ScopeFlag auxScope = fieldController.GetScopeType();
                EditorGUI.BeginChangeCheck();
                auxScope = (CNField.ScopeFlag)EditorGUILayout.EnumPopup(auxScope, GUILayout.Width(70f));
                if (EditorGUI.EndChangeCheck())
                {
                    fieldController.SetScopeType(auxScope);
                    cnHierarchy.RecalculateFieldsDueToUserAction();
                    EditorUtility.SetDirty(Data);
                }
            }
            ProccesEvents(ev, evType, fieldController, objectsRect);
            EditorGUILayout.EndHorizontal();
            EditorGUI.EndDisabledGroup();
        }
Example #2
0
        //-----------------------------------------------------------------------------------
        private void ChangeToReplayingModeDone()
        {
            stopRequested_ = false;
            SimulationManager.ChangeToReplayingDone();

            manager_.BuildBakerData();

            EditorApplication.update -= UpdateSimulating;
            EditorApplication.update += UpdateReplaying;

            SimulationManager.SetReplayingFrame((uint)frame_, false);

            SceneView.RepaintAll();
            CRManagerEditor.RepaintIfOpen();
        }