Class Conversions
Utility class to convert data from/to Pixyz/Unity.
Inherited Members
Namespace: UnityEditor.Pixyz.UnitySDK
Assembly: Unity.Pixyz.UnitySDK.Editor.dll
Syntax
public static class Conversions
Methods
Identity(Matrix4)
Revert input matrix to identity
Declaration
public static void Identity(this Matrix4 matrix)
Parameters
Type | Name | Description |
---|---|---|
Matrix4 | matrix | Matrix to modify |
ToInt32(uint)
Convert System.UInt32 to System.Int32
Declaration
public static int ToInt32(this uint i)
Parameters
Type | Name | Description |
---|---|---|
uint | i | input |
Returns
Type | Description |
---|---|
int | Returned value |
ToMatrix4x4(string)
Convert input string value to UnityEngine.Matrix4x4
Declaration
public static Matrix4x4 ToMatrix4x4(this string input)
Parameters
Type | Name | Description |
---|---|---|
string | input | Input |
Returns
Type | Description |
---|---|
Matrix4x4 | Returned value |
ToPixyz(DateTime)
Convert input value
Declaration
public static Date ToPixyz(this DateTime unityObject)
Parameters
Type | Name | Description |
---|---|---|
DateTime | unityObject | input |
Returns
Type | Description |
---|---|
Date | Returned value |
ToPixyz(Bounds)
Convert input value
Declaration
public static AABB ToPixyz(this Bounds bounds)
Parameters
Type | Name | Description |
---|---|---|
Bounds | bounds | Unity bounds to convert |
Returns
Type | Description |
---|---|
AABB | Returned value |
ToPixyz(Color)
Convert UnityEngine.Color to Pixyz.Core.Color
Declaration
public static Color ToPixyz(this Color colorU)
Parameters
Type | Name | Description |
---|---|---|
Color | colorU | input |
Returns
Type | Description |
---|---|
Color | Returned value |
ToPixyz(Color[])
Convert UnityEngine.Color[] to Pixyz.Core.ColorList
Declaration
public static ColorList ToPixyz(this Color[] unityObject)
Parameters
Type | Name | Description |
---|---|---|
Color[] | unityObject | input |
Returns
Type | Description |
---|---|
ColorList | Returned value |
ToPixyz(Matrix4x4)
Convert input value
Declaration
public static Matrix4 ToPixyz(this Matrix4x4 unityObject)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x4 | unityObject | Unity variable to convert |
Returns
Type | Description |
---|---|
Matrix4 | Returned value |
ToPixyz(Matrix4x4[])
Convert input value
Declaration
public static Matrix4List ToPixyz(this Matrix4x4[] unityObject)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x4[] | unityObject | Unity variable to convert |
Returns
Type | Description |
---|---|
Matrix4List | Returned value |
ToPixyz(Mesh)
Converts a Unity Mesh to a Pixyz MeshDefinition
Declaration
public static MeshDefinition ToPixyz(this Mesh mesh)
Parameters
Type | Name | Description |
---|---|---|
Mesh | mesh | The mesh to convert |
Returns
Type | Description |
---|---|
MeshDefinition | Returned value |
ToPixyz(Ray)
Convert input value
Declaration
public static Ray ToPixyz(this Ray unityObject)
Parameters
Type | Name | Description |
---|---|---|
Ray | unityObject | Unity variable to convert |
Returns
Type | Description |
---|---|
Ray | Returned value |
ToPixyz(Texture2D, PiXYZAPI, double, double, double, double, bool)
Convert a UnityEngine.Texture2D to a Pixyz.Material.Texture
Declaration
public static Texture ToPixyz(this Texture2D texture, PiXYZAPI api, double offsetX = 0, double offsetY = 0, double tillingX = 1, double tillingY = 1, bool isNormalMap = false)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | texture | Texture to convert |
PiXYZAPI | api | Session to use |
double | offsetX | X offset |
double | offsetY | Y offset |
double | tillingX | X tilling |
double | tillingY | Y tilling |
bool | isNormalMap | If the texture is a normal map |
Returns
Type | Description |
---|---|
Texture | The converted texture |
ToPixyz(Texture2D[], PiXYZAPI, double, double, double, double, int)
Convert a set of textures
Declaration
public static Texture[] ToPixyz(this Texture2D[] textures, PiXYZAPI api, double offsetX = 0, double offsetY = 0, double tillingX = 1, double tillingY = 1, int normalMapIndex = -1)
Parameters
Type | Name | Description |
---|---|---|
Texture2D[] | textures | Textures to convert |
PiXYZAPI | api | Session to use |
double | offsetX | X offset |
double | offsetY | Y offset |
double | tillingX | X tilling |
double | tillingY | Y tilling |
int | normalMapIndex | Normal map index |
Returns
Type | Description |
---|---|
Texture[] | The converted texture |
ToPixyz(Vector2)
Convert input value
Declaration
public static Point2 ToPixyz(this Vector2 unityObject)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | unityObject | input |
Returns
Type | Description |
---|---|
Point2 | Returned value |
ToPixyz(in Vector2, ref Point2)
Convert input value
Declaration
public static void ToPixyz(in Vector2 unityObject, ref Point2 point2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | unityObject | input |
Point2 | point2 | input |
ToPixyz(Vector2[])
Convert input value
Declaration
public static Point2List ToPixyz(this Vector2[] unityObject)
Parameters
Type | Name | Description |
---|---|---|
Vector2[] | unityObject | Unity variable to convert |
Returns
Type | Description |
---|---|
Point2List | Returned value |
ToPixyz(Vector2[], Point2List)
Convert input value
Declaration
public static void ToPixyz(this Vector2[] unityObject, Point2List points)
Parameters
Type | Name | Description |
---|---|---|
Vector2[] | unityObject | Unity variable to convert |
Point2List | points | Output list to modify |
ToPixyz(Vector3)
Convert input value
Declaration
public static Point3 ToPixyz(this Vector3 unityObject)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | unityObject | Unity variable to convert |
Returns
Type | Description |
---|---|
Point3 | Returned value |
ToPixyz(in Vector3, ref Point3)
Convert input value
Declaration
public static void ToPixyz(in Vector3 unityObject, ref Point3 point3)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | unityObject | Unity variable to convert |
Point3 | point3 | Ref struct storing the output |
ToPixyz(in Vector3, ref Vector3)
Convert input value
Declaration
public static void ToPixyz(in Vector3 unityObject, ref Vector3 vector3)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | unityObject | Unity variable to convert |
Vector3 | vector3 | Ref struct storing the output |
ToPixyz(Vector3[])
Convert input value
Declaration
public static Point3List ToPixyz(this Vector3[] unityObject)
Parameters
Type | Name | Description |
---|---|---|
Vector3[] | unityObject | Unity variable to convert |
Returns
Type | Description |
---|---|
Point3List | Returned value |
ToPixyz(Vector3[], Point3List)
Convert input value
Declaration
public static void ToPixyz(this Vector3[] unityObject, Point3List points)
Parameters
Type | Name | Description |
---|---|---|
Vector3[] | unityObject | Unity variable to convert |
Point3List | points | List storing the output |
ToPixyz(Vector4)
Convert input value
Declaration
public static Vector4 ToPixyz(this Vector4 unityObject)
Parameters
Type | Name | Description |
---|---|---|
Vector4 | unityObject | Unity variable to convert |
Returns
Type | Description |
---|---|
Vector4 | Returned value |
ToPixyz(Vector4, ref Vector4)
Convert input value
Declaration
public static void ToPixyz(this Vector4 unityObject, ref Vector4 pxzObject)
Parameters
Type | Name | Description |
---|---|---|
Vector4 | unityObject | Unity variable to convert |
Vector4 | pxzObject | Output |
ToPixyz(Vector4[])
Convert input value
Declaration
public static Vector4List ToPixyz(this Vector4[] unityObject)
Parameters
Type | Name | Description |
---|---|---|
Vector4[] | unityObject | Unity variable to convert |
Returns
Type | Description |
---|---|
Vector4List | Returned value |
ToPixyz(Vector4[], Vector4List)
Convert input value
Declaration
public static void ToPixyz(this Vector4[] unityObject, Vector4List list)
Parameters
Type | Name | Description |
---|---|---|
Vector4[] | unityObject | Unity variable to convert |
Vector4List | list | Output |
ToPixyzColor(ColorAlpha)
Convert input value
Declaration
public static Color ToPixyzColor(this ColorAlpha color)
Parameters
Type | Name | Description |
---|---|---|
ColorAlpha | color | input |
Returns
Type | Description |
---|---|
Color | Returned value |
ToPixyzColorAlpha(Color)
Convert input value
Declaration
public static ColorAlpha ToPixyzColorAlpha(this Color colorU)
Parameters
Type | Name | Description |
---|---|---|
Color | colorU | input |
Returns
Type | Description |
---|---|
ColorAlpha | Returned value |
ToPixyzColorAlpha(Color, ref ColorAlpha)
Convert input value
Declaration
public static void ToPixyzColorAlpha(this Color colorU, ref ColorAlpha pxzColor)
Parameters
Type | Name | Description |
---|---|---|
Color | colorU | input |
ColorAlpha | pxzColor | input |
ToPixyzColorAlpha(Color)
Convert input value
Declaration
public static ColorAlpha ToPixyzColorAlpha(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | input |
Returns
Type | Description |
---|---|
ColorAlpha | Returned value |
ToPixyzColorAlphaList(Color[])
Convert input value
Declaration
public static ColorAlphaList ToPixyzColorAlphaList(this Color[] unityObject)
Parameters
Type | Name | Description |
---|---|---|
Color[] | unityObject | input |
Returns
Type | Description |
---|---|
ColorAlphaList | Returned value |
ToPixyzDefinition(Material, PiXYZAPI, Dictionary<Texture2D, uint>, int, bool)
Convert input value
Declaration
public static MaterialDefinition ToPixyzDefinition(this Material material, PiXYZAPI api, Dictionary<Texture2D, uint> texMap = null, int fetcherResolution = -1, bool specularWorkflow = false)
Parameters
Type | Name | Description |
---|---|---|
Material | material | Material to convert |
PiXYZAPI | api | Session to use |
Dictionary<Texture2D, uint> | texMap | Already converted textures |
int | fetcherResolution | Resolution to use to convert materials |
bool | specularWorkflow | Is material specular |
Returns
Type | Description |
---|---|
MaterialDefinition | Returned value |
ToPixyzDefinition(Texture2D, bool)
Convert input value
Declaration
public static ImageDefinition ToPixyzDefinition(this Texture2D texture, bool isLinear)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | texture | Texture to convert |
bool | isLinear | Is the texture linear |
Returns
Type | Description |
---|---|
ImageDefinition | Returned value |
ToPixyzVector2(Vector2)
Convert input value
Declaration
public static Vector2 ToPixyzVector2(this Vector2 unityObject)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | unityObject | Unity variable to convert |
Returns
Type | Description |
---|---|
Vector2 | Returned value |
ToPixyzVector3List(Vector3[])
Convert input value
Declaration
public static Vector3List ToPixyzVector3List(this Vector3[] unityObject)
Parameters
Type | Name | Description |
---|---|---|
Vector3[] | unityObject | Unity variable to convert |
Returns
Type | Description |
---|---|
Vector3List | Returned value |
ToPixyzVector3List(Vector3[], Vector3List)
Convert input value
Declaration
public static Vector3List ToPixyzVector3List(this Vector3[] unityObject, Vector3List list)
Parameters
Type | Name | Description |
---|---|---|
Vector3[] | unityObject | Unity variable to convert |
Vector3List | list | Output |
Returns
Type | Description |
---|---|
Vector3List | Returned value |
ToUInt32(int)
Convert System.Int32 to System.UInt32
Declaration
public static uint ToUInt32(this int i)
Parameters
Type | Name | Description |
---|---|---|
int | i | input |
Returns
Type | Description |
---|---|
uint | Returned value |
ToUnity(Color)
Convert Pixyz.Core.Color to UnityEngine.Color
Declaration
public static Color ToUnity(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | input |
Returns
Type | Description |
---|---|
Color | Returned value |
ToUnity(ColorAlpha)
Convert input value
Declaration
public static Color ToUnity(this ColorAlpha color)
Parameters
Type | Name | Description |
---|---|---|
ColorAlpha | color | input |
Returns
Type | Description |
---|---|
Color | Returned value |
ToUnity(ColorAlpha[])
Convert input value
Declaration
public static Color[] ToUnity(this ColorAlpha[] dtObject)
Parameters
Type | Name | Description |
---|---|---|
ColorAlpha[] | dtObject | input |
Returns
Type | Description |
---|---|
Color[] | Returned value |
ToUnity(Color[])
Convert Pixyz.Core.Color[] to UnityEngine.Color[]
Declaration
public static Color[] ToUnity(this Color[] dtObject)
Parameters
Type | Name | Description |
---|---|---|
Color[] | dtObject | input |
Returns
Type | Description |
---|---|
Color[] | Returned value |
ToUnity(Date)
Convert input value
Declaration
public static DateTime ToUnity(this Date dtObject)
Parameters
Type | Name | Description |
---|---|---|
Date | dtObject | input |
Returns
Type | Description |
---|---|
DateTime | Returned value |
ToUnity(AABB)
Convert input value
Declaration
public static Bounds ToUnity(this AABB dtObject)
Parameters
Type | Name | Description |
---|---|---|
AABB | dtObject | Input to convert to Unity |
Returns
Type | Description |
---|---|
Bounds | Returned value |
ToUnity(Matrix4)
Convert input value
Declaration
public static Matrix4x4 ToUnity(this Matrix4 dtObject)
Parameters
Type | Name | Description |
---|---|---|
Matrix4 | dtObject | Input to convert to Unity |
Returns
Type | Description |
---|---|
Matrix4x4 | Returned value |
ToUnity(Point2)
Convert input value
Declaration
public static Vector2 ToUnity(this Point2 dtObject)
Parameters
Type | Name | Description |
---|---|---|
Point2 | dtObject | Input to convert to Unity |
Returns
Type | Description |
---|---|
Vector2 | Returned value |
ToUnity(Point2[])
Convert input value
Declaration
public static Vector2[] ToUnity(this Point2[] dtObject)
Parameters
Type | Name | Description |
---|---|---|
Point2[] | dtObject | Input to convert to Unity |
Returns
Type | Description |
---|---|
Vector2[] | Returned value |
ToUnity(Point2[], Vector2[])
Convert input value
Declaration
public static void ToUnity(this Point2[] dtObject, Vector2[] vectors)
Parameters
Type | Name | Description |
---|---|---|
Point2[] | dtObject | Input to convert to Unity |
Vector2[] | vectors | Array storing the output |
ToUnity(Point3)
Convert input value
Declaration
public static Vector3 ToUnity(this Point3 dtObject)
Parameters
Type | Name | Description |
---|---|---|
Point3 | dtObject | Input to convert to Unity |
Returns
Type | Description |
---|---|
Vector3 | Returned value |
ToUnity(Point3[])
Convert input value
Declaration
public static Vector3[] ToUnity(this Point3[] dtObject)
Parameters
Type | Name | Description |
---|---|---|
Point3[] | dtObject | Input to convert to Unity |
Returns
Type | Description |
---|---|
Vector3[] | Returned value |
ToUnity(Point3[], Vector3[])
Convert input value
Declaration
public static void ToUnity(this Point3[] dtObject, Vector3[] array)
Parameters
Type | Name | Description |
---|---|---|
Point3[] | dtObject | Input to convert to Unity |
Vector3[] | array | Array storing the output |
ToUnity(Ray)
Convert input value
Declaration
public static Ray ToUnity(this Ray dtObject)
Parameters
Type | Name | Description |
---|---|---|
Ray | dtObject | Input to convert to Unity |
Returns
Type | Description |
---|---|
Ray | Returned value |
ToUnity(Vector2)
Convert input value
Declaration
public static Vector2 ToUnity(this Vector2 dtObject)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | dtObject | Input to convert to Unity |
Returns
Type | Description |
---|---|
Vector2 | Returned value |
ToUnity(Vector2[])
Convert input value
Declaration
public static Vector2[] ToUnity(this Vector2[] dtObject)
Parameters
Type | Name | Description |
---|---|---|
Vector2[] | dtObject | Input to convert to Unity |
Returns
Type | Description |
---|---|
Vector2[] | Returned value |
ToUnity(Vector3)
Convert input value
Declaration
public static Vector3 ToUnity(this Vector3 dtObject)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | dtObject | Input to convert to Unity |
Returns
Type | Description |
---|---|
Vector3 | Returned value |
ToUnity(Vector3[])
Convert input value
Declaration
public static Vector3[] ToUnity(this Vector3[] dtObject)
Parameters
Type | Name | Description |
---|---|---|
Vector3[] | dtObject | Input to convert to Unity |
Returns
Type | Description |
---|---|
Vector3[] | Returned value |
ToUnity(Vector3[], Vector3[])
Convert input value
Declaration
public static void ToUnity(this Vector3[] dtObject, Vector3[] array)
Parameters
Type | Name | Description |
---|---|---|
Vector3[] | dtObject | Input to convert to Unity |
Vector3[] | array | Output |
ToUnity(Vector4)
Convert input value
Declaration
public static Vector4 ToUnity(this Vector4 dtObject)
Parameters
Type | Name | Description |
---|---|---|
Vector4 | dtObject | Input to convert to Unity |
Returns
Type | Description |
---|---|
Vector4 | Returned value |
ToUnity(Vector4[])
Convert input value
Declaration
public static Vector4[] ToUnity(this Vector4[] dtObject)
Parameters
Type | Name | Description |
---|---|---|
Vector4[] | dtObject | Input to convert to Unity |
Returns
Type | Description |
---|---|
Vector4[] | Returned value |
ToUnity(Vector4[], Vector4[])
Convert input value
Declaration
public static void ToUnity(this Vector4[] dtObject, Vector4[] array)
Parameters
Type | Name | Description |
---|---|---|
Vector4[] | dtObject | Input to convert to Unity |
Vector4[] | array | Output |
ToUnity(ImageDefinition, bool)
Convert input value
Declaration
public static Texture2D ToUnity(this ImageDefinition imageDefinition, bool isLinear)
Parameters
Type | Name | Description |
---|---|---|
ImageDefinition | imageDefinition | Image definition |
bool | isLinear | Is the image linear |
Returns
Type | Description |
---|---|
Texture2D | Returned value |
ToUnity(MaterialDefinition, PiXYZAPI, Dictionary<uint, Texture2D>, Shader, bool, MaterialPatternType)
Convert input value
Declaration
public static Material ToUnity(this MaterialDefinition definition, PiXYZAPI api, Dictionary<uint, Texture2D> map = null, Shader shader = null, bool specularWorkflow = false, MaterialPatternType pattern = MaterialPatternType.PBR)
Parameters
Type | Name | Description |
---|---|---|
MaterialDefinition | definition | Material definition |
PiXYZAPI | api | Session to use |
Dictionary<uint, Texture2D> | map | Already converted textures |
Shader | shader | Shader to convert to |
bool | specularWorkflow | Is material specular |
MaterialPatternType | pattern | Pixyz material pattern |
Returns
Type | Description |
---|---|
Material | Returned value |
ToUnity(MaterialDefinition, PiXYZAPI, Material, Dictionary<uint, Texture2D>)
Convert input value
Declaration
public static void ToUnity(this MaterialDefinition definition, PiXYZAPI api, Material material, Dictionary<uint, Texture2D> map)
Parameters
Type | Name | Description |
---|---|---|
MaterialDefinition | definition | Material definition |
PiXYZAPI | api | Session to use |
Material | material | Material to update |
Dictionary<uint, Texture2D> | map | Already converted textures |
ToUnity(MaterialList, PiXYZAPI, Dictionary<uint, Texture2D>, Shader, bool)
Converts a Pixyz material list to a Unity material list. Check "ToUnityMaterial" for more details on parameters.
Declaration
public static Material[] ToUnity(this MaterialList pxzMaterials, PiXYZAPI api, Dictionary<uint, Texture2D> textureMap = null, Shader shader = null, bool specularWorkflow = false)
Parameters
Type | Name | Description |
---|---|---|
MaterialList | pxzMaterials | Materials to convert |
PiXYZAPI | api | Session to use |
Dictionary<uint, Texture2D> | textureMap | Already converted textures |
Shader | shader | Shader to convert to |
bool | specularWorkflow | If materials are specular |
Returns
Type | Description |
---|---|
Material[] | Returned value |
ToUnity(Texture, PiXYZAPI, Dictionary<uint, Texture2D>, bool)
Convert input value
Declaration
public static Texture2D ToUnity(this Texture textureExtract, PiXYZAPI api, Dictionary<uint, Texture2D> map, bool linear)
Parameters
Type | Name | Description |
---|---|---|
Texture | textureExtract | Texture to convert |
PiXYZAPI | api | Session to use |
Dictionary<uint, Texture2D> | map | Already converted textures |
bool | linear | Is texture linear |
Returns
Type | Description |
---|---|
Texture2D | Returned value |
ToUnity(MeshDefinition, float, string, Mesh, bool, bool, Dictionary<uint, uint[]>)
Converts a Pixyz MeshDefinition to a Unity Mesh
Declaration
public static (Mesh, int[]) ToUnity(this MeshDefinition definition, float scaleFactor = 1, string name = "", Mesh mesh = null, bool reorder = false, bool calculateTangents = false, Dictionary<uint, uint[]> meshTolinesMaterials = null)
Parameters
Type | Name | Description |
---|---|---|
MeshDefinition | definition | MeshDefinition to convert |
float | scaleFactor | Scale factor to apply on vertices |
string | name | Mesh name |
Mesh | mesh | Optional Mesh to fill. Create a new one if null. |
bool | reorder | If mesh was converted from Unity to Pixyz before, reorder sub-meshes to preserve original order. |
bool | calculateTangents | If true tangents will be recomputed using Unity API. |
Dictionary<uint, uint[]> | meshTolinesMaterials | Optional dictionary containing mesh id to lines materials ids mapping |
Returns
Type | Description |
---|---|
(Mesh, int[]) | The converted Unity mesh, the reordered submesh indices if they wered reordered |
ToUnityMaterial(uint, PiXYZAPI, Dictionary<uint, Texture2D>, Shader, bool)
Converts a Pixyz material to a Unity material.
Declaration
public static Material ToUnityMaterial(this uint pxzMaterial, PiXYZAPI api, Dictionary<uint, Texture2D> map = null, Shader shader = null, bool specularWorkflow = false)
Parameters
Type | Name | Description |
---|---|---|
uint | pxzMaterial | Pixyz material id |
PiXYZAPI | api | PiXYZAPI is necessary to get material definition (and optionally textures definition associated to the material). |
Dictionary<uint, Texture2D> | map | Pixyz id to Unity UnityEngine.Texture2D map, necessary if some textures are shared among multiple materials. |
Shader | shader | Shader to convert the material to (set to null if you want to convert to BiRP/Standard, URP/Lit or HDRP/Lit) |
bool | specularWorkflow | If using the specular workflow in BiRP, will create a BiRP/Standard specular material |
Returns
Type | Description |
---|---|
Material | The converted Unity Material |