261 lines
16 KiB
HTML
261 lines
16 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>DNACalib — 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="API overview" href="dnacalib_api_md.html" />
|
|
<link rel="prev" title="Repository Organization" href="repository_organization_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 class="current">
|
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">DNACalib</a><ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="#dnacalib-folder-structure">DNACalib folder structure</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#usage">Usage</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#examples">Examples</a><ul>
|
|
<li class="toctree-l3"><a class="reference internal" href="#c">C++</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="#python">Python</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#build">Build</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="dnacalib_api_md.html">API overview</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>
|
|
<li class="toctree-l1"><a class="reference internal" href="dna_viewer_api_md.html">Environment Setup</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="dna_viewer_api_md.html#dna">DNA</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="dna_viewer_api_build_meshes_md.html">Mesh Utilities</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="dna_viewer_api_build_rig_md.html">Build rig (<code class="docutils literal notranslate"><span class="pre">build_rig</span></code>)</a></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="dna.html">DNA</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="dnacalib.html">DNACalib</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="dna_viewer_modules.html">DNAViewer</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> »</li>
|
|
<li>DNACalib</li>
|
|
<li class="wy-breadcrumbs-aside">
|
|
<a href="_sources/dnacalib_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="dnacalib">
|
|
<h1>DNACalib<a class="headerlink" href="#dnacalib" title="Permalink to this headline"></a></h1>
|
|
<p>This library is used for performing modifications on a DNA file.
|
|
It is written in C++ and there is also a Python wrapper for it. <a class="reference external" href="https://www.swig.org/">SWIG</a> library is used for generating
|
|
bindings for Python. DNACalib can be used in command line, or in Maya.
|
|
Binaries for Windows and Linux are provided. <strong>If you are using a different architecture and/or platform, you must build DNACalib.</strong></p>
|
|
<section id="dnacalib-folder-structure">
|
|
<h2>DNACalib folder structure<a class="headerlink" href="#dnacalib-folder-structure" title="Permalink to this headline"></a></h2>
|
|
<ul class="simple">
|
|
<li><p><a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/dnacalib/DNACalib"><code class="docutils literal notranslate"><span class="pre">DNACalib</span></code></a> - Contains C++ source code of DNACalib and its dependencies. There is a library for
|
|
reading and writing DNA files, along with a few other utility libraries.</p></li>
|
|
<li><p><a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/dnacalib/PyDNACalib"><code class="docutils literal notranslate"><span class="pre">PyDNACalib</span></code></a> - Contains the source code for generating the Python wrapper for DNACalib.</p></li>
|
|
<li><p><a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/dnacalib/PyDNA"><code class="docutils literal notranslate"><span class="pre">PyDNA</span></code></a> - Contains the source code for generating the Python wrapper for DNA library, that is under
|
|
DNACalib folder containing C++ source code.</p></li>
|
|
<li><p><a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/dnacalib/SPyUS"><code class="docutils literal notranslate"><span class="pre">SPyUS</span></code></a> - Contains some common SWIG interface files used by both PyDNACalib and PyDNA.</p></li>
|
|
<li><p><a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/dnacalib/CMakeModulesExtra"><code class="docutils literal notranslate"><span class="pre">CMakeModulesExtra</span></code></a> - Contains some common CMake functions that are used throughout the
|
|
project, both in C++ and the Python wrapper.</p></li>
|
|
</ul>
|
|
</section>
|
|
<section id="usage">
|
|
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
|
|
<p>For example, to change rotation values of neutral joints, use the
|
|
<a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/dnacalib/DNACalib/include/dnacalib/commands/SetNeutralJointRotationsCommand.h"><code class="docutils literal notranslate"><span class="pre">SetNeutralJointRotationsCommand</span></code></a>.</p>
|
|
<p>Below is an example that reads DNA, changes rotation values of all neutral joints to <code class="docutils literal notranslate"><span class="pre">{1,</span> <span class="pre">2,</span> <span class="pre">3}</span></code>, and overwrites the DNA
|
|
file with these new values.</p>
|
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>
|
|
// Create DNA reader
|
|
auto inOutStream = dnac::makeScoped<dnac::FileStream>("example.dna",
|
|
dnac::FileStream::AccessMode::ReadWrite,
|
|
dnac::FileStream::OpenMode::Binary);
|
|
auto reader = dnac::makeScoped<dnac::BinaryStreamReader>(inOutStream.get());
|
|
reader->read();
|
|
|
|
// Check if an error occurred while reading DNA file
|
|
if (!dnac::Status::isOk()) {
|
|
// handle reader error
|
|
}
|
|
|
|
// Create DNACalib reader in order to edit DNA
|
|
auto dnaReader = dnac::makeScoped<dnac::DNACalibDNAReader>(reader.get());
|
|
|
|
std::vector<dnac::Vector3> rotations{dnaReader->getJointCount(), {1.0f, 2.0f, 3.0f}};
|
|
|
|
// Create command instance
|
|
dnac::SetNeutralJointRotationsCommand cmd{dnac::ConstArrayView<dnac::Vector3>{rotations}};
|
|
|
|
// Execute command
|
|
cmd.run(dnaReader.get());
|
|
|
|
// Write DNA file
|
|
auto writer = dnac::makeScoped<dnac::BinaryStreamWriter>(inOutStream.get());
|
|
writer->setFrom(dnaReader.get());
|
|
writer->write();
|
|
|
|
// Check if an error occurred while writing DNA file
|
|
if (!dnac::Status::isOk()) {
|
|
// handle writer error
|
|
}
|
|
</pre></div>
|
|
</div>
|
|
</section>
|
|
<section id="examples">
|
|
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
|
|
<section id="c">
|
|
<h3>C++<a class="headerlink" href="#c" title="Permalink to this headline"></a></h3>
|
|
<p>Examples of C++ library usage can be found <a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/dnacalib/DNACalib/examples">here</a>.</p>
|
|
<p>These are:</p>
|
|
<ul class="simple">
|
|
<li><p><a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/dnacalib/DNACalib/examples/CommandSequence.cpp">Chain multiple commands</a></p></li>
|
|
<li><p><a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/dnacalib/DNACalib/examples/SingleCommand.cpp">Rename a blendshape</a></p></li>
|
|
</ul>
|
|
</section>
|
|
<section id="python">
|
|
<h3>Python<a class="headerlink" href="#python" title="Permalink to this headline"></a></h3>
|
|
<p>Examples of using the library from Python are <a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/examples">here</a>.</p>
|
|
<p>These are:</p>
|
|
<ul class="simple">
|
|
<li><p><a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/examples/dnacalib_demo.py">Showcase a few commands</a></p></li>
|
|
<li><p><a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/examples/dnacalib_rename_joint_demo.py">Rename a joint</a></p></li>
|
|
<li><p><a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/examples/dna_demo.py">Create a small DNA from scratch</a></p></li>
|
|
<li><p><a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/examples/dnacalib_lod_demo.py">Create a new DNA from an existing one by extracting specific LODs</a></p></li>
|
|
<li><p><a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/examples/dna_binary_to_json_demo.py">Read binary DNA and write it in a human readable format</a></p></li>
|
|
<li><p><a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/examples/dnacalib_remove_joint.py">Remove a joint</a></p></li>
|
|
<li><p><a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/examples/dnacalib_clear_blend_shapes.py">Clear blend shape data</a></p></li>
|
|
<li><p><a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/examples/dnacalib_neutral_mesh_subtract.py">Subtract values from neutral mesh</a></p></li>
|
|
</ul>
|
|
</section>
|
|
</section>
|
|
<section id="build">
|
|
<h2>Build<a class="headerlink" href="#build" title="Permalink to this headline"></a></h2>
|
|
<p>Prebuilt binaries for 64-bit Windows and Linux are <a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/lib">provided</a>.
|
|
If you are using a different architecture and/or platform, you must build DNACalib.</p>
|
|
<p>Prerequisites:</p>
|
|
<ul class="simple">
|
|
<li><p><a class="reference external" href="https://cmake.org/download/">CMake</a> at least version 3.14</p></li>
|
|
<li><p><a class="reference external" href="https://www.swig.org/download.html">SWIG</a> at least version 4.0.0</p></li>
|
|
<li><p><a class="reference external" href="https://www.python.org/downloads/">Python</a> To specify the exact version of python3 to use, set the CMake variable
|
|
<code class="docutils literal notranslate"><span class="pre">PYTHON3_EXACT_VERSION</span></code>. For example, to use the lib from Maya 2022, use version 3.7. For Maya 2023, use version 3.9.</p></li>
|
|
</ul>
|
|
<p>Use CMake to generate the build scripts required for building, e.g. by executing the following commands from the
|
|
<a class="reference external" href="https://github.com/EpicGames/MetaHuman-DNA-Calibration/tree/main/dnacalib"><code class="docutils literal notranslate"><span class="pre">MetaHuman-DNA-Calibration/dnacalib/</span></code></a> directory:</p>
|
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mkdir</span> <span class="n">build</span>
|
|
<span class="n">cd</span> <span class="n">build</span>
|
|
<span class="n">cmake</span> <span class="o">..</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>And subsequently, to start the build process:</p>
|
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cmake</span> <span class="o">--</span><span class="n">build</span>
|
|
</pre></div>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
|
<a href="repository_organization_md.html" class="btn btn-neutral float-left" title="Repository Organization" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
|
<a href="dnacalib_api_md.html" class="btn btn-neutral float-right" title="API overview" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
|
</div>
|
|
|
|
<hr/>
|
|
|
|
<div role="contentinfo">
|
|
<p>© Copyright 2023, 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> |