feat: add isolated Liam square540 head-chest build preset
This commit is contained in:
+19
-9
@@ -8,8 +8,12 @@ def characterProfileId = providers.gradleProperty('characterProfile').orNull ?:
|
||||
def characterCatalogFile = rootProject.file('manifests/character-build-profiles.json')
|
||||
def characterCatalog = new groovy.json.JsonSlurper().parse(characterCatalogFile)
|
||||
def characterProfile = characterCatalog.profiles[characterProfileId]
|
||||
if (!characterProfile || !(characterProfileId in ['main', 'lvbu-test', 'liam-test'])) throw new GradleException('Unknown trusted character profile')
|
||||
if (characterProfileId != 'main') layout.buildDirectory.set(file('build/characters/' + characterProfileId))
|
||||
if (!characterProfile || !(characterProfileId in ['main', 'lvbu-test', 'liam-test', 'liam-test-square540'])) throw new GradleException('Unknown trusted character profile')
|
||||
def framingPresetId = providers.gradleProperty('avatarFramingPreset').orNull ?: (characterProfile.framingPreset ?: 'legacy')
|
||||
if (framingPresetId != (characterProfile.framingPreset ?: 'legacy')) throw new GradleException('Profile/framing preset mismatch')
|
||||
def framingPreset = framingPresetId == 'legacy' ? null : characterCatalog.framingPresets[framingPresetId]
|
||||
if (framingPresetId != 'legacy' && (!framingPreset || framingPreset.profile != characterProfileId)) throw new GradleException('Unknown trusted framing preset')
|
||||
if (characterProfileId != 'main') layout.buildDirectory.set(file('build/characters/' + characterProfileId + (framingPreset ? '/framing/' + framingPresetId : '')))
|
||||
if (characterProfileId != 'main' && gradle.startParameter.taskNames.any { it.toLowerCase().contains('release') }) throw new GradleException('Persona test profile is debug-only')
|
||||
|
||||
// Populated once by scripts/prepare-expression.sh from stable Maven versions, then pinned.
|
||||
@@ -57,12 +61,16 @@ def characterMedia = characterCatalog.mediaBundles[characterMediaId]
|
||||
def allowedMedia = characterProfile.mediaSelection == 'existing-build-flags' ? ['black-correct03','white-full04'] : [characterProfile.mediaSelection] + (characterProfile.additionalMediaSelections ?: [])
|
||||
if (!characterMedia || !(characterMediaId in allowedMedia)) throw new GradleException('Profile/media selection is not authorized')
|
||||
if (avatarUserNetworkActions && characterMedia.networkActionsAllowed != true) throw new GradleException('Network dance requires separate reviewed media registration')
|
||||
def avatarFrameZoom = (providers.gradleProperty('avatarFrameZoom').orNull ?: '1.0').toFloat()
|
||||
def avatarFrameCenterY = (providers.gradleProperty('avatarFrameCenterY').orNull ?: '0.5').toFloat()
|
||||
if (!Float.isFinite(avatarFrameZoom) || avatarFrameZoom < 1f || avatarFrameZoom > 2f ||
|
||||
!Float.isFinite(avatarFrameCenterY) || avatarFrameCenterY < 0.4f || avatarFrameCenterY > 0.6f) throw new GradleException('Invalid avatar framing')
|
||||
if ((avatarFrameZoom != 1f || avatarFrameCenterY != 0.5f) &&
|
||||
(!avatarUserAssetCandidate || characterMediaId != 'black-correct03')) throw new GradleException('Framing candidate requires exact black media')
|
||||
if (framingPreset && (framingPreset.mediaBundle != characterMediaId || framingPreset.indexSha256 != emotionManifestSha || !avatarUserAssetCandidate)) throw new GradleException('Framing preset requires exact authorized media')
|
||||
if (framingPreset && (providers.gradleProperty('avatarFrameZoom').isPresent() || providers.gradleProperty('avatarFrameCenterY').isPresent())) throw new GradleException('Controlled preset cannot be overridden')
|
||||
def avatarFrameZoom = (framingPreset ? framingPreset.zoom : (providers.gradleProperty('avatarFrameZoom').orNull ?: '1.0')).toFloat()
|
||||
def avatarFrameCenterY = (framingPreset ? framingPreset.centerY : (providers.gradleProperty('avatarFrameCenterY').orNull ?: '0.5')).toFloat()
|
||||
if (!framingPreset) {
|
||||
if (!Float.isFinite(avatarFrameZoom) || avatarFrameZoom < 1f || avatarFrameZoom > 2f ||
|
||||
!Float.isFinite(avatarFrameCenterY) || avatarFrameCenterY < 0.4f || avatarFrameCenterY > 0.6f) throw new GradleException('Invalid avatar framing')
|
||||
if ((avatarFrameZoom != 1f || avatarFrameCenterY != 0.5f) &&
|
||||
(!avatarUserAssetCandidate || characterMediaId != 'black-correct03')) throw new GradleException('Framing candidate requires exact black media')
|
||||
} else if (framingPresetId != 'square540-headchest' || avatarFrameZoom != 3.5555556f || avatarFrameCenterY != 0.128125f) throw new GradleException('Invalid controlled square framing')
|
||||
if (emotionManifestSha && !(emotionManifestSha ==~ /[0-9a-f]{64}/)) throw new GradleException('Emotion graph requires exact external manifest SHA')
|
||||
if (emotionManifestSha && (!avatarActionCandidate || !avatarMouthCandidate || !avatarNatural || actionVersionCode < 17)) throw new GradleException('Emotion candidate requires own-mouth runtime and a fresh code >=17')
|
||||
if (avatarFullActionCandidate && (!emotionManifestSha || !avatarActionCandidate || actionVersionCode < 18)) throw new GradleException('Full candidate requires pinned emotion/action graph and fresh code >=18')
|
||||
@@ -115,7 +123,7 @@ def stagePackagedAssets = tasks.register('stagePackagedAssets', Exec) {
|
||||
inputs.dir(file('src/main/assets'))
|
||||
inputs.dir(file('src/main/res/drawable-nodpi'))
|
||||
if (characterMedia.resourceDirectory) inputs.dir(rootProject.file(characterMedia.resourceDirectory))
|
||||
inputs.property('selection', [characterProfileId, characterMediaId, emotionManifestSha, avatarUserAssetCandidate, avatarMouthCandidate, avatarStartupFix].toString())
|
||||
inputs.property('selection', [characterProfileId, framingPresetId, characterMediaId, emotionManifestSha, avatarUserAssetCandidate, avatarMouthCandidate, avatarStartupFix].toString())
|
||||
outputs.dir(packagedAssets)
|
||||
outputs.file(layout.buildDirectory.file('generated/character-selection.json'))
|
||||
commandLine 'python3', rootProject.file('scripts/select-character-assets.py'), '--profile', characterProfileId,
|
||||
@@ -165,6 +173,7 @@ android {
|
||||
buildConfigField 'String', 'STARTUP_ASSET_ROOT', groovy.json.JsonOutput.toJson(characterMedia.bootstrapRoot)
|
||||
buildConfigField 'String', 'STARTUP_MANIFEST_SHA', groovy.json.JsonOutput.toJson(characterMedia.bootstrapSha256)
|
||||
buildConfigField 'int', 'STARTUP_POSTER_RES_ID', 'com.gorios.lanvoice.R.drawable.' + characterMedia.posterResource
|
||||
buildConfigField 'String', 'AVATAR_FRAMING_PRESET', groovy.json.JsonOutput.toJson(framingPresetId)
|
||||
buildConfigField 'float', 'AVATAR_FRAME_ZOOM', avatarFrameZoom.toString() + 'f'
|
||||
buildConfigField 'float', 'AVATAR_FRAME_CENTER_Y', avatarFrameCenterY.toString() + 'f'
|
||||
buildConfigField 'boolean', 'CAMERA_PROBE_DIAGNOSTIC', cameraProbeDiagnostic ? 'true' : 'false'
|
||||
@@ -183,6 +192,7 @@ android {
|
||||
buildConfigField 'String', 'STARTUP_ASSET_ROOT', '"avatar/startup-white-01/"'
|
||||
buildConfigField 'String', 'STARTUP_MANIFEST_SHA', '"461f5cfc10036de5f10ca3ce765fb8d9998697d3fd035aa9b1862d2ccfc3eaa2"'
|
||||
buildConfigField 'int', 'STARTUP_POSTER_RES_ID', 'com.gorios.lanvoice.R.drawable.startup_poster'
|
||||
buildConfigField 'String', 'AVATAR_FRAMING_PRESET', '"legacy"'
|
||||
buildConfigField 'float', 'AVATAR_FRAME_ZOOM', '1.0f'
|
||||
buildConfigField 'float', 'AVATAR_FRAME_CENTER_Y', '0.5f'
|
||||
buildConfigField 'boolean', 'CAMERA_PROBE_DIAGNOSTIC', 'false'
|
||||
|
||||
@@ -232,7 +232,8 @@ class ContinuousBodyRenderer(private val context: Context,private val pack: Cont
|
||||
check(width>0 && height>0)
|
||||
GLES20.glViewport(0,0,width,height);GLES20.glClearColor(1f,1f,1f,1f);GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)
|
||||
val rect=bodyFit(width,height,pack.body.width,pack.body.height,
|
||||
com.gorios.lanvoice.BuildConfig.AVATAR_FRAME_ZOOM,com.gorios.lanvoice.BuildConfig.AVATAR_FRAME_CENTER_Y)
|
||||
com.gorios.lanvoice.BuildConfig.AVATAR_FRAME_ZOOM,com.gorios.lanvoice.BuildConfig.AVATAR_FRAME_CENTER_Y,
|
||||
com.gorios.lanvoice.BuildConfig.AVATAR_FRAMING_PRESET)
|
||||
val left=rect.left/width*2-1;val right=(rect.left+rect.width)/width*2-1
|
||||
val top=1-rect.top/height*2;val bottom=1-(rect.top+rect.height)/height*2
|
||||
positions.clear();positions.put(floatArrayOf(left,bottom,right,bottom,left,top,right,top));positions.position(0);uv.position(0)
|
||||
|
||||
@@ -98,9 +98,14 @@ class ContinuousFrameClock(private val frames: Int=97,
|
||||
}
|
||||
|
||||
data class BodyFitRect(val left: Float,val top: Float,val width: Float,val height: Float)
|
||||
fun bodyFit(viewW: Int,viewH: Int,mediaW: Int=480,mediaH: Int=848,zoom: Float=1f,centerY: Float=0.5f): BodyFitRect {
|
||||
fun bodyFit(viewW: Int,viewH: Int,mediaW: Int=480,mediaH: Int=848,zoom: Float=1f,centerY: Float=0.5f,preset: String="legacy"): BodyFitRect {
|
||||
require(viewW>0 && viewH>0 && mediaW>0 && mediaH>0)
|
||||
require(zoom.isFinite() && zoom in 1f..2f && centerY.isFinite() && centerY in 0.4f..0.6f)
|
||||
// Named, exact candidate only. Legacy callers retain their original bounds.
|
||||
require(when(preset) {
|
||||
"legacy" -> zoom.isFinite() && zoom in 1f..2f && centerY.isFinite() && centerY in 0.4f..0.6f
|
||||
"square540-headchest" -> zoom==32f/9f && centerY==0.128125f && mediaW*16L==mediaH*9L
|
||||
else -> false
|
||||
})
|
||||
val scale=minOf(viewW.toFloat()/mediaW,viewH.toFloat()/mediaH)*zoom
|
||||
val w=mediaW*scale; val h=mediaH*scale
|
||||
return BodyFitRect((viewW-w)/2,viewH/2f-h*centerY,w,h)
|
||||
|
||||
@@ -16,7 +16,10 @@ internal class FramedAvatarPoster(context: Context): ImageView(context) {
|
||||
if(w<=0 || h<=0) return
|
||||
val zoom=com.gorios.lanvoice.BuildConfig.AVATAR_FRAME_ZOOM
|
||||
scaleX=zoom;scaleY=zoom
|
||||
translationY=bodyFit(w,h,180,320).height*zoom*(0.5f-com.gorios.lanvoice.BuildConfig.AVATAR_FRAME_CENTER_Y)
|
||||
val fitted=bodyFit(w,h,180,320)
|
||||
val framed=bodyFit(w,h,180,320,zoom,com.gorios.lanvoice.BuildConfig.AVATAR_FRAME_CENTER_Y,
|
||||
com.gorios.lanvoice.BuildConfig.AVATAR_FRAMING_PRESET)
|
||||
translationY=framed.top-(h/2f+(fitted.top-h/2f)*zoom)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user