
    K	i`              	          S r SrSSKJrJrJrJrJrJ	r	J
r
JrJrJrJrJrJr  SSKrSSKrSSKrSSKr\R4                  R6                  r\R:                  R<                  rSr \RB                  RE                  \RB                  RE                  \RB                  RE                  \RB                  RE                  \#5      5      5      5      r$\%" 5       r&SS.S jr'S r(\%" 5       r)S	 r*S
 r+S r,/ r-SSK.r.S r/S r0SSSS.S jr1S r2SS.S jr3S r4S r5S r6SSSSSS.S jrS r7SS.S jr8S r9S r:S r;S  r<S! r=S" r>SSS#.S$ jr?SSS#.S% jr@SSS#.S& jrASSS#.S' jrBSS(S).S* jrCS+ rDSS,.S- jrES.SS/.S0 jrS.SS/.S1 jrFS2 rGS3 rHSSSS4.S5 jrIS6 rJS7 rK\K/rLS8 rMS9 rNS: rO0 S;S<_S=S>_S?S@_SASB_SCSC_SDSE_SFSG_SHSI_SJSK_SLSM_SNSO_SPSQ_SRSS_STSS_SUSV_SWSX_SYSZ_S[S\S]S^S_S`.ErPSdSa jrQSb rRSc rSg)ezl
This module contains utility functions specific to blender but
not associated with blenders internal data.
)'blend_pathsescape_identifier	flip_nameunescape_identifierkeyconfig_initkeyconfig_setload_scriptsmodules_from_pathpreset_findpreset_pathsrefresh_script_pathsapp_template_pathsregister_classregister_cli_commandtime_from_frameunregister_cli_commandregister_manual_mapunregister_manual_mapregister_preset_pathunregister_preset_pathregister_classes_factoryregister_submodule_factoryregister_toolmake_rna_paths
manual_mapmanual_language_codepreviewsresource_pathscript_path_userextension_path_userscript_pathssmpte_from_framesmpte_from_secondsunitsunregister_classunregister_tooluser_resourceexecfileexpose_bundled_modules    )_utils_unitsr   r   r   r   r   r   r   r    r$   r   r&   system_resourceN)startupmodules)modc                ~   SSK nSnUR                  R                  X05      nUc  UR                  R                  U5      n[        R
                  nUR                  US5      nXU'    UR                  R                  U5        Uc  UR                  US5        U$ XeU'    U$ ! Uc  UR                  US5        f XeU'   f = f)a"  
Execute a file path as a Python script.

:param filepath: Path of the script to execute.
:type filepath: str
:param mod: Optional cached module, the result of a previous execution.
:type mod: ModuleType | None
:return: The module which can be passed back in as ``mod``.
:rtype: ModuleType
r)   N__main__)
importlib.utilutilspec_from_file_locationmodule_from_spec_sysr-   getloaderexec_modulepop)filepathr.   	importlibmod_namemod_specr-   mod_origs          Z/home/wildlama/Downloads/blender-5.1.2-linux-x64/5.1/scripts/modules/bpy/utils/__init__.pyr'   r'   [   s     H~~55hIH
{nn--h7
 llG{{8T*HH)##C(KK$' J !)HJ KK$' (Hs   'B   B<c                    [         R                  R                  nX;   a  g SU ;   a  [        SR	                  U 5      5        g U(       a  SS KnUR                  5       n [        U 5      nU(       a,  [        SR	                  U WR                  5       W-
  5      5        UR                  UR                  5        U$ ! [         a    SS KnUR                  5          g f = f)N.z@Ignoring '{:s}', cannot import files containing multiple periodsr)   ztime {:s} {:.4f})_bpyappdebug_pythonprintformattime
__import__	Exception	traceback	print_excadd__name__)module_nameloaded_modulesuse_timerG   tr.   rJ   s          r?   _test_importrR      s    xx$$H$
kPWWXcdeIIK%  ''TYY[1_EFs||$J  s   B9 9CCc                     U [         R                  ;  a6  [         R                  R                  SU 5        [        R	                  U 5        g g Nr)   )r5   pathinsert_sys_path_ensure_pathsrL   rU   s    r?   _sys_path_ensure_prependrY      s5    499		D!""4(     c                     U [         R                  ;  a5  [         R                  R                  U 5        [        R	                  U 5        g g N)r5   rU   appendrW   rL   rX   s    r?   _sys_path_ensure_appendr^      s3    499		""4( rZ   c                     / n[         R                  R                  U 5       H*  u  p4[        X15      nU(       d  M  UR	                  U5        M,     U$ )a<  
Load all modules in a path and return them as a list.

:param path: this path is scanned for scripts and packages.
:type path: str
:param loaded_modules: already loaded module names, files matching these
   names will be ignored.
:type loaded_modules: set[str]
:return: all loaded modules.
:rtype: list[ModuleType]
)rB   rU   module_namesrR   r]   )rU   rO   r-   r<   	_mod_pathr.   s         r?   r	   r	      sG     G#yy55d;843NN3  <
 NrZ   c                     [        U SS 5      nU(       a	   U" 5         g [	        SR                  U R                  5      5        g ! [         a    SS KnUR                  5          g f = f)Nregisterr)   z[
Warning! {!r} has no register function, this is now a requirement for registerable scripts)getattrrI   rJ   rK   rE   rF   __file__)r.   rc   rJ   s      r?   _register_module_callrf      s[    sJ-H	"J
 	AAGAU	
	  	"!	"s   A A$#A$c                     [        U SS 5      nU(       a	   U" 5         g g ! [         a    SS KnUR                  5          g f = f)N
unregisterr)   )rd   rI   rJ   rK   )r.   rh   rJ   s      r?   _unregister_module_callri      sB    lD1J	"L   	"!	"s    A A FT)reload_scriptsrefresh_scripts
extensionsc                 :  ^ ^^^ [         R                  R                  =p4[        (       + nU(       a  SSKnUR	                  5       n[        5       nT(       a  [        R                  R                  5       mT (       aG  [        R                   V	s/ s H  oR                  PM     sn	 H  n
[        R                  " U
5        M     S mUUU U4S jnT (       Ga  [        [        R                  R                  [!        ["        5      5       Vs/ s H
  nUc  M  UPM     nn[%        U5      [%        ["        5      :w  a6  ['        S["         Vs/ s H  o[        R                  ;  d  M  UPM     sn5        ["        R)                  5         U H  n[+        U5        M     U H  nT" U5        M     A[         R,                  R.                  R0                  R3                  SS9  SSKJn  U" 5          [9        US	9 H  n[:         Hw  n[<        R>                  RA                  UU5      n[<        R>                  RC                  U5      (       d  MI  [E        U5        US
:X  d  M\  [G        UU5       H  nU" U5        M     My     M     SSS5        T (       a2  [         R,                  R.                  R0                  R3                  5         U(       a	  [I        T S9  T (       aT  [         R,                  R.                  RK                  5         SSK&n['        SRO                  URQ                  5       5      5        U(       a+  ['        SRO                  WR	                  5       W-
  5      5        U(       a  [         RR                  RT                  RW                  5        Hp  n[Y        USS5      (       d  M  URW                  5        HE  nURZ                  (       a  M  ['        SRO                  UR\                  UR\                  5      5        MG     Mr     ggs  sn	f s  snf s  snf ! , (       d  f       GN= f)a  
Load scripts and run each modules register function.

:param reload_scripts: Causes all scripts to have their unregister method
   called before loading.
:type reload_scripts: bool
:param refresh_scripts: only load scripts which are not already loaded
   as modules.
:type refresh_scripts: bool
:param extensions: Loads additional scripts (add-ons & app-templates).
:type extensions: bool
r)   Nc                     SS K nU [        :X  a  U $  UR                  U 5      $ ! [         a    SS KnUR                  5          g f = frT   )r;   
_bpy_typesreloadrI   rJ   rK   )r.   r;   rJ   s      r?   test_reload!load_scripts.<locals>.test_reload  sH     *J	"##C(( 	"!	"s   # AAc                    > T(       a  U T;   a  g T(       a  U (       a  [        SU 5        T" U 5      n U (       a+  [        U 5        [        R                  U R                  5        g g )Nz
Reloading:)rE   rf   _registered_module_namesr]   rM   )r.   original_modulesrk   rj   rq   s    r?   test_register#load_scripts.<locals>.test_register  sL    s&66c,$c"C!#&$++CLL9 rZ   z:Warning: globally loaded modules not found in sys.modules:T)keep_propertiesRestrictBlend)use_userr,   rj   zgc.collect() -> {:d}zPython Script Load Time {:.4f}is_registeredFz'Warning, unregistered class: {:s}({:s}))/rB   rC   rD   _is_factory_startuprG   setr5   r-   values_preferencesaddonsmodule_addon_utilsdisablemapr6   reversedrt   lenrE   clearri   contextwindow_manager
keyconfigsupdate_bpy_restrict_staterz   r    _script_module_dirs_osrU   joinisdirrY   r	   load_scripts_extensionstag_script_reloadgcrF   collecttypes
bpy_struct__subclasses__rd   r}   rM   )rj   rk   rl   rP   use_class_register_checkr{   rG   t_mainrO   extaddon_module_namerv   r.   registered_modulesr<   rz   	base_pathpath_subdirrU   r   clssubclsru   rq   s   ``                    @@r?   r   r      s    +/((*?*??H&&HUN<<..0
 9E8K8K!L8K**8K!L  !23 "M": :  t||//:R1ST
TC T 	 
 !"c*B&CCL*Bc*BhVZVbVbFb*Bc 	!&&( &C#C( & &C & 	##..55d5K1	%x8I2xx}}Y<88>>$'',T2 #i/#4T>#JC)#. $K  3 9 
  	##..557~>##557$++BJJL9:.55diikF6JKL::((779CsOU33!002F!///GNNv`c`l`lmn 3 :  } "MF
 d* 
s7   O<
PPP
"P
'APP#P
Pc                  2   [         R                  " 5         SSKJn   U " 5          [	        [
        5       HH  n[        R                  R                  U5      =nc  [        S[        U5      S5        M=  [        U5        MJ     S S S 5        g ! , (       d  f       g = f)Nr)   ry   zWarning: moduleznot found in sys.modules)r   disable_allr   rz   r   rt   r5   r-   r6   rE   reprri   )rz   r<   r.   s      r?   _on_exitr   l  si     2	 !9:H||''11:'h9ST#C(	 ; 
s   AB
Br|   c                     [        [        R                  R                  5       5      (       a  SSKnUR                  U S9  A[        [        SS5      nUb  U" 5         [        ?Ag[        R                  " U S9  Ag)z
Load extensions scripts (add-ons and app-templates)

:param reload_scripts: Causes all scripts to have their unregister method
   called before loading.
:type reload_scripts: bool
r)   Nr|   _initialize_once)
anyrB   utilsr   bl_app_template_utilsresetrd   r   r   	reset_all)rj   r   r   s      r?   r   r   {  so     4::((*++$##>#B! |-?F#) 	 	n=rZ   c                  h    [        S5      n U (       a  [        R                  R                  U 5      $ S$ )zo
Return the user script path or None.

:return: The user script path, or None if not found.
:rtype: str | None
SCRIPTSN)_user_resourcer   rU   normpathrX   s    r?   r   r     s*     )$D&*388T"44rZ   c                      / n [         R                  R                   HF  nUR                  nU(       d  M  U R	                  [
        R                  R                  U5      5        MH     U $ )z5Returns a list of user preference script directories.)r   	filepathsscript_directories	directoryr]   r   rU   r   )pathsscript_directoryr   s      r?   script_paths_prefr     sQ    E(22EE$..	9LL**956 F LrZ   c                     [         R                  R                  S5      =n (       aU  U R                  [         R                  5       Vs/ s H*  o(       d  M  [         R
                  R                  U5      PM,     sn$ / $ s  snf )zGReturns a list of system script directories from environment variables.BLENDER_SYSTEM_SCRIPTS)r   environr6   splitpathseprU   r   )env_system_pathsps     r?   script_paths_system_environmentr     sb    ;;??+CDDD.>.D.DS[[.QW.QUV$!!!$.QWWI Xs   
A>#A>)subdir	user_pref	check_allr{   use_system_environmentc                 .   U(       d  U(       a  [        5       u  pV/ nU(       aj  [        S5      =n(       a/  UR                  [        R                  R                  US5      5        U(       a  UR                  W5        UR                  W5        UR                  [        5        U(       d  U(       a  UR                  W5        U(       a  UR                  [        5       5        U(       a  UR                  [        5       5        / n	U H  n
U
(       d  M  [        R                  R                  U
5      n
U b  [        R                  R                  X5      n
X;   a  MT  [        R                  R                  U
5      (       d  Mz  U	R                  U
5        M     U	$ )a  
Returns a list of valid script paths.

:param subdir: Optional subdir.
:type subdir: str | None
:param user_pref: Include the user preference script paths.
:type user_pref: bool
:param check_all: Include local, user and system paths rather just the paths Blender uses.
:type check_all: bool
:param use_user: Include user paths
:type use_user: bool
:param use_system_environment: Include BLENDER_SYSTEM_SCRIPTS variable path
:type use_system_environment: bool
:return: script paths.
:rtype: list[str]
LOCALscripts)_bpy_script_pathsr   r]   r   rU   r   _script_base_dirextendr   r   r   r   )r   r   r   r{   r   path_system	path_user
base_paths
path_localr   rU   s              r?   r    r      s)   $ H!2!4J&w//:/chhmmJ	BCi(+& &'i(+-.9;<Gxx  &88==.D?xx~~d##t  NrZ   c                  v   [          H#  n  [        R                  R                  U 5        M%     [         R                  5         [        5        H`  n[         HS  n[        R                  R                  X5      n [        R                  R                  U 5      (       d  MH  [        U 5        MU     Mb     [        R                  " 5        H_  n [        U 5        [        R                  R                  U S5      n [        R                  R                  U 5      (       d  MT  [        U 5        Ma     g! [         a     GM0  f = f)z=
Run this after creating new script paths to update sys.path
r-   N)rW   r5   rU   remove
ValueErrorr   r    r   r   r   r   rY   r   r   r^   )rU   r   r   s      r?   r   r     s    
 '	IIT" '
   "!^	.K88==8Dxx~~d##(. / $ ""$%xx}}T9-88>>$#D)	 %  		s   D))
D87D8rX   c              #   @  #    U b  U 4OSn[        S[        R                  R                  " SS/UQ76 S9nU(       a(  [        R                  R	                  U5      (       a  Uv   [        5        HP  n [        R                  R                  " U SS/UQ76 n[        R                  R	                  U5      (       d  ML  Uv   MR     [        S[        R                  R                  " SS/UQ76 S9nU(       a*  [        R                  R	                  U5      (       a  Uv   ggg7f)z
Returns valid application template paths.

:param path: Optional subdir.
:type path: str | None
:return: App template paths.
:rtype: Iterator[str]
N r   r,   bl_app_templates_userrX   bl_app_templates_system)r   r   rU   r   r   r   r+   )rU   subdir_args	path_tests      r?   r   r     s      "-4'2K ysxx}}YH_/nbm/noISXX^^I.. 01HHMM$	3L[{[	88>>)$$O 2  	iIb0qep0qrISXX^^I.. /ys   B4D:A$Dc                    / n[        SS9 H  n[        R                  R                  X 5      nUR	                  U5      (       d  [        SR                  U 5      5      e[        R                  R                  U5      (       d  Mx  UR                  U5        M     [        R                  " 5        H[  n[        R                  R                  USU 5      n[        R                  R                  U5      (       d  MJ  UR                  U5        M]     [         H[  n[        R                  R                  USU 5      n[        R                  R                  U5      (       d  MJ  UR                  U5        M]     U$ )z
Returns a list of paths for a specific preset.

:param subdir: preset subdirectory (must not be an absolute path).
:type subdir: str
:return: Script paths.
:rtype: list[str]
presets)r   zinvalid subdir given {!r})r    r   rU   r   
startswithrI   rF   r   r]   r   r   _preset_path_registry)r   dirsrU   r   s       r?   r   r   '  s    DI.HHMM$/	##D))7>>vFGGXX^^I&&KK	" / ""$HHMM$	6:	88>>)$$KK	" %
 &HHMM$	6:	88>>)$$KK	" &
 KrZ   c                     [        [        5      n[        R                  U 5        U[        [        5      :X  a  [        SU 5        gg)aR  
Register a preset search path.

:param path: preset directory (must be an absolute path).

   This path must contain a "presets" subdirectory which will typically contain presets for add-ons.

   You may call ``bpy.utils.register_preset_path(os.path.dirname(__file__))`` from an add-ons ``__init__.py`` file.
   When the ``__init__.py`` is in the same location as a ``presets`` directory.
   For example an operators preset would be located under: ``presets/operator/{operator.id}/``
   where ``operator.id`` is the ``bl_idname`` of the operator.
:type path: str
:return: success
:rtype: bool
z'Warning: preset path already registeredFT)r   r   rL   rE   rU   set_lens     r?   r   r   F  s<      '(Gd##+,,7>rZ   c                     [        [        5      n[        R                  U 5        U[        [        5      :X  a  [        SU 5        gg)z
Unregister a preset search path.

:param path: preset directory (must be an absolute path).

   This must match the registered path exactly.
:type path: str
:return: success
:rtype: bool
z#Warning: preset path not registeredFT)r   r   discardrE   r   s     r?   r   r   ^  s<     '(G!!$'#+,,3T:rZ   c                     [         R                  R                  [         R                  R                  U /5      [         R                  R                  X/5      5      (       a  g g! [         a     g[
         a     g[         a     gf = f)NTF)r   rU   samefile
commonpathFileNotFoundErrorr   PermissionError)parent_pathrU   s     r?   _is_path_parent_ofr   q  s    88##[M2##[$78
 
 	
(      
 	  	s   A!A& &
B	2	B	=	B	B	c                     [        S5      nS H.  n[        U5      nU(       a  X1:X  a  M  [        X05      (       d  M.    g   g)z
Returns True if the path is one of the built-in paths used by Blender.

:param path: Path you want to check if it is in the built-in settings directory
:type path: str
:rtype: bool
USER)SYSTEMr   TF)r   r   )rU   	user_pathresr   s       r?   is_path_builtinr     sB     f%I"#C(k6 k00 # rZ   c                     [         R                  R                   H3  nUR                  (       d  M  [	        UR
                  U 5      (       d  M3    g   g)z
Returns True if the path is from an extensions repository.

:param path: Path to check if it is within an extension repository.
:type path: str
:rtype: bool
TF)r   rl   reposenabledr   r   )rU   repos     r?   is_path_extensionr     s?     ''--|| dnnd33 . rZ   fpsfps_basec                (    [        [        XUS9UUS9$ )a  
Returns an SMPTE formatted string from the *time*:
``HH:MM:SS:FF``.

If *fps* and *fps_base* are not given the current scene is used.

:param time: time in seconds.
:type time: int | float | datetime.timedelta
:param fps: Frames per second, if not given the current scene is used.
:type fps: float | None
:param fps_base: Frames per second base, if not given the current scene is used.
:type fps_base: float | None
:return: the frame string.
:rtype: str
r   )r!   time_to_frame)rG   r   r   s      r?   r"   r"     s!    " dh7 rZ   c          
         Uc.  [         R                  R                  R                  R                  nUc.  [         R                  R                  R                  R
                  nX-  nU S:  a  SOSn[        U 5      n SR                  U[        U SU-  -  5      [        U SU-  -  S-  5      [        X-  S-  5      [        X-  5      5      $ )a  
Returns an SMPTE formatted string from the *frame*:
``HH:MM:SS:FF``.

If *fps* and *fps_base* are not given the current scene is used.

:param frame: frame number.
:type frame: int | float
:param fps: Frames per second, if not given the current scene is used.
:type fps: float | None
:param fps_base: Frames per second base, if not given the current scene is used.
:type fps_base: float | None
:return: the frame string.
:rtype: str
r)   - z{:s}{:02d}:{:02d}:{:02d}:{:02d}i  <   )	rB   r   scenerenderr   r   absrF   int)framer   r   signs       r?   r!   r!     s    " {ll  ''++<<%%,,55
.C!)3DJE 	*00$%"s(#r)*"#	
rZ   c                    Uc.  [         R                  R                  R                  R                  nUc.  [         R                  R                  R                  R
                  nX-  nSSKJn  U" SX-  5      $ )a  
Returns the time from a frame number.

If *fps* and *fps_base* are not given the current scene is used.

:param frame: number.
:type frame: int | float
:param fps: Frames per second, if not given the current scene is used.
:type fps: float | None
:param fps_base: Frames per second base, if not given the current scene is used.
:type fps_base: float | None
:return: the time in seconds.
:rtype: datetime.timedelta
r)   	timedelta)rB   r   r   r   r   r   datetimer  )r  r   r   r  s       r?   r   r     s^      {ll  ''++<<%%,,55
.C"Q$$rZ   c                "   Uc.  [         R                  R                  R                  R                  nUc.  [         R                  R                  R                  R
                  nX-  nSSKJn  [        X5      (       a  U R                  5       n X-  $ )a)  
Returns a float frame number from a time given in seconds or
as a datetime.timedelta object.

If *fps* and *fps_base* are not given the current scene is used.

:param time: time in seconds.
:type time: float | int | datetime.timedelta
:return: The frame.
:rtype: float | int | datetime.timedelta
r)   r  )
rB   r   r   r   r   r   r  r  
isinstancetotal_seconds)rG   r   r   r  s       r?   r   r     sp     {ll  ''++<<%%,,55
.C"$""!!#:rZ   z.py)display_namer   c                   U (       d  g[        U5       H  nU(       a^  Sn[        R                  " U5       HA  nUR                  U5      (       d  M  U [        R
                  R                  USS9:X  d  M?  Un  O   OX-   nU(       d  Mu  [        R
                  R                  XE5      n[        R
                  R                  U5      (       d  M  Us  $    g)a  
Search for a preset by name.

:param name: The preset name.
:type name: str
:param preset_path: The preset subdirectory (e.g. ``"keyconfig"``).
:type preset_path: str
:param display_name: When True, search by display name instead of filename.
:type display_name: bool
:param ext: The file extension for the preset.
:type ext: str
:return: The file path of the preset or None if not found.
:rtype: str | None
Nr   F)
title_case)	r   r   listdirendswithrB   rU   r
  r   exists)namepreset_pathr
  r   r   filenamefnr:   s           r?   r
   r
   1  s     !+.	Hkk),;;s##		0F0FrV[0F0\(\!H -
 zH8xx}}Y9Hxxx(( /rZ   c                      Sn [         R                  R                  n[        U S5      n[	        U5        X:w  a   [        US5      nU(       a  [	        U5        ggg)zk
Initialize and refresh key configurations, called from the Blender
window manager on startup and refresh.
Blender	keyconfigN)r   keymapactive_keyconfigr
   r   )default_configactive_configr:   s      r?   r   r   T  sY    
 N ''88M >;7H( &}k:(#  'rZ   )reportc                :   SSK JnJn  [        R                  R
                  (       a  [        SU 5        [        R                  R                  R                  nU" U" U 5      5      S   nUR                  U5      n Sn[        U 5        UR                  U5      n	U(       a2  Ub
  U" S1U5        [        U5        U	b  X:w  a  UR                  U	5        gU	c  Ub  U" S1SR!                  U 5      5        gXl        g	! [         a    SSKnUR                  5       n Nf = f)
z
Load and activate a key configuration from a file.

:param filepath: The file path to the key configuration preset.
:type filepath: str
:param report: An optional callable for reporting errors.
:type report: Callable[[set[str], str], None] | None
r)   )basenamesplitextzloading preset:r   NERRORFzFailed to load keymap {!r}T)os.pathr  r  rB   rC   rD   rE   r   r   r   r6   r'   rI   rJ   
format_excr   rF   active)
r:   r  r  r  r   r  kc_old	error_msgrJ   kc_news
             r?   r   r   g  s    +xx*,,77JHX&'*D ^^D!F+	
 ^^D!FG9i(iV%5f% ~G9:AA(KL"+  +((*	+s   ;C9 9DDr   )rU   createc                |   [        XS9nU(       a  U(       a}  [        R                  R                  U5      (       d   [        R                  " U5        U$ [        R                  R                  U5      (       d  [        SR                  U5      5        SnU$ ! [
         a    SSKnUR                  5         Sn U$ f = f)ar  
Return a user resource path (normally from the users home directory).

:param resource_type: The resource type.
:type resource_type: Literal['DATAFILES', 'CONFIG', 'SCRIPTS', 'EXTENSIONS']
:param path: Optional subdirectory.
:type path: str
:param create: Treat the path as a directory and create it if its not existing.
:type create: bool
:return: a path.
:rtype: str
rX   r)   Nr   &Path {!r} found but isn't a directory!)r   r   rU   r  makedirsrI   rJ   rK   r   rE   rF   )resource_typerU   r&  target_pathrJ   s        r?   r&   r&     s     !:K88??;//%LL- 	 XX^^K00>EEkRS  ! %$'')"$K
 %s   B  B;:B;c                6   SSK Jn  U" U 5      u  pE[        S5      nU(       a  U(       a#  [        R                  R                  USXEU5      nO![        R                  R                  USXE5      nU(       a}  [        R                  R                  U5      (       d   [        R                  " U5        U$ [        R                  R                  U5      (       d  [        SR                  U5      5        SnU$ ! [         a    SSK	nUR                  5         Sn U$ f = f)as  
Return a user writable directory associated with an extension.

.. note::

   This allows each extension to have its own user directory to store files.

   The location of the extension it self is not a suitable place to store files
   because it is cleared each upgrade and the users may not have write permissions
   to the repository (typically "System" repositories).

:param package: The ``__package__`` of the extension.
:type package: str
:param path: Optional subdirectory.
:type path: str
:param create: Treat the path as a directory and create it if its not existing.
:type create: bool
:return: a path.
:rtype: str
r)   ) _extension_module_name_decompose
EXTENSIONSz.userNr   r(  )addon_utilsr-  r   r   rU   r   r  r)  rI   rJ   rK   r   rE   rF   )packagerU   r&  r-  repo_module
pkg_idnamer+  rJ   s           r?   r   r     s    * = ?wGK .K((--WkW[\K((--WkVK88??;//%LL- 	 XX^^K00>EEkRS  ! %$'')"$K
 %s   C4 4 DDc                 "   ^  U 4S jnU 4S jnX4$ )a=  
Utility function to create register and unregister functions
which simply registers and unregisters a sequence of classes.

:param classes: Sequence of classes to register and unregister.
:type classes: Sequence[type]
:return: register and unregister functions.
:rtype: tuple[Callable[[], None], Callable[[], None]]
c                  .   > T H  n [        U 5        M     g r\   )r   r   classess    r?   rc   *register_classes_factory.<locals>.register  s    C3 rZ   c                  @   > [        T5       H  n [        U 5        M     g r\   )r   r$   r5  s    r?   rh   ,register_classes_factory.<locals>.unregister  s    G$CS! %rZ   r   )r6  rc   rh   s   `  r?   r   r     s     " rZ   c                 8   ^ ^^^ Sm/ mUU UU4S jnUU4S jnX#4$ )a  
Utility function to create register and unregister functions
which simply load submodules,
calling their register & unregister functions.

.. note::

   Modules are registered in the order given,
   unregistered in reverse order.

:param module_name: The module name, typically ``__name__``.
:type module_name: str
:param submodule_names: List of submodule names to load and unload.
:type submodule_names: list[str]
:return: register and unregister functions.
:rtype: tuple[Callable[[], None], Callable[[], None]]
Nc                     > [        TTS9mT V s/ s H  n [        TU 5      U 4PM     sn TS S & T H  u  pUR                  5         M     g s  sn f )N)r  fromlist)rH   rd   rc   )r<   r.   	_mod_namer   rN   submodule_names
submoduless      r?   rc   ,register_submodule_factory.<locals>.register  sN    GO^_8'&(3X>_
1(NCLLN ) `s   A
c                     > SSK Jn   [        T5       H-  u  pUR                  5         [	        TU5        XR
                  	 M/     TR                  5         g )Nr)   )r-   )sysr-   r   rh   delattrrM   r   )r-   r.   r<   r   r?  s      r?   rh   .register_submodule_factory.<locals>.unregister  sC    %j1MCNNFH%% 2 	rZ   r   )rN   r>  rc   rh   r   r?  s   ``  @@r?   r   r     s)    & FJ  rZ   )after	separatorgroupc                  ^^^ U R                   nU R                  mSSKJnJm  UR                  U5      mTc  [        SR                  U5      5      eTR                  T   nSSK	J
n  UR                  U5       Vs1 s H  nUc  M  UR                  iM     n	n[        X5      (       d#  [        SR                  [        U 5      5      5      eU R                  U	;   a$  [        SR                  U R                  5      5      eA	AUUU4S jn
U
" U 5      nU(       a  U4nU(       a  SU4OU4nS	 nS
nUb  [!        U5       H  u  pUc  M
  [#        UT5      (       a(  UR                  U;   a  U" X5      nXUS-   US-   & Sn  OMC  [#        U[$        5      (       d  MZ  [!        US5       Hh  u  nn[#        UT5      (       d  M  UR                  U;   d  M+  U(       a  U" Xo5      nXUS-   US-   & O!U" UU5      nUSUS-    U-   UUS-   S -   nXU'   Sn  O   U(       d  M    O   U(       d  ['        SU5        U(       d  UR)                  U5        ggs  snf )a  
Register a tool in the toolbar.

:param tool_cls: A tool subclass.
:type tool_cls: type[:class:`bpy.types.WorkSpaceTool`]
:param after: Optional identifiers this tool will be added after.
:type after: Sequence[str] | set[str] | None
:param separator: When true, add a separator before this tool.
:type separator: bool
:param group: When true, add a new nested group of tools.
:type group: bool
r)   )ToolSelectPanelHelperToolDefNSpace type {!r} has no toolbar)WorkSpaceToolz)Expected WorkSpaceTool subclass, not {!r}zTool {!r} already exists!c                   > T	R                  U R                  U R                  [        U SU R                  5      [        U SS 5      [        U SS 5      [        U SS 5      [        U SS 5      [        U SS 5      [        U SS 5      [        U SS 5      [        U S	S 5      [        U S
S 5      [        U SS 5      S.5      nXl        UR                  nUb  [        US   5      (       a|  SSKJ	n  UR                  nUR                  nUR                  nUR                  nUbC  Tc  SnO TR                  SS5      R                  5       nT
R!                  XgXR"                  U5        U$ )Nbl_descriptionbl_icon	bl_cursor
bl_options	bl_widgetbl_widget_properties	bl_keymapbl_data_blockbl_operatordraw_settingsdraw_cursor)idnamelabeldescriptioniconcursoroptionswidgetwidget_propertiesr  
data_blockoperatorrW  rX  r)   r   All_ )	from_dict	bl_idnamebl_labelrd   __doc___bl_toolr  callablebpyr   r   r   defaultaddonreplacetitle_km_action_simplerZ  )tool_clstool_defkeymap_datar   wmr   
kc_defaultkccontext_descrrJ  r   context_modes            r?   tool_from_class&register_tool.<locals>.tool_from_classQ  sQ   $$((&&"8-=x?O?OPHi6hT:xt<hT:!(3I4!PhT:!(OTB->$XE"8]DA&
  %oo"xA'?'?#''BJ#++J !!B~'$)M$0$8$8c$B$H$H$JM%%jm^^U`arZ   c                 l    UnU[        U 5      :  a"  X   b  UnUS-  nU[        U 5      :  a  X   b  M  U$ )N   )r   )seqii_prevs      r?   skip_to_end_of_group+register_tool.<locals>.skip_to_end_of_group  sB    #c(lsv1FFA #c(lsv1 rZ   Fr~  Tz/bpy.utils.register_tool: could not find 'after')bl_space_typebl_context_modebl_ui.space_toolsystem_commonrI  rJ  _tool_class_from_space_typerI   rF   _tools	bpy.typesrL  _tools_flattenrY  
issubclasstyperh  	enumerater  tuplerE   r   )rs  rE  rF  rG  
space_typerI  toolsrL  itemtools_idr{  tool_convertedtool_def_insertr  changedr  jsub_itemrJ  r   rz  s                     @@@r?   r   r   *  s`    ''J++L
  
;
;J
GC
{8??
KLLJJ|$E ( 5 D DU K K 	 K   h..CJJ4PX>Z[[X%3::8;M;MNOO-"H %X.N(* #,~	 
 G 'GA|D'**;;%',T5A)8!a%A&"G	 (
 D%((#,T1#5KAx!(G44#??e3$ %9$B5Da!eAE 2$8q$A'+FQU|o'EQQRUV'T+/a&*G! $6 73 (6 CUK_% As   :IIc                 ,   U R                   nU R                  nSSKJn  UR	                  U5      nUc  [        SR                  U5      5      eUR                  U   nU R                  n UR                  U5      nS nSn	US:w  a  XW	 U" U5        Sn	U	(       d|  [        U5       Hm  u  pz[        U
[        5      (       d  M   U
R                  U5      nUS:w  d  M6  [        U
5      nX	 U" U5        U(       a  [        U5      XW'   O
XW	 U" U5        ASn	  O   U	(       d  [        S	R                  U 5      5      eU ?UR                  nUb  SS
KJn  UR$                  nUR&                  nUR(                  UR*                  4 Hn  nUc  M  UR,                  R/                  US   5      nUc*  [1        SR                  US   UR2                  5      5        MS  UR,                  R5                  U5        Mp     gg! [         a    Sn GNf = f! [         a    Sn GNAf = f)z
Unregister a previously registered tool.

:param tool_cls: The tool class to unregister.
:type tool_cls: type[:class:`bpy.types.WorkSpaceTool`]
r)   )rI  NrK  c                     U (       a  U S   c  U S	 U (       a  U S   c  M  U (       a  U S   c  U S	 U (       a  U S   c  M  [        [        U 5      S-
  SS5       H  nX   S L nU(       a	  W(       a  X	 UnM     g )Nr  r)   r~  )ranger   )	tool_listr  is_noneprev_is_nones       r?   tool_list_clean(unregister_tool.<locals>.tool_list_clean  s}    IbM1" IbM1IaL0! IaL0 s9~)2r2Ald*G<L"L	 3rZ   FTzUnable to remove {!r}rc  z&Warning keymap {!r} not found in {!r}!)r  r  r  rI  r  rI   rF   r  rk  indexr   r  r  r  listr  rm  r   r   r   rn  ro  keymapsr6   rE   r  r   )rs  r  rz  rI  r   r  rt  r  r  r  r  r  
item_cleanru  r   rv  r   rx  kms                      r?   r%   r%     s    ''J++LC

;
;J
GC
{8??
KLLJJ|$E  HKK!# GBwH 'GA$&&

8,A 7!%dJ"#J/!#(#4!H'." #G) (, /66x@AA//K##]]
%%z'7'78BzA/Bz>EEkRSnVXV]V]^_

!!"% 9	 e  6 " As$   )G0  H0H ?H HHc                      [        [        R                  R                  [        SS5      5      n U R
                  U R                  4$ )Nr-   z_rna_manual_reference.py)r'   r   rU   r   r   url_manual_prefixurl_manual_mapping)ref_mods    r?   _blender_default_mapr    s8     sxx}}%5yB\]^G%%w'A'ABBrZ   c                 .    [         R                  U 5        g)z
Register a function to provide manual URL mappings.

:param manual_hook: A callable that returns ``(prefix, mapping)``
   where *mapping* is a sequence of ``(pattern, url)`` pairs.
:type manual_hook: Callable[[], tuple[str, list[tuple[str, str]]]]
N)_manual_mapr]   manual_hooks    r?   r   r     s     {#rZ   c                 .    [         R                  U 5        g)z
Unregister a previously registered manual map hook.

:param manual_hook: The hook function to remove.
:type manual_hook: Callable[[], tuple[str, list[tuple[str, str]]]]
N)r  r   r  s    r?   r   r     s     {#rZ   c               #      #    [        [        5       H  n  U " 5       u  pX4v   M     g! [         a2    [        SR	                  U 5      5        SSKnUR                  5          MR  f = f7f)z
Yield manual URL mappings from all registered hooks.

:return: An iterator of ``(prefix, mapping)`` pairs.
:rtype: Iterator[tuple[str, list[tuple[str, str]]]]
zError calling {!r}r)   N)r   r  rI   rE   rF   rJ   rK   )cbprefixr  rJ   s       r?   r   r   #  sf      {#	)+&F (( $  	&--b12!		s%   A(	)
A(8A%!A($A%%A(ar_EGarca_ADcade_DEdeel_GRelesfi_FIfifr_FRfrid_IDidit_ITitja_JPjako_KRkonl_NLnlpt_PTptpt_BRru_RUrusk_SKsksr_RSsrthukvizzh-hanszzh-hant)th_THuk_UAvi_VNzh_HANSzh_HANTc                     [         R                  R                  R                  R                  nUS:X  a)  [
        R                  " SS5      R                  S5      S   n[        R                  X5      $ )a!  
:param default: The fallback language code to use when the current language is unavailable.
:type default: str
:return:
   The language code used for user manual URL component based on the current language user-preference,
   falling back to the ``default`` when unavailable.
:rtype: str
DEFAULTLANGr   rA   r)   )
rB   r   preferencesviewlanguager   getenvr   _manual_language_codesr6   )rn  r  s     r?   r   r   p  sX     ||'',,55H9::fb)//4Q7!%%h88rZ   c                     S=n=pEU (       a7  U(       a-  SR                  X45      =p4U(       a  SR                  XB5      =p5OU =p4X4U4$ )a  
Create RNA "paths" from given names.

:param struct_name: Name of a RNA struct (like e.g. "Scene").
:type struct_name: str
:param prop_name: Name of a RNA struct's property.
:type prop_name: str
:param enum_name: Name of a RNA enum identifier.
:type enum_name: str
:return: A triple of three "RNA paths"
   (most_complete_path, "struct.prop", "struct.prop:'enum'").
   If no enum_name is given, the third element will always be empty.
:rtype: tuple[str, str, str]
r   rA   z{:s}:'{:s}')r   rF   )struct_name	prop_name	enum_namesrcsrc_rnasrc_enums         r?   r   r     sU      "!C!'HHk%=>>C!.!5!5g!II''C!!rZ   c            	         [         R                  R                  (       d  g[         R                  R                  (       d  g[        R
                  R                  [        R
                  R                  [         R                  SSSS5      5      n [        R
                  R                  U SS5      n[        R                  S:w  a>  [        R
                  R                  USR                  " [        R                  SS 6 5      n[        R
                  R                  US5      nU[        R
                  ;  a!  [        R
                  R                  S	U5        gg)
z
For Blender as a Python module, add bundled VFX library python bindings
to ``sys.path``. These may be used instead of dedicated packages, to ensure
the libraries are compatible with Blender.
Nz..pythonlibwin32zpython{:d}.{:d}   zsite-packagesr)   )rB   rC   r   portabler   rU   r   r   re   r5   platformrF   version_inforV   )version_dirpackages_dirs     r?   r(   r(     s     88?? 88((##CHHMM$--tTSW$XYK88==h>L}}xx}}\3D3K3KTM^M^_a`aMb3cd88==?L499$		L) %rZ   )en)Trj  __all__rB   r*   r#   r   r   r   r   r   r   r   r    r   r$   r   r&   r   r+   rm  osr   rB  r5   r/  r   r   r  r   rC   factory_startupr~   r   rU   dirnamere   r   r   r   r'   rR   rW   rY   r^   r	   rt   ro   rf   ri   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   rZ   r?   <module>r     s
  

(T        "||''hh..  +  88##CHH$4$4SXX5E5EchhFVFVW_F`5a$bc    # "JD  ))0   
" $)%D AoJ) /4 25  454hl ?D*2  $ 8>0&28& %)4 0 $($ #L #' %:  $d : 49e   F$& '+ ,^ *,E D *,E .b *% X &*U% }&@P&pC $$$$)*5 T5 T5 T5 T5 	$5  T!5" T#5. T/50 T152 T35: T;5B TC5F TG5J TK5N TO5P TQ5T TU5\ i5 p9 "4*rZ   