diff --git a/app/src/main/assets/luts/config.json b/app/src/main/assets/luts/config.json index bd18d176..05e7cb66 100644 --- a/app/src/main/assets/luts/config.json +++ b/app/src/main/assets/luts/config.json @@ -20,52 +20,6 @@ "isDefault": true, "isVip": false }, - { - "id": "ricoh_negative", - "name": { - "en": "Negative", - "zh": "理光负片" - }, - "path": "ricoh_negative.plut", - "isDefault": false, - "isVip": false - }, - { - "id": "ricoh_positive", - "name": { - "en": "Positive", - "zh": "理光正片" - }, - "path": "ricoh_positive.plut", - "isVip": false - }, - { - "id": "ricoh_gr2_positive", - "name": { - "en": "Positive GR2", - "zh": "理光正片GR2" - }, - "path": "Ricoh_GR2_POSI.plut", - "isVip": false - }, - { - "id": "ricoh_green", - "name": { - "en": "Green", - "zh": "电影绿" - }, - "path": "ricoh_green.plut", - "isVip": false - }, - { - "id": "ricoh_yellow", - "name": { - "en": "Yellow", - "zh": "电影黄" - }, - "path": "ricoh_yellow.plut", - "isVip": false - }, { "id": "leica_m9", "name": { @@ -79,7 +33,7 @@ "id": "leica", "name": { "en": "Leica", - "zh": "徕卡影调" + "zh": "徕卡ETN" }, "path": "leica.plut", "isVip": false @@ -112,48 +66,12 @@ "isVip": false }, { - "id": "pentax", + "id": "fl3", "name": { - "en": "Pentax", - "zh": "宾得明亮" + "en": "FL3", + "zh": "FL3" }, - "path": "pentax.plut", - "isVip": false - }, - { - "id": "pentax_harubeni", - "name": { - "en": "Harubeni", - "zh": "宾得春红" - }, - "path": "Pentax_Harubeni.plut", - "isVip": false - }, - { - "id": "pentax_katen", - "name": { - "en": "Katen", - "zh": "宾得夏天" - }, - "path": "Pentax_Katen.plut", - "isVip": false - }, - { - "id": "pentax_kyushu", - "name": { - "en": "Kyushu", - "zh": "宾得九秋" - }, - "path": "Pentax_Kyushu.plut", - "isVip": false - }, - { - "id": "pentax_fuyuno", - "name": { - "en": "Fuyuno", - "zh": "宾得冬野" - }, - "path": "Pentax_Fuyuno.plut", + "path": "fl3.plut", "isVip": false }, { @@ -172,16 +90,157 @@ "zh": "富士CC" }, "path": "cc.plut", - "isDefault": true, "isVip": false }, { - "id": "fl3", + "id": "ricoh_negative", "name": { - "en": "FL3", - "zh": "FL3" + "en": "Negative", + "zh": "理光负片" }, - "path": "fl3.plut", + "path": "ricoh_negative.plut", + "isDefault": false, + "category": "Ricoh", + "isVip": false + }, + { + "id": "ricoh_positive", + "name": { + "en": "Positive", + "zh": "理光正片" + }, + "path": "ricoh_positive.plut", + "category": "Ricoh", + "isVip": false + }, + { + "id": "ricoh_gr2_positive", + "name": { + "en": "Positive GR2", + "zh": "理光正片GR2" + }, + "path": "Ricoh_GR2_POSI.plut", + "category": "Ricoh", + "isVip": false + }, + { + "id": "ricoh_green", + "name": { + "en": "Green", + "zh": "电影绿" + }, + "path": "ricoh_green.plut", + "category": "Ricoh", + "isVip": false + }, + { + "id": "ricoh_yellow", + "name": { + "en": "Yellow", + "zh": "电影黄" + }, + "path": "ricoh_yellow.plut", + "category": "Ricoh", + "isVip": false + }, + { + "id": "pentax", + "name": { + "en": "Pentax", + "zh": "宾得明亮" + }, + "path": "pentax.plut", + "category": "Pentax", + "isVip": false + }, + { + "id": "pentax_harubeni", + "name": { + "en": "Harubeni", + "zh": "宾得春红" + }, + "path": "Pentax_Harubeni.plut", + "category": "Pentax", + "isVip": false + }, + { + "id": "pentax_katen", + "name": { + "en": "Katen", + "zh": "宾得夏天" + }, + "path": "Pentax_Katen.plut", + "category": "Pentax", + "isVip": false + }, + { + "id": "pentax_kyushu", + "name": { + "en": "Kyushu", + "zh": "宾得九秋" + }, + "path": "Pentax_Kyushu.plut", + "category": "Pentax", + "isVip": false + }, + { + "id": "pentax_fuyuno", + "name": { + "en": "Fuyuno", + "zh": "宾得冬野" + }, + "path": "Pentax_Fuyuno.plut", + "category": "Pentax", + "isVip": false + }, + { + "id": "lumix_std", + "name": { + "en": "Lumix STD", + "zh": "Lumix标准" + }, + "path": "lumix_std.plut", + "category": "Lumix", + "isVip": false + }, + { + "id": "lumix_vlog", + "name": { + "en": "Lumix VLog", + "zh": "Lumix VLog" + }, + "path": "lumix_vlog.plut", + "category": "Lumix", + "isVip": false + }, + { + "id": "lumix_portrait", + "name": { + "en": "Lumix Portrait", + "zh": "Lumix肖像" + }, + "path": "lumix_portrait.plut", + "category": "Lumix", + "isVip": false + }, + { + "id": "lumix_nat", + "name": { + "en": "Lumix Nature", + "zh": "Lumix自然" + }, + "path": "lumix_nat.plut", + "category": "Lumix", + "isVip": false + }, + { + "id": "lumix_vivid", + "name": { + "en": "Lumix Vivid", + "zh": "Lumix生动" + }, + "path": "lumix_vivid.plut", + "category": "Lumix", "isVip": false }, { @@ -191,7 +250,7 @@ "zh": "Ultramax 400" }, "path": "ultramax400.plut", - "isDefault": false, + "category": "Film", "isVip": true }, { @@ -201,7 +260,7 @@ "zh": "E100" }, "path": "e100.plut", - "isDefault": false, + "category": "Film", "isVip": true }, { @@ -211,7 +270,7 @@ "zh": "CN200" }, "path": "cn200.plut", - "isDefault": false, + "category": "Film", "isVip": true }, { @@ -221,7 +280,7 @@ "zh": "Natura 1600" }, "path": "nature1600.plut", - "isDefault": false, + "category": "Film", "isVip": true }, { @@ -231,7 +290,7 @@ "zh": "Superia 1600" }, "path": "superia1600.plut", - "isDefault": false, + "category": "Film", "isVip": true }, { @@ -241,7 +300,7 @@ "zh": "Cinestill 800T" }, "path": "cinestill800t.33.plut", - "isDefault": false, + "category": "Film", "isVip": true } ] diff --git a/app/src/main/assets/luts/lumix_nat.plut b/app/src/main/assets/luts/lumix_nat.plut new file mode 100644 index 00000000..6f4d7dc8 Binary files /dev/null and b/app/src/main/assets/luts/lumix_nat.plut differ diff --git a/app/src/main/assets/luts/lumix_portrait.plut b/app/src/main/assets/luts/lumix_portrait.plut new file mode 100644 index 00000000..fa059f15 Binary files /dev/null and b/app/src/main/assets/luts/lumix_portrait.plut differ diff --git a/app/src/main/assets/luts/lumix_std.plut b/app/src/main/assets/luts/lumix_std.plut new file mode 100644 index 00000000..7c48fe00 Binary files /dev/null and b/app/src/main/assets/luts/lumix_std.plut differ diff --git a/app/src/main/assets/luts/lumix_vivid.plut b/app/src/main/assets/luts/lumix_vivid.plut new file mode 100644 index 00000000..6d20cef9 Binary files /dev/null and b/app/src/main/assets/luts/lumix_vivid.plut differ diff --git a/app/src/main/assets/luts/lumix_vlog.plut b/app/src/main/assets/luts/lumix_vlog.plut new file mode 100644 index 00000000..6336eb44 Binary files /dev/null and b/app/src/main/assets/luts/lumix_vlog.plut differ diff --git a/app/src/main/java/com/hinnka/mycamera/data/CustomImportManager.kt b/app/src/main/java/com/hinnka/mycamera/data/CustomImportManager.kt index 25a2975d..5368c154 100644 --- a/app/src/main/java/com/hinnka/mycamera/data/CustomImportManager.kt +++ b/app/src/main/java/com/hinnka/mycamera/data/CustomImportManager.kt @@ -43,6 +43,7 @@ class CustomImportManager(private val context: Context) { private const val CUSTOM_DCP_CONFIG = "custom_dcps.json" private const val CATEGORY_OVERRIDES_CONFIG = "category_overrides.json" private const val FAVORITE_OVERRIDES_CONFIG = "favorite_overrides.json" + private const val BUILT_IN_LUT_CATEGORY_INITIALIZED_CONFIG = "built_in_lut_categories_initialized.json" // 自定义字体目录 private const val CUSTOM_FONT_DIR = "custom_fonts" @@ -83,6 +84,46 @@ class CustomImportManager(private val context: Context) { } } + fun initializeBuiltInLutCategoriesIfNeeded(luts: List) { + try { + val categorizedLuts = luts + .filter { it.isBuiltIn && it.category.isNotEmpty() } + .associate { it.id to it.category } + if (categorizedLuts.isEmpty()) return + + val initializedFile = File(context.filesDir, BUILT_IN_LUT_CATEGORY_INITIALIZED_CONFIG) + val initializedJson = if (initializedFile.exists()) { + JSONObject(initializedFile.readText()) + } else { + JSONObject() + } + + val overridesFile = File(context.filesDir, CATEGORY_OVERRIDES_CONFIG) + val overridesJson = if (overridesFile.exists()) { + JSONObject(overridesFile.readText()) + } else { + JSONObject() + } + + var updatedCount = 0 + categorizedLuts.forEach { (id, category) -> + if (!initializedJson.optBoolean(id, false)) { + overridesJson.put(id, category) + initializedJson.put(id, true) + updatedCount++ + } + } + + if (updatedCount > 0) { + overridesFile.writeText(overridesJson.toString()) + initializedFile.writeText(initializedJson.toString()) + } + PLog.d(TAG, "Built-in LUT categories initialized: $updatedCount") + } catch (e: Exception) { + PLog.e(TAG, "Failed to initialize built-in LUT categories", e) + } + } + /** * 获取收藏重写映射。 */ diff --git a/app/src/main/java/com/hinnka/mycamera/data/UserPreferencesRepository.kt b/app/src/main/java/com/hinnka/mycamera/data/UserPreferencesRepository.kt index ceeeb143..ba759c15 100644 --- a/app/src/main/java/com/hinnka/mycamera/data/UserPreferencesRepository.kt +++ b/app/src/main/java/com/hinnka/mycamera/data/UserPreferencesRepository.kt @@ -13,6 +13,7 @@ import com.hinnka.mycamera.camera.AspectRatio import com.hinnka.mycamera.camera.MultiFrameConfig import com.hinnka.mycamera.camera.MeteringMode import com.hinnka.mycamera.lut.BaselineColorCorrectionTarget +import com.hinnka.mycamera.lut.DEFAULT_RAW_BASELINE_LUT_ID import com.hinnka.mycamera.raw.ColorSpace import com.hinnka.mycamera.color.TransferCurve import com.hinnka.mycamera.raw.RawProfile @@ -68,6 +69,7 @@ data class UserPreferences( val phantomLutId: String? = null, val jpgBaselineLutId: String? = null, val rawBaselineLutId: String? = null, + val rawBaselineLutConfigured: Boolean = false, val phantomBaselineLutId: String? = null, val rawDcpId: String? = null, val rawNlmNoiseFactor: Float = 0f, @@ -170,6 +172,7 @@ class UserPreferencesRepository(private val context: Context) { private val PHANTOM_LUT_ID_KEY = stringPreferencesKey("phantom_lut_id") private val JPG_BASELINE_LUT_ID_KEY = stringPreferencesKey("jpg_baseline_lut_id") private val RAW_BASELINE_LUT_ID_KEY = stringPreferencesKey("raw_baseline_lut_id") + private val RAW_BASELINE_LUT_CONFIGURED_KEY = booleanPreferencesKey("raw_baseline_lut_configured") private val RAW_DCP_ID_KEY = stringPreferencesKey("raw_dcp_id") private val RAW_NLM_NOISE_FACTOR_KEY = floatPreferencesKey("raw_nlm_noise_factor") private val RAW_EXPOSURE_COMPENSATION_KEY = floatPreferencesKey("raw_exposure_compensation") @@ -273,6 +276,8 @@ class UserPreferencesRepository(private val context: Context) { .map { preferences -> val customAspectRatios = parseCustomAspectRatios(preferences[CUSTOM_ASPECT_RATIOS]) val availableAspectRatios = AspectRatio.entries + customAspectRatios + val rawBaselineLutConfigured = preferences[RAW_BASELINE_LUT_CONFIGURED_KEY] + ?: preferences.contains(RAW_BASELINE_LUT_ID_KEY) UserPreferences( captureMode = CaptureMode.valueOf(preferences[CAPTURE_MODE] ?: CaptureMode.PHOTO.name), aspectRatio = preferences[ASPECT_RATIO_KEY] ?: "RATIO_4_3", @@ -284,7 +289,9 @@ class UserPreferencesRepository(private val context: Context) { lutId = preferences[LUT_ID_KEY], // 不提供默认值,由 CameraViewModel 处理 phantomLutId = preferences[PHANTOM_LUT_ID_KEY], jpgBaselineLutId = preferences[JPG_BASELINE_LUT_ID_KEY], - rawBaselineLutId = preferences[RAW_BASELINE_LUT_ID_KEY], + rawBaselineLutId = preferences[RAW_BASELINE_LUT_ID_KEY] + ?: if (!rawBaselineLutConfigured) DEFAULT_RAW_BASELINE_LUT_ID else null, + rawBaselineLutConfigured = rawBaselineLutConfigured, rawDcpId = preferences[RAW_DCP_ID_KEY], rawNlmNoiseFactor = preferences[RAW_NLM_NOISE_FACTOR_KEY] ?: 0f, rawExposureCompensation = preferences[RAW_EXPOSURE_COMPENSATION_KEY] ?: 0f, @@ -588,6 +595,9 @@ class UserPreferencesRepository(private val context: Context) { } else { preferences.remove(key) } + if (target == BaselineColorCorrectionTarget.RAW) { + preferences[RAW_BASELINE_LUT_CONFIGURED_KEY] = true + } } } diff --git a/app/src/main/java/com/hinnka/mycamera/lut/BaselineColorCorrection.kt b/app/src/main/java/com/hinnka/mycamera/lut/BaselineColorCorrection.kt index 24a0820c..3c6e9fee 100644 --- a/app/src/main/java/com/hinnka/mycamera/lut/BaselineColorCorrection.kt +++ b/app/src/main/java/com/hinnka/mycamera/lut/BaselineColorCorrection.kt @@ -10,6 +10,8 @@ enum class BaselineColorCorrectionTarget { PHANTOM } +const val DEFAULT_RAW_BASELINE_LUT_ID = "lumix_std" + data class BaselineColorCorrectionConfig( val lutId: String? = null ) diff --git a/app/src/main/java/com/hinnka/mycamera/lut/LutManager.kt b/app/src/main/java/com/hinnka/mycamera/lut/LutManager.kt index 3b212456..4e9d7d4c 100644 --- a/app/src/main/java/com/hinnka/mycamera/lut/LutManager.kt +++ b/app/src/main/java/com/hinnka/mycamera/lut/LutManager.kt @@ -158,10 +158,9 @@ class LutManager(private val context: Context) { * 初始化,扫描可用的 LUT 文件(包括内置和自定义) */ fun initialize() { - // 加载内置滤镜并强制把初始分类设为空(用户不想要内置分类标签) - val builtInLuts = LutParser.listAvailableLuts(context, BUILT_IN_LUT_FOLDER).map { - it.copy(category = "") - } + val configuredBuiltInLuts = LutParser.listAvailableLuts(context, BUILT_IN_LUT_FOLDER) + customImportManager.initializeBuiltInLutCategoriesIfNeeded(configuredBuiltInLuts) + val builtInLuts = configuredBuiltInLuts.map { it.copy(category = "") } val customLuts = customImportManager.getCustomLuts() val categoryOverrides = customImportManager.getCategoryOverrides() val favoriteOverrides = customImportManager.getFavoriteOverrides() diff --git a/app/src/main/java/com/hinnka/mycamera/lut/LutParser.kt b/app/src/main/java/com/hinnka/mycamera/lut/LutParser.kt index f07ecaba..c8d32dda 100644 --- a/app/src/main/java/com/hinnka/mycamera/lut/LutParser.kt +++ b/app/src/main/java/com/hinnka/mycamera/lut/LutParser.kt @@ -118,7 +118,7 @@ object LutParser { val nameObj = lutObj.getJSONObject("name") val isDefault = lutObj.optBoolean("isDefault", false) val isVip = lutObj.getBoolean("isVip") - val category = lutObj.optString("category", "Built-in") + val category = lutObj.optString("category", "").trim() val isFavorite = lutObj.optBoolean("isFavorite", false) // 读取多语言名称