コード例 #1
0
        private void OnGenerateNormals(object sender, EventArgs e)
        {
            if (_normalsDialog != null)
            {
                _normalsDialog.Close();
                _normalsDialog.Dispose();
                _normalsDialog = null;
            }
            _normalsDialog = new NormalVectorGeneratorDialog(_scene, _mesh, _meshName);
            _normalsDialog.Show(this);

            // Disable this dialog for the duration of the NormalsVectorGeneratorDialog.
            // The latter replaces the mesh being displayed with a temporary preview
            // mesh, so changes made to the source mesh would not be visible. This is
            // very confusing, so disallow it.
            EnableDialogControls(false);
            _normalsDialog.FormClosed +=
                (o, args) =>
            {
                if (IsDisposed)
                {
                    return;
                }
                _normalsDialog = null;
                EnableDialogControls(true);
                // Unless the user canceled the operation, Normals were added.
                UpdateVertexItems();
            };
        }
コード例 #2
0
        private void OnGenerateNormals(object sender, EventArgs e)
        {
            var activeTab = UiState.ActiveTab;

            if (activeTab.ActiveScene == null)
            {
                return;
            }

            var scene = activeTab.ActiveScene;

            if (_normalsDialog != null)
            {
                _normalsDialog.Close();
                _normalsDialog.Dispose();
                _normalsDialog = null;
            }
            _normalsDialog = new NormalVectorGeneratorDialog(scene, scene.Raw.Meshes, TabPageForTab(activeTab).Text + " (all meshes)");
            _normalsDialog.Show(this);
        }
コード例 #3
0
        private void OnGenerateMeshNormals(object sender, EventArgs e)
        {
            var node = GetTreeNodeForContextMenuEvent(sender);

            if (node == null || !(node.Tag as KeyValuePair <Node, Mesh>?).HasValue)
            {
                return;
            }
            var nodeMeshPair = (KeyValuePair <Node, Mesh>)node.Tag;
            var mesh         = nodeMeshPair.Value;

            if (_normalsDialog != null)
            {
                _normalsDialog.Close();
                _normalsDialog.Dispose();
                _normalsDialog = null;
            }
            _normalsDialog = new NormalVectorGeneratorDialog(_scene, mesh, node.Text);
            _normalsDialog.Show(this);
        }