public void SavePreferences()
        {
            //UserPrefs.SetString("filepath_root", m_filepath_root);
            UserPrefs.SetString("filepath_decal_textures", m_filepath_decal_textures);
            UserPrefs.SetString("filepath_level_textures", m_filepath_level_textures);
            UserPrefs.SetString("filepath_decals", m_filepath_decals);

            UserPrefs.SetInt("grid_display", (int)m_grid_display);
            UserPrefs.SetFloat("grid_spacing", m_grid_spacing);
            UserPrefs.SetFloat("grid_snap", m_grid_snap);

            UserPrefs.SetFloat("extrude_length", m_extrude_length);
            UserPrefs.SetInt("inset_pct", m_inset_pct);
            UserPrefs.SetFloat("inset_length", m_inset_length);
            UserPrefs.SetFloat("bevel_width", m_bevel_width);

            UserPrefs.SetInt("coplanar_tol", m_coplanar_tol);
            UserPrefs.SetInt("side_select", (int)m_side_select);
            UserPrefs.SetInt("drag_mode", (int)m_drag_mode);

            UserPrefs.SetInt("view_mode_ortho", (int)m_view_mode_ortho);
            UserPrefs.SetInt("view_mode_persp", (int)m_view_mode_persp);
            UserPrefs.SetInt("view_persp_fov", m_view_persp_fov);
            UserPrefs.SetInt("view_layout", (int)m_view_layout);
            UserPrefs.SetInt("bg_color", (int)m_bg_color);
            UserPrefs.SetInt("gimbal_display", (int)m_gimbal_display);
            UserPrefs.SetInt("lighting_type", (int)m_lighting_type);
            UserPrefs.SetInt("pivot_mode", (int)m_pivot_mode);

            UserPrefs.SetBool("low_res_force", m_low_res_force);

            UserPrefs.SetPoint("tex_list_loc", m_tex_list_loc);
            UserPrefs.SetPoint("tex_list_sz", (Point)texture_list.Size);
            UserPrefs.SetPoint("tunnel_builder_loc", m_tunnel_builder_loc);

            for (int i = 0; i < RECENT_NUM; i++)
            {
                UserPrefs.SetString("recent" + i.ToString(), m_recent_files[i]);
            }

            Directory.SetCurrentDirectory(m_filepath_root);
            UserPrefs.Flush();
        }
        public void StoreLayoutToPreferences(string layout)
        {
            if (string.IsNullOrWhiteSpace(layout))
            {
                m_editor_layout = string.Empty;
            }
            else
            {
                m_editor_layout = layout;
            }

            UserPrefs.SetString("layout", m_editor_layout);

            //Save whether pop-up windows are open
            UserPrefs.SetBool("decal_list_vis", decal_list.Visible);
            UserPrefs.SetBool("tex_list_vis", texture_list.Visible);
            UserPrefs.SetBool("texture_set_list_vis", texture_set_list.Visible);
            UserPrefs.SetBool("uv_editor_vis", uv_editor.Visible);
        }
        public void SavePreferences()
        {
            UserPrefs.SetInt("grid_display", (int)m_grid_display);
            UserPrefs.SetInt("grid_spacing", m_grid_spacing);
            UserPrefs.SetFloat("grid_snap", m_grid_snap);

            UserPrefs.SetInt("coplanar_tol", m_coplanar_tol);
            UserPrefs.SetInt("rotate_angle", m_rotate_angle);
            UserPrefs.SetInt("side_select", (int)m_side_select);
            UserPrefs.SetBool("insert_advance", m_insert_advance);
            UserPrefs.SetInt("drag_mode", (int)m_drag_mode);

            UserPrefs.SetInt("view_mode_ortho", (int)m_view_mode_ortho);
            UserPrefs.SetInt("view_mode_persp", (int)m_view_mode_persp);
            UserPrefs.SetInt("view_persp_fov", m_view_persp_fov);
            UserPrefs.SetInt("view_layout", (int)m_view_layout);
            UserPrefs.SetInt("bg_color", (int)m_bg_color);
            UserPrefs.SetInt("gimbal_display", (int)m_gimbal_display);
            UserPrefs.SetInt("lighting_type", (int)m_lighting_type);
            UserPrefs.SetInt("clip_decal", (int)m_cp_display);
            UserPrefs.SetInt("insert_decal", (int)m_insert_decal);
            UserPrefs.SetInt("show_segment_numbers", (int)m_show_3d_text_type);
            UserPrefs.SetBool("auto_center", m_auto_center);

            UserPrefs.SetInt("entity_pivot", (int)m_pivot_mode);

            UserPrefs.SetPoint("decal_list_loc", m_decal_list_loc);
            UserPrefs.SetPoint("decal_list_sz", (Point)decal_list.Size);
            UserPrefs.SetPoint("tex_list_loc", m_tex_list_loc);
            UserPrefs.SetPoint("tex_list_sz", (Point)texture_list.Size);
            UserPrefs.SetPoint("texture_set_list_loc", m_texture_set_list_loc);
            UserPrefs.SetPoint("texture_set_list_sz", (Point)texture_set_list.Size);
            UserPrefs.SetPoint("uv_editor_loc", m_uv_editor_loc);
            UserPrefs.SetPoint("uv_editor_sz", (Point)uv_editor.RestoreBounds.Size);

            UserPrefs.SetInt("mm_edit_type", (int)m_mm_edit_type);
            UserPrefs.SetInt("mm_op_mode", (int)m_mm_op_mode);

            for (int i = 0; i < NumRecentFiles; i++)
            {
                UserPrefs.SetString(string.Format("recent{0}", i), GetRecentFile(i));
            }

#if !PUBLIC_RELEASE
            UserPrefs.SetString("m_cached_username", Overload.Perforce.m_cached_username);
            UserPrefs.SetString("m_cached_clientname", Overload.Perforce.m_cached_clientname);
#endif // !PUBLIC_RELEASE

            //Pack texture collections into string
            if (TextureCollections.Count > 0)
            {
                UserPrefs.SetInt("num_texture_collections", TextureCollections.Count);
                int num = 0;
                foreach (TextureCollection collection in TextureCollections)
                {
                    UserPrefs.SetString("texture_collection_" + num, collection.Serialize());
                    num++;
                }
            }

            Directory.SetCurrentDirectory(m_filepath_root);
            UserPrefs.Flush();
        }