Skip to content

Commit 179628f

Browse files
committed
review feedback #1
1 parent 79e7338 commit 179628f

File tree

6 files changed

+29
-21
lines changed

6 files changed

+29
-21
lines changed

com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,51 +38,52 @@ public static void DrawItemInList(Rect rect, SerializedCompositionLayer serializ
3838

3939
// Compute the desired indentation
4040
{
41-
rect.x = isCameraStack ? rect.x + CompositorStyle.k_ListItemStackPading + 2 : rect.x + 2;
42-
rect.width = isCameraStack ? rect.width - CompositorStyle.k_ListItemStackPading : rect.width;
41+
const float listBorder = 2.0f;
42+
rect.x = isCameraStack ? rect.x + CompositorStyle.k_ListItemStackPading + listBorder : rect.x + listBorder;
43+
rect.width = isCameraStack ? rect.width - CompositorStyle.k_ListItemStackPading - listBorder : rect.width - listBorder;
4344
rect.y += CompositorStyle.k_ListItemPading;
4445
rect.height = EditorGUIUtility.singleLineHeight;
4546
}
4647

4748
if (thumbnail)
4849
{
4950
Rect newRect = rect;
50-
newRect.width = 20;
51+
newRect.width = EditorGUIUtility.singleLineHeight;
5152
EditorGUI.PropertyField(newRect, serialized.Show, GUIContent.none);
52-
rect.x += 20;
53+
rect.x += CompositorStyle.k_CheckboxSpacing;
5354
Rect previewRect = rect;
5455
previewRect.width = CompositorStyle.k_ThumbnailSize * aspectRatio;
5556
previewRect.height = CompositorStyle.k_ThumbnailSize;
5657
EditorGUI.DrawPreviewTexture(previewRect, thumbnail);
57-
previewRect.x += previewRect.width + 5;
58-
rect.x += previewRect.width + 12;
59-
rect.width -= previewRect.width + 12;
58+
previewRect.x += previewRect.width + CompositorStyle.k_ThumbnailDivider;
59+
rect.x += previewRect.width + CompositorStyle.k_ThumbnailSpacing;
60+
rect.width -= previewRect.width + CompositorStyle.k_ThumbnailSpacing;
6061

6162
if (isAlphaEnbaled
6263
&& (thumbnail.format == RenderTextureFormat.ARGBHalf
6364
|| thumbnail.format == RenderTextureFormat.ARGBFloat
6465
|| thumbnail.format == RenderTextureFormat.ARGB64))
6566
{
6667
EditorGUI.DrawTextureAlpha(previewRect, thumbnail);
67-
rect.x += previewRect.width + 12;
68-
rect.width -= previewRect.width + 12;
68+
rect.x += previewRect.width + CompositorStyle.k_ThumbnailSpacing;
69+
rect.width -= previewRect.width + CompositorStyle.k_ThumbnailSpacing;
6970
}
7071

71-
rect.y += 6;
72+
rect.y += CompositorStyle.k_LabelVerticalOffset;
7273
EditorGUI.LabelField(rect, serialized.LayerName.stringValue);
7374
}
7475
else
7576
{
7677
Rect newRect = rect;
77-
newRect.width = 20;
78+
newRect.width = EditorGUIUtility.singleLineHeight;
7879
EditorGUI.PropertyField(newRect, serialized.Show, GUIContent.none);
79-
newRect.x += 20;
80+
newRect.x += CompositorStyle.k_CheckboxSpacing;
8081
if (isCameraStack)
8182
{
8283
Rect iconRect = newRect;
8384
iconRect.width = CompositorStyle.k_IconSize;
8485
iconRect.height = CompositorStyle.k_IconSize;
85-
iconRect.y -= 5;
86+
iconRect.y -= CompositorStyle.k_IconVerticalOffset;
8687
switch (serialized.InputLayerType.enumValueIndex)
8788
{
8889
case (int)CompositorLayer.LayerType.Camera:
@@ -99,12 +100,11 @@ public static void DrawItemInList(Rect rect, SerializedCompositionLayer serializ
99100
Debug.Log("Unknown layer type: Please add code here to draw this type of layer.");
100101
break;
101102
}
102-
newRect.x += CompositorStyle.k_IconSize + 5;
103+
newRect.x += CompositorStyle.k_IconSize + CompositorStyle.k_IconSpacing;
103104
}
104105

105-
newRect.width = rect.width - 60 - 20;
106+
newRect.width = rect.width - newRect.x;
106107
EditorGUI.LabelField(newRect, serialized.LayerName.stringValue);
107-
rect.y += rect.height;
108108
}
109109
}
110110

com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.Styles.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ namespace UnityEditor.Rendering.HighDefinition.Compositor
99
static internal class CompositorStyle
1010
{
1111
internal static readonly int k_ThumbnailSize = 32;
12+
internal static readonly int k_ThumbnailDivider = 5; // the horizontal space in between the thumbnails
13+
internal static readonly int k_ThumbnailSpacing = 10; // the horizontal space after the thumbnail
14+
internal static readonly int k_IconSpacing = 5; // the horizontal space after an icon
15+
internal static readonly int k_CheckboxSpacing = 20; // the horizontal space for a checkbox
16+
17+
internal static readonly int k_IconVerticalOffset = 5; // used to center the icons vertically
18+
internal static readonly int k_LabelVerticalOffset = 6; // used to center the labels vertically
19+
20+
1221
internal static readonly int k_IconSize = 28;
1322
internal static readonly int k_ListItemPading = 4;
1423
internal static readonly int k_ListItemStackPading = 20;

com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ public override void OnInspectorGUI()
181181

182182
m_layerList.drawHeaderCallback = (Rect rect) =>
183183
{
184-
//EditorGUI.LabelField(rect, "Render Schedule", EditorStyles.largeLabel);
185184
};
186185

187186
m_layerList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>

com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionUtils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static public void SetDefaultLayers(CompositionManager compositor)
7979
{
8080
if (compositor.layers[i].outputTarget == CompositorLayer.OutputTarget.CompositorLayer)
8181
{
82-
if ( (i+i < compositor.numLayers - 1) && (compositor.layers[i+1].outputTarget == CompositorLayer.OutputTarget.CameraStack))
82+
if ((i+i < compositor.numLayers - 1) && (compositor.layers[i+1].outputTarget == CompositorLayer.OutputTarget.CameraStack))
8383
{
8484
continue;
8585
}
@@ -102,7 +102,7 @@ static public void LoadOrCreateCompositionProfileAsset(CompositionManager compos
102102

103103
newProfile = ScriptableObject.CreateInstance<CompositionProfile>();
104104

105-
// path = AssetDatabase.GenerateUniqueAssetPath(path);
105+
//Note: no need to GenerateUniqueAssetPath(path), since we know that LoadAssetAtPath failed at this path
106106
AssetDatabase.CreateAsset(newProfile, path);
107107
AssetDatabase.SaveAssets();
108108
AssetDatabase.Refresh();

com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void Reset()
3030
m_clearAlpha = true;
3131
m_imageFitMode = BackgroundFitMode.Stretch;
3232

33-
if (m_layerFilters !=null )
33+
if (m_layerFilters !=null)
3434
{
3535
m_layerFilters.Clear();
3636
}

com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace UnityEngine.Rendering.HighDefinition.Compositor
77
{
8-
[Serializable, VolumeComponentMenu("Post-processing/Custom/AlphaIjection")]
8+
[Serializable, VolumeComponentMenu("Post-processing/Custom/AlphaInjection")]
99
internal sealed class AlphaInjection : CustomPostProcessVolumeComponent, IPostProcessComponent
1010
{
1111
internal class ShaderIDs

0 commit comments

Comments
 (0)