Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a8b3c1c
initial commit for the uxml's
martint-unity Mar 3, 2021
0649efa
updates to widget
martint-unity Mar 3, 2021
a6c66c9
update to uxml for editor part
martint-unity Mar 3, 2021
fe60e22
updates to layout
martint-unity Mar 3, 2021
9944ab2
Added first init of coonverters
martint-unity Mar 5, 2021
6cf0c4b
Updated styling and added new converter item
martint-unity Mar 9, 2021
f244127
Added convert method and restructured code
martint-unity Mar 12, 2021
4e8b454
added test converters. will be removed before done
martint-unity Mar 12, 2021
d4b4c61
Added converter Context
martint-unity Mar 15, 2021
d4c1432
Made the widget root element Bindable
martint-unity Mar 16, 2021
8c11fbe
Moved code into init phase
martint-unity Mar 17, 2021
38c9cb9
updates to the bindings to the Serilized Object
martint-unity Mar 18, 2021
650b811
Updated the naming of core converter
martint-unity Mar 18, 2021
8d364aa
Made sure user doesnt init twize
martint-unity Mar 18, 2021
d8890e9
moved the uxml's and uss to core and the Editor
martint-unity Mar 19, 2021
df2b186
spring cleaning
martint-unity Mar 19, 2021
de3165d
Updated the converter UI to get errors and pending
martint-unity Mar 25, 2021
5f3b773
Added OnClicked method
martint-unity Mar 25, 2021
16f7d92
added status enum
martint-unity Mar 26, 2021
7986ca8
updated the ui a bit
martint-unity Mar 26, 2021
c02175e
changed icon size and removed Visual element
martint-unity Mar 26, 2021
6669e06
Added contextual menu, but commented it out
martint-unity Mar 29, 2021
a5116c7
Added active bool to converteritemstate
martint-unity Mar 30, 2021
366d835
oups, active bool was placed in the wrong statment
martint-unity Mar 30, 2021
366210d
Merge branch 'master' into universal/upgrader/builtin-to-urp-upgrader…
martint-unity Mar 30, 2021
faca1ea
Added manipulator, trying out userData for index
martint-unity Mar 31, 2021
6437db9
cleaned out and documented code
martint-unity Apr 7, 2021
b532a7e
fixed a small bug in init method and list refresh
martint-unity Apr 7, 2021
0836acc
Removed unnecessary files
martint-unity Apr 7, 2021
e2710cd
added some doc strings
martint-unity Apr 7, 2021
2a68e59
Addressed PR Feedback
martint-unity Apr 8, 2021
a46dee6
removed old tests that shouldnt live here
martint-unity Apr 9, 2021
bfbb0ae
PR feedback, split code into files
martint-unity Apr 13, 2021
0c9fcd8
added progressbar and material upgrader
martint-unity Apr 16, 2021
4ecc880
Spring cleaning
martint-unity Apr 16, 2021
f88c9bf
Moved code into folder
martint-unity Apr 19, 2021
e4230a6
New name for Conversion, changed to Container
martint-unity Apr 19, 2021
43bf46a
Updated with PR feedback and Doc strings
martint-unity Apr 20, 2021
3f7d115
Merge branch 'master' into universal/upgrader/builtin-to-urp-upgrader…
martint-unity Apr 20, 2021
689e1ee
Adressed PR feedback
martint-unity Apr 21, 2021
b9198c1
Addressed PR Feedback. Changed message string
martint-unity Apr 22, 2021
a958cac
Moved converter to URP package.
martint-unity Apr 22, 2021
c1efeeb
Made converter and container internal
martint-unity Apr 22, 2021
ae5083c
Adressed PR feedback
martint-unity Apr 27, 2021
2516c9d
Removed member var, returned true instead
martint-unity Apr 27, 2021
a28bebe
Merge branch 'master' into universal/upgrader/builtin-to-urp-upgrader…
martint-unity Apr 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal abstract class RenderPipelineConverter
/// <summary>
/// A check if the converter is enabled or not. Can be used to do a check if prerequisites are met to have it enabled or disabled.
/// </summary>
public virtual bool IsEnabled { get => m_IsEnabled; set => m_IsEnabled = value; }
public virtual bool IsEnabled => m_IsEnabled;

/// <summary>
/// This method getting triggered when clicking the listview item in the UI.
Expand Down Expand Up @@ -47,6 +47,5 @@ public virtual void OnClicked(int index)
/// </summary>
/// <param name="context">The context that will be used when executing converter.</param>
public abstract void OnRun(ref RunItemContext context);
//public abstract void OnRun(RunConverterContext context);
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
namespace UnityEditor.Rendering
{
/// <summary>
/// A class for different conversions.
/// A class to contain converters. This is for a common set of converters.
/// For example: Converters that is for Built-in to URP would have it's own container.
/// </summary>
public abstract class RenderPipelineConverterContainer
internal abstract class RenderPipelineConverterContainer
{
/// <summary>
/// Name = The name of the conversion.
/// The name of the Container. This will show up int the UI.
/// </summary>
public abstract string name { get; }

/// <summary>
/// Info = The information for this conversion.
/// The information for this container.
/// This will be shown in the UI to tell the user some information about the converters that this container are targeting.
/// </summary>
public abstract string info { get; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using UnityEditor;
using UnityEditor.Rendering;
Expand All @@ -8,8 +9,8 @@

namespace UnityEditor.Rendering.Universal
{
// Status for each row item to say in which state they are in.
// This will make sure they are showing the correct icon
// Status for each row item to say in which state they are in.
// This will make sure they are showing the correct icon
enum Status
{
Pending,
Expand All @@ -18,7 +19,7 @@ enum Status
Success
}

// This is the serialized class that stores the state of each item in the list of items to convert
// This is the serialized class that stores the state of each item in the list of items to convert
[Serializable]
class ConverterItemState
{
Expand All @@ -33,9 +34,9 @@ class ConverterItemState
internal bool hasConverted = false;
}

// Each converter uses the active bool
// Each converter has a list of active items/assets
// We do this so that we can use the binding system of the UI Elements
// Each converter uses the active bool
// Each converter has a list of active items/assets
// We do this so that we can use the binding system of the UI Elements
[Serializable]
class ConverterState
{
Expand All @@ -56,20 +57,14 @@ class ConverterState
[EditorWindowTitle(title = "Render Pipeline Converters")]
public class RenderPipelineConvertersEditor : EditorWindow
{
Texture2D kImgWarn;
Texture2D kImgHelp;
Texture2D kImgFail;
Texture2D kImgSuccess;
Texture2D kImgPending;

public VisualTreeAsset converterEditorAsset;
public VisualTreeAsset converterListAsset;
public VisualTreeAsset converterItem;

ScrollView m_ScrollView;
DropdownField m_ConversionsDropdownField;

List<RenderPipelineConverter> m_CoreConvertersList = new List<RenderPipelineConverter>();
List<RenderPipelineConverter> m_CoreConvertersList;

// This list needs to be as long as the amount of converters
List<List<ConverterItemDescriptor>> m_ItemsToConvert = new List<List<ConverterItemDescriptor>>();
Expand All @@ -81,7 +76,7 @@ public class RenderPipelineConvertersEditor : EditorWindow
// There is one for each Converter.
[SerializeField] List<ConverterState> m_ConverterStates = new List<ConverterState>();

TypeCache.TypeCollection m_Conversions;
TypeCache.TypeCollection m_ConverterContainers;

#if RENDER_PIPELINE_CONVERTER
[MenuItem("RenderPipelineConverter/RenderPipelineConverter")]
Expand All @@ -90,26 +85,33 @@ public class RenderPipelineConvertersEditor : EditorWindow
public static void ShowWindow()
{
RenderPipelineConvertersEditor wnd = GetWindow<RenderPipelineConvertersEditor>();
DontSaveToLayout(wnd);

wnd.Show();
}

internal static void DontSaveToLayout(EditorWindow wnd)
{
// Making sure that the window is not saved in layouts.
Assembly assembly = typeof(EditorWindow).Assembly;
var editorWindowType = typeof(EditorWindow);
var hostViewType = assembly.GetType("UnityEditor.HostView");
var containerWindowType = assembly.GetType("UnityEditor.ContainerWindow");
var parentViewField = editorWindowType.GetField("m_Parent", BindingFlags.Instance | BindingFlags.NonPublic);
var parentViewValue = parentViewField.GetValue(wnd);
// window should not be saved to layout
var containerWindowProperty = hostViewType.GetProperty("window", BindingFlags.Instance | BindingFlags.Public);
var parentContainerWindowValue = containerWindowProperty.GetValue(parentViewValue);
var dontSaveToLayoutField = containerWindowType.GetField("m_DontSaveToLayout", BindingFlags.Instance | BindingFlags.NonPublic);
dontSaveToLayoutField.SetValue(parentContainerWindowValue, true);
}

void OnEnable()
{
kImgWarn = CoreEditorStyles.iconWarn;
kImgHelp = CoreEditorStyles.iconHelp;
kImgFail = CoreEditorStyles.iconFail;
kImgSuccess = CoreEditorStyles.iconSuccess;
kImgPending = CoreEditorStyles.iconPending;
m_CoreConvertersList = new List<RenderPipelineConverter>();

// This is the drop down choices.
m_Conversions = TypeCache.GetTypesDerivedFrom<RenderPipelineConverterContainer>();
// for (int j = 0; j < m_Conversions.Count; j++)
// {
// // Iterate over the conversions
// RenderPipelineConverterContainer converterContainer =
// (RenderPipelineConverterContainer) Activator.CreateInstance(m_Conversions[j]);
// m_ConversionsChoices.Add(converterContainer.name);
// }
m_ConverterContainers = TypeCache.GetTypesDerivedFrom<RenderPipelineConverterContainer>();

var converters = TypeCache.GetTypesDerivedFrom<RenderPipelineConverter>();
for (int i = 0; i < converters.Count; ++i)
Expand Down Expand Up @@ -141,14 +143,9 @@ public void CreateGUI()
m_SerializedObject = new SerializedObject(this);
converterEditorAsset.CloneTree(rootVisualElement);

// Adding the different conversions
// Right now the .choices attribute is internal so we can not add it. This will be public in the future.
//m_ConversionsDropdownField = rootVisualElement.Q<DropdownField>("conversionDropDown");
//m_ConversionsDropdownField.choices = conversionsChoices;

// This is temp now to get the information filled in
RenderPipelineConverterContainer converterContainer =
(RenderPipelineConverterContainer)Activator.CreateInstance(m_Conversions[0]);
(RenderPipelineConverterContainer)Activator.CreateInstance(m_ConverterContainers[0]);
rootVisualElement.Q<Label>("conversionName").text = converterContainer.name;
rootVisualElement.Q<TextElement>("conversionInfo").text = converterContainer.info;

Expand All @@ -167,16 +164,16 @@ public void CreateGUI()
item.Q<VisualElement>("converterTopVisualElement").tooltip = conv.info;

// setup the images
item.Q<Image>("pendingImage").image = kImgPending;
item.Q<Image>("pendingImage").image = CoreEditorStyles.iconPending;
item.Q<Image>("pendingImage").tooltip = "Pending";
var pendingLabel = item.Q<Label>("pendingLabel");
item.Q<Image>("warningImage").image = kImgWarn;
item.Q<Image>("warningImage").image = CoreEditorStyles.iconWarn;
item.Q<Image>("warningImage").tooltip = "Warnings";
var warningLabel = item.Q<Label>("warningLabel");
item.Q<Image>("errorImage").image = kImgFail;
item.Q<Image>("errorImage").image = CoreEditorStyles.iconFail;
item.Q<Image>("errorImage").tooltip = "Failed";
var errorLabel = item.Q<Label>("errorLabel");
item.Q<Image>("successImage").image = kImgSuccess;
item.Q<Image>("successImage").image = CoreEditorStyles.iconSuccess;
item.Q<Image>("successImage").tooltip = "Success";
var successLabel = item.Q<Label>("successLabel");

Expand All @@ -188,7 +185,8 @@ public void CreateGUI()
$"{nameof(m_ConverterStates)}.Array.data[{i}].{nameof(ConverterState.pending)}";
warningLabel.bindingPath =
$"{nameof(m_ConverterStates)}.Array.data[{i}].{nameof(ConverterState.warnings)}";
errorLabel.bindingPath = $"{nameof(m_ConverterStates)}.Array.data[{i}].{nameof(ConverterState.errors)}";
errorLabel.bindingPath =
$"{nameof(m_ConverterStates)}.Array.data[{i}].{nameof(ConverterState.errors)}";
successLabel.bindingPath =
$"{nameof(m_ConverterStates)}.Array.data[{i}].{nameof(ConverterState.success)}";

Expand Down Expand Up @@ -310,7 +308,7 @@ void Init(ClickEvent evt)
element.Q<Label>("converterItemName").text = convItemDesc.name;
element.Q<Label>("converterItemPath").text = convItemDesc.info;

element.Q<Image>("converterItemHelpIcon").image = kImgHelp;
element.Q<Image>("converterItemHelpIcon").image = CoreEditorStyles.iconHelp;
element.Q<Image>("converterItemHelpIcon").tooltip = convItemDesc.helpLink;

// Changing the icon here depending on the status.
Expand All @@ -321,16 +319,16 @@ void Init(ClickEvent evt)
switch (status)
{
case Status.Pending:
icon = kImgPending;
icon = CoreEditorStyles.iconPending;
break;
case Status.Error:
icon = kImgFail;
icon = CoreEditorStyles.iconFail;
break;
case Status.Warning:
icon = kImgWarn;
icon = CoreEditorStyles.iconWarn;
break;
case Status.Success:
icon = kImgSuccess;
icon = CoreEditorStyles.iconSuccess;
break;
}

Expand Down