Exemplo n.º 1
0
    private void CreateAtomSourceGameObject(bool createGameObjectFlag)
    {
        if (Selection.gameObjects.Length == 0)
        {
            createGameObjectFlag = true;
        }
        var acbInfoList = projInfo.GetAcbInfoList(false, searchPath);

        if (acbInfoList.Count > this.selectedCueSheetId)
        {
            GameObject go = null;
            if (createGameObjectFlag)
            {
                go = new GameObject(acbInfoList[this.selectedCueSheetId].cueInfoList[this.selectedCueInfoIndex].name + "(CriAtomSource)");
                if (Selection.gameObjects.Length > 0)
                {
                    go.transform.parent = Selection.gameObjects[0].transform;
                }
                Undo.RegisterCreatedObjectUndo(go, "Create AtomSource GameObject");
            }
            else
            {
                go = Selection.gameObjects[0];
            }
            var     acbInfo = acbInfoList[this.selectedCueSheetId];
            CriAtom atom    = GameObject.FindObjectOfType(typeof(CriAtom)) as CriAtom;
            if (atom == null)
            {
                atom = CriWare.Common.managerObject.AddComponent <CriAtom>();
                var acfList = projInfo.GetAcfInfoList(false, searchPath);
                if (acfList.Count > selectedAcfId)
                {
                    atom.acfFile = acfList[selectedAcfId].filePath;
                }
            }
            CriAtomCueSheet cueSheet = atom.GetCueSheetInternal(acbInfo.name);
            if (cueSheet == null)
            {
                cueSheet = atom.AddCueSheetInternal(null, acbInfo.acbPath, acbInfo.awbPath, null);
            }
            CriAtomSource newCriAtomSource = go.AddComponent <CriAtomSource>();
            if (createGameObjectFlag == false)
            {
                Undo.RegisterCreatedObjectUndo(newCriAtomSource, "Add AtomSource Component");
            }
            newCriAtomSource.cueSheet = cueSheet.name;
            newCriAtomSource.cueName  = acbInfo.cueInfoList[this.selectedCueInfoIndex].name;
            Selection.activeObject    = go;
        }
    }
Exemplo n.º 2
0
    private void CreateAtomSourceGameObject(bool createGameObjectFlag)
    {
        if (Selection.gameObjects.Length == 0)
        {
            createGameObjectFlag = true;
        }

        var acbInfoList = CriAtomAcfInfo.acfInfo.GetAcbInfoList(false, searchPath);

        if (acbInfoList.Length > this.selectedCueSheetId)
        {
            GameObject go = null;
            if (createGameObjectFlag)
            {
                go = new GameObject(acbInfoList[this.selectedCueSheetId].cueInfoList[this.selectedCueId].name + "(CriAtomSource)");
                if (Selection.gameObjects.Length > 0)
                {
                    go.transform.parent = Selection.gameObjects[0].transform;
                }
            }
            else
            {
                go = Selection.gameObjects[0];
            }

            var     acbInfo = acbInfoList[this.selectedCueSheetId];
            CriAtom atom    = GameObject.FindObjectOfType(typeof(CriAtom)) as CriAtom;
            if (atom == null)
            {
                atom         = CriWare.managerObject.AddComponent <CriAtom>();
                atom.acfFile = CriAtomAcfInfo.acfInfo.acfPath;
            }
            CriAtomCueSheet cueSheet = atom.GetCueSheetInternal(acbInfo.name);
            if (cueSheet == null)
            {
                cueSheet = atom.AddCueSheetInternal(null, acbInfo.acbPath, acbInfo.awbPath, null);
            }

            CriAtomSource newCriAtomSource = go.AddComponent <CriAtomSource>();
            newCriAtomSource.cueSheet = cueSheet.name;
            newCriAtomSource.cueName  = acbInfo.cueInfoList[this.selectedCueId].name;


            Selection.activeObject = go;

            //Debug.Log("Add \"CRI Atom Souce\" \"" + newCriAtomSource.AcbName + "/" + newCriAtomSource.CueName + "\"");
        }
    }