Пример #1
0
        /// <summary>
        /// Resets the object's properties.
        /// </summary>
        void Reset()
        {
            // Set the default values.
            UpdateRenderingObjectsList();
            launchOrderIndex      = renderingObjectCount;
            readyToBeLaunched     = false;
            _launchOnAwake        = true;
            _launched             = false;
            _previewRenderTexture = null;
            _previewEvalTexture   = null;
            // Get the processing component. If this was not called on AddComponent, reset it as well.
            _processing = GeneralToolkit.GetOrAddComponent <Processing.Processing>(gameObject);
            if (_processing.renderingCaller != null)
            {
                _processing.Reset();
            }
            else
            {
                _processing.renderingCaller = this;
            }
            // Initialize the rendering methods and helpers. This has to be done after the processing component has been reset.
            _renderingMethods = RenderingMethod.CreateOrResetRenderingMethods(transform);
            Method[] methods = GetComponentsInChildren <Method>();
            for (int iter = 0; iter < methods.Length; iter++)
            {
                methods[iter].InitializeLinks();
            }
            // Initialize the evaluation methods.
            _evaluationMethods = EvaluationMethod.GetOrCreateEvaluationMethods(transform);
#if UNITY_EDITOR
            UnityEditorInternal.InternalEditorUtility.SetIsInspectorExpanded(processing, false);
#endif //UNITY_EDITOR
        }
        /// <summary>
        /// Enables the user to select a blending method.
        /// </summary>
        private void SectionBlendingMethod()
        {
            RenderingMethod[] compatibleBlendingMethods = RenderingMethod.GetCompatibleRenderingMethods(_targetObject);
            string            label   = "Type:";
            string            tooltip = "Choice of a blending method.";

            _targetObject.selectedBlendingMethod = DisplayMethodGUI <RenderingMethod>(label, tooltip, _targetObject.renderingMethods, compatibleBlendingMethods, _propertyRenderingMethodIndex);
            _targetObject.processing.cameraSetup.SectionColorIsIndices();
            _targetObject.processing.dataHandler.SectionGenerateColliders();
            label   = "Underlying scene representation:";
            tooltip = "Set of processed assets that this blending method will use for rendering.";
            bool isGUIEnabled = GUI.enabled;

            GUI.enabled = false;
            EditorGUILayout.Space();
            EditorGUILayout.LabelField(new GUIContent(label, tooltip));
            ProcessingMethod[] sceneRepresentationMethods = _targetObject.selectedBlendingMethod.sceneRepresentationMethods;
            foreach (ProcessingMethod method in sceneRepresentationMethods)
            {
                if (method == null)
                {
                    continue;
                }
                using (var horizontalScope = new EditorGUILayout.HorizontalScope())
                {
                    EditorGUILayout.ToggleLeft(string.Empty, true, GUILayout.MaxWidth(30f));
                    GeneralToolkit.addedSpace = -15f;
                    GUILayout.Space(GeneralToolkit.addedSpace);
                    using (var verticalScope = new EditorGUILayout.VerticalScope())
                    {
                        GUILayout.Space(3f);
                        GUIContent labelGUIContent = method.GetProcessedDataName();
                        EditorGUILayout.LabelField(labelGUIContent, GeneralToolkit.wordWrapStyle, GUILayout.MaxWidth(GeneralToolkit.EditorGetCurrentScopeWidth() - 35f));
                    }
                    GeneralToolkit.addedSpace = 0f;
                }
            }
            GUI.enabled = isGUIEnabled;
            EditorGUILayout.Space();
        }