Metahuman_DNA_Calibration/docs/dna_viewer_api_md.html
2022-12-02 14:51:53 +01:00

194 lines
13 KiB
HTML

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Environment Setup &mdash; DNA Calibration documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="dnacalib" href="dnacalib.html" />
<link rel="prev" title="Usage in Maya" href="dna_viewer_maya_md.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> DNA Calibration
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="index_.html">MetaHuman DNA Calibration</a></li>
<li class="toctree-l1"><a class="reference internal" href="index_.html#overview">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="index_.html#examples">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="index_.html#notes">Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="index_.html#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="index_.html#indices-and-tables">Indices and tables</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Repository Organization</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="repository_organization_md.html">Repository Organization</a></li>
<li class="toctree-l1"><a class="reference internal" href="repository_organization_md.html#folder-structure">Folder structure</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">DNACalib</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="dnacalib_md.html">DNACalib</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">DNAViewer</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="dna_viewer_md.html">DNAViewer</a></li>
<li class="toctree-l1"><a class="reference internal" href="dna_viewer_maya_md.html">Usage in Maya</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">DNAViewer API</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Environment Setup</a></li>
<li class="toctree-l1"><a class="reference internal" href="#dna">DNA</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#loading-the-dna-load-dna">Loading the DNA (<code class="docutils literal notranslate"><span class="pre">load_dna</span></code>)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#mesh-utilities">Mesh Utilities</a></li>
<li class="toctree-l2"><a class="reference internal" href="#rig-assembly">Rig Assembly</a></li>
</ul>
</li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Technical documentation</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="dnacalib.html">dnacalib</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">dna_viewer</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">FAQ</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="faq_md.html">Frequently Asked Questions (FAQ)</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">DNA Calibration</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
<li>Environment Setup</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/dna_viewer_api_md.md.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="environment-setup">
<h1>Environment Setup<a class="headerlink" href="#environment-setup" title="Permalink to this headline"></a></h1>
<p>In order be able to import from dna_viewer, the environment needs to be set up. This is done by adding this code to the
beginning of any example mentioned below:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">sys</span> <span class="kn">import</span> <span class="n">path</span> <span class="k">as</span> <span class="n">syspath</span><span class="p">,</span> <span class="n">platform</span>
<span class="kn">from</span> <span class="nn">os</span> <span class="kn">import</span> <span class="n">environ</span><span class="p">,</span> <span class="n">path</span> <span class="k">as</span> <span class="n">ospath</span>
<span class="n">ROOT_DIR</span> <span class="o">=</span> <span class="sa">fr</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">ospath</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">ospath</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="vm">__file__</span><span class="p">))</span><span class="si">}</span><span class="s2">/..&quot;</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">&quot;</span><span class="se">\\</span><span class="s2">&quot;</span><span class="p">,</span> <span class="s2">&quot;/&quot;</span><span class="p">)</span> <span class="c1"># if you use Maya, use an absolute path instead</span>
<span class="n">ROOT_LIB_DIR</span> <span class="o">=</span> <span class="sa">fr</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">ROOT_DIR</span><span class="si">}</span><span class="s2">/lib&quot;</span>
<span class="k">if</span> <span class="n">platform</span> <span class="o">==</span> <span class="s2">&quot;win32&quot;</span><span class="p">:</span>
<span class="n">LIB_DIR</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">ROOT_LIB_DIR</span><span class="si">}</span><span class="s2">/windows&quot;</span>
<span class="k">elif</span> <span class="n">platform</span> <span class="o">==</span> <span class="s2">&quot;linux&quot;</span><span class="p">:</span>
<span class="n">LIB_DIR</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">ROOT_LIB_DIR</span><span class="si">}</span><span class="s2">/linux&quot;</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">OSError</span><span class="p">(</span><span class="s2">&quot;OS not supported, please compile dependencies and add value to LIB_DIR&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="s2">&quot;MAYA_PLUG_IN_PATH&quot;</span> <span class="ow">in</span> <span class="n">environ</span><span class="p">:</span>
<span class="n">separator</span> <span class="o">=</span> <span class="s2">&quot;:&quot;</span> <span class="k">if</span> <span class="n">platform</span> <span class="o">==</span> <span class="s2">&quot;linux&quot;</span> <span class="k">else</span> <span class="s2">&quot;;&quot;</span>
<span class="n">environ</span><span class="p">[</span><span class="s2">&quot;MAYA_PLUG_IN_PATH&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">separator</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">environ</span><span class="p">[</span><span class="s2">&quot;MAYA_PLUG_IN_PATH&quot;</span><span class="p">],</span> <span class="n">LIB_DIR</span><span class="p">])</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">environ</span><span class="p">[</span><span class="s2">&quot;MAYA_PLUG_IN_PATH&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">LIB_DIR</span>
<span class="n">syspath</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ROOT_DIR</span><span class="p">)</span>
<span class="n">syspath</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">LIB_DIR</span><span class="p">)</span>
</pre></div>
</div>
<p>When running this from Maya, the <code class="docutils literal notranslate"><span class="pre">ROOT_DIR</span></code> should be set to an absolute path to the root of the repository instead.</p>
</section>
<section id="dna">
<h1>DNA<a class="headerlink" href="#dna" title="Permalink to this headline"></a></h1>
<section id="loading-the-dna-load-dna">
<h2>Loading the DNA (<a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/dna_viewer/reader/dna.py#L28"><code class="docutils literal notranslate"><span class="pre">load_dna</span></code></a>)<a class="headerlink" href="#loading-the-dna-load-dna" title="Permalink to this headline"></a></h2>
<p>Loads the DNA and returns a <a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/dna_viewer/model/dna.py#L40"><code class="docutils literal notranslate"><span class="pre">DNA</span></code></a> object.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">dna_viewer</span> <span class="kn">import</span> <span class="n">get_dna</span>
<span class="n">dna_ada</span> <span class="o">=</span> <span class="n">load_dna</span><span class="p">(</span><span class="n">DNA_PATH_ADA</span><span class="p">)</span>
<span class="n">dna_taro</span> <span class="o">=</span> <span class="n">load_dna</span><span class="p">(</span><span class="n">DNA_PATH_TARO</span><span class="p">)</span>
</pre></div>
</div>
<p>This uses the following parameters:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">dna_path:</span> <span class="pre">str</span></code> - The path of the DNA file that should be used.</p></li>
</ul>
</section>
<section id="mesh-utilities">
<h2>Mesh Utilities<a class="headerlink" href="#mesh-utilities" title="Permalink to this headline"></a></h2>
<p>Mesh Utilities API explanation is located <a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/docs/dna_viewer_api_mesh_utilities_md">here</a>.</p>
</section>
<section id="rig-assembly">
<h2>Rig Assembly<a class="headerlink" href="#rig-assembly" title="Permalink to this headline"></a></h2>
<p>Rig Assembly API explanation is located <a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/docs/dna_viewer_api_rig_assembly_md">here</a>.</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="dna_viewer_maya_md.html" class="btn btn-neutral float-left" title="Usage in Maya" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="dnacalib.html" class="btn btn-neutral float-right" title="dnacalib" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2022, Epic Games.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>