void CustomDispose() { ChildForms.Clear(); if (FormVar != null) { Gui.Scripting.Variables.Remove(FormVar); FormVar = null; } if (treeView.Nodes.Count > 0) { TreeNode firstRoot = treeView.Nodes[0]; TreeNode firstChild = firstRoot.Nodes[0]; if (firstChild != null && firstChild.Tag != null && firstChild.Tag is DragSource) { DragSource ds = (DragSource)firstChild.Tag; ImportedEditor importedEditor = Gui.Scripting.Variables[ds.Variable] as ImportedEditor; if (importedEditor != null) { importedEditor.Dispose(); Gui.Scripting.Variables.Remove(ds.Variable); } } } if (Watcher != null) { if (Reopen) { Gui.Scripting.RunScript("OpenFile(path=\"" + ToolTipText + "\")", false); } Watcher.EnableRaisingEvents = false; Watcher = null; } }
private void treeView_AfterCheck(object sender, TreeViewEventArgs e) { if (e.Node.Tag is ImportedSubmesh) { TreeNode submeshNode = e.Node; ImportedSubmesh submesh = (ImportedSubmesh)submeshNode.Tag; TreeNode meshNode = submeshNode.Parent; DragSource dragSrc = (DragSource)meshNode.Tag; var srcEditor = (ImportedEditor)Gui.Scripting.Variables[dragSrc.Variable]; srcEditor.Meshes[(int)dragSrc.Id].setSubmeshEnabled(submesh, submeshNode.Checked); } else if (e.Node.Tag is ImportedMorphKeyframe) { TreeNode keyframeNode = e.Node; ImportedMorphKeyframe keyframe = (ImportedMorphKeyframe)keyframeNode.Tag; TreeNode morphNode = keyframeNode.Parent; DragSource dragSrc = (DragSource)morphNode.Tag; var srcEditor = (ImportedEditor)Gui.Scripting.Variables[dragSrc.Variable]; srcEditor.Morphs[(int)dragSrc.Id].setMorphKeyframeEnabled(keyframe, keyframeNode.Checked); } else if (e.Node.Tag is ImportedAnimationTrack) { TreeNode trackNode = e.Node; ImportedAnimationTrack track = (ImportedAnimationTrack)trackNode.Tag; TreeNode animationNode = trackNode.Parent; DragSource dragSrc = (DragSource)animationNode.Tag; var srcEditor = (ImportedEditor)Gui.Scripting.Variables[dragSrc.Variable]; srcEditor.Animations[(int)dragSrc.Id].setTrackEnabled(track, trackNode.Checked); } }
private void UpdateMorphKeyframeNode(TreeNode node) { ImportedMorphKeyframe keyframe = (ImportedMorphKeyframe)node.Tag; TreeNode morphNode = node.Parent; DragSource dragSrc = (DragSource)morphNode.Tag; var srcEditor = (ImportedEditor)Gui.Scripting.Variables[dragSrc.Variable]; string newName = srcEditor.Morphs[(int)dragSrc.Id].getMorphKeyframeNewName(keyframe); node.Text = "Morph: " + keyframe.Name + (newName != String.Empty ? ", Rename to: " + newName : null); }
private void UpdateSubmeshNode(TreeNode node) { ImportedSubmesh submesh = (ImportedSubmesh)node.Tag; TreeNode meshNode = node.Parent; DragSource dragSrc = (DragSource)meshNode.Tag; var srcEditor = (ImportedEditor)Gui.Scripting.Variables[dragSrc.Variable]; bool replaceSubmesh = srcEditor.Meshes[(int)dragSrc.Id].isSubmeshReplacingOriginal(submesh); node.Text = "Sub: V " + submesh.VertexList.Count + ", F " + submesh.FaceList.Count + ", Base: " + submesh.Index + ", Replace: " + replaceSubmesh + ", Mat: " + submesh.Material + ", World:" + submesh.WorldCoords; }
private void treeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) { DragSource source = (DragSource)e.Node.Tag; if (source.Type == typeof(WorkspaceMesh)) { var srcEditor = (ImportedEditor)Gui.Scripting.Variables[source.Variable]; ImportedMesh iMesh = srcEditor.Imported.MeshList[(int)source.Id]; WorkspaceMesh wsMesh = srcEditor.Meshes[(int)source.Id]; iMesh.Name = wsMesh.Name = e.Label; } }
private void contextMenuStripMorphKeyframe_Opening(object sender, CancelEventArgs e) { Point contextLoc = new Point(contextMenuStripMorphKeyframe.Left, contextMenuStripMorphKeyframe.Top); Point relativeLoc = treeView.PointToClient(contextLoc); TreeNode morphKeyframeNode = treeView.GetNodeAt(relativeLoc); ImportedMorphKeyframe keyframe = (ImportedMorphKeyframe)morphKeyframeNode.Tag; TreeNode morphNode = morphKeyframeNode.Parent; DragSource dragSrc = (DragSource)morphNode.Tag; var srcEditor = (ImportedEditor)Gui.Scripting.Variables[dragSrc.Variable]; string newName = srcEditor.Morphs[(int)dragSrc.Id].getMorphKeyframeNewName(keyframe); toolStripEditTextBoxNewMorphKeyframeName.Text = newName; }
private void toolStripEditTextBoxNewMorphKeyframeName_AfterEditTextChanged(object sender, EventArgs e) { Point contextLoc = new Point(contextMenuStripMorphKeyframe.Left, contextMenuStripMorphKeyframe.Top); Point relativeLoc = treeView.PointToClient(contextLoc); TreeNode morphKeyframeNode = treeView.GetNodeAt(relativeLoc); ImportedMorphKeyframe keyframe = (ImportedMorphKeyframe)morphKeyframeNode.Tag; TreeNode morphNode = morphKeyframeNode.Parent; DragSource dragSrc = (DragSource)morphNode.Tag; var srcEditor = (ImportedEditor)Gui.Scripting.Variables[dragSrc.Variable]; string newName = toolStripEditTextBoxNewMorphKeyframeName.Text; srcEditor.Morphs[(int)dragSrc.Id].setMorphKeyframeNewName(keyframe, newName != String.Empty ? newName : null); UpdateMorphKeyframeNode(morphKeyframeNode); }
private void replaceToolStripMenuItem_Click(object sender, EventArgs e) { Point contextLoc = new Point(contextMenuStripSubmesh.Left, contextMenuStripSubmesh.Top); Point relativeLoc = treeView.PointToClient(contextLoc); TreeNode submeshNode = treeView.GetNodeAt(relativeLoc); ImportedSubmesh submesh = (ImportedSubmesh)submeshNode.Tag; TreeNode meshNode = submeshNode.Parent; DragSource dragSrc = (DragSource)meshNode.Tag; var srcEditor = (ImportedEditor)Gui.Scripting.Variables[dragSrc.Variable]; bool replaceSubmesh = srcEditor.Meshes[(int)dragSrc.Id].isSubmeshReplacingOriginal(submesh); replaceSubmesh ^= true; srcEditor.Meshes[(int)dragSrc.Id].setSubmeshReplacingOriginal(submesh, replaceSubmesh); replaceToolStripMenuItem.Checked = replaceSubmesh; UpdateSubmeshNode(submeshNode); }
private void contextMenuStripSubmesh_Opening(object sender, CancelEventArgs e) { Point contextLoc = new Point(contextMenuStripSubmesh.Left, contextMenuStripSubmesh.Top); Point relativeLoc = treeView.PointToClient(contextLoc); TreeNode submeshNode = treeView.GetNodeAt(relativeLoc); ImportedSubmesh submesh = (ImportedSubmesh)submeshNode.Tag; toolStripTextBoxTargetPosition.Text = submesh.Index.ToString(); TreeNode meshNode = submeshNode.Parent; DragSource dragSrc = (DragSource)meshNode.Tag; var srcEditor = (ImportedEditor)Gui.Scripting.Variables[dragSrc.Variable]; bool replaceSubmesh = srcEditor.Meshes[(int)dragSrc.Id].isSubmeshReplacingOriginal(submesh); replaceToolStripMenuItem.Checked = replaceSubmesh; toolStripTextBoxMaterialName.Text = submesh.Material; worldCoordinatesToolStripMenuItem.Checked = submesh.WorldCoords; }