
    Mi                     d   S SK r S SKJr  SSKJr  SSKJr  S rS\4S jr	\\S	.r
0 r
 S SKr\R                  R                  5        V s0 s H  o S
S \	_M
     sn r\
R                  \5         S SKr\R$                  \
S'   gs  sn f ! \ a    0 r N$f = f! \ a  r\" \5      \
S'    SrCgSrCff = f)    N)NamedTemporaryFile   )util)ExceptionWrapperc           	      2   U c  [        S5      e[        R                  " U S5      (       a  U $ [        U [        5      (       a7  SU ;  a  [        S5      e[
        R                  " U R                  S5      5      n O1[        R                  " U 5      (       a  [
        R                  " U 5      n SSSSSSS.n[        U [        5      (       d  [        S	[        U 5       S
35      e0 n[        R                  " U S5      n UR                  5        Hp  u  pEX@;   d  M  [        R                  " X   5      X4'   [        R                  " X4   U5      (       a  MF  [        SU[	        X4   R                   5      [	        U5      5      e   [#        U5      S:X  a  [        S5      eU$ )a  
Load multiple input types into kwargs for a Trimesh constructor.
Tries to extract keys:
'faces'
'vertices'
'face_normals'
'vertex_normals'

Parameters
----------
file_obj : dict
accepts multiple forms
      -dict: has keys for vertices and faces as (n,3) numpy arrays
      -dict: has keys for vertices/faces (n,3) arrays encoded as dicts/base64
             with trimesh.util.array_to_encoded/trimesh.util.encoded_to_array
      -str:  json blob as dict with either straight array or base64 values
      -file object: json blob of dict
file_type: not used

Returns
-----------
loaded: dict with keys
        -vertices: (n,3) float
        -faces:    (n,3) int
        -face_normals: (n,3) float (optional)
z&file_obj passed to load_dict was None!Trimesh{z(Object is not a JSON encoded dictionary!zutf-8)   )r
   )r      )verticesfacesface_normalsface_colorsvertex_normalsvertex_colors`z` object passed to dict loader!zShape of %s is %s, not %s!r   z'Unable to extract a mesh from the dict!)
ValueErrorr   is_instance_named
isinstancestrjsonloadsdecodeis_fileloaddicttypedecode_keysitemsencoded_to_arrayis_shapeshapelen)file_objkwargsmesh_file_objloadedkeyr#   s         o/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/trimesh/exchange/misc.py	load_dictr+      sh   6 ABBh	22(C  hGHH::hoog67	h		99X& #!%M h%%1T(^,,KLMMF'2H#))+
?//>FK==e44 0))*J	 	 , 6{aBCCM    	file_typec                    [         R                  SU-      nSn/ n[        SU 3S9 nUR                  U R	                  5       5        UR                  5         U H#  n [         R                  " UR                  US9n  O   SSS5        Uc  [        SSR                  U5      -   5      e0 n	U	R                  U5        UR                  U	S'    UR                  S5      U	S	'   U	$ ! [         a%  nUR                  [        U5      5         SnAM  SnAff = f! , (       d  f       N= f! [         a'    [        R                   R#                  S
SS9  / U	S	'    U	$ f = f)a   
Load a meshio-supported file into the kwargs for a Trimesh
constructor.


Parameters
----------
file_obj : file object
  Contains a meshio file
file_type : str
  File extension, aka 'vtk'

Returns
----------
loaded : dict
  kwargs for Trimesh constructor
.N)suffix)file_formatzFailed to load file:
r   triangler   zunable to get facesT)exc_info)meshioextension_to_filetypesr   writereadflushnameBaseExceptionappendr   r   joinupdatepointsget_cells_typer   logwarning)
r%   r-   r&   file_formatsmesh
exceptionstempr1   Eresults
             r*   load_meshiorI   O   sB   ( 00yALDJ 
Qyk?	3t

8==?#

'K*{{499+F (	 
4 |/$))J2GGHH F
MM&F:--j9w
 M' ! *!!#a&))* 
4	3.  .>wM	sG   5DC!<DD$ !
D+DDDD
D!$-EE)r   dict64   ctm)r   tempfiler    r   rE   r   r+   r   rI   _misc_loadersr5   r6   keys_meshio_loadersr>   r;   openctmload_ctmrG   )ks   0r*   <module>rU      s     '  )DN5S 5p #i8 4:3P3P3U3U3WX3Wauk)3WXO)/"++M% Y O  /+A.M%/s;    B 	BB -B B BBB/B**B/