
    9Kj%                        d Z ddlZddlZddlZddlmZ ej                  j                  d e ee	      j                               ddlZddlZddlZej"                  dz  ZdZddD  ci c]  } | dd	i	 c} g dd
dZd Zdj-                  g d      Zdj-                  g d      Zdj-                  g d      Zd Zd Zd Zd Zd Zd Zd Z e!dk(  r e         yyc c} w )um  s15 — fp 재생성 (사용자 3단 지시, 2026-07-05 — fp 만 먼저):

  ① 블록 도면 = **참조만** — 모사/트레이스 금지, 무엇이 있고 대략 어디인지의
     레퍼런스로만 쓰고 구도/비율은 모델이 실제 장소답게 자유 작도.
  ② **LLM 이 건물/도면 상세 설명을 생성**해 프롬프트에 주입 — 특히 상부 유닛
     아래 건물 몸체의 층수 구조(데이터에 없으면 가장 그럴듯한 층수를 LLM 이
     선택하고 그렇게 밝힘), 외피/개구부/지상 접근 전부 상세히. EN+KO(갤러리).
  ③ 코드 렌더 도면 자체가 어색 → 참조 이미지 없이 **추출 내용 텍스트만으로
     T2I 가 알아서** 작도(순수 생성).
표시 순서 = ①→②→③(=r1/r2/r0). 각 gpt/nb2. 시나리오 중립: 구체 내용은 전부
데이터(씬 원문/layout JSON/loc/override) — 템플릿은 kind·일반 어휘만.
사용: .venv/bin/python s15_fp_redo.py [--only desc|images|html]
산출: plans/fp_place_desc.json, plans/fp_redo_prompts.json,
      out/blockset/fp_r{1,2,0}_{gpt,nb2}.png, blockgen.html 갱신
    N)Pathblocksetu  You write the PLACE DESCRIPTION for an architectural SITE-PLAN
asset in film pre-production. The place is one real-world location: a building
and its grounds with connected indoor and outdoor parts. You get production
data: member descriptions, the FULL original scene texts, a structured block
layout (elements with kinds and height layers) and any production-owner
corrections. Every specific must come from that data.

Write a DETAILED, CONCRETE description for the plan-drawing model:
- building_en: the main building itself — ★its storey structure explicitly
  (how many storeys the body has BELOW any upper-level unit; if the texts do
  not state a count, choose the most plausible one for this type of building
  and say it plainly as a chosen assumption), massing, envelope materials as
  the data gives them, facade opening pattern per storey, roof condition.
- upper_en: any topmost enclosed unit and its open deck level — envelope,
  boundary openings (counts per the data), fixed fixtures around it.
- grounds_en: ground level — approach, boundary, entrances, any exterior
  level-connecting route (honour production-owner corrections about it).
- plan_en: what the finished TOP-DOWN site plan must therefore show, in
  drawing terms (2-4 sentences).
Each field 40-90 words, plain factual tone, present-tense physical state
only — never past or one-off events, actions, usage stories or story
moments. NO story props, no vehicles, no people, no mood/lighting words, no
proper names, no text/labels in the image.
Also output faithful Korean translations (same keys with _ko) for human
review. notes: which data grounded the storey choice and opening counts.object)	building_enbuilding_koupper_enupper_ko
grounds_en
grounds_koplan_enplan_konotestypestringF)r   
propertiesrequiredadditionalPropertiesc                    t        j                  | d         }t        j                  |       \  }}t	        j
                         }d|z   dz   |z   dz   t        j                  |d      z   dz   dj                  |j                  d	      xs d
g      z   dz   }t        j                  dt        |t        d      t        j                  d       t        dt        fddD                     S )NmemberszPLACE MEMBERS:
z

FULL ORIGINAL SCENE TEXTS:

z'

STRUCTURED BLOCK LAYOUT (extracted):
F)ensure_asciiz 

PRODUCTION-OWNER CORRECTIONS:

facts_extraz(none)z"

Write the place description now.forest_fp_place_descgpt)modelfp_place_desczdesc words:c              3   V   K   | ]   }t        |   j                                " y w)N)lensplit).0kouts     s15_fp_redo.py	<genexpr>zgen_desc.<locals>.<genexpr>O   s)      SQ 67SQ0Qs   &))r   r   r
   r   )Fmembers_blockS13scene_textsS14load_overridesjsondumpsjoingetllmDESC_SYSTEMDESC_SCHEMA	save_planprintsum)reconlayoutr   idxsscenesovuserr"   s          @r#   gen_descr;   A   s    ooeI./G??5)LD&				B(235;<:; jje45 4	4
 ii}-;(<= 55D %%&T;CKK%	- SQS S TJ    r   )zIThe FIRST attached image is a rough BLOCK REFERENCE of one real property:zEit tells you only WHAT exists and the APPROXIMATE arrangement. Do NOTzFtrace, copy or reproduce its composition, block shapes, proportions orzEspacing. Compose the site plan yourself so the place reads as a real,zDbelievable property that satisfies the facts below. Its fill coloursuH   encode height layers only — never surface colours. Any letters/numbersu*   on it are annotations — never draw them.)zCDraw ONE strict TOP-DOWN 2D architectural SITE PLAN in the draftinguH   language of a clean floor plan — thin dark outlines, flat muted colourzGfills, detailed plan symbols (double-line walls, door leaf + swing arc,zEwindow frames set in walls, stair treads with stringers and landings,zAbase rings for round fixtures, paving joints, kerb lines). Heightz=levels appear only as flat fill tints (darker = higher). FlatzAorthographic plan view: NO 3D, NO axonometric, NO perspective, nozEshadows. Neutral document: no people, no story props, no vehicles, nozFposted papers, no text, no letters, no numbers, no markers, no legend,zDno compass. Never expose interior rooms or furniture of any enclosedu0   unit — outer shell and boundary openings only.)z?The LAST attached image is an interior floor plan from the sameuH   production — use it ONLY as the DRAFTING-STYLE reference (line weight,zCfill language, symbol vocabulary). Never copy its rooms or content.c           	      ^    dj                  dd| d   z   d| d   z   d| d   z   d	| d
   z   g      S )Nr   u>   THE PLACE (authored description — the content ground truth):z
BUILDING: r   zTOP UNIT & DECK: r   z	GROUNDS: r
   zTHE PLAN MUST SHOW: r   )r-   )descs    r#   
desc_blockr?   s   sN    99HtM**d:..d<((i0  r<   c                 6    dt        j                  | |      z   S )Nu_   LAYOUT RELATIONS (approximate — honour what exists and rough relations, NOT exact geometry):
)ids)r)   summary_lines)r6   rA   s     r#   facts_blockrC   }   s!    1C01 2r<   c                     dj                  t        t        | |      dt        j                  |      z   t
        t        g      S )N

z.WHAT THIS PLACE LOOKS LIKE (production data):
)r-   	LOOSE_REFrC   r)   	loc_linesSTYLE_REF_NOTESTYLE_2D)r6   r5   rA   s      r#   	r1_promptrJ      s=    ;;;vs+9
--
		  r<   c                 l    dj                  t        t        |      t        | |      t        t
        g      S )NrE   )r-   rF   r?   rC   rH   rI   r6   r5   r>   rA   s       r#   	r2_promptrM      s0    ;;:d#[%=  r<   c                 b    dj                  dddddt        |      t        | |      t        g      S )NrE   zACompose the site plan of one real property entirely from the textuB   below — there is NO layout reference image; you decide the wholez;composition so the place reads as real and believable. If azAdrafting-style reference image is attached, copy ONLY its drawinguC   style (line weight, fills, symbols) — never its rooms or content.)r-   r?   rC   rI   rL   s       r#   	r0_promptrO      s;    ;;KLEKM4+fc2  r<   c           
      X    t        j                         }t        dz  }i  fd}|r|gng }|rt         j                  |fgng } |ddt	         d      t         j
                  g|z   d         |ddt	         d      d t         j                  |fg|z           |d	d
t         |d      t         j
                  g|z   d         |ddt         |d      d t         j                  |fg|z           |ddt         |d      |xs d d         |ddt         |d      d |xs d        y )Nzblockset_v2_canvas_clean.pngc                    ||<   |j                  d      r!t        j                  | ||t        |z         n t        j                  | ||t        |z         t        j
                  d       t        j                         y )Nz_gpt.png)refsout_path)rS   fp_redo_prompts)endswithr%   img_gptOUTBimg_nb2r2   r)   
build_html)tagfnpromptgpt_refsnb2_refsr6   promptsr5   s        r#   runzimages.<locals>.run   sa    ;;z"IIc64"9EIIc68dRi@	%w/vu%r<   	fp_r1_gptzfp_r1_gpt.pngT	fp_r1_nb2zfp_r1_nb2.pngF	fp_r2_gptzfp_r2_gpt.png	fp_r2_nb2zfp_r2_nb2.png	fp_r0_gptzfp_r0_gpt.png	fp_r0_nb2zfp_r0_nb2.png)	r)   	indoor_fprW   NB2_STYLE_LABELrJ   
CANVAS_PNG	NB2_LABELrM   rO   )	r5   r6   r>   fpcleanr`   	style_gpt	style_nb2r_   s	   ``      @r#   imagesro      sB   	u	B11EG& I/1#%%r*+rI_it&D	9$d,_iu&Eu%&24 _itT&J	9$d,_itU&Ku%&24 _itT&JT4!_itU&Ki4!r<   c                     t        j                         } | j                  ddg d       | j                         }t	        j
                         }t	        j                  d      }|j                  dv rt        ||      }nt	        j                  d      }|j                  dv rt        |||       |j                  d	v rt        j                  ||       t	        j                  d
d|j                  d       y )Nz--onlyall)rq   r>   ro   html)defaultchoicesblockset_layout_v2)rq   r>   r   )rq   ro   )rq   rr   stages15_fp_redo)kindrv   done)argparseArgumentParseradd_argument
parse_argsr%   
load_recon	load_planonlyr;   ro   r)   rY   runlog)apargsr5   r6   r>   s        r#   mainr      s    		 	 	"BOOHe 6>O ?==?DLLNE[[-.FyyO#v&{{?+yy%%ufd#yyO#vu%HHgtyyIJr<   __main__)"__doc__rz   r+   syspathlibr   pathinsertstr__file__parent
forest_libr%   s13_blockset_v2r'   s14_blockgenr)   OUTrW   r0   r1   r;   r-   rF   rI   rH   r?   rC   rJ   rM   rO   ro   r   __name__)r!   s   0r#   <module>r      s     
  3tH~,,- .   uuzL6 3C D 3CQ1vx(( 3C DL!& II  	 99     2	!BK$ zF uDs   )C