// Token: 0x06000370 RID: 880 RVA: 0x0001E7E0 File Offset: 0x0001C9E0 public ACCTexturesView(Material m, int matNo) { this.material = m; ShaderType type = ShaderType.Resolve(m.shader.name); this.original = ACCTexturesView.Load(m, type); this.edited = new List <ACCTexture>(this.original.Count); foreach (ACCTexture src in this.original) { this.edited.Add(new ACCTexture(src)); } this.matNo = matNo; }
// Token: 0x0600036F RID: 879 RVA: 0x0001E744 File Offset: 0x0001C944 public static List <ACCTexture> Load(Material mate, ShaderType type1) { if (type1 == null) { type1 = ShaderType.Resolve(mate.shader.name); } List <ACCTexture> list = new List <ACCTexture>(type1.texProps.Length); list.AddRange(from texProp in type1.texProps select ACCTexture.Create(mate, texProp, type1) into tex where tex != null select tex); return(list); }
public static List <ACCTexture> Load(Material mate, ShaderType type1) { if (type1 == null) { type1 = ShaderType.Resolve(mate.shader.name); } var ret = new List <ACCTexture>(type1.texProps.Length); ret.AddRange( type1.texProps.Select(texProp => ACCTexture.Create(mate, texProp, type1)) .Where(tex => tex != null)); return(ret); }
public ACCTexturesView(Material m, int matNo) { this.material = m; //this.matType = ShaderMapper.resolve(m.shader.name); // this.original = Load(m, matType); this.type = ShaderType.Resolve(m.shader.name); this.original = Load(m, type); this.edited = new List <ACCTexture>(original.Count); foreach (var tex in original) { edited.Add(new ACCTexture(tex)); } this.matNo = matNo; }
public static List <ACCTexture> Load(Material mate, ShaderType type) { if (type == null) { type = ShaderType.Resolve(mate.shader.name); } var ret = new List <ACCTexture>(type.texProps.Length); foreach (var texProp in type.texProps) { var tex = ACCTexture.Create(mate, texProp, type); if (tex != null) { ret.Add(tex); } } return(ret); }
public void Save(string fileName, string presetName, Dictionary <string, bool> dDelNodes) { Maid maid = holder.currentMaid; // カレントのメイドデータからプリセットデータを抽出 var preset = new PresetData(); preset.name = presetName; foreach (SlotInfo slotInfo in ACConstants.SlotNames.Values) { if (!slotInfo.enable) { continue; } TBodySkin slot = maid.body0.GetSlot((int)slotInfo.Id); // マスク情報を抽出 SlotState maskState; if (slot.obj == null) { maskState = SlotState.NotLoaded; } else if (!slot.boVisible) { maskState = SlotState.Masked; } else { maskState = SlotState.Displayed; } Material[] materialList = holder.GetMaterials(slot); if (materialList.Length == 0) { continue; } var slotItem = new CCSlot(slotInfo.Id); slotItem.mask = maskState; foreach (Material material in materialList) { var type = ShaderType.Resolve(material.shader.name); if (type == ShaderType.UNKNOWN) { continue; } var cmat = new CCMaterial(material, type); slotItem.Add(cmat); foreach (var texProp in type.texProps) { var tex2d = material.GetTexture(texProp.propId) as Texture2D; if (tex2d == null || string.IsNullOrEmpty(tex2d.name)) { continue; } var ti = new TextureInfo(); cmat.Add(ti); ti.propName = texProp.keyName; ti.texFile = tex2d.name; var fp = texModifier.GetFilter(maid, slotInfo.Id.ToString(), material.name, tex2d.name); if (fp != null && !fp.hasNotChanged()) { ti.filter = new TexFilter(fp); } } } preset.slots.Add(slotItem); } for (int i = TypeUtil.BODY_START; i <= TypeUtil.BODY_END; i++) { var mpn = (MPN)Enum.ToObject(typeof(MPN), i); MaidProp mp = maid.GetProp(mpn); if (mp != null) { if (!String.IsNullOrEmpty(mp.strFileName)) { preset.mpns.Add(new CCMPN(mpn, mp.strFileName)); } else { preset.mpnvals.Add(new CCMPNValue(mpn, mp.value, mp.min, mp.max)); } } } for (int i = TypeUtil.WEAR_START; i <= TypeUtil.WEAR_END; i++) { var mpn = (MPN)Enum.ToObject(typeof(MPN), i); MaidProp mp = maid.GetProp(mpn); if (mp != null && !String.IsNullOrEmpty(mp.strFileName)) { preset.mpns.Add(new CCMPN(mpn, mp.strFileName)); } } // for (int i = (int)MPN_TYPE_RANGE.FOLDER_BODY_START; i <= (int)MPN_TYPE_RANGE.FOLDER_BODY_END; i++) { // var mpn = (MPN)Enum.ToObject(typeof(MPN), i); // MaidProp mp = maid.GetProp(mpn); // if (mp != null) { // LogUtil.Debug(mpn,":", mp.type, ", value=", mp.value, ", temp=", mp.temp_value, ", file=", mp.strFileName); // } // } // 無限色 for (int j = TypeUtil.PARTSCOLOR_START; j <= TypeUtil.PARTSCOLOR_END; j++) { var pcEnum = (MaidParts.PARTS_COLOR)j; MaidParts.PartsColor part = maid.Parts.GetPartsColor(pcEnum); preset.partsColors[pcEnum.ToString()] = new CCPartsColor(part); } // 表示ノード preset.delNodes = new Dictionary <string, bool>(dDelNodes); LogUtil.Debug("create preset...", fileName); SavePreset(fileName, preset); }
// Token: 0x06000066 RID: 102 RVA: 0x00007270 File Offset: 0x00005470 public void Save(string fileName, string presetName, Dictionary <string, bool> dDelNodes) { Maid currentMaid = this._holder.CurrentMaid; PresetData presetData = new PresetData { name = presetName }; foreach (SlotInfo slotInfo in ACConstants.SlotNames.Values) { if (slotInfo.enable) { TBodySkin slot = currentMaid.body0.GetSlot((int)slotInfo.Id); SlotState mask; if (slot.obj == null) { mask = SlotState.NotLoaded; } else if (!slot.boVisible) { mask = SlotState.Masked; } else { mask = SlotState.Displayed; } Material[] materials = this._holder.GetMaterials(slot); if (materials.Length != 0) { CCSlot ccslot = new CCSlot(slotInfo.Id) { mask = mask }; foreach (Material material in materials) { ShaderType shaderType = ShaderType.Resolve(material.shader.name); if (shaderType != ShaderType.UNKNOWN) { CCMaterial ccmaterial = new CCMaterial(material, shaderType); ccslot.Add(ccmaterial); foreach (ShaderPropTex shaderPropTex in shaderType.texProps) { Texture2D texture2D = material.GetTexture(shaderPropTex.propId) as Texture2D; if (!(texture2D == null) && !string.IsNullOrEmpty(texture2D.name)) { TextureInfo textureInfo = new TextureInfo(); ccmaterial.Add(textureInfo); textureInfo.propName = shaderPropTex.keyName; textureInfo.texFile = texture2D.name; TextureModifier.FilterParam filter = this._texModifier.GetFilter(currentMaid, slotInfo.Id.ToString(), material.name, texture2D.name); if (filter != null && !filter.HasNotChanged()) { textureInfo.filter = new TexFilter(filter); } Vector2 textureOffset = material.GetTextureOffset(shaderPropTex.propId); if (Math.Abs(textureOffset.x) > 0.001f) { textureInfo.offsetX = new float?(textureOffset.x); } if (Math.Abs(textureOffset.y) > 0.001f) { textureInfo.offsetY = new float?(textureOffset.y); } Vector2 textureScale = material.GetTextureScale(shaderPropTex.propId); if (Math.Abs(textureScale.x) > 0.001f) { textureInfo.scaleX = new float?(textureScale.x); } if (Math.Abs(textureScale.y) > 0.001f) { textureInfo.scaleY = new float?(textureScale.y); } } } } } presetData.slots.Add(ccslot); } } } for (int k = TypeUtil.BODY_START; k <= TypeUtil.BODY_END; k++) { MPN mpn = (MPN)Enum.ToObject(typeof(MPN), k); MaidProp prop = currentMaid.GetProp(mpn); if (prop != null) { if (prop.type == 1 || prop.type == 2) { presetData.mpnvals.Add(new CCMPNValue(mpn, prop.value, prop.min, prop.max)); } else if (prop.type == 3 && prop.nFileNameRID != 0) { presetData.mpns.Add(new CCMPN(mpn, prop.strFileName)); } } } for (int l = TypeUtil.WEAR_START; l <= TypeUtil.WEAR_END; l++) { MPN mpn2 = (MPN)Enum.ToObject(typeof(MPN), l); MaidProp prop2 = currentMaid.GetProp(mpn2); if (prop2 != null && prop2.nFileNameRID != 0) { presetData.mpns.Add(new CCMPN(mpn2, prop2.strFileName)); } } for (MaidParts.PARTS_COLOR parts_COLOR = TypeUtil.PARTS_COLOR_START; parts_COLOR <= TypeUtil.PARTS_COLOR_END; parts_COLOR++) { MaidParts.PartsColor partsColor = currentMaid.Parts.GetPartsColor(parts_COLOR); presetData.partsColors[parts_COLOR.ToString()] = new CCPartsColor(partsColor); } presetData.delNodes = new Dictionary <string, bool>(dDelNodes); LogUtil.Debug(new object[] { "create preset...", fileName }); this.SavePreset(fileName, presetData); }
public void Save(string fileName, string presetName, Dictionary <string, bool> dDelNodes) { var maid = _holder.CurrentMaid; // カレントのメイドデータからプリセットデータを抽出 var preset = new PresetData { name = presetName }; foreach (var slotInfo in ACConstants.SlotNames.Values) { if (!slotInfo.enable) { continue; } var slot = maid.body0.GetSlot((int)slotInfo.Id); // マスク情報を抽出 SlotState maskState; if (slot.obj == null) { maskState = SlotState.NotLoaded; } else if (!slot.boVisible) { maskState = SlotState.Masked; } else { maskState = SlotState.Displayed; } var materialList = _holder.GetMaterials(slot); if (materialList.Length == 0) { continue; } var slotItem = new CCSlot(slotInfo.Id) { mask = maskState }; foreach (var material in materialList) { var type = ShaderType.Resolve(material.shader.name); if (type == ShaderType.UNKNOWN) { continue; } var cmat = new CCMaterial(material, type); slotItem.Add(cmat); foreach (var texProp in type.texProps) { var tex2D = material.GetTexture(texProp.propId) as Texture2D; if (tex2D == null || string.IsNullOrEmpty(tex2D.name)) { continue; } var ti = new TextureInfo(); cmat.Add(ti); ti.propName = texProp.keyName; ti.texFile = tex2D.name; var fp = _texModifier.GetFilter(maid, slotInfo.Id.ToString(), material.name, tex2D.name); if (fp != null && !fp.HasNotChanged()) { ti.filter = new TexFilter(fp); } #if UNITY_5_6_OR_NEWER var offset = material.GetTextureOffset(texProp.propId); #else var offset = material.GetTextureOffset(texProp.keyName); #endif if (Math.Abs(offset.x) > ConstantValues.EPSILON_3) { ti.offsetX = offset.x; } if (Math.Abs(offset.y) > ConstantValues.EPSILON_3) { ti.offsetY = offset.y; } #if UNITY_5_6_OR_NEWER var scale = material.GetTextureScale(texProp.propId); #else var scale = material.GetTextureScale(texProp.keyName); #endif if (Math.Abs(scale.x) > ConstantValues.EPSILON_3) { ti.scaleX = scale.x; } if (Math.Abs(scale.y) > ConstantValues.EPSILON_3) { ti.scaleY = scale.y; } } } preset.slots.Add(slotItem); } for (var i = TypeUtil.BODY_START; i <= TypeUtil.BODY_END; i++) { var mpn = (MPN)Enum.ToObject(typeof(MPN), i); var mp = maid.GetProp(mpn); if (mp == null) { continue; } // 身体パラメータ if (mp.type == 1 || mp.type == 2) { preset.mpnvals.Add(new CCMPNValue(mpn, mp.value, mp.min, mp.max)); continue; } // スロットアイテム if (mp.type == 3 && mp.nFileNameRID != 0) { preset.mpns.Add(new CCMPN(mpn, mp.strFileName)); } } // FOLDER_BODYは自動で0にリセットされるためプリセットの保持する必要はない // for (var i = MPN_TYPE_RANGE.FOLDER_BODY_START; i <= MPN_TYPE_RANGE.FOLDER_BODY_END; i++) { // var mpn = (MPN)Enum.ToObject(typeof(MPN), i); // var mp = maid.GetProp(mpn); // if (mp == null || mp.nFileNameRID == 0) continue; // preset.mpns.Add(new CCMPN(mpn, mp.strFileName)); // } for (var i = TypeUtil.WEAR_START; i <= TypeUtil.WEAR_END; i++) { var mpn = (MPN)Enum.ToObject(typeof(MPN), i); var mp = maid.GetProp(mpn); if (mp != null && mp.nFileNameRID != 0) { preset.mpns.Add(new CCMPN(mpn, mp.strFileName)); } } // 無限色 for (var pcEnum = TypeUtil.PARTS_COLOR_START; pcEnum <= TypeUtil.PARTS_COLOR_END; pcEnum++) { var part = maid.Parts.GetPartsColor(pcEnum); preset.partsColors[pcEnum.ToString()] = new CCPartsColor(part); } // 表示ノード preset.delNodes = new Dictionary <string, bool>(dDelNodes); LogUtil.Debug("create preset...", fileName); SavePreset(fileName, preset); }
protected override void OnTranslate(ShaderTranslationContext sc, MemberAccessExpressionSyntax syntax, ScopeInfo scope) { switch (syntax.Expression) { case IdentifierNameSyntax idSyntax: // Is this a static class identifier? // Static classes are abstract and sealed at IL level. Type targetType = ShaderType.Resolve(sc, idSyntax.Identifier.ValueText); if (targetType != null && targetType.IsClass && targetType.IsAbstract && targetType.IsSealed) { // Is the member a constant value? If so, we can take it's value directly. FieldInfo fInfo = targetType.GetField(syntax.Name.Identifier.ValueText); if (fInfo != null && (fInfo.Attributes & FieldAttributes.Literal) == FieldAttributes.Literal) { object val = fInfo.GetValue(null); if (val != null) { sc.Source.Append(val.ToString()); sc.CompleteChildren(syntax); return; } } } else { ScopeInfo cScope = scope.FindOfType(ScopeType.Class); if (cScope == sc.Source.RootScope) { FieldInfo fInfo = cScope.TypeInfo.OriginalType.GetField(idSyntax.Identifier.ValueText); if (fInfo != null && sc.ConstantBuffers.Values.Any(x => x.TypeInfo == fInfo.FieldType)) { if (!sc.Language.InstancedConstantBuffers) { sc.CompleteSelfAndChildren(syntax.Expression); sc.Runner.Translate(sc, syntax.Name); return; } } } } break; case ThisExpressionSyntax thisSyntax: case BaseExpressionSyntax baseSyntax: ScopeInfo pScope = scope.FindOfType(ScopeType.Class); if (pScope.TypeInfo.OriginalType == sc.ShaderType) { sc.Complete(syntax.Expression); // Are we translating a shader intrinsic method/function? if (syntax.Name is IdentifierNameSyntax idSyntax && syntax.Parent is InvocationExpressionSyntax) { string translatedIntrinsic = ShaderType.GetIntrinsicTranslation(sc, idSyntax.Identifier.ValueText); sc.Source.Append(translatedIntrinsic); sc.Complete(syntax.Name); } return; } break; } sc.Runner.Translate(sc, syntax.Expression); sc.Source.Append(syntax.OperatorToken); sc.Runner.Translate(sc, syntax.Name); }