Extract subject context policy
This commit is contained in:
+12
-53
@@ -47,6 +47,7 @@ try:
|
||||
from . import row_camera as row_camera_policy
|
||||
from . import row_location as row_location_policy
|
||||
from . import seed_config as seed_policy
|
||||
from . import subject_context as subject_context_policy
|
||||
from .hardcore_text_cleanup import (
|
||||
sanitize_hardcore_axis_values as _sanitize_hardcore_axis_values,
|
||||
sanitize_hardcore_environment_anchors as _sanitize_hardcore_environment_anchors,
|
||||
@@ -93,6 +94,7 @@ except ImportError: # Allows local smoke tests with `python -c`.
|
||||
import row_camera as row_camera_policy
|
||||
import row_location as row_location_policy
|
||||
import seed_config as seed_policy
|
||||
import subject_context as subject_context_policy
|
||||
from hardcore_text_cleanup import (
|
||||
sanitize_hardcore_axis_values as _sanitize_hardcore_axis_values,
|
||||
sanitize_hardcore_environment_anchors as _sanitize_hardcore_environment_anchors,
|
||||
@@ -2498,59 +2500,16 @@ def _subject_context(
|
||||
women_count: int = 1,
|
||||
men_count: int = 1,
|
||||
) -> dict[str, str]:
|
||||
if subject_type in ("woman", "man", "single_any"):
|
||||
return _appearance_for_subject(rng, subject_type, ethnicity, figure, no_plus_women, no_black)
|
||||
|
||||
if subject_type == "configured_cast":
|
||||
return _configured_cast_context(women_count, men_count)
|
||||
|
||||
if subject_type == "couple":
|
||||
primary_subject, subject_phrase, pose, effective_women_count, effective_men_count = _couple_type_from_counts(
|
||||
rng,
|
||||
women_count,
|
||||
men_count,
|
||||
)
|
||||
return {
|
||||
"subject_type": "couple",
|
||||
"subject": primary_subject,
|
||||
"subject_phrase": subject_phrase,
|
||||
"age": g.choose(rng, g.COUPLE_AGES),
|
||||
"body": g.choose(rng, ["slim and average", "curvy and broad", "stocky and curvy", "average and athletic"]),
|
||||
"skin": "",
|
||||
"hair": "",
|
||||
"eyes": "",
|
||||
"body_phrase": "",
|
||||
"fallback_pose": pose,
|
||||
"women_count": str(effective_women_count),
|
||||
"men_count": str(effective_men_count),
|
||||
"person_count": "2",
|
||||
}
|
||||
|
||||
if subject_type == "group":
|
||||
eth = "Asian " if ethnicity == "asian" else ""
|
||||
return {
|
||||
"subject_type": "group",
|
||||
"subject": f"mixed {eth}adult group",
|
||||
"subject_phrase": f"A mixed {eth}adult group of women and men",
|
||||
"age": g.choose(rng, g.GROUP_AGES),
|
||||
"body": "diverse",
|
||||
"skin": "",
|
||||
"hair": "",
|
||||
"eyes": "",
|
||||
"body_phrase": "diverse adult body types",
|
||||
}
|
||||
|
||||
return {
|
||||
"subject_type": subject_type,
|
||||
"subject": "layout scene",
|
||||
"subject_phrase": "Adult layout scene",
|
||||
"age": "adult",
|
||||
"body": "varied",
|
||||
"skin": "",
|
||||
"hair": "",
|
||||
"eyes": "",
|
||||
"body_phrase": "varied adult figures",
|
||||
}
|
||||
return subject_context_policy.subject_context(
|
||||
rng,
|
||||
subject_type,
|
||||
ethnicity,
|
||||
figure,
|
||||
no_plus_women,
|
||||
no_black,
|
||||
women_count,
|
||||
men_count,
|
||||
)
|
||||
|
||||
|
||||
def _scene_pool(
|
||||
|
||||
Reference in New Issue
Block a user