Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functions and fixes #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,6 @@ dittovehicles.sh
SF_DLL_BUILDER/ShaderForge/Properties/AssemblyInfo.cs
SF_DLL_BUILDER/ShaderForge/ShaderForge.csproj
SF_DLL_BUILDER/

.vs/
*.csproj
3 changes: 3 additions & 0 deletions Shader Forge/Assets/ShaderForge/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.orig
*.orig.meta

9 changes: 9 additions & 0 deletions Shader Forge/Assets/ShaderForge/Editor/Code/SFPSC_Blending.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class SFPSC_Blending : SFPS_Category {
public int offsetFactor = 0;
public int offsetUnits = 0;

public bool allowColorMaskWriteThroughProperties = false;
// colorMask is a bitmask
// 0 = ____
// 1 = ___A
Expand Down Expand Up @@ -143,6 +144,7 @@ public override string Serialize(){
s += Serialize( "rfrpo", perObjectRefraction.ToString() );
s += Serialize( "rfrpn", refractionPassName );

s += Serialize( "acwp", allowColorMaskWriteThroughProperties.ToString());
s += Serialize( "coma", colorMask.ToString() );

s += Serialize( "ufog", useFog.ToString() );
Expand Down Expand Up @@ -242,6 +244,9 @@ public override void Deserialize(string key, string value){
case "rfrpn":
refractionPassName = value;
break;
case "acwp":
allowColorMaskWriteThroughProperties = bool.Parse( value );
break;
case "coma":
colorMask = int.Parse( value );
break;
Expand Down Expand Up @@ -414,9 +419,13 @@ public override float DrawInner(ref Rect r){
r.y += 20;
//}

allowColorMaskWriteThroughProperties = UndoableToggle( r, allowColorMaskWriteThroughProperties, "Expose ColorMask as property", "Allow Color Mask Write through property" );
r.y += 20;

EditorGUI.BeginDisabledGroup(allowColorMaskWriteThroughProperties);
UndoableColorMask( r, "Color Mask", ref colorMask );
r.y += 20;
EditorGUI.EndDisabledGroup();

bool canEditDithering = editor.mainNode.alphaClip.IsConnectedAndEnabled();
EditorGUI.BeginDisabledGroup( !canEditDithering );
Expand Down
14 changes: 14 additions & 0 deletions Shader Forge/Assets/ShaderForge/Editor/Code/SFPSC_Meta.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public enum BatchingMode { Enabled, Disabled, DisableDuringLODFade };
public bool[] usedRenderers; // TODO: Serialization?
public string fallback = "";
public int LOD = 0; // TODO: Serialization?
public string customTag = "SF";

public List<string> cgIncludes = new List<string>();

Expand Down Expand Up @@ -83,6 +84,7 @@ void DeserializeCgIncludes( string serialized ) {
public override string Serialize(){
string s = "";
s += Serialize( "flbk", fallback );
s += Serialize( "cmtg", customTag );
s += Serialize( "iptp", ((int)previewType).ToString() );
s += Serialize( "cusa", canUseSpriteAtlas.ToString() );
s += Serialize( "bamd", ( (int)batchingMode ).ToString() );
Expand All @@ -96,6 +98,9 @@ public override void Deserialize(string key, string value){
case "flbk":
fallback = value;
break;
case "cmtg":
customTag = value;
break;
case "iptp":
previewType = (Inspector3DPreviewType)int.Parse(value);
break;
Expand Down Expand Up @@ -182,6 +187,15 @@ public override float DrawInner(ref Rect r){
r.xMax += 3;
r.y += 20;

EditorGUI.LabelField( r, "Custom Tag", EditorStyles.miniLabel );
r.xMin += 80;
r.height = 17;
r.xMax -= 3;
customTag = UndoableTextField( r, customTag, "CustomTag", null);
r.xMin -= 80;
r.height = 20;
r.xMax += 3;
r.y += 20;

canUseSpriteAtlas = UndoableToggle( r, canUseSpriteAtlas, "Allow using atlased sprites", "allow using atlased sprites", null );
r.y += 20;
Expand Down
Loading