[DllImport(Lib.name)] static extern void rthsGlobalsSetDebugFlags(rthsDebugFlag v);
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)); }
[DllImport("rths")] static extern void rthsGlobalsSetDebugFlags(rthsDebugFlag v);