// Load all Uni2D editor prefs at Unity editor startup static Uni2DEditorPreferences () { Uni2DEditorPreferences.UnselectedBoneGizmoColor = Uni2DEditorPreferences.GetEditorPrefColor32 (mc_oUnselectedBoneGizmoColorKeyPref, ms_oUnselectedBoneGizmoColor32); Uni2DEditorPreferences.SelectedBoneGizmoColor = Uni2DEditorPreferences.GetEditorPrefColor32 (mc_oSelectedBoneGizmoColorKeyPref, ms_oSelectedBoneGizmoColor32); Uni2DEditorPreferences.EditableBoneGizmoColor = Uni2DEditorPreferences.GetEditorPrefColor32 (mc_oEditableBoneGizmoColorKeyPref, ms_oEditableBoneGizmoColor32); Uni2DEditorPreferences.ActiveBoneGizmoColor = Uni2DEditorPreferences.GetEditorPrefColor32 (mc_oActiveBoneGizmoColorKeyPref, ms_oActiveBoneGizmoColor32); Uni2DEditorPreferences.UnselectedRootBoneGizmoColor = Uni2DEditorPreferences.GetEditorPrefColor32 (mc_oUnselectedRootBoneGizmoColorKeyPref, ms_oUnselectedRootBoneGizmoColor32); Uni2DEditorPreferences.SelectedRootBoneGizmoColor = Uni2DEditorPreferences.GetEditorPrefColor32 (mc_oSelectedRootBoneGizmoColorKeyPref, ms_oSelectedRootBoneGizmoColor32); Uni2DEditorPreferences.EditableRootBoneGizmoColor = Uni2DEditorPreferences.GetEditorPrefColor32 (mc_oEditableRootBoneGizmoColorKeyPref, ms_oEditableRootBoneGizmoColor32); Uni2DEditorPreferences.ActiveRootBoneGizmoColor = Uni2DEditorPreferences.GetEditorPrefColor32 (mc_oActiveRootBoneGizmoColorKeyPref, ms_oActiveRootBoneGizmoColor32); Uni2DEditorPreferences.InnerBoneDiscHandleColor = Uni2DEditorPreferences.GetEditorPrefColor32 (mc_oInnerBoneDiscHandleColorKeyPref, ms_oInnerBoneDiscHandleColor32); Uni2DEditorPreferences.OuterBoneDiscHandleColor = Uni2DEditorPreferences.GetEditorPrefColor32 (mc_oOuterBoneDiscHandleColorKeyPref, ms_oOuterBoneDiscHandleColor32); Uni2DEditorPreferences.SelectedBoneDiscHandleOutlineColor = Uni2DEditorPreferences.GetEditorPrefColor32 (mc_oSelectedBoneDiscHandleOutlineColorKeyPref, ms_oSelectedBoneDiscHandleOutlineColor32); Uni2DEditorPreferences.InnerRootBoneDiscHandleColor = Uni2DEditorPreferences.GetEditorPrefColor32 (mc_oInnerRootBoneDiscHandleColorKeyPref, ms_oInnerRootBoneDiscHandleColor32); Uni2DEditorPreferences.OuterRootBoneDiscHandleColor = Uni2DEditorPreferences.GetEditorPrefColor32 (mc_oOuterRootBoneDiscHandleColorKeyPref, ms_oOuterRootBoneDiscHandleColor32); Uni2DEditorPreferences.SelectedRootBoneDiscHandleOutlineColor = Uni2DEditorPreferences.GetEditorPrefColor32 (mc_oSelectedRootBoneDiscHandleOutlineColorKeyPref, ms_oSelectedRootBoneDiscHandleOutlineColor32); Uni2DEditorPreferences.SmoothBindingDefaultSkinQuality = (SkinQuality)EditorPrefs.GetInt (mc_oSmoothBindingDefaultSkinQualityKeyPref, (int)ms_oSmoothBindingDefaultSkinQuality); }
public static void ShowUni2DPreferences( ) { GUILayoutOption oMaxWidthOption = GUILayout.MaxWidth( 135.0f ); GUILayoutOption oMaxColorPickedWidthOption = GUILayout.MaxWidth( 100.0f ); //EditorGUILayout.HelpBox( "Uni2D Beta", MessageType.Warning, true ); EditorGUILayout.BeginVertical( ); { // Header EditorGUILayout.BeginHorizontal( ); { EditorGUILayout.LabelField( "Bone Gizmo State", EditorStyles.boldLabel, oMaxWidthOption ); EditorGUILayout.LabelField( "Bone", EditorStyles.boldLabel, oMaxColorPickedWidthOption ); EditorGUILayout.LabelField( "Root Bone", EditorStyles.boldLabel, oMaxColorPickedWidthOption ); } EditorGUILayout.EndHorizontal( ); // Unselected EditorGUILayout.BeginHorizontal( ); { EditorGUILayout.LabelField( "Unselected", oMaxWidthOption ); Uni2DEditorPreferences.UnselectedBoneGizmoColor = EditorGUILayout.ColorField( Uni2DEditorPreferences.UnselectedBoneGizmoColor, oMaxColorPickedWidthOption ); Uni2DEditorPreferences.UnselectedRootBoneGizmoColor = EditorGUILayout.ColorField( Uni2DEditorPreferences.UnselectedRootBoneGizmoColor, oMaxColorPickedWidthOption ); } EditorGUILayout.EndHorizontal( ); // Selected EditorGUILayout.BeginHorizontal( ); { EditorGUILayout.LabelField( "Selected", oMaxWidthOption ); Uni2DEditorPreferences.SelectedBoneGizmoColor = EditorGUILayout.ColorField( Uni2DEditorPreferences.SelectedBoneGizmoColor, oMaxColorPickedWidthOption ); Uni2DEditorPreferences.SelectedRootBoneGizmoColor = EditorGUILayout.ColorField( Uni2DEditorPreferences.SelectedRootBoneGizmoColor, oMaxColorPickedWidthOption ); } EditorGUILayout.EndHorizontal( ); // Editable EditorGUILayout.BeginHorizontal( ); { EditorGUILayout.LabelField( "Editable", oMaxWidthOption ); Uni2DEditorPreferences.EditableBoneGizmoColor = EditorGUILayout.ColorField( Uni2DEditorPreferences.EditableBoneGizmoColor, oMaxColorPickedWidthOption ); Uni2DEditorPreferences.EditableRootBoneGizmoColor = EditorGUILayout.ColorField( Uni2DEditorPreferences.EditableRootBoneGizmoColor, oMaxColorPickedWidthOption ); } EditorGUILayout.EndHorizontal( ); // Active EditorGUILayout.BeginHorizontal( ); { EditorGUILayout.LabelField( "Active", oMaxWidthOption ); Uni2DEditorPreferences.ActiveBoneGizmoColor = EditorGUILayout.ColorField( Uni2DEditorPreferences.ActiveBoneGizmoColor, oMaxColorPickedWidthOption ); Uni2DEditorPreferences.ActiveRootBoneGizmoColor = EditorGUILayout.ColorField( Uni2DEditorPreferences.ActiveRootBoneGizmoColor, oMaxColorPickedWidthOption ); } EditorGUILayout.EndHorizontal( ); EditorGUILayout.Space( ); // Header EditorGUILayout.BeginHorizontal( ); { EditorGUILayout.LabelField( "Disc Handle", EditorStyles.boldLabel, oMaxWidthOption ); EditorGUILayout.LabelField( "Bone", EditorStyles.boldLabel, oMaxColorPickedWidthOption ); EditorGUILayout.LabelField( "Root Bone", EditorStyles.boldLabel, oMaxColorPickedWidthOption ); } EditorGUILayout.EndHorizontal( ); // Inner disc handle EditorGUILayout.BeginHorizontal( ); { EditorGUILayout.LabelField( "Inner", oMaxWidthOption ); Uni2DEditorPreferences.InnerBoneDiscHandleColor = EditorGUILayout.ColorField( Uni2DEditorPreferences.InnerBoneDiscHandleColor, oMaxColorPickedWidthOption ); Uni2DEditorPreferences.InnerRootBoneDiscHandleColor = EditorGUILayout.ColorField( Uni2DEditorPreferences.InnerRootBoneDiscHandleColor, oMaxColorPickedWidthOption ); } EditorGUILayout.EndHorizontal( ); // Outer disc handle EditorGUILayout.BeginHorizontal( ); { EditorGUILayout.LabelField( "Outer", oMaxWidthOption ); Uni2DEditorPreferences.OuterBoneDiscHandleColor = EditorGUILayout.ColorField( Uni2DEditorPreferences.OuterBoneDiscHandleColor, oMaxColorPickedWidthOption ); Uni2DEditorPreferences.OuterRootBoneDiscHandleColor = EditorGUILayout.ColorField( Uni2DEditorPreferences.OuterRootBoneDiscHandleColor, oMaxColorPickedWidthOption ); } EditorGUILayout.EndHorizontal( ); // Selected disc handle outline EditorGUILayout.BeginHorizontal( ); { EditorGUILayout.LabelField( "Outline (when selected)", oMaxWidthOption ); Uni2DEditorPreferences.SelectedBoneGizmoColor = EditorGUILayout.ColorField( Uni2DEditorPreferences.SelectedBoneDiscHandleOutlineColor, oMaxColorPickedWidthOption ); Uni2DEditorPreferences.SelectedRootBoneGizmoColor = EditorGUILayout.ColorField( Uni2DEditorPreferences.SelectedRootBoneDiscHandleOutlineColor, oMaxColorPickedWidthOption ); } EditorGUILayout.EndHorizontal( ); EditorGUILayout.Space( ); } EditorGUILayout.EndVertical( ); Uni2DEditorPreferences.SmoothBindingDefaultSkinQuality = (SkinQuality) EditorGUILayout.EnumPopup( "Default Skin Quality", Uni2DEditorPreferences.SmoothBindingDefaultSkinQuality ); EditorGUILayout.Space( ); EditorGUILayout.BeginHorizontal( ); { if( GUILayout.Button( "Use Default" ) ) { Uni2DEditorPreferences.RestoreDefaults( ); } GUILayout.FlexibleSpace( ); } EditorGUILayout.EndHorizontal( ); EditorGUILayout.Space( ); // Asset table rebuild EditorGUILayout.BeginVertical( ); { EditorGUILayout.LabelField( "Rebuild the Uni2D asset table if you think Uni2D is not handling your assets properly.", EditorStyles.wordWrappedLabel ); if( GUILayout.Button( "Rebuild Uni2D Asset Table" ) ) { Uni2DEditorAssetTable rAssetTable = Uni2DEditorAssetTable.Instance; rAssetTable.Rebuild( ); } } EditorGUILayout.EndVertical( ); }