
    ai                        S SK Jr  S SKrS SKJr  S SKJrJr	  S SK
Jr   " S S5      r " S S	\\5      r " S
 S\\5      r " S S\5      r\\\4rg)    )annotationsN)Operator)pgettext_datapgettext_rpt)SpaceAssetInfoc                  $    \ rS rSr\S 5       rSrg)AssetBrowserMetadataOperator   c                    [         R                  " U5      (       a  UR                  (       d  gUR                  R                  (       d  [        R
                  " S5        gg)NFziAsset metadata from external asset libraries cannot be edited, only assets stored in the current file canT)r   is_asset_browser_pollassetlocal_idr   poll_message_set)clscontexts     [/home/wildlama/Downloads/blender-5.1.2-linux-x64/5.1/scripts/startup/bl_operators/assets.pypoll!AssetBrowserMetadataOperator.poll   sE    33G<<GMM}}%%%%E      N)__name__
__module____qualname____firstlineno__classmethodr   __static_attributes__r   r   r   r	   r	      s    
 
r   r	   c                  .    \ rS rSrSrSrSrSS1rS rSr	g	)
ASSET_OT_tag_add#   z)Add a new keyword tag to the active assetzasset.tag_addzAdd Asset TagREGISTERUNDOc                |    UR                   nUR                  R                  R                  [	        S5      5        S1$ )NTagFINISHED)r   metadatatagsnewdata_)selfr   active_assets      r   executeASSET_OT_tag_add.execute*   s1    }}""&&uU|4|r   r   N)
r   r   r   r   __doc__	bl_idnamebl_label
bl_optionsr+   r   r   r   r   r   r   #   s    3IHf%Jr   r   c                  L   ^  \ rS rSrSrSrSrSS1r\U 4S j5       r	S r
S	rU =r$ )
ASSET_OT_tag_remove1   z4Remove an existing keyword tag from the active assetzasset.tag_removezRemove Asset Tagr    r!   c                   > [         TU ]  U5      (       d  gUR                  nUR                  nUR                  [        [        UR                  5      5      ;   $ )NF)superr   r   r%   
active_tagrangelenr&   )r   r   r*   asset_metadata	__class__s       r   r   ASSET_OT_tag_remove.poll8   sJ    w|G$$}}%..((E#n6I6I2J,KKKr   c                    UR                   nUR                  nUR                  UR                     nUR                  R	                  U5        U=R                  S-  sl        S1$ )N   r$   )r   r%   r&   r6   remove)r)   r   r*   r9   tags        r   r+   ASSET_OT_tag_remove.executeA   sY    }}%..!!.";";<""3'!!Q&!|r   r   )r   r   r   r   r-   r.   r/   r0   r   r   r+   r   __classcell__)r:   s   @r   r2   r2   1   s8    >"I!Hf%JL L r   r2   c                  R    \ rS rSrSrSrSrS1rSr\	S 5       r
S rS	 rS
 rS rSrg)#ASSET_OT_open_containing_blend_fileL   z2Open the blend file that contains the active assetz asset.open_containing_blend_filezOpen Blend Filer    Nc                    [        USS 5      nU(       d  U R                  S5        gUR                  (       a  U R                  S5        gUR                  R	                  S5      (       a  U R                  S5        gg)Nr   zNo asset selectedFz/Selected asset is contained in the current filez.asset.blendzaSelected asset is contained in a file managed by the asset system, manual edits should be avoidedT)getattrr   r   full_library_pathendswith)r   r   r   s      r   r   (ASSET_OT_open_containing_blend_file.pollU   sn    $/  !45>>  !RS""++N;;  s r   c                    UR                   nUR                  (       a  U R                  S1S5        S1$ UR                  nU R	                  U5        UR
                  nUR                  SUR                  S9U l        UR                  U 5        S1$ )NWARNINGz.This asset is stored in the current blend file	CANCELLEDg?)windowRUNNING_MODAL)
r   r   reportrG   open_in_new_blenderwindow_managerevent_timer_addrM   _timermodal_handler_add)r)   r   r   asset_lib_pathwms        r   r+   +ASSET_OT_open_containing_blend_file.executeg   s    >>KK%UV= 00  0##((W^^(D
T"  r   c                   UR                   S:w  a  S1$ U R                  c'  U R                  S1S5        U R                  U5        S1$ U R                  R	                  5       nUc  S1$ U(       a+  U R                  S1[        S5      R                  U5      5        [        R                  R                  R                  R	                  5       (       a(  [        R                  R                  R                  5         U R                  U5        S	1$ )
NTIMERPASS_THROUGHERRORz"Unable to find any running processrL   rN   rK   z/Blender sub-process exited with error code {:d}r$   )type_processrO   cancelr   rpt_formatbpyopsr   library_refresh)r)   r   event
returncodes       r   modal)ASSET_OT_open_containing_blend_file.modalw   s    :: "##== KK	#GHKK = ]]'')
#$$KKT*[%\%c%cdn%op77==((--//GGMM))+G|r   c                R    UR                   nUR                  U R                  5        g )N)rQ   event_timer_removerS   )r)   r   rV   s      r   r^   *ASSET_OT_open_containing_blend_file.cancel   s    ##
dkk*r   c                    SS K n[        R                  R                  [	        U5      /nUR                  U5      U l        g )Nr   )
subprocessra   appbinary_pathstrPopenr]   )r)   filepathrl   cli_argss       r   rP   7ASSET_OT_open_containing_blend_file.open_in_new_blender   s/    GG''X7"((2r   )r]   rS   )r   r   r   r   r-   r.   r/   r0   r]   r   r   r+   rf   r^   rP   r   r   r   r   rC   rC   L   sA    <2I HJH "! .+3r   rC   )
__future__r   ra   	bpy.typesr   bpy.app.translationsr   r(   r   r_   bpy_extras.asset_utilsr   r	   r   r2   rC   classesr   r   r   <module>ry      sc   
 # 
 
 3X 6 6J3( J3\ 'r   