
    ΍id                        S r SSKrSSKJrJrJr  SSKJrJ	r
Jr  S r " S S5      r " S S	5      rS7S
 jrSr1 Sk1 Sk1 Sk1 Sk1 Sk1 Sk1 Sk1 Sk1 Sk1 Sk1 Sk1 Sk1 Sk1 Sk1 Sk1 Sk1 Sk1 Sk1 Sk1 Sk1 S k1 S!k1 S"k4rSS#S$S%S&S'S(.rS8S) jrS* rS+ rS, rS- rS. r\" S/S0S1\R4                  S2S39r    S9S4 jr\4S5 jrS:S6 jrg);)ExportHelperImportHelperorientation_helperaxis_conversionaxis_conversion_ensurecreate_derived_objectspoll_file_object_dropunpack_listunpack_face_listpath_referencepath_reference_copypath_reference_modeunique_name    N)BoolPropertyEnumPropertyStringProperty)contextspgettext_ifacepgettext_datac                 b    [        U S5      (       a  [        U S5      (       a  [        U SS5      $ g)Naxis_forwardaxis_upF)hasattrr   )ops    [/home/wildlama/Downloads/blender-5.1.2-linux-x64/5.1/scripts/modules/bpy_extras/io_utils.py_check_axis_conversionr   "   s6    r>""wr9'='=%
 	

     c                   X    \ rS rSr% \" SSSSS9\S'   \" SS	S
S1S9\S'   S
rS rS r	Sr
g)r   ,   	File Pathz$Filepath used for exporting the file   	FILE_PATH)namedescriptionmaxlensubtypefilepathzCheck Existingz,Check and warn on overwriting existing filesTHIDDEN)r#   r$   defaultoptionscheck_existingc                    SSK nU R                  (       dZ  UR                  R                  nU(       d  [        S5      nOUR                  R                  U5      S   nX@R                  -   U l        UR                  R                  U 5        S1$ )z
Invoke the file selector for exporting, setting a default filepath
based on the current blend file name.

:param context: The context.
:type context: :class:`bpy.types.Context`
:return: The operator return value.
:rtype: set[str]
r   NUntitledRUNNING_MODAL)	osr'   
blend_datadata_pathsplitextfilename_extwindow_managerfileselect_add)selfcontext_eventr/   blend_filepaths        r   invokeExportHelper.invoke>   sr     	}}$//88N!!&z!2!#!1!1.!A!!D*->->>DM--d3  r   c                 x   SSK nSn[        U 5      nU R                  nUb  U R                  nUR                  R                  U5      (       ad  U(       aF  [        R                  R                  UR                  R                  U5      S   U R                  5      nX`R                  :w  a  X`l        SnU=(       d    U$ )zn
Validate the filepath and axis conversion settings.

:return: True when a property was updated.
:rtype: bool
r   NFT)
r/   r   check_extensionr'   r2   basenamebpy
ensure_extr3   r4   )r7   _contextr/   
change_extchange_axisr>   r'   s          r   checkExportHelper.checkU   s     	
,T2..&}}Hww))""xx22((215)) H }},$,M!%J)k*r   )r'   N)__name__
__module____qualname____firstlineno__r   __annotations__r   r>   r;   rE   __static_attributes__ r   r   r   r   ,   sI    :	  !B
	  O!.+r   r   c                   J    \ rS rSr% \" SSSSSS1S9\S	'   S
 rSS jrS rSr	g)r   q   r    z$Filepath used for importing the filer!   r"   SKIP_PRESETr(   )r#   r$   r%   r&   r*   r'   c                 >    UR                   R                  U 5        S1$ )z
Invoke the file selector for importing.

:param context: The context.
:type context: :class:`bpy.types.Context`
:return: The operator return value.
:rtype: set[str]
r.   )r5   r6   )r7   r8   r9   s      r   r;   ImportHelper.invokez   s!     	--d3  r   c                    U R                   R                  S5      (       a  U R                  n[        U R                  5      S:  a-  [        S5      R                  [        U R                  5      5      nU(       a  [        U5      nO$[        U R                  [        R                  5      nUR                  R                  U UUSS9$ UR                  R                  U 5        S1$ )a\  
Invoke as a popup confirmation dialog when a filepath is already set,
otherwise fall back to the file selector.

:param context: The context.
:type context: :class:`bpy.types.Context`
:param confirm_text: Label for the confirm button,
   defaults to the operator label.
:type confirm_text: str
:return: The operator return value.
:rtype: set[str]
r'      zImport {:d} filesF)confirm_texttitle	translater.   )
propertiesis_property_setr'   lenfilesiface_formatbl_labeli18n_contextsoperator_defaultr5   invoke_props_dialogr6   )r7   r8   rU   rV   s       r   invoke_popupImportHelper.invoke_popup   s     ??**:66MME4::"23::3tzz?K%l3  &dmm]5S5ST))==)	 >   	--d3  r   c                     [        U 5      $ )z]
Validate axis conversion settings.

:return: True when a property was updated.
:rtype: bool
)r   r7   rB   s     r   rE   ImportHelper.check   s     &d++r   rM   N) )
rG   rH   rI   rJ   r   rK   r;   rb   rE   rL   rM   r   r   r   r   q   s3    :) 
! !D,r   r   c                    ^ ^ U U4S jnU$ )a  
A decorator for import/export classes, generating properties needed by the axis conversion system and IO helpers,
with specified default values (axes).

:param axis_forward: The default forward axis.
:type axis_forward: Literal['X', 'Y', 'Z', '-X', '-Y', '-Z']
:param axis_up: The default up axis.
:type axis_up: Literal['X', 'Y', 'Z', '-X', '-Y', '-Z']
:return: A class decorator.
:rtype: Callable[[type], type]
c                    > SS K nUR                  S:  a  SU R                  ;  a  [        U S0 5        S n[	        SSTUS9U R
                  S'   S	 n[	        S
STUS9U R
                  S'   U $ )Nr   )      rK   c                     U R                   S   U R                  S   :X  a=  U R                  SS SSR                  U R                  S   5      S-   S-     -   U l        g g Nr   XYZrT   rj   )r   r   indexre   s     r   _update_axis_forwardAorientation_helper.<locals>.wrapper.<locals>._update_axis_forward   sb      $R(88LL2&5;;t||B'781<ABC  9r   Forward))Xz	X Forwardrg   )Yz	Y Forwardrg   )Zz	Z Forwardrg   )-Xz
-X Forwardrg   )-Yz
-Y Forwardrg   )-Zz
-Z Forwardrg   )r#   itemsr)   updater   c                     U R                   S   U R                  S   :X  a=  U R                  SS SSR                  U R                  S   5      S-   S-     -   U l        g g rm   )r   r   rp   re   s     r   _update_axis_up<orientation_helper.<locals>.wrapper.<locals>._update_axis_up   sg    ||B4#4#4R#88%%a+5;;t'8'8'<=AQFGH ! 9r   Up))rt   zX Uprg   )ru   zY Uprg   )rv   zZ Uprg   )rw   z-X Uprg   )rx   z-Y Uprg   )ry   z-Z Uprg   r   )sysversion_info__dict__setattrr   rK   )clsr   rq   r}   r   r   s       r   wrapper#orientation_helper.<locals>.wrapper   s     	g% !4.3	 /; !'/
N+	 *6 "*
I& 
r   rM   )r   r   r   s   `` r   r   r      s    5n Nr   ))              r   r   r   r   r   r         ?)r   r   r   r   r   )r   r   r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   >             #  )  +
  D  E  M	  T  \   ]  e  l
                 
  >     
  
      "  #  +  A  E  M
  Q	  Y  ]   e  i           
        >             #
  %  +  B  D  J  T  Z   \  b
  l	               
    >       
      #  +  ,  A  B  J  Q
  Y   Z  b	  i             
      >         
       (  ,  B	  J  K  S
  Z  b  c   k             
      >       

         "  (  A	  K
  Q  S   Y  c  i  k             
      >                %
  (  D	  K  S  T  \  c
  k   l                 
  >                (  )
  E	  K   M  S  ]  c  e  k
                 
  >   
            %  ,  B
  H  J  P  Z  `  b   h	           
        >     
          %  )  D
  H	  P  T  \  `  h  l            
        >   
    
        "  ,  A
  H  P  Q   Y  `	  h  i           
        >   
    
        "  )  E
  H  M   P	  ]  `  e  h           
        >       
      
  "  ,  E  K  M  S	  ]
  c  e   k               
    >       
      
  "  )  D  K	  S  T   \
  c  k  l               
    >             
  %  ,  A  K  Q  S  Y
  c	  i   k               
    >           
    %  )  B  J   K  S  Z
  b  c  k	               
    >             #  +  ,
  E  H  M  P  ]	  `   e  h
                 
  >       
      #  %  +  A  H
  P  Q  Y	  `  h   i             
      >     
        "
  #  +  D  H  P   T  \	  `
  h  l                 
  >       
      #  )  +  B  H   J  P
  Z	  `  b  h             
      >       
         (  )  B  D   J	  T
  Z  \  b  l             
      >     
           %  (  A  B   J
  Q  Y  Z  b  i	           
        >       
       
  "  (  D  E   M  T	  \  ]  e
  l               
    rT      rj         )rt   ru   rv   rw   rx   ry   c           
      ^   SSK Jn  SSKJn  X:X  a  X:X  a  U" 5       R	                  5       $ U S   US   :X  d  US   US   :X  a  [        S5      eU" [        R                  S [        U UUU45       5       5      n[        [        5       H  u  pxXh;   d  M  U" [        U   5      s  $     S5       e)a  
Each argument is an axis
where the first 2 are a source and the second 2 are the target.

:param from_forward: Source forward axis.
:type from_forward: Literal['X', 'Y', 'Z', '-X', '-Y', '-Z']
:param from_up: Source up axis.
:type from_up: Literal['X', 'Y', 'Z', '-X', '-Y', '-Z']
:param to_forward: Target forward axis.
:type to_forward: Literal['X', 'Y', 'Z', '-X', '-Y', '-Z']
:param to_up: Target up axis.
:type to_up: Literal['X', 'Y', 'Z', '-X', '-Y', '-Z']
:return: The conversion matrix.
:rtype: :class:`mathutils.Matrix`
r   )Matrix)reducern   zEInvalid axis arguments passed, cannot use up/forward on the same axisc              3   D   #    U  H  u  p[         U   US -  -  v   M     g7f)rj   N)_axis_convert_num).0ias      r   	<genexpr>"axis_conversion.<locals>.<genexpr>  s)      	 6TQ	1	!a%	( 6s    unreachable)	mathutilsr  	functoolsr  to_3x3	Exceptionint__or__	enumerate_axis_convert_lut_axis_convert_matrix)	from_forwardfrom_up
to_forwardto_upr  r  valuer  axis_luts	            r   r   r   e  s      ! !g&6x  B72;&*R.E"I*E_``

	Y	@
 6 	E !!23.q122 4  -5r   c                     S n[        X5      [        X5      4nU" U6 nXE:w  a  [        XUS   5        [        XUS   5        gg)a  
Function to ensure an operator has valid axis conversion settings, intended
to be used from :class:`bpy.types.Operator.check`.

:param operator: the operator to access axis attributes from.
:type operator: :class:`bpy.types.Operator`
:param forward_attr: attribute storing the forward axis
:type forward_attr: str
:param up_attr: attribute storing the up axis
:type up_attr: str
:return: True if the value was modified.
:rtype: bool
c                 f    U S   US   :X  a#  USS SSR                  US   5      S-   S-     -   nX4$ rm   )rp   )r   r   s     r   validate(axis_conversion_ensure.<locals>.validate  sH    wr{*ameU[[-E-IQ,N&OOG$$r   r   rT   TF)getattrr   )operatorforward_attrup_attrr  axisaxis_news         r   r   r     sN    % 8*GH,FFDH48A;/r   c                    0 nU HY  nUR                   nU(       a  UR                  S;   a  M(  UR                  (       a  / OX3R                  R	                  5       4/X#'   M[     U(       a  U R
                   H  nUR                   nUc  M  UR                  nUR                  (       d  M3  UR                  U5      nUc  MI  UR                  UR                  R                  UR                  R	                  5       45        M     U$ )a  
This function takes a sequence of objects, returning their instances.

:param depsgraph: The evaluated depsgraph.
:type depsgraph: :class:`bpy.types.Depsgraph`
:param objects: A sequence of objects.
:type objects: Sequence[:class:`bpy.types.Object`]
:return: A dictionary where each key is an object from ``objects``,
   values are lists of (object, matrix) tuples representing instances.
:rtype: dict[:class:`bpy.types.Object`, list[tuple[:class:`bpy.types.Object`, :class:`mathutils.Matrix`]]]
>   FACESVERTS)
parentinstance_typeis_instancermatrix_worldcopyobject_instancesoriginalgetappendinstance_object)		depsgraphobjectsresultob	ob_parentdup
dup_parentdup_parent_originalinstance_lists	            r   r   r     s     FII	004FF??R"oo6J6J6L1M0N
	  --CJ!","5"5&33"JJ':;M$  #"5"5">">@P@P@U@U@W!XY . Mr   c                 D    / nUR                   nU  H  nU" U5        M     U$ )z
Flatten a sequence of tuples into a single list.

:param list_of_tuples: A sequence of tuples to unpack.
:type list_of_tuples: Sequence[tuple]
:return: A flat list of all values.
:rtype: list
)extend)list_of_tuples	flat_listflat_list_extendts       r   r	   r	     s-     I '' r   c                     S/[        U 5      S-  -  nSnU  Hb  n[        U5      S:X  a  US   S:X  a  US   US   US   4nO$US   S:X  d	  US   S:X  a  US   US   US   US   4nX1X"[        U5      -   & US-  nMd     U$ )aD  
Unpack a list of faces (triangles or quads) into a flat list,
padding triangles with a zero to fit into groups of four.

:param list_of_tuples: A sequence of face index tuples (3 or 4 elements each).
:type list_of_tuples: Sequence[tuple[int, ...]]
:return: A flat list of face indices, padded with zeros.
:rtype: list[int]
r   r  rj   r  rT   )rZ   )r  flat_lsr  r  s       r   r
   r
     s     cS(1,-G	Aq6Q;tqyaD!A$!$tqyAaDAIaD!A$!ad* !c!f*	Q  Nr   c                     U R                   nU(       d  gUR                  S:H  nUR                  S:H  =(       a#    UR                  R                  R                  S:H  nU=(       d    U$ )a0  
A default implementation for FileHandler poll_drop methods. Allows for both the 3D Viewport and
the Outliner (in ViewLayer display mode) to be targets for file drag and drop.

:param context: The context.
:type context: :class:`bpy.types.Context`
:return: Whether the drop target is valid.
:rtype: bool
FVIEW_3DOUTLINER
VIEW_LAYER)areatypespacesactivedisplay_mode)r8   r  is_v3dis_outliner_view_layers       r   r   r     sW     <<DYY)#F!YY*4h9K9K9X9X\h9h+++r   z	Path ModezMethod used to reference paths))AUTOAutoz+Use relative paths with subdirectories only)ABSOLUTEAbsolutezAlways write absolute paths)RELATIVERelativez#Write relative paths where possible)MATCHMatchz/Match absolute/relative setting with input path)STRIPStripzFilename only)COPYCopyz7Copy the file to the destination path (or subdirectory)r  )r#   r$   rz   translation_contextr)   c                 :   SSK nU R                  S5      n[        R                  R	                  XUS9n	UR                  R                  U	5      n	US;   a  OUS:X  a  U(       a  SOSnOUS	:X  a)  [        R                  R                  X5      (       a  SOSnOUS
:X  a  UR                  R                  U5      n
U(       a  UR                  R                  X5      n
UR                  R                  XR                  R                  U	5      5      nUR                  X45        Un	SnO[        SR                  U5      5      eUS:X  a  U	$ US:X  a   UR                  R                  X5      $ US:X  a  UR                  R                  U	5      $ g! [         a    U	s $ f = f)a  
Return a filepath relative to a destination directory, for use with
exporters.

:param filepath: the file path to return,
   supporting blenders relative '//' prefix.
:type filepath: str
:param base_src: the directory the *filepath* is relative to
   (normally the blend file).
:type base_src: str
:param base_dst: the directory the *filepath* will be referenced from
   (normally the export path).
:type base_dst: str
:param mode: the method used to reference the path.
:type mode: Literal['AUTO', 'ABSOLUTE', 'RELATIVE', 'MATCH', 'STRIP', 'COPY']
:param copy_subdir: the subdirectory of *base_dst* to use when mode='COPY'.
:type copy_subdir: str
:param copy_set: collect from/to pairs when mode='COPY',
   pass to *path_reference_copy* when exporting is done.
:type copy_set: set[tuple[str, str]] | None
:param library: The library this path is relative to.
:type library: :class:`bpy.types.Library` | None
:return: the new filepath.
:rtype: str
r   Nz//)startlibrary>   r  r
  r  r  r  r
  r  r  zinvalid mode given {!r}r  )r/   
startswithr@   r2   abspathnormpath	is_subdirjoinr?   addr  r]   relpath
ValueError)r'   base_srcbase_dstmodecopy_subdircopy_setr  r/   is_relativefilepath_abs
subdir_absfilepath_cpys               r   r   r   !  sr   D %%d+K88##Hg#NL77##L1L00	(zj	((,,\DDJ 	 
WW%%h/
j>Jww||J0@0@0NOl12#188>??z			 77??<:: 
ww-- 
  	 	 s   F FFc                 @   U (       d  gSSK nSSKnU  H  u  pEUR                  R                  U5      (       d  U" SR	                  U5      5        M>  UR                  R                  U5      (       a"  UR                  R                  XE5      (       a  M  UR                  R                  U5      n UR                  USS9   UR                  XE5        M     g! [         a    SSK	nUR                  5          N7f = f! [         a    SSK	nUR                  5          GM	  f = f)z
Execute copying files of path_reference

:param copy_set: set of (from, to) pairs to copy.
:type copy_set: set[tuple[str, str]]
:param report: function used for reporting warnings, takes a string argument.
:type report: Callable[[str], None]
Nr   zmissing {!r}, not copyingT)exist_ok)r/   shutilr2   existsr]   samefiledirnamemakedirsr  	traceback	print_excr  )r$  reportr/   r+  file_srcfile_dstdir_tor0  s           r   r   r   l  s     &ww~~h''.55h?@WW^^H%%"''*:*:8*N*NWW__X.F&FT2
&H/ '  & ##%&  & ##%%&s$   /C C:C76C7:DDc                 `   UR                  U 5      nUc  SnUR                  5       nUc  UOU" U5      =piUS:X  a%  Xh;   a  SR                  U	UU5      nUS-  nXh;   a  M  OJUSU nXh;   a@  SR                  U5      n
SR                  U	U[        U
5      S-   -
  UU
5      nUS-  nXh;   a  M@  XbU '   U$ )a  
Helper function for storing unique names which may have special characters
stripped and restricted to a maximum length.

:param key: Unique item this name belongs to, name_dict[key] will be reused
   when available.
   This can be the object, mesh, material, etc instance itself.
   Any hashable object associated with the *name*.
:type key: Any
:param name: The name used to create a unique value in *name_dict*.
:type name: str
:param name_dict: This is used to cache namespace to ensure no collisions
   occur, this should be an empty dict initially and only modified by this
   function.
:type name_dict: dict[Any, str]
:param name_max: Maximum length of the name. When ``-1`` the name is unlimited.
:type name_max: int
:param clean_func: Function to call on *name* before creating a unique value.
:type clean_func: Callable[[str], str] | None
:param sep: Separator to use when between the name and a number when a
   duplicate name is found.
:type sep: str
:return: A unique name.
:rtype: str
NrT   rn   z{:s}{:s}{:03d}z{:03d}z{:.{:d}s}{:s}{:s})r  valuesr]   rZ   )keyr#   	name_dictname_max
clean_funcsepname_newcountname_dict_valuesname_new_orig	count_strs              r   r   r     s    4 }}S!H$++-&DD!	

 r>.+22!
 
 .  	*H.$OOE2	.55!I 23	 
 . "#Or   )ru   rv   )ru   rv   ru   rv   )r  rg   NN)rn   N.) __all__r@   	bpy.propsr   r   r   bpy.app.translationsr   r_   r   r\   r   r1   r   r   r   r   r  r  r  r   r   r   r	   r
   r   editor_filebrowserr   r   printr   r   rM   r   r   <module>rH     sQ  
   
 B+ B+J>, >,BDR @!!!!!!!!!!!!!!!!!!!!!!!GF P !!1AQG & R@ F"6,$ #	0	 &88 , H.V */ !&H9r   