Ejemplo n.º 1
0
        public IPropertyEditingContext CreatePropertyContext(GUILayer.RawMaterial material)
        {
            var ps = new GUILayer.BasicPropertySource(
                new XLEBridgeUtils.RawMaterialShaderConstants_GetAndSet(material),
                GetPropertyDescriptors("gap:RawMaterial"));

            return(new XLEBridgeUtils.PropertyBridge(ps));
        }
Ejemplo n.º 2
0
        protected void ClearAndDispose(bool disposing = false)
        {
            if (!disposing)
            {
                _materialParameterBox.DataSource = null;
                _shaderConstants.DataSource      = null;
                _resourceBindings.DataSource     = null;
                foreach (var o in _controls)
                {
                    o.Object = null;
                }
                _doubleSidedCheck.DataBindings.Clear();
                _wireframeGroup.DataBindings.Clear();
                _doubleSidedCheck.CheckState = CheckState.Indeterminate;
                _wireframeGroup.CheckState   = CheckState.Indeterminate;
            }
            else
            {
                // note --  We can get a crash here if the user is currently
                //          editing a value in the data grid. We just want to
                //          release any references on the objects bound to DataSource
                //  Nothing we can do about it... just have to skip the dispose
                // _materialParameterBox.Dispose();
                // _shaderConstants.Dispose();
                // _resourceBindings.Dispose();
                foreach (var o in _controls)
                {
                    o.Dispose();
                }
                _doubleSidedCheck.Dispose();
                _wireframeGroup.Dispose();
                _doubleSidedCheck.Dispose();
                _wireframeGroup.Dispose();
            }

            if (_currentFocusMat != null)
            {
                // unbind our callbacks... We don't need to leave behind redundant callbacks everywhere
                _currentFocusMat.MaterialParameterBox.ListChanged -= OnParameterChanged;
                _currentFocusMat.ShaderConstants.ListChanged      -= OnParameterChanged;
                _currentFocusMat.ResourceBindings.ListChanged     -= OnParameterChanged;
                _currentFocusMat = null;
            }
        }
Ejemplo n.º 3
0
        protected void ClearAndDispose(bool disposing = false)
        {
            if (!disposing)
            {
                _materialParameterBox.DataSource = null;
                _shaderConstants.DataSource = null;
                _resourceBindings.DataSource = null;
                foreach (var o in _controls) o.Object = null;
                _doubleSidedCheck.DataBindings.Clear();
                _wireframeGroup.DataBindings.Clear();
                _doubleSidedCheck.CheckState = CheckState.Indeterminate;
                _wireframeGroup.CheckState = CheckState.Indeterminate;
            }
            else
            {
                    // note --  We can get a crash here if the user is currently
                    //          editing a value in the data grid. We just want to
                    //          release any references on the objects bound to DataSource
                    //  Nothing we can do about it... just have to skip the dispose
                // _materialParameterBox.Dispose();
                // _shaderConstants.Dispose();
                // _resourceBindings.Dispose();
                foreach (var o in _controls) o.Dispose();
                _doubleSidedCheck.Dispose();
                _wireframeGroup.Dispose();
                _doubleSidedCheck.Dispose();
                _wireframeGroup.Dispose();
            }

            if (_currentFocusMat != null)
            {
                    // unbind our callbacks... We don't need to leave behind redundant callbacks everywhere
                _currentFocusMat.MaterialParameterBox.ListChanged -= OnParameterChanged;
                _currentFocusMat.ShaderConstants.ListChanged -= OnParameterChanged;
                _currentFocusMat.ResourceBindings.ListChanged -= OnParameterChanged;
                _currentFocusMat = null;
            }
        }
Ejemplo n.º 4
0
        private void _addInherit_Click(object sender, EventArgs e)
        {
            var selectedMaterial = (_hierachyTree.SelectedNode != null) ? _hierachyTree.SelectedNode.Text : null;
            if (selectedMaterial == null) return;

            var result = Prompt.ShowDialog(
                "Material configuration:",
                "Add Inheritted Material Settings");
            if (result.Length > 0)
            {
                using (var mat = new GUILayer.RawMaterial(selectedMaterial))
                    mat.AddInheritted(result);
                // now we need to refresh this control with the new changes...
                Object = _activeObject;
            }
        }