public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter) { Camera camera = (Camera)editor.Component; PropertyEditorCallback valueChanged = () => editor.BuildEditor(); MemberInfo projection = Strong.PropertyInfo((CameraPropertyConverter x) => x.Projection, "Projection"); MemberInfo orthographic = Strong.PropertyInfo((Camera x) => x.orthographic, "orthographic"); MemberInfo fov = Strong.PropertyInfo((Camera x) => x.fieldOfView, "fieldOfView"); MemberInfo orthographicSize = Strong.PropertyInfo((Camera x) => x.orthographicSize, "orthographicSize"); List <PropertyDescriptor> descriptors = new List <PropertyDescriptor>(); descriptors.Add(new PropertyDescriptor("Projection", converter, projection, orthographic, valueChanged)); if (!camera.orthographic) { descriptors.Add(new PropertyDescriptor("Field Of View", editor.Component, fov, fov)); } else { descriptors.Add(new PropertyDescriptor("Size", editor.Component, orthographicSize, orthographicSize)); } return(descriptors.ToArray()); }
public PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter) { PropertyEditorCallback valueChanged = () => editor.BuildEditor(); MemberInfo convexInfo = Strong.MemberInfo((MeshCollider x) => x.convex); MemberInfo isTriggerInfo = Strong.MemberInfo((MeshCollider x) => x.isTrigger); MemberInfo materialInfo = Strong.MemberInfo((MeshCollider x) => x.sharedMaterial); MemberInfo meshInfo = Strong.MemberInfo((MeshCollider x) => x.sharedMesh); MeshCollider collider = (MeshCollider)editor.Component; if (collider.convex) { return(new[] { new PropertyDescriptor("Convex", editor.Component, convexInfo, convexInfo, valueChanged), new PropertyDescriptor("Is Trigger", editor.Component, isTriggerInfo, isTriggerInfo), new PropertyDescriptor("Material", editor.Component, materialInfo, materialInfo), new PropertyDescriptor("Mesh", editor.Component, meshInfo, meshInfo), }); } else { return(new[] { new PropertyDescriptor("Convex", editor.Component, convexInfo, convexInfo, valueChanged), new PropertyDescriptor("Material", editor.Component, materialInfo, materialInfo), new PropertyDescriptor("Mesh", editor.Component, meshInfo, meshInfo), }); } }
public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter) { ILocalization lc = IOC.Resolve <ILocalization>(); Camera camera = (Camera)editor.Component; PropertyEditorCallback valueChanged = () => editor.BuildEditor(); MemberInfo projection = Strong.PropertyInfo((CameraPropertyConverter x) => x.Projection, "Projection"); MemberInfo orthographic = Strong.PropertyInfo((Camera x) => x.orthographic, "orthographic"); MemberInfo fov = Strong.PropertyInfo((Camera x) => x.fieldOfView, "fieldOfView"); MemberInfo orthographicSize = Strong.PropertyInfo((Camera x) => x.orthographicSize, "orthographicSize"); List <PropertyDescriptor> descriptors = new List <PropertyDescriptor>(); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_Projection", "Projection"), converter, projection, orthographic, valueChanged)); if (!camera.orthographic) { descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_Fov", "Field Of View"), editor.Component, fov, "field of view")); } else { descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_Size", "Size"), editor.Component, orthographicSize, "orthographic size")); } return(descriptors.ToArray()); }
public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter) { object[] converters = (object[])converter; ILocalization lc = IOC.Resolve <ILocalization>(); PropertyEditorCallback valueChanged = () => editor.BuildEditor(); MemberInfo projection = Strong.PropertyInfo((CameraPropertyConverter x) => x.Projection, "Projection"); MemberInfo orthographic = Strong.PropertyInfo((Camera x) => x.orthographic, "orthographic"); MemberInfo fov = Strong.PropertyInfo((Camera x) => x.fieldOfView, "fieldOfView"); MemberInfo orthographicSize = Strong.PropertyInfo((Camera x) => x.orthographicSize, "orthographicSize"); MemberInfo cullingMask = Strong.PropertyInfo((Camera x) => x.cullingMask, "cullingMask"); List <PropertyDescriptor> descriptors = new List <PropertyDescriptor>(); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_Projection", "Projection"), converters, projection, orthographic, valueChanged)); Camera[] cameras = editor.NotNullComponents.OfType <Camera>().ToArray(); if (cameras.Length > 0) { bool isCameraOrthographic = cameras[0].orthographic; for (int i = 1; i < cameras.Length; ++i) { if (cameras[i].orthographic != isCameraOrthographic) { return(descriptors.ToArray()); } } if (!isCameraOrthographic) { descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_Fov", "Field Of View"), editor.Components, fov, "field of view")); } else { descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_Size", "Size"), editor.Components, orthographicSize, "orthographic size")); } List <RangeOptions.Option> flags = new List <RangeOptions.Option>(); LayersInfo layersInfo = LayersEditor.LoadedLayers; foreach (LayersInfo.Layer layer in layersInfo.Layers) { if (!string.IsNullOrEmpty(layer.Name)) { flags.Add(new RangeOptions.Option(layer.Name, layer.Index)); } } descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_CullingMask", "Culling Mask"), editor.Components, cullingMask) { Range = new RangeFlags(flags.ToArray()) }); } return(descriptors.ToArray()); }
public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter) { ILocalization lc = IOC.Resolve <ILocalization>(); PropertyEditorCallback valueChanged = () => editor.BuildEditor(); MemberInfo convexInfo = Strong.PropertyInfo((MeshCollider x) => x.convex, "convex"); MemberInfo isTriggerInfo = Strong.PropertyInfo((MeshCollider x) => x.isTrigger, "isTrigger"); MemberInfo materialInfo = Strong.PropertyInfo((MeshCollider x) => x.sharedMaterial, "sharedMaterial"); MemberInfo meshInfo = Strong.PropertyInfo((MeshCollider x) => x.sharedMesh, "sharedMesh"); bool?hasMixedValues; bool isConvex = GetIsConvex(editor, out hasMixedValues); if (hasMixedValues != null) { if (isConvex && hasMixedValues == false) { return(new[] { new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_MeshCollider_Convex", "Convex"), editor.Components, convexInfo, convexInfo, valueChanged) { AnimationPropertyName = "m_Convex" }, new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_MeshCollider_IsTrigger", "Is Trigger"), editor.Components, isTriggerInfo, "m_IsTrigger"), new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_MeshCollider_Material", "Material"), editor.Components, materialInfo, materialInfo), new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_MeshCollider_Mesh", "Mesh"), editor.Components, meshInfo, meshInfo), }); } return(new[] { new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_MeshCollider_Convex", "Convex"), editor.Components, convexInfo, convexInfo, valueChanged) { AnimationPropertyName = "m_Convex" }, new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_MeshCollider_Material", "Material"), editor.Components, materialInfo, materialInfo), new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_MeshCollider_Mesh", "Mesh"), editor.Components, meshInfo, meshInfo), }); } return(new PropertyDescriptor[0]); }
public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter) { object[] converters = (object[])converter; ILocalization lc = IOC.Resolve <ILocalization>(); PropertyEditorCallback valueChanged = () => editor.BuildEditor(); MemberInfo projection = Strong.PropertyInfo((CameraPropertyConverter x) => x.Projection, "Projection"); MemberInfo orthographic = Strong.PropertyInfo((Camera x) => x.orthographic, "orthographic"); MemberInfo fov = Strong.PropertyInfo((Camera x) => x.fieldOfView, "fieldOfView"); MemberInfo orthographicSize = Strong.PropertyInfo((Camera x) => x.orthographicSize, "orthographicSize"); List <PropertyDescriptor> descriptors = new List <PropertyDescriptor>(); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_Projection", "Projection"), converters, projection, orthographic, valueChanged)); Camera[] cameras = editor.NotNullComponents.OfType <Camera>().ToArray(); if (cameras.Length > 0) { bool isCameraOrthographic = cameras[0].orthographic; for (int i = 1; i < cameras.Length; ++i) { if (cameras[i].orthographic != isCameraOrthographic) { return(descriptors.ToArray()); } } if (!isCameraOrthographic) { descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_Fov", "Field Of View"), editor.Components, fov, "field of view")); } else { descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_Size", "Size"), editor.Components, orthographicSize, "orthographic size")); } } return(descriptors.ToArray()); }
public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter) { ILocalization lc = IOC.Resolve <ILocalization>(); PropertyEditorCallback valueChanged = () => editor.BuildEditor(); MemberInfo convexInfo = Strong.PropertyInfo((MeshCollider x) => x.convex, "convex"); MemberInfo isTriggerInfo = Strong.PropertyInfo((MeshCollider x) => x.isTrigger, "isTrigger"); MemberInfo materialInfo = Strong.PropertyInfo((MeshCollider x) => x.sharedMaterial, "sharedMaterial"); MemberInfo meshInfo = Strong.PropertyInfo((MeshCollider x) => x.sharedMesh, "sharedMesh"); MeshCollider collider = (MeshCollider)editor.Component; if (collider.convex) { return(new[] { new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_MeshCollider_Convex", "Convex"), editor.Component, convexInfo, convexInfo, valueChanged) { AnimationPropertyName = "m_Convex" }, new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_MeshCollider_IsTrigger", "Is Trigger"), editor.Component, isTriggerInfo, "m_IsTrigger"), new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_MeshCollider_Material", "Material"), editor.Component, materialInfo, materialInfo), new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_MeshCollider_Mesh", "Mesh"), editor.Component, meshInfo, meshInfo), }); } else { return(new[] { new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_MeshCollider_Convex", "Convex"), editor.Component, convexInfo, convexInfo, valueChanged) { AnimationPropertyName = "m_Convex" }, new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_MeshCollider_Material", "Material"), editor.Component, materialInfo, materialInfo), new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_MeshCollider_Mesh", "Mesh"), editor.Component, meshInfo, meshInfo), }); } }
public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter) { Light light = (Light)editor.Component; PropertyEditorCallback valueChanged = () => editor.BuildEditor(); MemberInfo enabledInfo = Strong.PropertyInfo((Light x) => x.enabled, "enabled"); MemberInfo lightTypeInfo = Strong.PropertyInfo((Light x) => x.type, "type"); MemberInfo colorInfo = Strong.PropertyInfo((Light x) => x.color, "color"); MemberInfo intensityInfo = Strong.PropertyInfo((Light x) => x.intensity, "intensity"); MemberInfo bounceIntensityInfo = Strong.PropertyInfo((Light x) => x.bounceIntensity, "bounceIntensity"); MemberInfo shadowTypeInfo = Strong.PropertyInfo((Light x) => x.shadows, "shadows"); MemberInfo cookieInfo = Strong.PropertyInfo((Light x) => x.cookie, "cookie"); MemberInfo cookieSizeInfo = Strong.PropertyInfo((Light x) => x.cookieSize, "cookieSize"); MemberInfo flareInfo = Strong.PropertyInfo((Light x) => x.flare, "flare"); MemberInfo renderModeInfo = Strong.PropertyInfo((Light x) => x.renderMode, "renderMode"); List <PropertyDescriptor> descriptors = new List <PropertyDescriptor>(); descriptors.Add(new PropertyDescriptor("Enabled", editor.Component, enabledInfo, "m_Enabled")); descriptors.Add(new PropertyDescriptor("Type", editor.Component, lightTypeInfo, lightTypeInfo, valueChanged)); if (light.type == LightType.Point) { MemberInfo rangeInfo = Strong.PropertyInfo((Light x) => x.range, "range"); descriptors.Add(new PropertyDescriptor("Range", editor.Component, rangeInfo, "m_Range")); } else if (light.type == LightType.Spot) { MemberInfo rangeInfo = Strong.PropertyInfo((Light x) => x.range, "range"); MemberInfo spotAngleInfo = Strong.PropertyInfo((Light x) => x.spotAngle, "spotAngle"); descriptors.Add(new PropertyDescriptor("Range", editor.Component, rangeInfo, "m_Range")); descriptors.Add(new PropertyDescriptor("Spot Angle", editor.Component, spotAngleInfo, spotAngleInfo, null, new Range(1, 179)) { AnimationPropertyName = "m_SpotAngle" }); } descriptors.Add(new PropertyDescriptor("Color", editor.Component, colorInfo, "m_Color")); descriptors.Add(new PropertyDescriptor("Intensity", editor.Component, intensityInfo, intensityInfo, null, new Range(0, 8)) { AnimationPropertyName = "m_Intensity" }); descriptors.Add(new PropertyDescriptor("Bounce Intensity", editor.Component, bounceIntensityInfo, bounceIntensityInfo, null, new Range(0, 8)) { AnimationPropertyName = "m_BounceIntensity" }); if (light.type != LightType.Area) { descriptors.Add(new PropertyDescriptor("Shadow Type", editor.Component, shadowTypeInfo, shadowTypeInfo, valueChanged)); if (light.shadows == LightShadows.Soft || light.shadows == LightShadows.Hard) { MemberInfo shadowStrengthInfo = Strong.PropertyInfo((Light x) => x.shadowStrength, "shadowStrength"); MemberInfo shadowResolutionInfo = Strong.PropertyInfo((Light x) => x.shadowResolution, "shadowResolution"); MemberInfo shadowBiasInfo = Strong.PropertyInfo((Light x) => x.shadowBias, "shadowBias"); MemberInfo shadowNormalBiasInfo = Strong.PropertyInfo((Light x) => x.shadowNormalBias, "shadowNormalBias"); MemberInfo shadowNearPlaneInfo = Strong.PropertyInfo((Light x) => x.shadowNearPlane, "shadowNearPlane"); descriptors.Add(new PropertyDescriptor("Strength", editor.Component, shadowStrengthInfo, shadowStrengthInfo, null, new Range(0, 1)) { AnimationPropertyName = "m_Strength" }); descriptors.Add(new PropertyDescriptor("Resoultion", editor.Component, shadowResolutionInfo, shadowResolutionInfo)); descriptors.Add(new PropertyDescriptor("Bias", editor.Component, shadowBiasInfo, shadowBiasInfo, null, new Range(0, 2)) { AnimationPropertyName = "m_Bias" }); descriptors.Add(new PropertyDescriptor("Normal Bias", editor.Component, shadowNormalBiasInfo, shadowNormalBiasInfo, null, new Range(0, 3)) { AnimationPropertyName = "m_NormalBias" }); descriptors.Add(new PropertyDescriptor("Shadow Near Plane", editor.Component, shadowNearPlaneInfo, shadowNearPlaneInfo, null, new Range(0, 10)) { AnimationPropertyName = "m_NearPlane" }); } descriptors.Add(new PropertyDescriptor("Cookie", editor.Component, cookieInfo, cookieInfo)); descriptors.Add(new PropertyDescriptor("Cookie Size", editor.Component, cookieSizeInfo, cookieSizeInfo)); } descriptors.Add(new PropertyDescriptor("Flare", editor.Component, flareInfo, flareInfo)); descriptors.Add(new PropertyDescriptor("Render Mode", editor.Component, renderModeInfo, renderModeInfo)); return(descriptors.ToArray()); }
public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter) { ILocalization lc = IOC.Resolve <ILocalization>(); PropertyEditorCallback valueChanged = () => editor.BuildEditor(); MemberInfo enabledInfo = Strong.PropertyInfo((Light x) => x.enabled, "enabled"); MemberInfo lightTypeInfo = Strong.PropertyInfo((Light x) => x.type, "type"); MemberInfo colorInfo = Strong.PropertyInfo((Light x) => x.color, "color"); MemberInfo intensityInfo = Strong.PropertyInfo((Light x) => x.intensity, "intensity"); MemberInfo bounceIntensityInfo = Strong.PropertyInfo((Light x) => x.bounceIntensity, "bounceIntensity"); MemberInfo shadowTypeInfo = Strong.PropertyInfo((Light x) => x.shadows, "shadows"); MemberInfo cookieInfo = Strong.PropertyInfo((Light x) => x.cookie, "cookie"); MemberInfo cookieSizeInfo = Strong.PropertyInfo((Light x) => x.cookieSize, "cookieSize"); MemberInfo flareInfo = Strong.PropertyInfo((Light x) => x.flare, "flare"); MemberInfo renderModeInfo = Strong.PropertyInfo((Light x) => x.renderMode, "renderMode"); bool? hasMixedLightTypes; LightType lightType = GetLightType(editor, out hasMixedLightTypes); List <PropertyDescriptor> descriptors = new List <PropertyDescriptor>(); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_Enabled", "Enabled"), editor.Components, enabledInfo, "m_Enabled")); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_Type", "Type"), editor.Components, lightTypeInfo, lightTypeInfo, valueChanged)); if (hasMixedLightTypes == false) { if (lightType == LightType.Point) { MemberInfo rangeInfo = Strong.PropertyInfo((Light x) => x.range, "range"); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_Range", "Range"), editor.Components, rangeInfo, "m_Range")); } else if (lightType == LightType.Spot) { MemberInfo rangeInfo = Strong.PropertyInfo((Light x) => x.range, "range"); MemberInfo spotAngleInfo = Strong.PropertyInfo((Light x) => x.spotAngle, "spotAngle"); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_Range", "Range"), editor.Components, rangeInfo, "m_Range")); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_SpotAngle", "Spot Angle"), editor.Components, spotAngleInfo, spotAngleInfo, null, new Range(1, 179)) { AnimationPropertyName = "m_SpotAngle" }); } } descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_Color", "Color"), editor.Components, colorInfo, "m_Color")); Range lightIntensityRange = RenderPipelineInfo.Type == RPType.HDRP ? new Range(0, 128000) : new Range(0, 8); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_Intensity", "Intensity"), editor.Components, intensityInfo, intensityInfo, null, lightIntensityRange) { AnimationPropertyName = "m_Intensity" }); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_BounceIntensity", "Bounce Intensity"), editor.Components, bounceIntensityInfo, bounceIntensityInfo, null, new Range(0, 8)) { AnimationPropertyName = "m_BounceIntensity" }); if (hasMixedLightTypes == false) { if (lightType != LightType.Area) { descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_ShadowType", "Shadow Type"), editor.Components, shadowTypeInfo, shadowTypeInfo, valueChanged)); bool? hasMixedLightShadows; LightShadows lightShadows = GetLightShadows(editor, out hasMixedLightShadows); if (hasMixedLightShadows == false && (lightShadows == LightShadows.Soft || lightShadows == LightShadows.Hard)) { MemberInfo shadowStrengthInfo = Strong.PropertyInfo((Light x) => x.shadowStrength, "shadowStrength"); MemberInfo shadowResolutionInfo = Strong.PropertyInfo((Light x) => x.shadowResolution, "shadowResolution"); MemberInfo shadowBiasInfo = Strong.PropertyInfo((Light x) => x.shadowBias, "shadowBias"); MemberInfo shadowNormalBiasInfo = Strong.PropertyInfo((Light x) => x.shadowNormalBias, "shadowNormalBias"); MemberInfo shadowNearPlaneInfo = Strong.PropertyInfo((Light x) => x.shadowNearPlane, "shadowNearPlane"); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_Strength", "Strength"), editor.Components, shadowStrengthInfo, shadowStrengthInfo, null, new Range(0, 1)) { AnimationPropertyName = "m_Strength" }); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_Resolution", "Resoultion"), editor.Components, shadowResolutionInfo, shadowResolutionInfo)); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_Bias", "Bias"), editor.Components, shadowBiasInfo, shadowBiasInfo, null, new Range(0, 2)) { AnimationPropertyName = "m_Bias" }); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_NormalBias", "Normal Bias"), editor.Components, shadowNormalBiasInfo, shadowNormalBiasInfo, null, new Range(0, 3)) { AnimationPropertyName = "m_NormalBias" }); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_ShadowNearPlane", "Shadow Near Plane"), editor.Components, shadowNearPlaneInfo, shadowNearPlaneInfo, null, new Range(0, 10)) { AnimationPropertyName = "m_NearPlane" }); } descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_Cookie", "Cookie"), editor.Components, cookieInfo, cookieInfo)); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_CookieSize", "Cookie Size"), editor.Components, cookieSizeInfo, cookieSizeInfo)); } } descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_Flare", "Flare"), editor.Components, flareInfo, flareInfo)); descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Light_RenderMode", "Render Mode"), editor.Components, renderModeInfo, renderModeInfo)); return(descriptors.ToArray()); }