Skip to content
Merged
Show file tree
Hide file tree
Changes from 32 commits
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
23 changes: 19 additions & 4 deletions com.unity.render-pipelines.core/Editor/CoreEditorStyles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ public static class CoreEditorStyles
static readonly Texture2D paneOptionsIconLight;
public static Texture2D paneOptionsIcon => EditorGUIUtility.isProSkin ? paneOptionsIconDark : paneOptionsIconLight;

/// <summary> Warning icon </summary>
public static readonly Texture2D iconWarn;
/// <summary> Help icon </summary>
public static readonly Texture2D iconHelp;
/// <summary> Fail icon </summary>
public static readonly Texture2D iconFail;
/// <summary> Success icon </summary>
public static readonly Texture2D iconSuccess;
/// <summary> Pending icon </summary>
public static readonly Texture2D iconPending;

/// <summary>Context Menu button icon</summary>
public static readonly GUIContent contextMenuIcon;
/// <summary>Context Menu button style</summary>
Expand All @@ -50,8 +61,7 @@ public static class CoreEditorStyles
/// <summary>Hightlited background color.</summary>
public static Color backgroundHighlightColor { get { return EditorGUIUtility.isProSkin ? m_DarkThemeBackgroundHighlightColor : m_LightThemeBackgroundHighlightColor; } }

public static GUIContent iconHelp { get; }
public static GUIStyle iconHelpStyle { get; }
public static GUIStyle iconHelpStyle => GUI.skin.FindStyle("IconButton") ?? EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector).FindStyle("IconButton");

/// <summary>RenderPipeline Global Settings icon</summary>
public static readonly Texture2D globalSettingsIcon;
Expand Down Expand Up @@ -107,8 +117,13 @@ static CoreEditorStyles()
greenTexture = CoreEditorUtils.CreateColoredTexture2D(Color.green, "Green 1x1");
blueTexture = CoreEditorUtils.CreateColoredTexture2D(Color.blue, "Blue 1x1");

iconHelp = new GUIContent(EditorGUIUtility.FindTexture("_Help"));
iconHelpStyle = GUI.skin.FindStyle("IconButton") ?? EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector).FindStyle("IconButton");
iconHelp = EditorGUIUtility.FindTexture("_Help");
iconWarn = EditorGUIUtility.FindTexture("console.warnicon");
iconFail = EditorGUIUtility.FindTexture("console.erroricon");
iconSuccess = EditorGUIUtility.FindTexture("TestPassed");
iconPending = EditorGUIUtility.FindTexture("Toolbar Minus");


globalSettingsIcon = EditorGUIUtility.FindTexture("ScriptableObject Icon");

// Make sure that textures are unloaded on domain reloads.
Expand Down
18 changes: 18 additions & 0 deletions com.unity.render-pipelines.core/Editor/RenderPipelineConversion.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace UnityEditor.Rendering
{
/// <summary>
/// A class for different conversions.
/// </summary>
public abstract class RenderPipelineConversion
{
/// <summary>
/// Name = The name of the conversion.
/// </summary>
public abstract string name { get; }

/// <summary>
/// Info = The information for this conversion.
/// </summary>
public abstract string info { get; }
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

196 changes: 196 additions & 0 deletions com.unity.render-pipelines.core/Editor/RenderPipelineConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;
using UnityEngine.UIElements;

namespace UnityEditor.Rendering
{
/// <summary>
/// A structure holding the information for each Item that needs to be Converted.
/// Name = The Name of the asset that is being converted.
/// Info = Information that can be used to store some data. This will also be shown in the UI.
/// WarningMessage = If there are some issues with the converter that we already know about.
/// Example: If we know it is a custom shader, we can not convert it so we add the information here.
/// HelpLink = Link to the documentation of how to convert this asset. Useful if the conversion failed or if we know we can not convert this asset automatically.
/// </summary>
public struct ConverterItemDescriptor
{
public string name;
public string info;
public string warningMessage;
public string helpLink;
}

/// <summary>
/// A structure holding the information for each Item that needs to be Converted.
/// Descriptor = The ConverterItemDescriptor this item contain.
/// Index = The index for this item in the list of converter items.
/// </summary>
public struct ConverterItemInfo
{
public ConverterItemDescriptor descriptor { get; internal set; }
public int index { get; internal set; }
}

// Storing the index and message of the failed item so that we can show that in the UI.
internal struct FailedItem
{
public int index;
public string message;
}

internal struct SuccessfulItem
{
public int index;
}

/// <summary>
/// A structure needed for the initialization step of the converter.
/// Stores data to be visible in the UI.
/// </summary>
public struct InitializeConverterContext
{
/// <summary>
/// Stores the list of ConverterItemDescriptor that will be filled in during the initialization step.
/// </summary>
internal List<ConverterItemDescriptor> items;

/// <summary>
/// Add to the list of assets to be converted.
/// This will be used to display information to the user in the UI.
/// </summary>
/// <param name="item">The item to add to the list items to convert</param>
public void AddAssetToConvert(ConverterItemDescriptor item)
{
items.Add(item);
}
}

/// <summary>
/// A structure needed for the conversion part of the converter.
/// This holds the index for failed and successful items converted.
/// </summary>
public struct RunConverterContext
{
List<ConverterItemInfo> m_Items;

internal List<FailedItem> m_FailedItems;
internal List<SuccessfulItem> m_SuccessfulItems;

/// <summary>
/// These are the items that the converter needs to iterate over.
/// The UI will make this list of items only the ones that are ticked and should be converted.
/// </summary>
public IEnumerable<ConverterItemInfo> items => m_Items;

internal int failedCount => m_FailedItems.Count;
internal int successfulCount => m_SuccessfulItems.Count;

internal FailedItem GetFailedItemAtIndex(int index)
{
if (index < 0 || index > failedCount)
throw new ArgumentOutOfRangeException();
return m_FailedItems[index];
}

internal SuccessfulItem GetSuccessfulItemAtIndex(int index)
{
if (index < 0 || index > successfulCount)
throw new ArgumentOutOfRangeException();
return m_SuccessfulItems[index];
}



/// <summary>
/// These are the items that the converter needs to iterate over.
/// The UI will make this list of items only the ones that are ticked and should be converted.
/// </summary>
/// <param name="items">The items the converter will operate on.</param>
public RunConverterContext(List<ConverterItemInfo> items)
{
m_Items = items;

m_FailedItems = new List<FailedItem>();
m_SuccessfulItems = new List<SuccessfulItem>();
}

/// <summary>
/// Mark the converter item index as failed.
/// </summary>
/// <param name="index">The index that will be marked as failed.</param>
public void MarkFailed(int index)
{
MarkFailed(index, "Failed");
}

/// <summary>
/// Mark the converter item index as failed.
/// </summary>
/// <param name="index">The index that will be marked as failed.</param>
/// <param name="message">The message that will be shown for the failed item.</param>
public void MarkFailed(int index, string message)
{
m_FailedItems.Add(new FailedItem(){index = index, message = message});
}

/// <summary>
/// Mark the converter item index as successful.
/// </summary>
/// <param name="index">The index that will be marked as successful.</param>
public void MarkSuccessful(int index)
{
m_SuccessfulItems.Add(new SuccessfulItem(){index = index});
}
}

// Might need to change this name before making it public
public abstract class RenderPipelineConverter
{
/// <summary>
/// Name of the converter.
/// </summary>
public abstract string name { get; }

/// <summary>
/// The information when hovering over the converter.
/// </summary>
public abstract string info { get; }

/// <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 Enabled()
{
return true;
}

/// <summary>
/// This method getting triggered when clicking the listview item in the UI.
/// </summary>
public virtual void OnClicked(int index)
{
}

// This is so that we can have different segment in our UI, example Unity converters, your custom converters etc..
// This is not implemented yet
public virtual string category { get; }

// This is in which drop down item the converter belongs to.
// Not properly implemented yet
public abstract Type conversion { get; }

/// <summary>
/// This runs when initializing the converter. To gather data for the UI and also for the converter if needed.
/// </summary>
/// <param name="context">The context that will be used to initialize data for the converter.</param>
public abstract void OnInitialize(InitializeConverterContext context);

/// <summary>
/// The method that will be run when converting the assets.
/// </summary>
/// <param name="context">The context that will be used when executing converter.</param>
public abstract void OnRun(RunConverterContext context);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading