コード例 #1
0
 private void comboBoxSourceNmlMonoBehaviour_DropDown(object sender, EventArgs e)
 {
     try
     {
         HashSet <string> parsers = new HashSet <string>();
         for (int i = 1; i < comboBoxSourceNmlMonoBehaviour.Items.Count; i++)
         {
             Tuple <string, string> item = (Tuple <string, string>)comboBoxSourceNmlMonoBehaviour.Items[i];
             parsers.Add(item.Item2);
         }
         if (comboBoxSourceNmlMonoBehaviour.Items.Count == 0)
         {
             comboBoxSourceNmlMonoBehaviour.Items.Add(new Tuple <string, string>("(none)", null));
             comboBoxSourceNmlMonoBehaviour.SelectedIndexChanged -= comboBoxSourceNmlMonoBehaviour_SelectedIndexChanged;
             comboBoxSourceNmlMonoBehaviour.SelectedItem          = comboBoxSourceNmlMonoBehaviour.Items[0];
             comboBoxSourceNmlMonoBehaviour.SelectedIndexChanged += comboBoxSourceNmlMonoBehaviour_SelectedIndexChanged;
         }
         foreach (var pair in Gui.Scripting.Variables)
         {
             if (pair.Value is NmlMonoBehaviour)
             {
                 NmlMonoBehaviour parser = (NmlMonoBehaviour)pair.Value;
                 if (parser != Editor.Parser && !parsers.Contains(pair.Key))
                 {
                     Tuple <string, string> item = new Tuple <string, string>(parser.m_Name, pair.Key);
                     comboBoxSourceNmlMonoBehaviour.Items.Add(item);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
コード例 #2
0
        public FormNmlMonoBehaviour(UnityParser uParser, string nmlMonoBehaviourParserVar)
        {
            try
            {
                InitializeComponent();

                NmlMonoBehaviour parser = (NmlMonoBehaviour)Gui.Scripting.Variables[nmlMonoBehaviourParserVar];

                this.ShowHint    = DockState.Document;
                this.Text        = parser.m_Name;
                this.ToolTipText = uParser.FilePath + @"\" + this.Text;

                ParserVar = nmlMonoBehaviourParserVar;

                EditorVar = Gui.Scripting.GetNextVariable("nmlMonoBehaviourEditor");
                Editor    = (NmlMonoBehaviourEditor)Gui.Scripting.RunScript(EditorVar + " = NmlMonoBehaviourEditor(parser=" + ParserVar + ")");

                Init();
                LoadNml();
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
コード例 #3
0
ファイル: NmlMonoBehaviourEditor.cs プロジェクト: kkdevs/sb3u
        public void ComputeMinMaxNormals(object[] nmlMeshIds, AnimatorEditor dstAnimatorEditor, object[] adjacentAnimatorEditorMeshIdPairs, double adjacentSquaredDistance, bool worldCoordinates)
        {
            string path      = Path.GetDirectoryName(Parser.file.Parser.FilePath);
            string file      = Path.GetFileNameWithoutExtension(Parser.file.Parser.FilePath);
            string backupExt = Path.GetExtension(Parser.file.Parser.FilePath);

            backupExt = backupExt == String.Empty ? backupExt = "None" : backupExt.Substring(1);
            backupExt = (string)Properties.Settings.Default["BackupExtension" + backupExt];
            UnityParser   srcFileParser = new UnityParser(path + @"\" + file + ".bak0" + backupExt);
            Unity3dEditor srcFileEditor = new Unity3dEditor(srcFileParser);

            srcFileEditor.GetAssetNames(true);
            Animator srcAnimator = null;

            if (dstAnimatorEditor.Parser.classID() != UnityClassID.Animator)
            {
                Component baseAsset = srcFileParser.Cabinet.Components.Find
                                      (
                    delegate(Component asset)
                {
                    return(asset is NotLoaded && asset.classID() == UnityClassID.GameObject && ((NotLoaded)asset).Name == dstAnimatorEditor.Parser.m_GameObject.instance.m_Name);
                }
                                      );
                srcAnimator = srcFileEditor.OpenVirtualAnimator(srcFileParser.Cabinet.Components.IndexOf(baseAsset));
            }
            else
            {
                Component baseAsset = srcFileParser.Cabinet.Components.Find
                                      (
                    delegate(Component asset)
                {
                    return(asset is NotLoaded && asset.classID() == UnityClassID.Animator && ((NotLoaded)asset).Name == dstAnimatorEditor.Parser.m_GameObject.instance.m_Name);
                }
                                      );
                srcAnimator = srcFileEditor.OpenAnimator(srcFileParser.Cabinet.Components.IndexOf(baseAsset));
            }
            AnimatorEditor srcAnimatorEditor = new AnimatorEditor(srcAnimator);

            Component srcNmlAsset = srcFileParser.Cabinet.Components.Find
                                    (
                delegate(Component asset)
            {
                return(asset is NotLoaded && asset.classID() == UnityClassID.MonoBehaviour && ((NotLoaded)asset).Name == Parser.m_Name);
            }
                                    );
            NmlMonoBehaviour srcNml = srcFileEditor.OpenNmlMonoBehaviour(srcFileParser.Cabinet.Components.IndexOf(srcNmlAsset));

            ComputeMinMaxNormals(nmlMeshIds, dstAnimatorEditor, srcNml, -1, srcAnimatorEditor, adjacentAnimatorEditorMeshIdPairs, adjacentSquaredDistance, worldCoordinates);
        }
コード例 #4
0
        private void comboBoxSourceNmlMonoBehaviour_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                comboBoxSourceMesh.Items.Clear();
                RefreshLabelSourceWarning();

                Tuple <string, string> item = (Tuple <string, string>)comboBoxSourceNmlMonoBehaviour.SelectedItem;
                if (item == null || item.Item2 == null)
                {
                    toolTip1.SetToolTip(comboBoxSourceNmlMonoBehaviour, null);
                    return;
                }

                NmlMonoBehaviour       srcNmlParser = (NmlMonoBehaviour)Gui.Scripting.Variables[item.Item2];
                NmlMonoBehaviourEditor srcNmlEditor = new NmlMonoBehaviourEditor(srcNmlParser);
                int selectIdx = -1;
                for (int i = 0; i < srcNmlEditor.GenericMonos.Count; i++)
                {
                    Tuple <string, int> obj = new Tuple <string, int>(srcNmlEditor.GenericMonos[i].ObjectName, i);
                    comboBoxSourceMesh.Items.Add(obj);
                    if (listViewNmlMeshes.SelectedIndices.Count > 0 && obj.Item1 == listViewNmlMeshes.SelectedItems[0].Text)
                    {
                        selectIdx = i;
                    }
                }
                comboBoxSourceMesh.SelectedIndex = selectIdx < 0 && comboBoxSourceMesh.Items.Count > 0 ? 0 : selectIdx;

                string tip = item.Item1 + " (" + ((NmlMonoBehaviour)Gui.Scripting.Variables[item.Item2]).file.Parser.FilePath + ")";
                toolTip1.SetToolTip(comboBoxSourceNmlMonoBehaviour, tip);
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
コード例 #5
0
ファイル: NmlMonoBehaviourEditor.cs プロジェクト: kkdevs/sb3u
 public NmlMonoBehaviourEditor(NmlMonoBehaviour parser)
 {
     Parser       = parser;
     GenericMonos = Parser.Param;
 }
コード例 #6
0
ファイル: NmlMonoBehaviourEditor.cs プロジェクト: kkdevs/sb3u
        public void ComputeMinMaxNormals(object[] nmlMeshIds, AnimatorEditor dstAnimatorEditor, NmlMonoBehaviour srcNmlParser, int srcNmlMeshId, AnimatorEditor srcAnimatorEditor, object[] adjacentAnimatorEditorMeshIdPairs, double adjacentSquaredDistance, bool worldCoordinates)
        {
            NmlMonoBehaviourEditor srcNmlEditor = new NmlMonoBehaviourEditor(srcNmlParser);

            ComputeMinMaxNormals(nmlMeshIds, dstAnimatorEditor, srcNmlEditor, srcNmlMeshId, srcAnimatorEditor, adjacentAnimatorEditorMeshIdPairs, adjacentSquaredDistance, worldCoordinates);
        }