private void removeNodeButton_Click(object sender, EventArgs e) { if (currentInfo == null) { return; } MaxNodeTree.BeginUpdate(); for (int i = 0; i < Loader.Core.SelNodeCount; ++i) { IINode node = Loader.Core.GetSelNode(i); MaxNodeTree.QueueRemoveNode(node); } MaxNodeTree.EndUpdate(); }
void SetFieldsFromInfo(AnimationGroup info) { if (info != null) { nameTextBox.Enabled = true; startTextBox.Enabled = true; endTextBox.Enabled = true; nameTextBox.Text = info.Name.ToString(); startTextBox.Text = info.FrameStart.ToString(); endTextBox.Text = info.FrameEnd.ToString(); // a color can still be red after setting the string: // possible if we change a name, don't confirm and switch to another item with the same name ResetChangedTextBoxColors(); MaxNodeTree.BeginUpdate(); //here we garanty retrocompatibility MaxNodeTree.QueueSetNodes(info.NodeGuids.ToHandles(), false); List <uint> handles; MaxNodeTree.ApplyQueuedChanges(out handles, false); MaxNodeTree.EndUpdate(); // if the nodes changed on max' side, even though the data has not changed, the list may be different (e.g. deleted nodes) // since we haven't loaded the list before, we can't compare it to the node tree // thus, we save it, and the property checks for actual differences (and set isdirty to true) info.NodeGuids = handles.ToGuids(); if (info.IsDirty) { InfoChanged?.Invoke(info); } } else { nameTextBox.Enabled = false; startTextBox.Enabled = false; endTextBox.Enabled = false; nameTextBox.Text = ""; startTextBox.Text = ""; endTextBox.Text = ""; MaxNodeTree.BeginUpdate(); MaxNodeTree.QueueSetNodes(null, false); List <uint> handles; MaxNodeTree.ApplyQueuedChanges(out handles, false); MaxNodeTree.EndUpdate(); } }
private void addSelectedButton_Click(object sender, EventArgs e) { if (currentInfo == null) { return; } MaxNodeTree.BeginUpdate(); for (int i = 0; i < Loader.Core.SelNodeCount; ++i) { IINode node = Loader.Core.GetSelNode(i); //added in flightsim to add lod node "x0_name" and all other lod relative // x1_name,x2_name etc //todo expost addnode to maxscript and call this outside if (node.Name.StartsWith("x")) { string lod_name = node.Name.Substring(3); string lod_prefix = node.Name.Replace(lod_name, ""); if (lod_prefix.ToCharArray()[0] == 'x' && lod_prefix.ToCharArray()[2] == '_') { for (int j = 0; j < 7; j++) { string relativeLodName = "x" + j + "_" + lod_name; IINode relativeLodNode = Loader.Core.GetINodeByName(relativeLodName); if (relativeLodNode != null) { MaxNodeTree.QueueAddNode(relativeLodNode); } } } else { MaxNodeTree.QueueAddNode(node); } } else { MaxNodeTree.QueueAddNode(node); } } MaxNodeTree.EndUpdate(); }
void SetFieldsFromInfo(AnimationGroup info) { if (info != null) { nameTextBox.Enabled = true; startTextBox.Enabled = true; endTextBox.Enabled = true; nameTextBox.Text = info.Name.ToString(); startTextBox.Text = info.FrameStart.ToString(); endTextBox.Text = info.FrameEnd.ToString(); MaxNodeTree.BeginUpdate(); MaxNodeTree.QueueSetNodes(info.NodeHandles, false); MaxNodeTree.ApplyQueuedChanges(out List <uint> handles, false); MaxNodeTree.EndUpdate(); // if the nodes changed on max' side, even though the data has not changed, the list may be different (e.g. deleted nodes) // since we haven't loaded the list before, we can't compare it to the node tree // thus, we save it, and the property checks for actual differences (and set isdirty to true) info.NodeHandles = handles; if (info.IsDirty) { InfoChanged?.Invoke(info); } } else { nameTextBox.Enabled = false; startTextBox.Enabled = false; endTextBox.Enabled = false; nameTextBox.Text = ""; startTextBox.Text = ""; endTextBox.Text = ""; MaxNodeTree.BeginUpdate(); MaxNodeTree.QueueSetNodes(null, false); MaxNodeTree.ApplyQueuedChanges(out List <uint> handles, false); MaxNodeTree.EndUpdate(); } }
private void removeNodeButton_Click(object sender, EventArgs e) { if (currentInfo == null) { return; } if (currentAnimationParseType == AnimationParseType.Nodes) { MaxNodeTree.BeginUpdate(); for (int i = 0; i < Loader.Core.SelNodeCount; ++i) { IINode node = Loader.Core.GetSelNode(i); MaxNodeTree.QueueRemoveNode(node); } MaxNodeTree.EndUpdate(); } if (currentAnimationParseType == AnimationParseType.Materials) { if (Loader.Core.SelNodeCount < 1) { MessageBox.Show("You need to select at least one Node"); return; } for (int i = 0; i < Loader.Core.SelNodeCount; ++i) { IINode node = Loader.Core.GetSelNode(i); IMtl material = node.GetAnimatableMaterial(); if (material != null) { maxMaterialView.RemoveMaterialFromSelection(material); } } } }
private void addSelectedButton_Click(object sender, EventArgs e) { if (currentInfo == null) { return; } if (currentAnimationParseType == AnimationParseType.Nodes) { MaxNodeTree.BeginUpdate(); for (int i = 0; i < Loader.Core.SelNodeCount; ++i) { IINode node = Loader.Core.GetSelNode(i); //added in flightsim to add lod node "x0_name" and all other lod relative // x1_name,x2_name etc //todo expost addnode to maxscript and call this outside if (node.Name.StartsWith("x")) { string lod_name = node.Name.Substring(3); string lod_prefix = node.Name.Replace(lod_name, ""); if (lod_prefix.ToCharArray()[0] == 'x' && lod_prefix.ToCharArray()[2] == '_') { for (int j = 0; j < 7; j++) { string relativeLodName = "x" + j + "_" + lod_name; IINode relativeLodNode = Loader.Core.GetINodeByName(relativeLodName); if (relativeLodNode != null) { MaxNodeTree.QueueAddNode(relativeLodNode); } } } else { MaxNodeTree.QueueAddNode(node); } } else { MaxNodeTree.QueueAddNode(node); } } MaxNodeTree.EndUpdate(); } if (currentAnimationParseType == AnimationParseType.Materials) { if (Loader.Core.SelNodeCount < 1) { MessageBox.Show("You need to select at least one Node"); return; } for (int i = 0; i < Loader.Core.SelNodeCount; ++i) { IINode node = Loader.Core.GetSelNode(i); IMtl material = node.GetAnimatableMaterial(); if (material != null) { maxMaterialView.AddMaterialFromSelection(material); } } } }