コード例 #1
0
        private void SelectNewOverlay(int index)
        {
            if (index < 0 || index >= overlayDataList.serializedProperty.arraySize)
            {
                currentOverlayProperty = null;
                return;
            }
            Debug.Log("Index is " + index);
            var element = overlayDataList.serializedProperty.GetArrayElementAtIndex(overlayDataList.index);

            if (element.objectReferenceValue == null)
            {
                currentOverlayProperty = null;
                return;
            }
            if (element != currentOverlayProperty)
            {
                currentOverlayProperty = element;
                OverlayDataAsset asset = currentOverlayProperty.objectReferenceValue as OverlayDataAsset;

                if (!AdditionalOverlays.ContainsKey(asset.GetInstanceID()))
                {
                    AdditionalOverlays.Add(asset.GetInstanceID(), new OverlayData(asset));
                }
                TempOverlay   = AdditionalOverlays[asset.GetInstanceID()];
                overlayEditor = new OverlayEditor(TempUMAData.umaRecipe, TempSlot, TempOverlay, baseOverlayProperty.objectReferenceValue as OverlayDataAsset);
            }
        }
コード例 #2
0
    public OverlayDataAsset GetOverlay()
    {
        #region 创建
        EditorUmaMaterial uMaterial = EditorUmaMaterialFactory.Creat(Name);

        IObjectBase texture_diffuse = new ObjectBase(texturePath);
        (new CharacterTexture(texturePath)).Handle();
        Texture2D dif = texture_diffuse.Load <Texture2D>();

        OverlayEditor    oeditor = new OverlayEditor(Fold, dif, Name, uMaterial);
        OverlayDataAsset overlay = oeditor.CreatOverlay();
        #endregion
        return(overlay);
    }
コード例 #3
0
    public OverlayDataAsset CreatOverlay()
    {
        string      fold        = string.Format("{0}/{1}/{2}", baseFold, PartName, UMAUtils.Slot);
        string      texturePath = string.Format("{0}/{1}/{2}/{3}_{4}.png", CharacterConst.rootPath, resType.ToString(), gameObject.name, gameObject.name, PartName);
        string      filename    = string.Format("{0}_{1}", gameObject.name, PartName);
        IObjectBase textureObj  = new ObjectBase(texturePath);
        Texture2D   t           = textureObj.Load <Texture2D>();

        (new CharacterTexture(texturePath)).Handle();

        OverlayEditor    oe  = new OverlayEditor(fold, t, filename, uMaterial);
        OverlayDataAsset oda = oe.CreatOverlay();

        return(oda);
    }
コード例 #4
0
    public List <SlotOverlayItem> CreatData()
    {
        List <SlotOverlayItem> sos = new List <SlotOverlayItem>();
        int    submeshIndex        = 0;
        bool   first         = false;
        string firstSlotPath = null;

        for (int i = 0; i < sharedMaterials.Count; i++)
        {
            SlotOverlayItem item         = new SlotOverlayItem();
            string          materialName = sharedMaterials[i];
            string          name         = baseName + "-" + i;
            if (!first)
            {
                #region slot
                SlotEditor    so        = new SlotEditor(slotMesh, name, slotFold, Mat);
                SlotDataAsset firstSlot = so.Creat();
                item.slot     = firstSlot;
                firstSlotPath = string.Format("{0}/{1}_{2}.asset", PathHelper.GetRelativeAssetPath(slotFold), name, UMAUtils.Slot);
                #endregion

                first = true;
            }
            else
            {
                #region slot
                string target = string.Format("{0}/{1}_{2}.asset", PathHelper.GetRelativeAssetPath(slotFold), name, UMAUtils.Slot);
                FileUtil.CopyFileOrDirectory(firstSlotPath, target);

                AssetDatabase.Refresh();

                ObjectBase    obj     = new ObjectBase(target);
                SlotDataAsset slotSub = obj.Load <SlotDataAsset>();
                slotSub.subMeshIndex = i;
                item.slot            = slotSub;
                #endregion
            }

            #region overlay
            OverlayEditor oe = null;
            if (materialName.EndsWith(CharacterConst.Common))
            {
                oe = new OverlayEditor(overlayFold, comTexture, name, Mat);
            }
            else
            {
                oe = new OverlayEditor(overlayFold, diff, name, Mat);
            }

            OverlayDataAsset overlay = oe.CreatOverlay();
            item.overlay = overlay;
            #endregion

            #region index
            item.partIndex = wearpos * 10 + i;
            #endregion

            sos.Add(item);
        }


        return(sos);
    }