public override void OnInspectorGUI() { //DrawDefaultInspector(); var t = target as ShadowRaytracer; var so = serializedObject; // output EditorGUILayout.Space(); EditorGUILayout.LabelField("Output", EditorStyles.boldLabel); EditorGUILayout.PropertyField(so.FindProperty("m_generateRenderTexture")); { EditorGUI.indentLevel++; if (t.generateRenderTexture) { EditorGUILayout.PropertyField(so.FindProperty("m_outputType")); EditorGUI.BeginDisabledGroup(true); } EditorGUILayout.PropertyField(so.FindProperty("m_outputTexture")); if (t.generateRenderTexture) { EditorGUI.EndDisabledGroup(); } EditorGUI.indentLevel--; } EditorGUILayout.PropertyField(so.FindProperty("m_assignGlobalTexture")); if (t.assignGlobalTexture) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(so.FindProperty("m_globalTextureName")); EditorGUI.indentLevel--; } EditorGUILayout.Space(); // shadows EditorGUILayout.LabelField("Shadows", EditorStyles.boldLabel); EditorGUILayout.PropertyField(so.FindProperty("m_useCameraCullingMask")); EditorGUILayout.PropertyField(so.FindProperty("m_cullBackFaces")); if (t.cullBackFaces) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(so.FindProperty("m_flipCasterFaces")); EditorGUI.indentLevel--; } EditorGUILayout.PropertyField(so.FindProperty("m_ignoreSelfShadow")); if (t.ignoreSelfShadow) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(so.FindProperty("m_keepSelfDropShadow")); EditorGUILayout.PropertyField(so.FindProperty("m_selfShadowThreshold")); EditorGUI.indentLevel--; } else { EditorGUILayout.PropertyField(so.FindProperty("m_shadowRayOffset")); } EditorGUILayout.Space(); // lights EditorGUILayout.LabelField("Lights", EditorStyles.boldLabel); EditorGUILayout.PropertyField(so.FindProperty("m_useLightShadowSettings")); EditorGUILayout.PropertyField(so.FindProperty("m_useLightCullingMask")); EditorGUILayout.PropertyField(so.FindProperty("m_setLightIndexToAlpha")); { var spLightScope = so.FindProperty("m_lightScope"); EditorGUILayout.PropertyField(spLightScope); switch ((ShadowRaytracer.ObjectScope)spLightScope.intValue) { case ShadowRaytracer.ObjectScope.Scenes: DrawScenesField(so.FindProperty("m_lightScenes")); break; case ShadowRaytracer.ObjectScope.Objects: EditorGUILayout.PropertyField(so.FindProperty("m_lightObjects"), true); break; } } EditorGUILayout.Space(); // geometry EditorGUILayout.LabelField("Geometry", EditorStyles.boldLabel); EditorGUILayout.PropertyField(so.FindProperty("m_useObjectShadowSettings")); EditorGUILayout.PropertyField(so.FindProperty("m_geometryScope")); switch (t.geometryScope) { case ShadowRaytracer.ObjectScope.Scenes: DrawScenesField(so.FindProperty("m_geometryScenes")); break; case ShadowRaytracer.ObjectScope.Objects: EditorGUILayout.PropertyField(so.FindProperty("m_geometryObjects"), true); break; } EditorGUILayout.Space(); // misc EditorGUILayout.LabelField("Misc", EditorStyles.boldLabel); EditorGUILayout.PropertyField(so.FindProperty("m_GPUSkinning")); EditorGUILayout.PropertyField(so.FindProperty("m_adaptiveSampling")); EditorGUILayout.PropertyField(so.FindProperty("m_antialiasing")); EditorCameraManager.enableSceneViewRendering = EditorGUILayout.Toggle("Preview In Scene View", EditorCameraManager.enableSceneViewRendering); // debug var foldDebug = so.FindProperty("m_foldDebug"); foldDebug.boolValue = EditorGUILayout.Foldout(foldDebug.boolValue, "Debug"); if (foldDebug.boolValue) { var debugFlags = rthsGlobals.debugFlags; bool timestamp = (debugFlags & rthsDebugFlag.Timestamp) != 0; bool forceUpdateAS = (debugFlags & rthsDebugFlag.ForceUpdateAS) != 0; bool powerStableState = (debugFlags & rthsDebugFlag.PowerStableState) != 0; EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); timestamp = EditorGUILayout.Toggle("Timestamp", timestamp); forceUpdateAS = EditorGUILayout.Toggle("Force Update AS", forceUpdateAS); powerStableState = EditorGUILayout.Toggle("Power Stable State", powerStableState); if (EditorGUI.EndChangeCheck()) { rthsDebugFlag v = 0; if (timestamp) { v |= rthsDebugFlag.Timestamp; } if (forceUpdateAS) { v |= rthsDebugFlag.ForceUpdateAS; } if (powerStableState) { v |= rthsDebugFlag.PowerStableState; } rthsGlobals.debugFlags = v; } EditorGUILayout.PropertyField(so.FindProperty("m_dbgVerboseLog"), new GUIContent("Verbose Log")); if (timestamp) { EditorGUILayout.TextArea(t.timestampLog, GUILayout.Height(80)); } EditorGUI.indentLevel--; } so.ApplyModifiedProperties(); EditorGUILayout.Space(); if (GUILayout.Button("Export to image", GUILayout.Width(200))) { ExportToImageWindow.Open(t); } EditorGUILayout.Space(); EditorGUILayout.LabelField(System.String.Format("Plugin version: {0} ({1})", Lib.version, Lib.releaseDate)); }
public override void OnInspectorGUI() { //DrawDefaultInspector(); var t = target as ShadowRaytracer; var so = serializedObject; // output EditorGUILayout.Space(); EditorGUILayout.LabelField("Output", EditorStyles.boldLabel); EditorGUILayout.PropertyField(so.FindProperty("m_generateRenderTexture")); { EditorGUI.indentLevel++; if (t.generateRenderTexture) { EditorGUI.BeginDisabledGroup(true); } EditorGUILayout.PropertyField(so.FindProperty("m_outputTexture")); if (t.generateRenderTexture) { EditorGUI.EndDisabledGroup(); } EditorGUI.indentLevel--; } EditorGUILayout.PropertyField(so.FindProperty("m_assignGlobalTexture")); if (t.assignGlobalTexture) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(so.FindProperty("m_globalTextureName")); EditorGUI.indentLevel--; } EditorGUILayout.Space(); // shadow EditorGUILayout.LabelField("Shadow", EditorStyles.boldLabel); EditorGUILayout.PropertyField(so.FindProperty("m_cullBackFaces")); if (t.cullBackFaces) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(so.FindProperty("m_flipCasterFaces")); EditorGUI.indentLevel--; } EditorGUILayout.PropertyField(so.FindProperty("m_ignoreSelfShadow")); if (t.ignoreSelfShadow) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(so.FindProperty("m_keepSelfDropShadow")); EditorGUILayout.PropertyField(so.FindProperty("m_selfShadowThreshold")); EditorGUI.indentLevel--; } else { EditorGUILayout.PropertyField(so.FindProperty("m_shadowRayOffset")); } EditorGUILayout.Space(); // lights EditorGUILayout.LabelField("Lights", EditorStyles.boldLabel); { var spLightScope = so.FindProperty("m_lightScope"); EditorGUILayout.PropertyField(spLightScope); switch ((ShadowRaytracer.ObjectScope)spLightScope.intValue) { case ShadowRaytracer.ObjectScope.Scenes: DrawScenesField(so.FindProperty("m_lightScenes")); break; case ShadowRaytracer.ObjectScope.Objects: EditorGUILayout.PropertyField(so.FindProperty("m_lightObjects"), true); break; } } EditorGUILayout.Space(); // geometry EditorGUILayout.LabelField("Geometry", EditorStyles.boldLabel); EditorGUILayout.PropertyField(so.FindProperty("m_separateCastersAndReceivers")); if (t.separateCastersAndReceivers) { int layerToRemove = -1; var spLayers = so.FindProperty("m_layers"); int layerCount = spLayers.arraySize; for (int li = 0; li < layerCount; ++li) { var spLayer = spLayers.GetArrayElementAtIndex(li); var fold = spLayer.FindPropertyRelative("fold"); GUILayout.BeginHorizontal(); GUILayout.BeginVertical("Box"); GUILayout.BeginHorizontal(); GUILayout.Space(indentSize); fold.boolValue = EditorGUILayout.Foldout(fold.boolValue, "Layer " + (li + 1)); if (GUILayout.Button("-", GUILayout.Width(20))) { layerToRemove = li; } GUILayout.EndHorizontal(); EditorGUILayout.Space(); if (fold.boolValue) { var spReceiverScope = spLayer.FindPropertyRelative("receiverScope"); var spCasterScope = spLayer.FindPropertyRelative("casterScope"); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(spReceiverScope); EditorGUI.indentLevel++; switch ((ShadowRaytracer.ObjectScope)spReceiverScope.intValue) { case ShadowRaytracer.ObjectScope.Scenes: DrawScenesField(spLayer.FindPropertyRelative("receiverScenes")); break; case ShadowRaytracer.ObjectScope.Objects: EditorGUILayout.PropertyField(spLayer.FindPropertyRelative("receiverObjects"), true); break; } EditorGUI.indentLevel--; EditorGUILayout.Space(); EditorGUILayout.PropertyField(spCasterScope); EditorGUI.indentLevel++; switch ((ShadowRaytracer.ObjectScope)spCasterScope.intValue) { case ShadowRaytracer.ObjectScope.Scenes: DrawScenesField(spLayer.FindPropertyRelative("casterScenes")); break; case ShadowRaytracer.ObjectScope.Objects: EditorGUILayout.PropertyField(spLayer.FindPropertyRelative("casterObjects"), true); break; } EditorGUI.indentLevel--; EditorGUI.indentLevel--; } GUILayout.EndVertical(); GUILayout.EndHorizontal(); } if (layerToRemove != -1) { spLayers.DeleteArrayElementAtIndex(layerToRemove); } if (layerCount < ShadowRaytracer.kMaxLayers) { GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal("Box"); GUILayout.Space(indentSize); GUILayout.FlexibleSpace(); if (GUILayout.Button("+", GUILayout.Width(20))) { Undo.RecordObject(t, "ShadowRaytracer"); t.AddLayer(); } GUILayout.EndHorizontal(); GUILayout.EndHorizontal(); } } else { EditorGUILayout.PropertyField(so.FindProperty("m_geometryScope")); switch (t.geometryScope) { case ShadowRaytracer.ObjectScope.Scenes: DrawScenesField(so.FindProperty("m_geometryScenes")); break; case ShadowRaytracer.ObjectScope.Objects: EditorGUILayout.PropertyField(so.FindProperty("m_geometryObjects"), true); break; } } EditorGUILayout.Space(); // misc EditorGUILayout.LabelField("Misc", EditorStyles.boldLabel); EditorGUILayout.PropertyField(so.FindProperty("m_GPUSkinning")); EditorGUILayout.PropertyField(so.FindProperty("m_adaptiveSampling")); EditorGUILayout.PropertyField(so.FindProperty("m_antialiasing")); //EditorGUILayout.PropertyField(so.FindProperty("m_parallelCommandList")); // debug var foldDebug = so.FindProperty("m_foldDebug"); foldDebug.boolValue = EditorGUILayout.Foldout(foldDebug.boolValue, "Debug"); if (foldDebug.boolValue) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(so.FindProperty("m_dbgTimestamp")); EditorGUILayout.PropertyField(so.FindProperty("m_dbgForceUpdateAS")); if (t.dbgTimestamp) { EditorGUILayout.TextArea(t.timestampLog, GUILayout.Height(80)); } EditorGUI.indentLevel--; } so.ApplyModifiedProperties(); EditorGUILayout.Space(); if (GUILayout.Button("Export to image", GUILayout.Width(200))) { ExportToImageWindow.Open(t); } }