publicstaticGUIContentinstancedColor=newGUIContent("Instanced Color","Enable a Unique Color Per Instance");
publicstaticGUIContentalbedo=newGUIContent("Albedo","Albedo (RGB) and Transparency (Alpha)");
publicstaticGUIContentalbedoAssignedAtRuntime=newGUIContent("Assigned at Runtime","As an optimization albedo operations are disabled when no albedo texture is specified. If a albedo texture will be specified at runtime enable this option.");
publicstaticGUIContentalphaCutoff=newGUIContent("Alpha Cutoff","Threshold for Alpha Cutoff");
publicstaticGUIContentenableChannelMap=newGUIContent("Channel Map","Enable Channel Map, a Channel Packing Texture That Follows Unity's Standard Channel Setup");
publicstaticGUIContentvertexColors=newGUIContent("Vertex Colors","Enable Vertex Color Tinting");
publicstaticGUIContentvertexExtrusion=newGUIContent("Vertex Extrusion","Enable Vertex Extrusion Along the Vertex Normal");
publicstaticGUIContentvertexExtrusionValue=newGUIContent("Extrusion Value","How Far to Extrude the Vertex Along the Vertex Normal");
publicstaticGUIContentvertexExtrusionSmoothNormals=newGUIContent("Use Smooth Normals","Should Vertex Extrusion use the Smooth Normals in UV3, or Default Normals");
publicstaticGUIContentblendedClippingWidth=newGUIContent("Blended Clipping Width","The Width of the Clipping Primitive Clip Fade Region on Non-Cutout Materials");
publicstaticGUIContentclippingBorder=newGUIContent("Clipping Border","Enable a Border Along the Clipping Primitive's Edge");
publicstaticGUIContentclippingBorderWidth=newGUIContent("Width","Width of the Clipping Border");
publicstaticGUIContentclippingBorderColor=newGUIContent("Color","Interpolated Color of the Clipping Border");
publicstaticGUIContentnearPlaneFade=newGUIContent("Near Fade","Objects Disappear (Turn to Black/Transparent) as the Camera (or Hover/Proximity Light) Nears Them");
publicstaticGUIContentnearLightFade=newGUIContent("Use Light","A Hover or Proximity Light (Rather Than the Camera) Determines Near Fade Distance");
publicstaticGUIContentfadeBeginDistance=newGUIContent("Fade Begin","Distance From Camera (or Hover/Proximity Light) to Begin Fade In");
publicstaticGUIContentfadeCompleteDistance=newGUIContent("Fade Complete","Distance From Camera (or Hover/Proximity Light) When Fade is Fully In");
publicstaticGUIContentfadeMinValue=newGUIContent("Fade Min Value","Clamps the Fade Amount to a Minimum Value");
publicstaticGUIContenthoverLight=newGUIContent("Hover Light","Enable utilization of Hover Light(s)");
publicstaticGUIContentenableHoverColorOverride=newGUIContent("Override Color","Override Global Hover Light Color for this Material");
publicstaticGUIContentproximityLight=newGUIContent("Proximity Light","Enable utilization of Proximity Light(s)");
publicstaticGUIContentenableProximityLightColorOverride=newGUIContent("Override Color","Override Global Proximity Light Color for this Material");
publicstaticGUIContentproximityLightCenterColorOverride=newGUIContent("Center Color","The Override Color of the ProximityLight Gradient at the Center (RGB) and (A) is Gradient Extent");
publicstaticGUIContentproximityLightMiddleColorOverride=newGUIContent("Middle Color","The Override Color of the ProximityLight Gradient at the Middle (RGB) and (A) is Gradient Extent");
publicstaticGUIContentproximityLightOuterColorOverride=newGUIContent("Outer Color","The Override Color of the ProximityLight Gradient at the Outer Edge (RGB) and (A) is Gradient Extent");
publicstaticGUIContentproximityLightSubtractive=newGUIContent("Subtractive","Proximity Lights Remove Light from a Surface, Used to Mimic a Shadow");
publicstaticGUIContentproximityLightTwoSided=newGUIContent("Two Sided","Proximity Lights Apply to Both Sides of a Surface");
publicstaticGUIContentfluentLightIntensity=newGUIContent("Light Intensity","Intensity Scaler for All Hover and Proximity Lights");
publicstaticGUIContentroundCorners=newGUIContent("Round Corners","(Assumes UVs Specify Borders of Surface, Works Best on Unity Cube, Quad, and Plane)");
publicstaticGUIContentroundCornerRadius=newGUIContent("Unit Radius","Rounded Rectangle Corner Unit Sphere Radius");
publicstaticGUIContentroundCornerMargin=newGUIContent("Margin %","Distance From Geometry Edge");
publicstaticGUIContentindependentCorners=newGUIContent("Independent Corners","Manage each corner separately");
publicstaticGUIContentborderLight=newGUIContent("Border Light","Enable Border Lighting (Assumes UVs Specify Borders of Surface, Works Best on Unity Cube, Quad, and Plane)");
publicstaticGUIContentborderLightUsesHoverColor=newGUIContent("Use Hover Color","Border Color Comes From Hover Light Color Override");
publicstaticGUIContentborderLightReplacesAlbedo=newGUIContent("Replace Albedo","Border Light Replaces Albedo (Replacement Rather Than Additive)");
publicstaticGUIContentborderLightOpaque=newGUIContent("Opaque Borders","Borders Override Alpha Value to Appear Opaque");
publicstaticGUIContentborderWidth=newGUIContent("Width %","Uniform Width Along Border as a % of the Smallest XYZ Dimension");
publicstaticGUIContentedgeSmoothingValue=newGUIContent("Edge Smoothing Value","Smooths Edges When Round Corners and Transparency Is Enabled");
publicstaticGUIContentborderLightOpaqueAlpha=newGUIContent("Alpha","Alpha value of \"opaque\" borders.");
publicstaticGUIContentinnerGlow=newGUIContent("Inner Glow","Enable Inner Glow (Assumes UVs Specify Borders of Surface, Works Best on Unity Cube, Quad, and Plane)");
publicstaticGUIContentinnerGlowColor=newGUIContent("Color","Inner Glow Color (RGB) and Intensity (A)");
publicstaticGUIContentinnerGlowPower=newGUIContent("Power","Power Exponent to Control Glow");
publicstaticGUIContentiridescence=newGUIContent("Iridescence","Simulated Iridescence via Albedo Changes with the Angle of Observation)");
publicstaticGUIContentiridescentSpectrumMap=newGUIContent("Spectrum Map","Spectrum of Colors to Apply (Usually a Texture with ROYGBIV from Left to Right)");
publicstaticGUIContentiridescenceIntensity=newGUIContent("Intensity","Intensity of Iridescence");
publicstaticGUIContentiridescenceThreshold=newGUIContent("Threshold","Threshold Window to Sample From the Spectrum Map");
publicstaticGUIContentenvironmentColoring=newGUIContent("Environment Coloring","Change Color Based on View");
publicstaticGUIContentenvironmentColorThreshold=newGUIContent("Threshold","Threshold When Environment Coloring Should Appear Based on Surface Normal");
publicstaticGUIContentenvironmentColorIntensity=newGUIContent("Intensity","Intensity (or Brightness) of the Environment Coloring");
publicstaticGUIContentenvironmentColorX=newGUIContent("X-Axis Color","Color Along the World Space X-Axis");
publicstaticGUIContentenvironmentColorY=newGUIContent("Y-Axis Color","Color Along the World Space Y-Axis");
publicstaticGUIContentenvironmentColorZ=newGUIContent("Z-Axis Color","Color Along the World Space Z-Axis");
publicstaticGUIContentstencilReference=newGUIContent("Stencil Reference","Value to Compared Against (if Comparison is Anything but Always) and/or the Value to be Written to the Buffer (if Either Pass, Fail or ZFail is Set to Replace)");
publicstaticGUIContentstencilComparison=newGUIContent("Stencil Comparison","Function to Compare the Reference Value to");
publicstaticGUIContentstencilOperation=newGUIContent("Stencil Operation","What to do When the Stencil Test Passes");
publicstaticGUIContentignoreZScale=newGUIContent("Ignore Z Scale","For Features That Use Object Scale (Round Corners, Border Light, etc.), Ignore the Z Scale of the Object");
/// GUI content styles which are common among shader GUIs.
/// </summary>
publicstaticclassStyles
{
publicstaticreadonlyGUIContentDepthWriteWarning=newGUIContent("<color=yellow>Warning:</color> Depth buffer sharing is enabled for this project, but this material does not write depth. Enabling depth will improve reprojection, but may cause rendering artifacts in translucent materials.");
publicstaticreadonlyGUIContentDepthWriteFixNowButton=newGUIContent("Fix Now","Enables Depth Write For This Material");
}
/// <summary>
/// Displays a depth write warning and fix button if depth buffer sharing is enabled.
/// </summary>
/// <param name="materialEditor">The material editor to display the warning in.</param>
/// <param name="dialogTitle">The title of the dialog window to display when the user selects the fix button.</param>
/// <param name="dialogMessage">The message in the dialog window when the user selects the fix button.</param>
/// <returns>True if the user opted to fix the warning, false otherwise.</returns>
publicstaticboolDisplayDepthWriteWarning(MaterialEditormaterialEditor,stringdialogTitle="Depth Write",stringdialogMessage="Change this material to write to the depth buffer?")
// Either when we are recompiling, or the inspector window is hidden behind another one, the target can get destroyed (null) and thereby will raise an ArgumentException when accessing serializedObject. For now, just return.
return;
}
}
/// <summary>
/// Renders a non-editable object field and an editable dropdown of a profile.
/// <param name="profileType">Profile type to filter available values to set on the provided property. If null, defaults to type <see cref="Microsoft.MixedReality.Toolkit.BaseMixedRealityProfile"/></param>
/// <param name="showAddButton">If true, draw the clone button, if false, don't</param>
/// <param name="renderProfileInBox">if true, render box around profile content, if false, don't</param>
/// <param name="serviceType">Optional service type to limit available profile types.</param>
/// <returns>True, if the profile changed.</returns>
EditorGUILayout.HelpBox("This profile is not supported for "+serviceType.Name+". Using an unsupported service may result in unexpected behavior.",MessageType.Warning);
}
}
if(profileType==null)
{
// Find the profile type so we can limit the available object field options
if(serviceType!=null)
{
// If GetProfileTypesForService has a count greater than one, then it won't be possible to use
// EditorGUILayout.ObjectField to restrict the set of profiles to a single type - in this
// case all profiles of BaseMixedRealityProfile will be visible in the picker.
//
// However in the case where there is just a single profile type for the service, we can improve
// upon the user experience by limiting the set of things that show in the picker by restricting
EditorGUILayout.HelpBox("Some properties may not be editable in this profile. Please refer to the error messages below to resolve editing.",MessageType.Warning);
/// If application is playing, then show warning to the user and disable inspector GUI
/// </summary>
/// <returns>true if application is playing, false otherwise</returns>
protectedboolCheckEditorPlayMode()
{
if(Application.isPlaying)
{
EditorGUILayout.HelpBox("Mixed Reality Toolkit settings cannot be edited while in play mode.",MessageType.Warning);
GUI.enabled=false;
returntrue;
}
returnfalse;
}
/// <summary>
/// Check if various input settings are set correctly to read the input actions for the active MRTK instance. If any failures, show appropriate error message
EditorGUILayout.HelpBox("No input actions profile found, please specify an input action profile in the main configuration.",MessageType.Error);
}
elseif(!IsProfileInActiveInstance())
{
EditorGUILayout.HelpBox("This profile is not assigned to the active MRTK instance in your scene. Some properties may not be editable",MessageType.Error);
/// Abstract class providing base functionality for data provider management in inspector. Useful for core systems that follow dataprovider access model.
/// Designed to target ScriptableObject profile classes that configure services who support data providers.
/// These profile ScriptableObject classes should contain an array of IMixedRealityServiceConfigurations that configure a list of data providers for this service configuration
/// Container class used to store references to serialized properties on a <see cref="IMixedRealityServiceConfiguration"/> target
/// </summary>
protectedclassServiceConfigurationProperties
{
internalSerializedPropertycomponentName;
internalSerializedPropertycomponentType;
internalSerializedPropertyproviderProfile;
internalSerializedPropertyruntimePlatform;
}
/// <summary>
/// Returns SerializedProperty object that wraps references to array of <see cref="IMixedRealityServiceConfiguration"/> stored on the inspected target object
/// Builds <see cref="ServiceConfigurationProperties"/> container object with SerializedProperty references to associated properties on the supplied <see cref="IMixedRealityServiceConfiguration"/> reference
/// </summary>
/// <param name="providerEntry">SerializedProperty reference pointing to <see cref="IMixedRealityServiceConfiguration"/> instance</param>
/// Returns direct <see cref="IMixedRealityServiceConfiguration"/> instance at provided index in target object's array of <see cref="IMixedRealityServiceConfiguration"/> configurations
/// Applies the given concrete dataprovider type properties to the provided <see cref="IMixedRealityServiceConfiguration"/> instance (as represented by <see cref="ServiceConfigurationProperties"/>).
/// Requires <see cref="MixedRealityDataProviderAttribute"/> on concrete type class to pull initial values
/// that will be applied to the <see cref="ServiceConfigurationProperties"/> container SerializedProperties
privateconststringProfileDescription="Use this profile to define all the controllers and their inputs your users will be able to use in your application.\n\n"+
"You'll want to define all your Input Actions first. They can then be wired up to hardware sensors, controllers, gestures, and other input devices.";
EditorUtility.DisplayDialog("Mappings updated","The \"HoloLens Voice and Clicker\" mappings have been migrated to a new serialization. Please save this asset.","Okay, thanks!");
return;
}
}
}
#endregionProfileMigration
if(!useCustomInteractionMappings)
{
boolskip=false;
// Merge controllers with the same supported controller type.
Debug.LogError($"Controller mappings between {thisProfile.MixedRealityControllerMappings[i].Description} and {controllerMapping.Description} do not match. Error message: {e.Message}");
privateconststringProfileDescription="Define all the custom controller visualizations you'd like to use for each controller type when they're rendered in the scene.\n\n"+
"Global settings are the default fallback, and any specific controller definitions take precedence.";
EditorGUILayout.HelpBox("When default models are used, an attempt is made to obtain controller models from the platform SDK. The global left and right models are only shown if no model can be obtained.",MessageType.Warning);
}
EditorGUI.BeginChangeCheck();
leftHandModelPrefab=EditorGUILayout.ObjectField(newGUIContent(globalLeftHandedControllerModel.displayName,"Note: If the default model is not found, the fallback is the global left hand model."),leftHandModelPrefab,typeof(GameObject),false)asGameObject;
rightHandModelPrefab=EditorGUILayout.ObjectField(newGUIContent(globalRightHandedControllerModel.displayName,"Note: If the default model is not found, the fallback is the global right hand model."),rightHandModelPrefab,typeof(GameObject),false)asGameObject;
EditorGUILayout.HelpBox("When default model is used, the override model will only be used if the default model cannot be loaded from the driver.",MessageType.Warning);
}
EditorGUI.BeginChangeCheck();
overrideModelPrefab=EditorGUILayout.ObjectField(newGUIContent(overrideModel.displayName,"If no override model is set, the global model is used."),overrideModelPrefab,typeof(GameObject),false)asGameObject;