ó
1säSc           @   s«   d  Z  d d l Z d d l Z d e j Z e j d Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d d „ Z d „  Z d „  Z d S(   sŠ  
**Project Name:**      MakeHuman

**Product Home Page:** http://www.makehuman.org/

**Code Home Page:**    https://bitbucket.org/MakeHuman/makehuman/

**Authors:**           Thomas Larsson

**Copyright(c):**      MakeHuman Team 2001-2014

**Licensing:**         AGPL3 (http://www.makehuman.org/doc/node/the_makehuman_application.html)

    This file is part of MakeHuman (www.makehuman.org).

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

**Coding Standards:**  See http://www.makehuman.org/node/165

Abstract
--------
Fbx utilities
iÿÿÿÿNi´   c           C   s   i d d 6a  d a t a d  S(   Ni    s   Model::RootNodeiè  (   t   _IdDictt   _Idt   Falset
   _IsLinking(    (    (    sP   c:\jenkins\workspace\mh_export_win32\makehuman\plugins\9_export_fbx\fbx_utils.pyt   resetId5   s    c           C   s
   t  a d  S(   N(   t   TrueR   (    (    (    sP   c:\jenkins\workspace\mh_export_win32\makehuman\plugins\9_export_fbx\fbx_utils.pyt   startLinking<   s    c           C   s
   t  a d  S(   N(   R   R   (    (    (    sP   c:\jenkins\workspace\mh_export_win32\makehuman\plugins\9_export_fbx\fbx_utils.pyt   stopLinkingA   s    c         C   s]   y t  |  |  f SWn t k
 r% n Xt r? t d |  ƒ ‚ n  t d 7a t t  |  <t |  f S(   Ns(   Did not find id for key %s while linkingi   (   R    t   KeyErrorR   t	   NameErrorR   (   t   key(    (    sP   c:\jenkins\workspace\mh_export_win32\makehuman\plugins\9_export_fbx\fbx_utils.pyt   getIdF   s    

c         C   s"   t  j j t  j j |  ƒ ƒ a d  S(   N(   t   ost   patht   dirnamet   abspatht   _AbsPath(   t   filepath(    (    sP   c:\jenkins\workspace\mh_export_win32\makehuman\plugins\9_export_fbx\fbx_utils.pyt   setAbsolutePathV   s    c         C   sF   t  j j t  j j |  ƒ t ƒ } t  j j d t  j j |  ƒ ƒ } | S(   Nt   textures(   R   R   t   relpathR   R   t   joint   basename(   R   R   (    (    sP   c:\jenkins\workspace\mh_export_win32\makehuman\plugins\9_export_fbx\fbx_utils.pyt   getRelativePath[   s    !!c         C   sF   t  j j t  j j |  ƒ ƒ }  t  j j t d t  j j |  ƒ ƒ }  |  S(   NR   (   R   R   R   t
   expanduserR   R   R   (   R   (    (    sP   c:\jenkins\workspace\mh_export_win32\makehuman\plugins\9_export_fbx\fbx_utils.pyt   getTexturePathb   s    $c         C   s"   t  j j |  ƒ } | j d d ƒ S(   Nt   .t   _(   R   R   R   t   replace(   R   t   texfile(    (    sP   c:\jenkins\workspace\mh_export_win32\makehuman\plugins\9_export_fbx\fbx_utils.pyt   getTextureNamei   s    c         C   s7   | r |  j  d k r | j  St j j |  j  ƒ d Sd  S(   Ns   base.obji    (   t   nameR   R   t   splitext(   t   mesht   skel(    (    sP   c:\jenkins\workspace\mh_export_win32\makehuman\plugins\9_export_fbx\fbx_utils.pyt   getMeshNamen   s    t    c      	   C   s°   |  j  d | | f d | ƒ xy t d ƒ D]k } |  j  d | | d f | | d f | | d f | | d f f ƒ | d k  r, |  j  d	 | ƒ q, q, W|  j  d
 | ƒ d  S(   Ns   %s        %s: *16 {
s   %s            a: i   s   %.4f,%.4f,%.4f,%.4fi    i   i   i   s   ,
%s               s   
%s        }
(   t   writet   range(   t   fpR   t   matt   padt   i(    (    sP   c:\jenkins\workspace\mh_export_win32\makehuman\plugins\9_export_fbx\fbx_utils.pyt   writeMatrixx   s    Ec         C   sQ   t  | ƒ \ } } t  | ƒ \ } } |  j d | | f d | | f d ƒ d  S(   Ns       ;%s, %s
s       C: "OO",%d,%d
s   
(   R   R%   (   R'   t   childt   parentt   cidR   t   pid(    (    sP   c:\jenkins\workspace\mh_export_win32\makehuman\plugins\9_export_fbx\fbx_utils.pyt   ooLink†   s
    c         C   sT   t  | ƒ \ } } t  | ƒ \ } } |  j d | | f d | | | f d ƒ d  S(   Ns       ;%s, %s
s       C: "OP",%d,%d, "%s"
s   
(   R   R%   (   R'   R,   R-   t   channelR.   R   R/   (    (    sP   c:\jenkins\workspace\mh_export_win32\makehuman\plugins\9_export_fbx\fbx_utils.pyt   opLink   s
    (   t   __doc__R   t   matht   pit   Rt   DR   R   R   R   R   R   R   R   R#   R+   R0   R2   (    (    (    sP   c:\jenkins\workspace\mh_export_win32\makehuman\plugins\9_export_fbx\fbx_utils.pyt   <module>%   s    									
		