
    ai&                     `    S r SSKJr  SSKJr  SrSrSrSrSr	S	r
S
 rS r " S S\5      r\4rg))classes    )Operator)EnumProperty                   c                 R  ^^^^^^ SS K nSSKJn  UR                  nUR	                  U5      mTR
                  R                  nUc  [        $ UR                  (       d  [        $ [        UR                  5      S:w  a  [        $ TR                  R                  R                  R                  mTc  [         $ U(       ad  U" U T5      nTR
                   V	s/ s HC  n	U	R                  (       d  M  [        U	R                  5      S:X  d  M1  U" U	S5      (       d  MA  U	PME     n
n	OJTR
                   V	s/ s H3  n	U	R                  (       d  M  [        U	R                  5      S:X  d  M1  U	PM5     n
n	U
(       d  ["        $ U4S jnS nS mU4S	 jnS
 mUUUU4S jnTS:X  a  TR$                  R'                  5         S /[        TR$                  5      -  mU
 H  n	U	R                  S S  nUS   US   4 Hx  nUR(                  nTUR*                     b  M!  S/nSnSnU" U5       H<  nTUR*                     b   eUTUR*                  '   UUR-                  5       -  nUS-  nM>     UU-  US'   Mz     M     U" X5        U" U5       H  nU" U6   M
     UR/                  USS9  [0        $ s  sn	f s  sn	f )Nr   r   )#is_face_uv_selected_fn_from_contextr   Fc                 h   > TR                    H
  nSUl        M     U  H
  nSUl        M     SUl        g NTF)facestag)r   f_actfbms      i/home/wildlama/Downloads/blender-5.1.2-linux-x64/5.1/scripts/startup/bl_operators/uvcalc_follow_active.pywalk_face_initextend.<locals>.walk_face_init<   s4    AAE  AAE  	    c              3     #    SU l         U /n/ nU(       a  U H  n U R                   Hz  nUR                  nUR                  SL d  M   UR                  SL d  M1  UR
                  nUR                  nUR                   (       a  M\  XU4v   SUl         UR                  U5        M|     M     X!p!UR                  5         U(       a  M  g g 7fr   )	r   loopsedgeis_manifoldseamlink_loop_radial_nextfaceappendclear)r   faces_afaces_bll_edgel_otherf_others          r   	walk_faceextend.<locals>.walk_faceF   s     #AVVF**d29M"#"9"9"),,&{{{#$/1*.GK#NN73 !   'WMMO gs   ACC'C?CCc              3      #    UR                   R                   nUR                  nXA;  a9  UR                  U5        Uv   UR                  (       d  U R	                  U5        g g g 7fN)link_loop_nextr   addis_boundaryr    )
loop_stackedges_visitedr$   r&   l_other_edges        r   walk_edgeloop_all_impl_loop+extend.<locals>.walk_edgeloop_all_impl_loop\   sZ     ""11||,l+++!!'* , -s   A"A$c              3     >#    / nU 1nU v   U R                    H9  n[        UR                  R                  5      S:w  a  M(  T" XU5       S h  vN   M;     U(       a  UR	                  5       =n(       a|  UnUR
                  =o4LaH  [        UR                  R                  5      S:w  a  M5  T" XU5       S h  vN   UR
                  =o4La  MH  U(       a  UR	                  5       =n(       a  Mz  g g g g  N N<7f)Nr   )
link_loopslenr   vertspopr   )er/   r0   r$   l_testr2   s        r   walk_edgeloop_all!extend.<locals>.walk_edgeloop_alle   s      
 A166<< A%2:aPPP 
 
(88f8A///1>qvv||$)6zRSTTT ///1> 
(88f88j8j Q Us1   A
C6C2A)C67C48C6C6.C64C6c                 &    X$S S & X"U-
  U -  -   US S & g r+    )fac	l_a_outer	l_a_inner	l_b_outer	l_b_inners        r   extrapolate_uvextend.<locals>.extrapolate_uv|   s!    
 !! %:c$AB	!r   c                 F  > / SQn/ SQnXS'   US   R                   US'   US   R                   US'   US   R                   US'   UR                  nUR                  UR                  :w  a;  XTS'   US   R                   US'   US   R                   US'   US   R                   US'   O:XTS'   US   R                   US'   US   R                   US'   US   R                   US'   U Vs/ s H  ofT   R                  PM     nnU Vs/ s H  ofT   R                  PM     nnTS:X  aD  TUS   R                  R
                     S   n	TUS   R                  R
                     S   n
 X-  nOTS:X  a  US   R                  R                  US   R                  R                  US   R                  R                  pnUS   R                  R                  US   R                  R                  US   R                  R                  nnnX-
  R                  UU-
  R                  -   n	X-
  R                  UU-
  R                  -   n
 X-  nOSnT" UUS   US   US   US   5        T" UUS   US   US   US   5        g s  snf s  snf ! [         a    Sn NIf = f! [         a    Sn N[f = f)	N)NNNNr   r   r      LENGTH_AVERAGEg      ?LENGTH)	r,   r   vertuvr   indexZeroDivisionErrorcolength)_f_prevl_prev_f_nextl_al_bl_nextr$   l_a_uvl_b_uvd1d2r?   a0b0c0a1b1c1EXTEND_MODEedge_lengthsrD   uv_acts                     r   apply_uvextend.<locals>.apply_uv   s   &&AQ&&AQ&&AQ&&A$ --;;&++%FV**CFV**CFV**CFFV**CFV**CFV**CF(+,1F),,,(+,1F),,,**c!fkk//03Bc!fkk//03Bg H$QQQBBQQQBB'!!R"W$4$44B'!!R"W$4$44Bg C1Ivay1Ivay	
 	1Ivay1Ivay	
; -, %  % s0   #I5I: I? =J ?JJJ J rH   g      g        )loop_triangles)bmeshuvcalc_transformr   datafrom_edit_meshr   activeSTATUS_ERR_ACTIVE_FACEselectSTATUS_ERR_NOT_SELECTEDr6   r7   STATUS_ERR_NOT_QUADr   layersrK   STATUS_ERR_MISSING_UV_LAYERSTATUS_ERR_NO_FACES_SELECTEDedgesindex_updater   rL   calc_lengthupdate_edit_mesh	STATUS_OK)sceneobjr`   use_uv_selectionrf   r   mer   face_select_test_fnr   r   r   r(   r;   rc   l_quadl_initl_init_edgeedge_length_storeedge_length_accumedge_length_totalr9   f_tripler   ra   rD   rb   r2   s     `                    @@@@@r   extendr      s   E	B			b	!BHHOOE}%%<<&&
5;;1""XX__&&F~**A%Lxx
!xx LA- 2Ea2O x 	 
 xx
!xx LA- x 	 

 ++,+U.CF
 F
V &&
vBHH-AWWQZF "!9fQi0 %kk 1 12>%)F!$'!$%!*;7A (0888,=L)%8%%*% 8 (9;L'L!!$) 1 < 5 e$( % 
2e4S


s*   J-JJJ/J$J$#J$c                    U R                   nSnU R                  (       a  U R                  R                  S:X  a  SnSnSnSnU R                  nU H>  nUS-  n[	        X(UR
                  R                  U5      n	U	[        :w  d  M5  US-  nXi-  nM@     XT:X  a  U[        -  (       a  UR                  S1S5        g U[        -  (       a  UR                  S1S5        g U[        -  (       a  UR                  S1S	5        g U[        -  (       a  UR                  S1S
5        g U[        -  S:w  d   eUR                  S1S5        g g )NTVIEW_3DFr   r   ERRORzActive face must be a quadzActive face not selectedzNo selected faceszNo UV layerszNo active face)rw   
space_datatypeobjects_in_mode_unique_datar   
propertiesmoderv   rn   reportrm   rq   rp   rk   )
contextoperatorrw   ry   
num_meshes
num_errorsstatusob_listobrets
             r   mainr      s,   MMEg0055B JJF11Ga
U 3 3 8 8:JK)!OJMF  ''OOWI'CD--OOWI'AB22OOWI':;11OOWI~622a777OOWI'78  r   c                   ^    \ rS rSr% SrSrSrSS1r\" SSS	S
S9\	S'   \
S 5       rS rS rSrg)FollowActiveQuadsi  z8Follow UVs from active quads along continuous face loopszuv.follow_active_quadszFollow Active QuadsREGISTERUNDOzEdge Length ModezMethod to space UV edge loops))EVENEvenzSpace all UVs evenly)rI   Length*Average space UVs edge length of each loop)rH   zLength Averager   rH   )namedescriptionitemsdefaultr   c                      UR                   S:H  $ )N	EDIT_MESH)r   )clsr   s     r   pollFollowActiveQuads.poll*  s    ||{**r   c                     [        X5        S1$ )NFINISHED)r   )selfr   s     r   executeFollowActiveQuads.execute.  s    W|r   c                 <    UR                   nUR                  U 5      $ r+   )window_managerinvoke_props_dialog)r   r   _eventwms       r   invokeFollowActiveQuads.invoke2  s    ##%%d++r   r>   N)__name__
__module____qualname____firstlineno____doc__	bl_idnamebl_label
bl_optionsr   __annotations__classmethodr   r   r   __static_attributes__r>   r   r   r   r     sT    B(I$Hf%J
3

 !	 	 + +,r   r   N)__all__	bpy.typesr   	bpy.propsr   rv   rk   rm   rn   rp   rq   r   r   r   r   r>   r   r   <module>r      s`   
  	  !  %  & _D9@, ,> r   