Merge pull request #58 from EpicGames/release_1.3.0

Update for 1.3.0 release
This commit is contained in:
marijavik 2024-08-15 10:11:36 +02:00 committed by GitHub
commit 6c46445fb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
60 changed files with 24365 additions and 777 deletions

View File

@ -2,6 +2,31 @@
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
## [1.3.0] - 2024-08-15
### Added
- support for Maya 2024
- support for Python 3.11
- added source code comments to python wrappers
### Fixed
- `CalculateMeshLowerLODsCommand` was rewritten to address edge cases discovered with eyelashes and to handle some common cases of invalid UV data.
- `RotateCommand` to rotate blend shape target deltas as well.
- `SetBlendShapeTargetDeltasCommand` to allow setting vertex indices as well.
- Swig generated classes are now wrapped instead of being monkey-patched to invoke constructors and destructors (which allows building with newer Swig versions - 4.0.x and 4.1.x).
### Changed
- CMake files to add test cases that execute the example scripts and allow generating bundled archives with CPack.
- Binaries for embeddedRL4 plugin to be .so files.
## [1.2.0] - 2023-06-30
### Added
- assets (gui.ma, Ada.dna, additional_assemble_script.py) which support MHC 2.x.x releases (UE 5.2 and 5.3)
## [1.1.0] - 2023-04-20 ## [1.1.0] - 2023-04-20
### Added ### Added
@ -26,4 +51,4 @@ All notable changes to this project will be documented in this file. This projec
- option to pass list of indices to remove in remove commands. - option to pass list of indices to remove in remove commands.
### Removed ### Removed
- removed method `assemble_rig` from DNAViewer API. - removed method `assemble_rig` from DNAViewer API.

View File

@ -3,7 +3,25 @@ project(dnacalib)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModulesExtra") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModulesExtra")
enable_testing()
add_subdirectory(DNACalib) add_subdirectory(DNACalib)
add_subdirectory(SPyUS) add_subdirectory(SPyUS)
add_subdirectory(PyDNA) add_subdirectory(PyDNA)
add_subdirectory(PyDNACalib) add_subdirectory(PyDNACalib)
################################################
# Package build artifacts
set(CPACK_GENERATOR "ZIP")
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)
string(CONCAT CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}"
"-${CMAKE_PROJECT_VERSION}"
"-${CMAKE_SYSTEM_NAME}"
"-${CMAKE_SYSTEM_PROCESSOR}"
"-${CMAKE_CXX_COMPILER_ID}${CMAKE_CXX_COMPILER_VERSION}"
"-${CMAKE_BUILD_TYPE}"
"-${PYTHON3_EXACT_VERSION}"
"-SHARED")
include(CPack)

View File

@ -14,6 +14,14 @@
set(INSTALL_LIBRARY_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}") set(INSTALL_LIBRARY_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}")
macro(install_library target_name) macro(install_library target_name)
# component_name is an optional argument, and will default to the given target_name
set(COMPONENT_NAME ${target_name})
set(extra_args ${ARGN})
list(LENGTH extra_args num_extra_args)
if(${num_extra_args} GREATER 0)
list(GET extra_args 0 COMPONENT_NAME)
endif()
include(GNUInstallDirs) include(GNUInstallDirs)
set(REPRESENTATIVE_TARGET_NAME ${target_name}) set(REPRESENTATIVE_TARGET_NAME ${target_name})
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
@ -21,9 +29,20 @@ macro(install_library target_name)
# Set install destinations and associate installed target files with an export # Set install destinations and associate installed target files with an export
install(TARGETS ${REPRESENTATIVE_TARGET_NAME} install(TARGETS ${REPRESENTATIVE_TARGET_NAME}
EXPORT ${PROJECT_NAME}-targets EXPORT ${PROJECT_NAME}-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${COMPONENT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT ${COMPONENT_NAME}
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT ${COMPONENT_NAME}
NAMELINK_COMPONENT ${COMPONENT_NAME}
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT ${COMPONENT_NAME}
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT ${COMPONENT_NAME}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# Write build-tree targets # Write build-tree targets
@ -37,7 +56,8 @@ macro(install_library target_name)
install(EXPORT ${PROJECT_NAME}-targets install(EXPORT ${PROJECT_NAME}-targets
FILE ${PROJECT_NAME}Targets.cmake FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE ${PROJECT_NAME}:: NAMESPACE ${PROJECT_NAME}::
DESTINATION ${INSTALL_CONFIGDIR}) DESTINATION ${INSTALL_CONFIGDIR}
COMPONENT ${COMPONENT_NAME})
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
@ -68,13 +88,17 @@ macro(install_library target_name)
install(FILES install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.install.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.install.cmake"
DESTINATION ${INSTALL_CONFIGDIR} DESTINATION ${INSTALL_CONFIGDIR}
RENAME "${PROJECT_NAME}Config.cmake") RENAME "${PROJECT_NAME}Config.cmake"
COMPONENT ${COMPONENT_NAME})
# Install package version file # Install package version file
install(FILES install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${INSTALL_CONFIGDIR}) DESTINATION ${INSTALL_CONFIGDIR}
COMPONENT ${COMPONENT_NAME})
# Install include files # Install include files
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT ${COMPONENT_NAME})
endmacro() endmacro()

View File

@ -100,6 +100,8 @@ set(SOURCES
src/dnacalib/TypeDefs.h src/dnacalib/TypeDefs.h
src/dnacalib/commands/CalculateMeshLowerLODsCommand.cpp src/dnacalib/commands/CalculateMeshLowerLODsCommand.cpp
src/dnacalib/commands/CalculateMeshLowerLODsCommandImpl.cpp
src/dnacalib/commands/CalculateMeshLowerLODsCommandImpl.h
src/dnacalib/commands/ClearBlendShapesCommand.cpp src/dnacalib/commands/ClearBlendShapesCommand.cpp
src/dnacalib/commands/CommandSequence.cpp src/dnacalib/commands/CommandSequence.cpp
src/dnacalib/commands/PruneBlendShapeTargetsCommand.cpp src/dnacalib/commands/PruneBlendShapeTargetsCommand.cpp

View File

@ -123,6 +123,8 @@ set(SOURCES
src/dnacalib/CommandImplBase.h src/dnacalib/CommandImplBase.h
src/dnacalib/TypeDefs.h src/dnacalib/TypeDefs.h
src/dnacalib/commands/CalculateMeshLowerLODsCommand.cpp src/dnacalib/commands/CalculateMeshLowerLODsCommand.cpp
src/dnacalib/commands/CalculateMeshLowerLODsCommandImpl.cpp
src/dnacalib/commands/CalculateMeshLowerLODsCommandImpl.h
src/dnacalib/commands/ClearBlendShapesCommand.cpp src/dnacalib/commands/ClearBlendShapesCommand.cpp
src/dnacalib/commands/CommandSequence.cpp src/dnacalib/commands/CommandSequence.cpp
src/dnacalib/commands/PruneBlendShapeTargetsCommand.cpp src/dnacalib/commands/PruneBlendShapeTargetsCommand.cpp

View File

@ -41,12 +41,19 @@ struct ArrayViewTraits<const T> {
using difference_type = std::ptrdiff_t; using difference_type = std::ptrdiff_t;
}; };
template<typename T, typename U>
struct IsCompatible {
static constexpr bool value = std::is_same<typename std::remove_cv<T>::type, typename std::remove_cv<U>::type>::value &&
(std::is_const<typename std::remove_reference<T>::type>::value ||
!std::is_const<typename std::remove_reference<U>::type>::value);
};
/** /**
@brief A view over a continuous sequence of objects. @brief A view over a continuous sequence of objects.
@tparam T element type @tparam T element type
Provides a view over a continuous sequence of objects owned by some other object. Provides a view over a continuous sequence of objects owned by some other object.
Contains a count of elements and a pointer to a location where they are stored. Contains a count of elements and a pointer to a location where they are stored.
ArrayView does not own the mmemory it points to - it does not perform any allocation ArrayView does not own the memory it points to - it does not perform any allocation
and deallocation. It can be constructed given a pointer and element count, or a container and deallocation. It can be constructed given a pointer and element count, or a container
type argument. The class provides helper methods for creating subviews over the objects, type argument. The class provides helper methods for creating subviews over the objects,
and methods for by-value comparison with containers. ConstArrayView represents an immutable view. and methods for by-value comparison with containers. ConstArrayView represents an immutable view.
@ -76,23 +83,23 @@ class ArrayView {
sz{size} { sz{size} {
} }
ArrayView(std::nullptr_t /*unused*/, size_type /*unused*/) : ArrayView{nullptr, {}} { template<typename U, typename std::enable_if<IsCompatible<T, U>::value, int>::type = 0>
}
template<typename U>
ArrayView(ArrayView<U>& src) : ArrayView{src.data(), src.size()} { ArrayView(ArrayView<U>& src) : ArrayView{src.data(), src.size()} {
} }
template<typename U> template<typename U, typename std::enable_if<IsCompatible<T, U>::value, int>::type = 0>
ArrayView(const ArrayView<U>& src) : ArrayView{src.data(), src.size()} { ArrayView(const ArrayView<U>& src) : ArrayView{src.data(), src.size()} {
} }
template<typename U> template<typename U, typename std::enable_if<IsCompatible<T, U>::value, int>::type = 0>
ArrayView(ArrayView<U>&& src) : ArrayView{src.data(), src.size()} { ArrayView(ArrayView<U>&& src) : ArrayView{src.data(), src.size()} {
} }
template<typename U, typename std::enable_if<!std::is_rvalue_reference<U &&>::value, int>::type = 0> template<typename U,
explicit ArrayView(U&& src) : ArrayView{src.data(), src.size()} { typename std::enable_if<!std::is_rvalue_reference<U &&>::value &&
IsCompatible<T, typename std::remove_reference<U>::type::value_type>::value,
int>::type = 0>
ArrayView(U&& src) : ArrayView{src.data(), static_cast<size_type>(src.size())} {
} }
size_type size() const { size_type size() const {
@ -193,7 +200,8 @@ bool operator!=(const ArrayView<T>& lhs, const ArrayView<U>& rhs) {
} }
template<typename T, typename TContainer> template<typename T, typename TContainer>
bool operator==(const ArrayView<T>& lhs, const TContainer& rhs) { typename std::enable_if<!std::is_base_of<ArrayView<T>, TContainer>::value, bool>::type operator==(const ArrayView<T>& lhs,
const TContainer& rhs) {
if (lhs.size() != rhs.size()) { if (lhs.size() != rhs.size()) {
return false; return false;
} }
@ -207,17 +215,20 @@ bool operator==(const ArrayView<T>& lhs, const TContainer& rhs) {
} }
template<typename T, typename TContainer> template<typename T, typename TContainer>
bool operator!=(const ArrayView<T>& lhs, const TContainer& rhs) { typename std::enable_if<!std::is_base_of<ArrayView<T>, TContainer>::value, bool>::type operator!=(const ArrayView<T>& lhs,
const TContainer& rhs) {
return !(lhs == rhs); return !(lhs == rhs);
} }
template<typename T, typename TContainer> template<typename T, typename TContainer>
bool operator==(const TContainer& lhs, const ArrayView<T>& rhs) { typename std::enable_if<!std::is_base_of<ArrayView<T>, TContainer>::value, bool>::type operator==(const TContainer& lhs,
const ArrayView<T>& rhs) {
return (rhs == lhs); return (rhs == lhs);
} }
template<typename T, typename TContainer> template<typename T, typename TContainer>
bool operator!=(const TContainer& lhs, const ArrayView<T>& rhs) { typename std::enable_if<!std::is_base_of<ArrayView<T>, TContainer>::value, bool>::type operator!=(const TContainer& lhs,
const ArrayView<T>& rhs) {
return !(lhs == rhs); return !(lhs == rhs);
} }

View File

@ -32,12 +32,4 @@ class StringView : public trust::ConstArrayView<char> {
}; };
inline bool operator==(const StringView& lhs, const StringView& rhs) {
return (static_cast<const StringView::Base&>(lhs) == static_cast<const StringView::Base&>(rhs));
}
inline bool operator!=(const StringView& lhs, const StringView& rhs) {
return !(lhs == rhs);
}
} // namespace dna } // namespace dna

View File

@ -70,7 +70,7 @@ void JointFilter::apply(RawBehavior& dest) {
} }
} }
// Collect row indices of removed output indices to be used for joint delta removal // Collect row indices of removed output indices to be used for joint delta removal
Set<std::size_t> rowsToDelete{memRes}; UnorderedSet<std::size_t> rowsToDelete{memRes};
// Remove output indices belonging to the deletable joint // Remove output indices belonging to the deletable joint
extd::filter(jointGroup.outputIndices, [this, &rowsToDelete](std::uint16_t outputIndex, std::size_t rowIndex) { extd::filter(jointGroup.outputIndices, [this, &rowsToDelete](std::uint16_t outputIndex, std::size_t rowIndex) {
const auto jointIndex = static_cast<std::uint16_t>(outputIndex / jointAttributeCount); const auto jointIndex = static_cast<std::uint16_t>(outputIndex / jointAttributeCount);

View File

@ -3,11 +3,26 @@
#include "dnacalib/commands/CalculateMeshLowerLODsCommand.h" #include "dnacalib/commands/CalculateMeshLowerLODsCommand.h"
#include "dnacalib/CommandImplBase.h" #include "dnacalib/CommandImplBase.h"
#include "dnacalib/commands/CalculateMeshLowerLODsCommandImpl.h"
#include "dnacalib/dna/DNA.h" #include "dnacalib/dna/DNA.h"
#include "dnacalib/dna/DNACalibDNAReaderImpl.h" #include "dnacalib/dna/DNACalibDNAReaderImpl.h"
#include "dnacalib/types/Aliases.h" #include "dnacalib/types/Aliases.h"
#include "dnacalib/types/UVBarycentricMapping.h" #include "dnacalib/types/UVBarycentricMapping.h"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4365 4987)
#endif
#include <algorithm>
#include <cstddef>
#include <cstdio>
#include <iterator>
#include <limits>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
namespace dnac { namespace dnac {
class CalculateMeshLowerLODsCommand::Impl : public CommandImplBase<Impl> { class CalculateMeshLowerLODsCommand::Impl : public CommandImplBase<Impl> {
@ -25,7 +40,16 @@ class CalculateMeshLowerLODsCommand::Impl : public CommandImplBase<Impl> {
} }
void run(DNACalibDNAReaderImpl* output) { void run(DNACalibDNAReaderImpl* output) {
UVBarycentricMapping mapping{output, meshIndex, getMemoryResource()}; auto faceGetter = std::bind(&dna::Reader::getFaceVertexLayoutIndices, output, meshIndex, std::placeholders::_1);
const auto layoutPositions = output->getVertexLayoutPositionIndices(meshIndex);
const auto layoutTexCoords = output->getVertexLayoutTextureCoordinateIndices(meshIndex);
const auto origMappingUs = output->getVertexTextureCoordinateUs(meshIndex);
const auto mappingVs = output->getVertexTextureCoordinateVs(meshIndex);
const auto mappingUs = deduplicateTextureCoordinates(origMappingUs, mappingVs);
const auto faceCount = output->getFaceCount(meshIndex);
UVBarycentricMapping mapping{faceGetter, layoutPositions, layoutTexCoords, mappingUs, mappingVs, faceCount,
getMemoryResource()};
auto srcMeshXs = output->getVertexPositionXs(meshIndex); auto srcMeshXs = output->getVertexPositionXs(meshIndex);
auto srcMeshYs = output->getVertexPositionYs(meshIndex); auto srcMeshYs = output->getVertexPositionYs(meshIndex);
@ -36,51 +60,83 @@ class CalculateMeshLowerLODsCommand::Impl : public CommandImplBase<Impl> {
}; };
for (std::uint16_t mi : findIndicesOfMeshLowerLODs(output)) { for (std::uint16_t mi : findIndicesOfMeshLowerLODs(output)) {
auto vertexLayoutPositionIndices = output->getVertexLayoutPositionIndices(mi); const auto vertexLayoutPositionIndices = output->getVertexLayoutPositionIndices(mi);
auto vertexLayoutTextureCoordinateIndices = output->getVertexLayoutTextureCoordinateIndices(mi); const auto vertexLayoutTextureCoordinateIndices = output->getVertexLayoutTextureCoordinateIndices(mi);
auto us = output->getVertexTextureCoordinateUs(mi); const auto vs = output->getVertexTextureCoordinateVs(mi);
auto vs = output->getVertexTextureCoordinateVs(mi); const auto us = deduplicateTextureCoordinates(output->getVertexTextureCoordinateUs(mi), vs);
const std::uint32_t positionCount = output->getVertexPositionCount(mi); const std::uint32_t positionCount = output->getVertexPositionCount(mi);
RawVector3Vector destVertexPositions {positionCount, {}, getMemoryResource()}; RawVector3Vector destVertexPositions {positionCount, {}, getMemoryResource()};
// As there can be multiple VertexLayout per each VertexPosition we will use arithmetic mean value. // As there can be multiple VertexLayout per each VertexPosition we will use arithmetic mean value.
Vector<uint8_t> vertexLayoutsPerPosition{positionCount, {}, getMemoryResource()}; Vector<std::uint8_t> vertexLayoutsPerPosition{positionCount, {}, getMemoryResource()};
for (std::size_t i = 0u; i < vertexLayoutPositionIndices.size(); ++i) { for (std::uint32_t vli = 0u; vli < vertexLayoutPositionIndices.size(); ++vli) {
const std::uint32_t uvIndex = vertexLayoutTextureCoordinateIndices[i]; std::uint32_t uvIndex = vertexLayoutTextureCoordinateIndices[vli];
const fvec2 uvs = {us[uvIndex], vs[uvIndex]}; const fvec2 uvs = {us[uvIndex], vs[uvIndex]};
const auto weightsIndicesPair = mapping.getBarycentric(uvs); const auto weightsIndicesPair = mapping.getBarycentric(uvs);
const fvec3& barycentric = std::get<0>(weightsIndicesPair); fvec3 barycentric = std::get<0>(weightsIndicesPair);
auto srcVtxIndices = std::get<1>(weightsIndicesPair); auto srcVtxIndices = std::get<1>(weightsIndicesPair);
if (srcVtxIndices.size() == 0) { if (srcVtxIndices.size() == 0) {
// We'll need to handle this case in the future? // We didn't hit any triangle. We aim to identify the nearest face to this UV, ensuring
assert(false && "Could not map a vertex, did not hit any triangle's bounding box."); // that the selected face has an intersection with at least one of the adjacent faces of the vertex we are
continue; // projecting.
float minDistance = std::numeric_limits<float>::max();
std::uint32_t sourceTriangleIndex = std::numeric_limits<std::uint32_t>::max();
// First we find all of the faces that are adjacent to this vertex
for (std::uint32_t fi = 0u; fi < output->getFaceCount(mi); fi++) {
const auto face = output->getFaceVertexLayoutIndices(mi, fi);
if (std::find(face.begin(), face.end(), vli) == face.end()) {
continue;
}
// Gather all vertex UVs from this face and create a bounding box from it
Vector<fvec2> UVs{getMemoryResource()};
for (const auto vertexLayoutIndex : face) {
uvIndex = vertexLayoutTextureCoordinateIndices[vertexLayoutIndex];
UVs.emplace_back(us[uvIndex], vs[uvIndex]);
}
const BoundingBox faceBoundingBox{UVs};
// Find the closest triangle that has intersection with this face
auto bBoxes = mapping.getBoundingBoxes();
for (std::uint32_t bi = 0u; bi < bBoxes.size(); bi++) {
const auto& bBox = bBoxes[bi];
if (bBox.overlaps(faceBoundingBox)) {
const float distance = bBox.distance(uvs);
if (distance < minDistance) {
minDistance = distance;
sourceTriangleIndex = bi;
}
}
}
}
if (sourceTriangleIndex != std::numeric_limits<std::uint32_t>::max()) {
barycentric = mapping.getTriangle(sourceTriangleIndex).getBarycentricCoords(uvs);
srcVtxIndices = mapping.getTrianglePositionIndices(sourceTriangleIndex);
} else {
assert(false && "Could not map a vertex. It is not within a face of higher lod.");
continue;
}
} }
const fvec3 src = const fvec3 src =
getSrcVertex(srcVtxIndices[0]) * barycentric[0] + getSrcVertex(srcVtxIndices[0]) * barycentric[0] +
getSrcVertex(srcVtxIndices[1]) * barycentric[1] + getSrcVertex(srcVtxIndices[1]) * barycentric[1] +
getSrcVertex(srcVtxIndices[2]) * barycentric[2]; getSrcVertex(srcVtxIndices[2]) * barycentric[2];
const uint32_t positionIndex = vertexLayoutPositionIndices[i]; const uint32_t positionIndex = vertexLayoutPositionIndices[vli];
float& destX = destVertexPositions.xs[positionIndex]; float& destX = destVertexPositions.xs[positionIndex];
float& destY = destVertexPositions.ys[positionIndex]; float& destY = destVertexPositions.ys[positionIndex];
float& destZ = destVertexPositions.zs[positionIndex]; float& destZ = destVertexPositions.zs[positionIndex];
const auto vtxLayoutCount = ++vertexLayoutsPerPosition[positionIndex]; const auto vtxLayoutCount = ++vertexLayoutsPerPosition[positionIndex];
// We require mean average, more than one vertexLayout for this vertex position
const auto lastDenominator = static_cast<float>(vtxLayoutCount - 1u);
const auto newDenominator = static_cast<float>(vtxLayoutCount);
destX = (destX * lastDenominator + src[0]) / newDenominator;
destY = (destY * lastDenominator + src[1]) / newDenominator;
destZ = (destZ * lastDenominator + src[2]) / newDenominator;
if (vtxLayoutCount == 1) {
destX = src[0];
destY = src[1];
destZ = src[2];
} else {
// We require mean average, more than one vertexLayout for this vertex position
const auto lastDenominator = static_cast<float>(vtxLayoutCount - 1u);
const auto newDenominator = static_cast<float>(vtxLayoutCount);
destX = (destX * lastDenominator + src[0]) / newDenominator;
destY = (destY * lastDenominator + src[1]) / newDenominator;
destZ = (destZ * lastDenominator + src[2]) / newDenominator;
}
} }
output->setVertexPositions(mi, std::move(destVertexPositions)); output->setVertexPositions(mi, std::move(destVertexPositions));
} }
@ -113,12 +169,23 @@ class CalculateMeshLowerLODsCommand::Impl : public CommandImplBase<Impl> {
} }
} }
} else { } else {
isLowerLOD = std::find(lodMeshIndices.begin(), lodMeshIndices.end(), meshIndex) != lodMeshIndices.end(); isLowerLOD =
std::find(lodMeshIndices.begin(), lodMeshIndices.end(), meshIndex) != lodMeshIndices.end();
} }
} }
return lowerLODIndices; return lowerLODIndices;
} }
Vector<float> deduplicateTextureCoordinates(ConstArrayView<float> us, ConstArrayView<float> vs) {
Vector<float> usCopy{us.begin(), us.end(), getMemoryResource()};
if (isUVMapOverlapping(us, vs)) {
// The offset function will not modify those given arrays for which the specified offset is 0.0
// So const_cast-ing here is just to satisfy the compiler, not for modifying the data sneakily.
offsetOverlappingUVMapRegion(usCopy, {const_cast<float*>(vs.data()), vs.size()}, 1.0f, 0.0f);
}
return usCopy;
}
private: private:
std::uint16_t meshIndex; std::uint16_t meshIndex;
}; };

View File

@ -0,0 +1,62 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "dnacalib/commands/CalculateMeshLowerLODsCommandImpl.h"
#include <algorithm>
#include <cmath>
#include <cstddef>
namespace dnac {
inline bool near(float a, float b, float threshold) {
return std::fabs(a - b) < threshold;
}
bool isUVMapOverlapping(ConstArrayView<float> us,
ConstArrayView<float> vs,
std::size_t overlapCountThreshold,
float uvCompareThreshold) {
// Quick heuristic to check if the UV is really mirrored into the upper half of the array,
// if first N matches, it will be considered a total match and deduplication should proceed
assert(us.size() == vs.size());
if ((us.size() % 2ul) != 0ul) {
return false;
}
const std::size_t half = (us.size() / 2ul);
for (std::size_t i = {}; i < std::min(half, overlapCountThreshold); ++i) {
bool found = false;
for (std::size_t j = half; j < us.size(); ++j) {
if (near(us[i], us[j], uvCompareThreshold) && near(vs[i], vs[j], uvCompareThreshold)) {
found = true;
break;
}
}
if (!found) {
return false;
}
}
return true;
}
void offsetOverlappingUVMapRegion(ArrayView<float> us, ArrayView<float> vs, float uOffset, float vOffset,
float uvCompareThreshold) {
assert(us.size() == vs.size());
const std::size_t half = (us.size() / 2ul);
for (std::size_t i = {}; i < half; ++i) {
for (std::size_t j = half; j < us.size(); ++j) {
if (near(us[i], us[j], uvCompareThreshold) && near(vs[i], vs[j], uvCompareThreshold)) {
if (uOffset != 0.0f) {
us[i] += uOffset;
}
if (vOffset != 0.0f) {
vs[i] += vOffset;
}
break;
}
}
}
}
} // namespace dnac

View File

@ -0,0 +1,19 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "dnacalib/types/Aliases.h"
namespace dnac {
bool isUVMapOverlapping(ConstArrayView<float> us,
ConstArrayView<float> vs,
std::size_t overlapCountThreshold = 10ul,
float uvCompareThreshold = 0.0002f);
void offsetOverlappingUVMapRegion(ArrayView<float> us,
ArrayView<float> vs,
float uOffset = 1.0f,
float vOffset = 0.0f,
float uvCompareThreshold = 0.0002f);
} // namespace dnac

View File

@ -70,7 +70,7 @@ void JointFilter::apply(RawBehavior& dest) {
} }
} }
// Collect row indices of removed output indices to be used for joint delta removal // Collect row indices of removed output indices to be used for joint delta removal
Set<std::size_t> rowsToDelete{memRes}; UnorderedSet<std::size_t> rowsToDelete{memRes};
// Remove output indices belonging to the deletable joint // Remove output indices belonging to the deletable joint
extd::filter(jointGroup.outputIndices, [this, &rowsToDelete](std::uint16_t outputIndex, std::size_t rowIndex) { extd::filter(jointGroup.outputIndices, [this, &rowsToDelete](std::uint16_t outputIndex, std::size_t rowIndex) {
const auto jointIndex = static_cast<std::uint16_t>(outputIndex / jointAttributeCount); const auto jointIndex = static_cast<std::uint16_t>(outputIndex / jointAttributeCount);

View File

@ -53,6 +53,11 @@ class BoundingBox {
return std::sqrt(dx * dx + dy * dy); return std::sqrt(dx * dx + dy * dy);
} }
bool overlaps(const BoundingBox& other) const {
return (max[0] >= other.min[0] && other.max[0] >= min[0]) &&
(max[1] >= other.min[1] && other.max[1] >= min[1]);
}
fvec2 getMin() const { fvec2 getMin() const {
return min; return min;
} }

View File

@ -4,42 +4,6 @@
namespace dnac { namespace dnac {
namespace {
tdm::vec3<std::uint32_t> findTriangleWithLargestArea(ConstArrayView<std::uint32_t> face,
ConstArrayView<std::uint32_t> textureCoordinateUVIndices,
ConstArrayView<float> Us,
ConstArrayView<float> Vs) {
float maxArea = 0.0f;
tdm::vec3<std::uint32_t> maxTriangle = {0u, 1u, static_cast<std::uint32_t>(face.size() - 1u)};
for (std::size_t ai = {}; ai < face.size(); ++ai) {
const std::uint32_t avli = face[ai];
const std::uint32_t auvi = textureCoordinateUVIndices[avli];
const float au = Us[auvi];
const float av = Vs[auvi];
for (std::size_t bi = (ai + 1ul); bi < face.size(); ++bi) {
const std::uint32_t bvli = face[bi];
const std::uint32_t buvi = textureCoordinateUVIndices[bvli];
const float bu = Us[buvi];
const float bv = Vs[buvi];
for (std::size_t ci = (bi + 1ul); ci < face.size(); ++ci) {
const std::uint32_t cvli = face[ci];
const std::uint32_t cuvi = textureCoordinateUVIndices[cvli];
const float cu = Us[cuvi];
const float cv = Vs[cuvi];
const float area = std::fabs(0.5f * (au * (bv - cv) + bu * (cv - av) + cu * (av - bv)));
if (area > maxArea) {
maxArea = area;
maxTriangle = {avli, bvli, cvli};
}
}
}
}
return maxTriangle;
}
} // namespace
UVBarycentricMapping::UVBarycentricMapping(const std::function<ConstArrayView<std::uint32_t>(std::uint32_t)>& faceGetter, UVBarycentricMapping::UVBarycentricMapping(const std::function<ConstArrayView<std::uint32_t>(std::uint32_t)>& faceGetter,
ConstArrayView<std::uint32_t> vertexPositionIndices, ConstArrayView<std::uint32_t> vertexPositionIndices,
ConstArrayView<std::uint32_t> textureCoordinateUVIndices, ConstArrayView<std::uint32_t> textureCoordinateUVIndices,
@ -48,76 +12,74 @@ UVBarycentricMapping::UVBarycentricMapping(const std::function<ConstArrayView<st
std::uint32_t faceCount, std::uint32_t faceCount,
MemoryResource* memRes) : MemoryResource* memRes) :
triangles{memRes}, triangles{memRes},
bBoxes{memRes} { trianglePositionIndices{memRes} {
auto estimatedTriangleCount = static_cast<std::size_t>(static_cast<float>(faceCount) * 2.5f); auto estimatedTriangleCount = static_cast<std::size_t>(static_cast<float>(faceCount) * 2.5f);
triangles.reserve(estimatedTriangleCount); triangles.reserve(estimatedTriangleCount);
bBoxes.reserve(estimatedTriangleCount); boundingBoxes.reserve(estimatedTriangleCount);
for (std::uint32_t i = 0u; i < faceCount; i++) { trianglePositionIndices.reserve(estimatedTriangleCount);
auto face = faceGetter(i);
while (face.size() > 2) {
const auto maxTriangle = findTriangleWithLargestArea(face, textureCoordinateUVIndices, Us, Vs);
const auto vertexLayoutIndex0 = maxTriangle[0];
const auto vertexLayoutIndex1 = maxTriangle[1];
const auto vertexLayoutIndex2 = maxTriangle[2];
const std::array<std::uint32_t, 3> positionIndices {vertexPositionIndices[vertexLayoutIndex0], for (std::uint32_t fi = 0u; fi < faceCount; fi++) {
vertexPositionIndices[vertexLayoutIndex1], auto face = faceGetter(fi);
vertexPositionIndices[vertexLayoutIndex2]}; if (face.size() > 2) {
const auto n = face.size();
for (std::uint32_t i = 0; i < n - 2; ++i) {
for (std::uint32_t j = i + 1; j < n - 1; ++j) {
for (std::uint32_t k = j + 1; k < n; ++k) {
const auto vli0 = face[i];
const auto vli1 = face[j];
const auto vli2 = face[k];
const std::array<std::uint32_t, 3> positionIndices {vertexPositionIndices[vli0],
vertexPositionIndices[vli1],
vertexPositionIndices[vli2]};
const auto uvIndex0 = textureCoordinateUVIndices[vli0];
const auto uvIndex1 = textureCoordinateUVIndices[vli1];
const auto uvIndex2 = textureCoordinateUVIndices[vli2];
const auto uvIndex0 = textureCoordinateUVIndices[vertexLayoutIndex0]; const std::array<fvec2, 3> UVs = {fvec2{Us[uvIndex0], Vs[uvIndex0]},
const auto uvIndex1 = textureCoordinateUVIndices[vertexLayoutIndex1]; fvec2{Us[uvIndex1], Vs[uvIndex1]},
const auto uvIndex2 = textureCoordinateUVIndices[vertexLayoutIndex2]; fvec2{Us[uvIndex2], Vs[uvIndex2]}};
triangles.emplace_back(UVs);
const std::array<fvec2, 3> UVs = {fvec2{Us[uvIndex0], Vs[uvIndex0]}, boundingBoxes.emplace_back(UVs);
fvec2{Us[uvIndex1], Vs[uvIndex1]}, trianglePositionIndices.emplace_back(positionIndices);
fvec2{Us[uvIndex2], Vs[uvIndex2]}}; }
}
triangles.emplace_back(Triangle{UVs}, positionIndices); }
bBoxes.emplace_back(BoundingBox{UVs});
face = face.last(face.size() - 1u);
} }
} }
triangles.shrink_to_fit(); triangles.shrink_to_fit();
bBoxes.shrink_to_fit(); boundingBoxes.shrink_to_fit();
} trianglePositionIndices.shrink_to_fit();
UVBarycentricMapping::UVBarycentricMapping(const dna::Reader* reader, std::uint16_t meshIndex, MemoryResource* memRes) :
UVBarycentricMapping(std::bind(&dna::Reader::getFaceVertexLayoutIndices, reader, meshIndex, std::placeholders::_1),
reader->getVertexLayoutPositionIndices(meshIndex),
reader->getVertexLayoutTextureCoordinateIndices(meshIndex),
reader->getVertexTextureCoordinateUs(meshIndex),
reader->getVertexTextureCoordinateVs(meshIndex),
reader->getFaceCount(meshIndex),
memRes) {
}
ConstArrayView<UVBarycentricMapping::TrianglePositionIndicesPair> UVBarycentricMapping::getTriangles() const {
return {triangles.data(), triangles.size()};
}
ConstArrayView<BoundingBox> UVBarycentricMapping::getBoundingBoxes() const {
return {bBoxes.data(), bBoxes.size()};
} }
UVBarycentricMapping::BarycentricPositionIndicesPair UVBarycentricMapping::getBarycentric(fvec2 uv) const { UVBarycentricMapping::BarycentricPositionIndicesPair UVBarycentricMapping::getBarycentric(fvec2 uv) const {
BarycentricPositionIndicesPair barycentricPositionsPair; const auto isPointInsideTriangle = [](const fvec3& barycentricPoint) {
auto it = std::min_element(bBoxes.begin(), bBoxes.end(), [uv](const BoundingBox& a, const BoundingBox& b) { return barycentricPoint[0] > 0.0f && barycentricPoint[1] > 0.0f && barycentricPoint[2] > 0.0f;
return a.distance(uv) < b.distance(uv); };
}); for (std::uint32_t i = 0; i < triangles.size(); i++) {
if (it != bBoxes.end()) { const auto& triangle = triangles[i];
const auto i = static_cast<std::size_t>(std::distance(bBoxes.begin(), it)); // we check if point is inside triangle (all barycentric coordinates are positive)
const auto barycentricWeights = std::get<0>(triangles[i]).getBarycentricCoords(uv); if (boundingBoxes[i].contains(uv)) {
// If we don't hit any triangle, we will use one whose bounding box we hit const auto barycentricPoint = triangle.getBarycentricCoords(uv);
barycentricPositionsPair = BarycentricPositionIndicesPair(barycentricWeights, ConstArrayView<std::uint32_t>{std::get<1>(triangles[i])}); if (isPointInsideTriangle(barycentricPoint)) {
if ((barycentricWeights[0] >= 0.0f) && (barycentricWeights[0] <= 1.0f) && return BarycentricPositionIndicesPair{barycentricPoint,
(barycentricWeights[1] >= 0.0f) && (barycentricWeights[1] <= 1.0f) && ConstArrayView<std::uint32_t>{trianglePositionIndices[i]}};
(barycentricWeights[2] >= 0.0f) && (barycentricWeights[2] <= 1.0f)) { }
return barycentricPositionsPair;
} }
} }
return barycentricPositionsPair; return {};
}
const Triangle& UVBarycentricMapping::getTriangle(std::uint32_t index) const {
return triangles[index];
}
ConstArrayView<std::uint32_t> UVBarycentricMapping::getTrianglePositionIndices(std::uint32_t index) const {
return trianglePositionIndices[index];
}
ConstArrayView<BoundingBox> UVBarycentricMapping::getBoundingBoxes() const {
return boundingBoxes;
} }
} // namespace dnac } // namespace dnac

View File

@ -3,12 +3,11 @@
#pragma once #pragma once
#include "dnacalib/types/Aliases.h" #include "dnacalib/types/Aliases.h"
#include "dnacalib/types/Triangle.h"
#include "dnacalib/types/BoundingBox.h" #include "dnacalib/types/BoundingBox.h"
#include "dnacalib/types/Triangle.h"
namespace dnac { namespace dnac {
class UVBarycentricMapping { class UVBarycentricMapping {
public: public:
using TrianglePositionIndicesPair = std::tuple<Triangle, std::array<std::uint32_t, 3u> >; using TrianglePositionIndicesPair = std::tuple<Triangle, std::array<std::uint32_t, 3u> >;
@ -23,16 +22,15 @@ class UVBarycentricMapping {
std::uint32_t faceCount, std::uint32_t faceCount,
MemoryResource* memRes); MemoryResource* memRes);
explicit UVBarycentricMapping(const dna::Reader* reader, std::uint16_t meshIndex, MemoryResource* memRes); BarycentricPositionIndicesPair getBarycentric(fvec2 uv) const;
const Triangle& getTriangle(std::uint32_t index) const;
ConstArrayView<TrianglePositionIndicesPair> getTriangles() const; ConstArrayView<std::uint32_t> getTrianglePositionIndices(std::uint32_t index) const;
ConstArrayView<BoundingBox> getBoundingBoxes() const; ConstArrayView<BoundingBox> getBoundingBoxes() const;
BarycentricPositionIndicesPair getBarycentric(fvec2 uv) const;
private: private:
Vector<TrianglePositionIndicesPair> triangles; Vector<Triangle> triangles;
Vector<BoundingBox> bBoxes; Vector<BoundingBox> boundingBoxes;
Vector<std::array<std::uint32_t, 3u> > trianglePositionIndices;
}; };
} // namespace dnac } // namespace dnac

View File

@ -2,13 +2,15 @@ set(PYTHON3_EXACT_VERSION "" CACHE STRING "Specify exact python3 version against
if(PYTHON3_EXACT_VERSION) if(PYTHON3_EXACT_VERSION)
set(find_python3_extra_args ${PYTHON3_EXACT_VERSION} EXACT) set(find_python3_extra_args ${PYTHON3_EXACT_VERSION} EXACT)
endif() endif()
find_package(Python3 ${find_python3_extra_args} COMPONENTS Development) find_package(Python3 ${find_python3_extra_args} COMPONENTS Development Interpreter)
set(py_version "py${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
set(output_dir "${py_version}")
set_property(SOURCE DNA.i PROPERTY CPLUSPLUS ON) set_property(SOURCE DNA.i PROPERTY CPLUSPLUS ON)
set_property(SOURCE DNA.i PROPERTY SWIG_MODULE_NAME dna) set_property(SOURCE DNA.i PROPERTY SWIG_MODULE_NAME dna)
set_property(SOURCE DNA.i PROPERTY SWIG_FLAGS "-doxygen")
option(TYPEMAP_DEBUG "Debug deducing of typemaps" OFF) option(TYPEMAP_DEBUG "Debug deducing of typemaps" OFF)
if(TYPEMAP_DEBUG) if(TYPEMAP_DEBUG)
set_property(SOURCE DNA.i PROPERTY SWIG_FLAGS "-debug-tmsearch") set_property(SOURCE DNA.i PROPERTY SWIG_FLAGS "-debug-tmsearch")
endif() endif()
@ -19,12 +21,17 @@ swig_add_library(py3dna
LANGUAGE LANGUAGE
python python
OUTPUT_DIR OUTPUT_DIR
${CMAKE_BINARY_DIR}/py3bin ${CMAKE_BINARY_DIR}/${output_dir}
OUTFILE_DIR
${CMAKE_BINARY_DIR}/python3
SOURCES SOURCES
DNA.i) DNA.i)
add_library(PyDNA::py3dna ALIAS py3dna)
set_property(TARGET py3dna PROPERTY SWIG_USE_TARGET_INCLUDE_DIRECTORIES ON) set_target_properties(py3dna PROPERTIES
SWIG_USE_TARGET_INCLUDE_DIRECTORIES ON
SWIG_COMPILE_DEFINITIONS DNA_BUILD_WITH_JSON_SUPPORT=ON)
target_compile_definitions(py3dna PRIVATE DNA_BUILD_WITH_JSON_SUPPORT=ON)
target_include_directories(py3dna PUBLIC ${CMAKE_CURRENT_LIST_DIR}) target_include_directories(py3dna PUBLIC ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(py3dna target_link_libraries(py3dna
PUBLIC PUBLIC
@ -33,14 +40,31 @@ target_link_libraries(py3dna
PRIVATE PRIVATE
Python3::Python) Python3::Python)
add_custom_target(py3dna-distribution ALL set(component_name "${PROJECT_NAME}-${py_version}")
DEPENDS get_property(wrapper_files TARGET py3dna PROPERTY SWIG_SUPPORT_FILES)
py3dna install(FILES ${wrapper_files} DESTINATION ${output_dir} COMPONENT ${component_name})
COMMAND install(TARGETS py3dna
${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/py3bin RUNTIME
COMMAND DESTINATION ${output_dir}
${CMAKE_COMMAND} -E copy $<TARGET_FILE:py3dna> ${CMAKE_BINARY_DIR}/py3bin COMPONENT ${component_name}
COMMAND LIBRARY
${CMAKE_COMMAND} -E copy $<TARGET_FILE:DNACalib::dnacalib> ${CMAKE_BINARY_DIR}/py3bin DESTINATION ${output_dir}
COMMAND COMPONENT ${component_name}
${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/examples/demo.py ${CMAKE_BINARY_DIR}/py3bin/dna_demo.py) NAMELINK_COMPONENT ${component_name}
ARCHIVE
DESTINATION ${output_dir}
COMPONENT ${component_name})
install(FILES ${CMAKE_CURRENT_LIST_DIR}/examples/demo.py DESTINATION ${output_dir} RENAME dna_demo.py COMPONENT ${component_name})
set(CPACK_COMPONENTS_ALL "${CPACK_COMPONENTS_ALL};${component_name}" PARENT_SCOPE)
if(WIN32)
set(extra_env "PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
endif()
set(DNA_TEST_NAMES dna_binary_to_json_demo dna_demo)
foreach(test_name ${DNA_TEST_NAMES})
add_test(NAME ${test_name}
COMMAND ${CMAKE_COMMAND} -E env ${extra_env} LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} PYTHONPATH=. ${Python3_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/../../../examples/${test_name}.py"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${output_dir})
set_property(TEST ${test_name} PROPERTY PASS_REGULAR_EXPRESSION "Done\.")
endforeach()

View File

@ -1,5 +1,17 @@
%module dna %module dna
%pythonbegin
%{
import os
if hasattr(os, 'add_dll_directory'):
for path in os.environ.get('PATH', '').split(';'):
try:
if path:
os.add_dll_directory(path)
except Exception:
pass
%}
%{ %{
#include <pma/Defs.h> #include <pma/Defs.h>
#include <pma/MemoryResource.h> #include <pma/MemoryResource.h>

View File

@ -2,13 +2,15 @@ set(PYTHON3_EXACT_VERSION "" CACHE STRING "Specify exact python3 version against
if(PYTHON3_EXACT_VERSION) if(PYTHON3_EXACT_VERSION)
set(find_python3_extra_args ${PYTHON3_EXACT_VERSION} EXACT) set(find_python3_extra_args ${PYTHON3_EXACT_VERSION} EXACT)
endif() endif()
find_package(Python3 ${find_python3_extra_args} COMPONENTS Development) find_package(Python3 ${find_python3_extra_args} COMPONENTS Development Interpreter)
set(py_version "py${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
set(output_dir "${py_version}")
set_property(SOURCE DNACalib.i PROPERTY CPLUSPLUS ON) set_property(SOURCE DNACalib.i PROPERTY CPLUSPLUS ON)
set_property(SOURCE DNACalib.i PROPERTY SWIG_MODULE_NAME dnacalib) set_property(SOURCE DNACalib.i PROPERTY SWIG_MODULE_NAME dnacalib)
set_property(SOURCE DNACalib.i PROPERTY SWIG_FLAGS "-doxygen")
option(TYPEMAP_DEBUG "Debug deducing of typemaps" OFF) option(TYPEMAP_DEBUG "Debug deducing of typemaps" OFF)
if(TYPEMAP_DEBUG) if(TYPEMAP_DEBUG)
set_property(SOURCE DNACalib.i PROPERTY SWIG_FLAGS "-debug-tmsearch") set_property(SOURCE DNACalib.i PROPERTY SWIG_FLAGS "-debug-tmsearch")
endif() endif()
@ -19,32 +21,53 @@ swig_add_library(py3dnacalib
LANGUAGE LANGUAGE
python python
OUTPUT_DIR OUTPUT_DIR
${CMAKE_BINARY_DIR}/py3bin ${CMAKE_BINARY_DIR}/${output_dir}
OUTFILE_DIR
${CMAKE_BINARY_DIR}/python3
SOURCES SOURCES
DNACalib.i) DNACalib.i)
add_library(PyDNACalib::py3dnacalib ALIAS py3dnacalib)
set_property(TARGET py3dnacalib PROPERTY SWIG_USE_TARGET_INCLUDE_DIRECTORIES ON) set_target_properties(py3dnacalib PROPERTIES SWIG_USE_TARGET_INCLUDE_DIRECTORIES ON)
target_link_libraries(py3dnacalib target_link_libraries(py3dnacalib
PUBLIC PUBLIC
py3dna PyDNA::py3dna
PRIVATE PRIVATE
Spyus::spyus Spyus::spyus
DNACalib::dnacalib DNACalib::dnacalib
Python3::Python) Python3::Python)
add_custom_target(py3dnacalib-distribution ALL set(component_name "${PROJECT_NAME}-${py_version}")
DEPENDS get_property(wrapper_files TARGET py3dnacalib PROPERTY SWIG_SUPPORT_FILES)
py3dnacalib install(FILES ${wrapper_files} DESTINATION ${output_dir} COMPONENT ${component_name})
COMMAND install(TARGETS py3dnacalib
${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/py3bin RUNTIME
COMMAND DESTINATION ${output_dir}
${CMAKE_COMMAND} -E copy $<TARGET_FILE:py3dnacalib> ${CMAKE_BINARY_DIR}/py3bin COMPONENT ${component_name}
COMMAND LIBRARY
${CMAKE_COMMAND} -E copy $<TARGET_FILE:DNACalib::dnacalib> ${CMAKE_BINARY_DIR}/py3bin DESTINATION ${output_dir}
COMMAND COMPONENT ${component_name}
${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/examples/demo.py ${CMAKE_BINARY_DIR}/py3bin/dnacalib_demo.py NAMELINK_COMPONENT ${component_name}
COMMAND ARCHIVE
${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/examples/remove_joint.py ${CMAKE_BINARY_DIR}/py3bin/dnacalib_remove_joint.py DESTINATION ${output_dir}
COMMAND COMPONENT ${component_name})
${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/examples/clear_blend_shapes.py ${CMAKE_BINARY_DIR}/py3bin/dnacalib_clear_blend_shapes.py) install(FILES ${CMAKE_CURRENT_LIST_DIR}/examples/clear_blend_shapes.py DESTINATION ${output_dir}/examples RENAME dnacalib_clear_blend_shapes.py COMPONENT ${component_name})
install(FILES ${CMAKE_CURRENT_LIST_DIR}/examples/demo.py DESTINATION ${output_dir}/examples RENAME dnacalib_demo.py COMPONENT ${component_name})
install(FILES ${CMAKE_CURRENT_LIST_DIR}/examples/remove_joint.py DESTINATION ${output_dir}/examples RENAME dnacalib_remove_joint.py COMPONENT ${component_name})
set(CPACK_COMPONENTS_ALL "${CPACK_COMPONENTS_ALL};${component_name}" PARENT_SCOPE)
if(WIN32)
set(extra_env "PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
endif()
set(DNACALIB_TEST_NAMES dnacalib_clear_blend_shapes
dnacalib_demo
dnacalib_lod_demo
dnacalib_neutral_mesh_subtract
dnacalib_remove_joint
dnacalib_rename_joint_demo)
foreach(test_name ${DNACALIB_TEST_NAMES})
add_test(NAME ${test_name}
COMMAND ${CMAKE_COMMAND} -E env ${extra_env} LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} PYTHONPATH=. ${Python3_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/../../../examples/${test_name}.py"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${output_dir})
set_property(TEST ${test_name} PROPERTY PASS_REGULAR_EXPRESSION "Done\.")
endforeach()

View File

@ -1,5 +1,17 @@
%module dnacalib %module dnacalib
%pythonbegin
%{
import os
if hasattr(os, 'add_dll_directory'):
for path in os.environ.get('PATH', '').split(';'):
try:
if path:
os.add_dll_directory(path)
except Exception:
pass
%}
%include <exception.i> %include <exception.i>
%include <stdint.i> %include <stdint.i>

View File

@ -171,28 +171,59 @@ class name(object):
%enddef %enddef
%pythoncode %{ %pythoncode %{
def __new_decorator(factory_func, original_new): def with_metaclass(meta, *bases):
@staticmethod class metaclass(type):
def __new(cls, *args, **kwargs):
# FIXME: while this workaround solves the immediate issue with the set of classes we currently have,
# it will fail for classes that use a factory function but need no parameters at all, in which case
# the factory function will never be invoked, only the original __new__ function.
if args or kwargs:
return factory_func(*args, **kwargs)
return original_new(cls)
return __new
def __managed_init(self, *args, **kwargs): def __new__(cls, name, this_bases, d):
self._args = args return meta(name, bases, d)
self._kwargs = kwargs
@classmethod
def __prepare__(cls, name, this_bases):
return meta.__prepare__(name, bases)
return type.__new__(metaclass, 'temporary_class', (), {})
%} %}
%define pythonize_unmanaged_type(type, creator, destroyer) %define pythonize_unmanaged_type(typename, creator, destroyer)
%pythoncode %{ %pythoncode %{
type ## .__new__ = __new_decorator(type ## _ ## creator, type ## .__new__) typename ## Impl = typename
type ## .__del__ = lambda instance: type ## _ ## destroyer ## (instance)
type ## .__init__ = __managed_init class typename ## ImplReflectionMixin(type):
del type ## .creator
del type ## .destroyer def __getattr__(cls, name):
return getattr(typename ## Impl, name)
def __dir__(cls):
return [name for name in dir(typename ## Impl) if name not in (#creator, #destroyer)]
class typename(with_metaclass(typename ## ImplReflectionMixin, object)):
__slots__ = ('_args', '_kwargs', '_instance')
def __init__(self, *args, **kwargs):
self._args = args
self._kwargs = kwargs
self._instance = typename ## Impl. ## creator(*args, **kwargs)
def __del__(self):
typename ## Impl. ## destroyer(self._instance)
def _in_slots(self, attr):
for cls in type(self).__mro__:
if attr in getattr(cls, '__slots__', []):
return True
return False
def __getattr__(self, attr):
if self._in_slots(attr):
return object.__getattr__(self, attr)
return getattr(self._instance, attr)
def __setattr__(self, attr, value):
if self._in_slots(attr):
object.__setattr__(self, attr, value)
else:
setattr(self._instance, attr, value)
def __dir__(self):
return [name for name in self._instance.__dir__() if name not in (#creator, #destroyer)]
%} %}
%enddef %enddef

View File

@ -75,6 +75,7 @@ def save_dna(reader, path):
def create_json_dna(input_path, output_path): def create_json_dna(input_path, output_path):
dna_reader = load_dna(input_path) dna_reader = load_dna(input_path)
save_dna(dna_reader, output_path) save_dna(dna_reader, output_path)
print('Done.')
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -93,6 +93,7 @@ def create_new_dna(dna_path):
create_dna(dna_path) create_dna(dna_path)
dna_reader = load_dna(dna_path) dna_reader = load_dna(dna_path)
print_dna_summary(dna_reader) print_dna_summary(dna_reader)
print('Done.')
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -15,7 +15,7 @@ IMPORTANT: You have to setup the environment before running this example. Please
- change CHARACTER_NAME to Taro, or the name of a custom DNA file placed in /data/dna_files - change CHARACTER_NAME to Taro, or the name of a custom DNA file placed in /data/dna_files
- change value of LODS to list of lods needed to be extracted - change value of LODS to list of lods needed to be extracted
Expected: Script will generate Ada_with_lods_1_and_3.dna in OUTPUT_DIR, from original Ada.dna. Expected: Script will generate Ada_with_lods_1_and_3.dna in OUTPUT_DIR, from original Ada.
NOTE: If OUTPUT_DIR does not exist, it will be created. NOTE: If OUTPUT_DIR does not exist, it will be created.
""" """
@ -27,8 +27,11 @@ from os import path as ospath
ROOT_DIR = f"{ospath.dirname(ospath.abspath(__file__))}/..".replace("\\", "/") ROOT_DIR = f"{ospath.dirname(ospath.abspath(__file__))}/..".replace("\\", "/")
OUTPUT_DIR = f"{ROOT_DIR}/output" OUTPUT_DIR = f"{ROOT_DIR}/output"
import dnacalib as dnacalib from dna import DataLayer_All, FileStream, Status, BinaryStreamReader, BinaryStreamWriter
import dna from dnacalib import (
DNACalibDNAReader,
SetLODsCommand,
)
# Sets DNA file path # Sets DNA file path
DNA = f"{ROOT_DIR}/data/dna_files/Ada.dna" DNA = f"{ROOT_DIR}/data/dna_files/Ada.dna"
@ -38,17 +41,21 @@ DNA_NEW = f"{OUTPUT_DIR}/Ada_with_lods_1_and_3.dna"
LODS = [1, 3] LODS = [1, 3]
def save_dna(reader: dnacalib.DNACalibDNAReader, created_dna_path: str): def save_dna(reader: DNACalibDNAReader, created_dna_path: str):
# Saves the dna # Saves the dna
stream = dna.FileStream(created_dna_path, dna.FileStream.AccessMode_Write, dna.FileStream.OpenMode_Binary) stream = FileStream(created_dna_path, FileStream.AccessMode_Write, FileStream.OpenMode_Binary)
writer = dna.BinaryStreamWriter(stream) writer = BinaryStreamWriter(stream)
writer.setFrom(reader) writer.setFrom(reader)
writer.write() writer.write()
if not Status.isOk():
status = Status.get()
raise RuntimeError(f"Error saving DNA: {status.message}")
def run_SetLODsCommand(reader): def run_SetLODsCommand(reader):
calibrated = dnacalib.DNACalibDNAReader(reader) calibrated = DNACalibDNAReader(reader)
command = dnacalib.SetLODsCommand() command = SetLODsCommand()
# Set a list of LODs that will be exported to the new file # Set a list of LODs that will be exported to the new file
command.setLODs(LODS) command.setLODs(LODS)
# Runs the command that reduces LODs of the DNA # Runs the command that reduces LODs of the DNA
@ -58,8 +65,8 @@ def run_SetLODsCommand(reader):
if calibrated.getLODCount() != 2: if calibrated.getLODCount() != 2:
raise RuntimeError("Setting new number of LODs in DNA was unsuccessful!") raise RuntimeError("Setting new number of LODs in DNA was unsuccessful!")
print("\nSuccessfully changed number of LODs in DNA.") print("\nSuccessfully changed number of LODs in ")
print("Saving DNA...") print("Saving ..")
# Save the newly created DNA # Save the newly created DNA
save_dna(calibrated, DNA_NEW) save_dna(calibrated, DNA_NEW)
print("Done.") print("Done.")
@ -67,8 +74,8 @@ def run_SetLODsCommand(reader):
def load_dna_calib(dna_path: str): def load_dna_calib(dna_path: str):
# Load the DNA # Load the DNA
stream = dna.FileStream(dna_path, dna.FileStream.AccessMode_Read, dna.FileStream.OpenMode_Binary) stream = FileStream(dna_path, FileStream.AccessMode_Read, FileStream.OpenMode_Binary)
reader = dna.BinaryStreamReader(stream, dna.DataLayer_All) reader = BinaryStreamReader(stream, DataLayer_All)
reader.read() reader.read()
return reader return reader

View File

@ -71,3 +71,4 @@ if __name__ == "__main__":
# Prints the new joint name # Prints the new joint name
print(calibrated.getJointName(10)) print(calibrated.getJointName(10))
save_dna(calibrated, OUTPUT_DNA) save_dna(calibrated, OUTPUT_DNA)
print('Done.')

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,18 @@
# Do not make changes to this file unless you know what you are doing--modify # Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead. # the SWIG interface file instead.
import os
if hasattr(os, 'add_dll_directory'):
for path in os.environ.get('PATH', '').split(';'):
try:
if path:
os.add_dll_directory(path)
except Exception:
pass
from sys import version_info as _swig_python_version_info from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0): if _swig_python_version_info < (2, 7, 0):
raise RuntimeError("Python 2.7 or later required") raise RuntimeError("Python 2.7 or later required")
@ -62,20 +74,16 @@ class _SwigNonDynamicMeta(type):
def __new_decorator(factory_func, original_new): def with_metaclass(meta, *bases):
@staticmethod class metaclass(type):
def __new(cls, *args, **kwargs):
# FIXME: while this workaround solves the immediate issue with the set of classes we currently have,
# it will fail for classes that use a factory function but need no parameters at all, in which case
# the factory function will never be invoked, only the original __new__ function.
if args or kwargs:
return factory_func(*args, **kwargs)
return original_new(cls)
return __new
def __managed_init(self, *args, **kwargs): def __new__(cls, name, this_bases, d):
self._args = args return meta(name, bases, d)
self._kwargs = kwargs
@classmethod
def __prepare__(cls, name, this_bases):
return meta.__prepare__(name, bases)
return type.__new__(metaclass, 'temporary_class', (), {})
import dna import dna
class VersionInfo(object): class VersionInfo(object):
@ -142,13 +150,50 @@ def DNACalibDNAReader_destroy(instance):
return _py3dnacalib.DNACalibDNAReader_destroy(instance) return _py3dnacalib.DNACalibDNAReader_destroy(instance)
DNACalibDNAReader.__new__ = __new_decorator(DNACalibDNAReader_create, DNACalibDNAReader.__new__) DNACalibDNAReaderImpl = DNACalibDNAReader
DNACalibDNAReader.__del__ = lambda instance: DNACalibDNAReader_destroy(instance)
DNACalibDNAReader.__init__ = __managed_init class DNACalibDNAReaderImplReflectionMixin(type):
del DNACalibDNAReader.create
del DNACalibDNAReader.destroy def __getattr__(cls, name):
return getattr(DNACalibDNAReaderImpl, name)
def __dir__(cls):
return [name for name in dir(DNACalibDNAReaderImpl) if name not in ("create","destroy")]
class DNACalibDNAReader(with_metaclass(DNACalibDNAReaderImplReflectionMixin, object)):
__slots__ = ('_args', '_kwargs', '_instance')
def __init__(self, *args, **kwargs):
self._args = args
self._kwargs = kwargs
self._instance = DNACalibDNAReaderImpl.create(*args, **kwargs)
def __del__(self):
DNACalibDNAReaderImpl.destroy(self._instance)
def _in_slots(self, attr):
for cls in type(self).__mro__:
if attr in getattr(cls, '__slots__', []):
return True
return False
def __getattr__(self, attr):
if self._in_slots(attr):
return object.__getattr__(self, attr)
return getattr(self._instance, attr)
def __setattr__(self, attr, value):
if self._in_slots(attr):
object.__setattr__(self, attr, value)
else:
setattr(self._instance, attr, value)
def __dir__(self):
return [name for name in self._instance.__dir__() if name not in ("create","destroy")]
class Command(object): class Command(object):
r""" Command is an abstract class whose implementations are expected to modify the DNA provided in the run() method in some way."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -167,6 +212,14 @@ VectorOperation_Add = _py3dnacalib.VectorOperation_Add
VectorOperation_Subtract = _py3dnacalib.VectorOperation_Subtract VectorOperation_Subtract = _py3dnacalib.VectorOperation_Subtract
VectorOperation_Multiply = _py3dnacalib.VectorOperation_Multiply VectorOperation_Multiply = _py3dnacalib.VectorOperation_Multiply
class CommandSequence(Command): class CommandSequence(Command):
r"""
CommandSequence is used to run a sequence of commands on the same DNA.
Notes:
Commands will be run in the order in which they were added to the sequence.
CommandSequence holds pointers to commands, but does not own them.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_CommandSequence __swig_destroy__ = _py3dnacalib.delete_CommandSequence
@ -178,15 +231,34 @@ class CommandSequence(Command):
return _py3dnacalib.CommandSequence_run(self, output) return _py3dnacalib.CommandSequence_run(self, output)
def add(self, command): def add(self, command):
r"""
Method for adding a command to a sequence of commands to run.
:type command: :py:class:`Command`
:param command:
The command to add.
"""
return _py3dnacalib.CommandSequence_add(self, command) return _py3dnacalib.CommandSequence_add(self, command)
def remove(self, command): def remove(self, command):
r"""
Method for removing a command from the sequence of commands to run.
:type command: :py:class:`Command`
:param command:
The command to remove.
"""
return _py3dnacalib.CommandSequence_remove(self, command) return _py3dnacalib.CommandSequence_remove(self, command)
def contains(self, command): def contains(self, command):
r"""
Method for checking if the provided command is part of the command sequence.
:type command: :py:class:`Command`
:param command:
The command to check.
"""
return _py3dnacalib.CommandSequence_contains(self, command) return _py3dnacalib.CommandSequence_contains(self, command)
def size(self): def size(self):
r""" Number of commands in command sequence."""
return _py3dnacalib.CommandSequence_size(self) return _py3dnacalib.CommandSequence_size(self)
# Register CommandSequence in _py3dnacalib: # Register CommandSequence in _py3dnacalib:
@ -216,6 +288,12 @@ CommandSequence.add = command_sequence_add(CommandSequence.add)
CommandSequence.remove = command_sequence_remove(CommandSequence.remove) CommandSequence.remove = command_sequence_remove(CommandSequence.remove)
class CalculateMeshLowerLODsCommand(Command): class CalculateMeshLowerLODsCommand(Command):
r"""
CalculateMeshLowerLODsCommand is used to recalculate vertex positions for lower LOD meshes of the specified mesh.
Notes:
The calculation is done based on vertex positions of the specified mesh and vertex texture coordinates of its lower LOD meshes.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_CalculateMeshLowerLODsCommand __swig_destroy__ = _py3dnacalib.delete_CalculateMeshLowerLODsCommand
@ -224,6 +302,12 @@ class CalculateMeshLowerLODsCommand(Command):
_py3dnacalib.CalculateMeshLowerLODsCommand_swiginit(self, _py3dnacalib.new_CalculateMeshLowerLODsCommand(*args)) _py3dnacalib.CalculateMeshLowerLODsCommand_swiginit(self, _py3dnacalib.new_CalculateMeshLowerLODsCommand(*args))
def setMeshIndex(self, meshIndex): def setMeshIndex(self, meshIndex):
r"""
Method for setting the index of the mesh to calculate lower LOD meshes from.
:type meshIndex: int
:param meshIndex:
The index of the mesh.
"""
return _py3dnacalib.CalculateMeshLowerLODsCommand_setMeshIndex(self, meshIndex) return _py3dnacalib.CalculateMeshLowerLODsCommand_setMeshIndex(self, meshIndex)
def run(self, output): def run(self, output):
@ -233,6 +317,11 @@ class CalculateMeshLowerLODsCommand(Command):
_py3dnacalib.CalculateMeshLowerLODsCommand_swigregister(CalculateMeshLowerLODsCommand) _py3dnacalib.CalculateMeshLowerLODsCommand_swigregister(CalculateMeshLowerLODsCommand)
class ClearBlendShapesCommand(Command): class ClearBlendShapesCommand(Command):
r"""
ClearBlendShapesCommand is used to clear all blend shapes data from a DNA.
Notes: This command clears blend shape target deltas and blend shape animation data. By doing so, it transforms the DNA to be "joints only".
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_ClearBlendShapesCommand __swig_destroy__ = _py3dnacalib.delete_ClearBlendShapesCommand
@ -247,6 +336,8 @@ class ClearBlendShapesCommand(Command):
_py3dnacalib.ClearBlendShapesCommand_swigregister(ClearBlendShapesCommand) _py3dnacalib.ClearBlendShapesCommand_swigregister(ClearBlendShapesCommand)
class PruneBlendShapeTargetsCommand(Command): class PruneBlendShapeTargetsCommand(Command):
r""" PruneBlendShapeTargetsCommand is used to prune blend shape target deltas whose absolute magnitude is less than or equal to the specified threshold."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_PruneBlendShapeTargetsCommand __swig_destroy__ = _py3dnacalib.delete_PruneBlendShapeTargetsCommand
@ -255,6 +346,12 @@ class PruneBlendShapeTargetsCommand(Command):
_py3dnacalib.PruneBlendShapeTargetsCommand_swiginit(self, _py3dnacalib.new_PruneBlendShapeTargetsCommand(*args)) _py3dnacalib.PruneBlendShapeTargetsCommand_swiginit(self, _py3dnacalib.new_PruneBlendShapeTargetsCommand(*args))
def setThreshold(self, threshold): def setThreshold(self, threshold):
r"""
Method for setting the threshold for pruning blend shape target deltas.
:type threshold: float
:param threshold:
The threshold to use.
"""
return _py3dnacalib.PruneBlendShapeTargetsCommand_setThreshold(self, threshold) return _py3dnacalib.PruneBlendShapeTargetsCommand_setThreshold(self, threshold)
def run(self, output): def run(self, output):
@ -264,6 +361,8 @@ class PruneBlendShapeTargetsCommand(Command):
_py3dnacalib.PruneBlendShapeTargetsCommand_swigregister(PruneBlendShapeTargetsCommand) _py3dnacalib.PruneBlendShapeTargetsCommand_swigregister(PruneBlendShapeTargetsCommand)
class RemoveAnimatedMapCommand(Command): class RemoveAnimatedMapCommand(Command):
r""" RemoveAnimatedMapCommand is used to remove animated maps."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RemoveAnimatedMapCommand __swig_destroy__ = _py3dnacalib.delete_RemoveAnimatedMapCommand
@ -272,9 +371,23 @@ class RemoveAnimatedMapCommand(Command):
_py3dnacalib.RemoveAnimatedMapCommand_swiginit(self, _py3dnacalib.new_RemoveAnimatedMapCommand(*args)) _py3dnacalib.RemoveAnimatedMapCommand_swiginit(self, _py3dnacalib.new_RemoveAnimatedMapCommand(*args))
def setAnimatedMapIndex(self, animatedMapIndex): def setAnimatedMapIndex(self, animatedMapIndex):
r"""
Method for setting the index of the animated map to remove.
:type animatedMapIndex: int
:param animatedMapIndex:
The index of the animated map.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set animated map(s) will be removed.
"""
return _py3dnacalib.RemoveAnimatedMapCommand_setAnimatedMapIndex(self, animatedMapIndex) return _py3dnacalib.RemoveAnimatedMapCommand_setAnimatedMapIndex(self, animatedMapIndex)
def setAnimatedMapIndices(self, animatedMapIndices): def setAnimatedMapIndices(self, animatedMapIndices):
r"""
Method for setting the indices of animated maps to remove.
:type animatedMapIndices: dnac::ConstArrayView< std::uint16_t >
:param animatedMapIndices:
The animated map indices.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set animated map(s) will be removed.
"""
return _py3dnacalib.RemoveAnimatedMapCommand_setAnimatedMapIndices(self, animatedMapIndices) return _py3dnacalib.RemoveAnimatedMapCommand_setAnimatedMapIndices(self, animatedMapIndices)
def run(self, output): def run(self, output):
@ -284,6 +397,8 @@ class RemoveAnimatedMapCommand(Command):
_py3dnacalib.RemoveAnimatedMapCommand_swigregister(RemoveAnimatedMapCommand) _py3dnacalib.RemoveAnimatedMapCommand_swigregister(RemoveAnimatedMapCommand)
class RemoveBlendShapeCommand(Command): class RemoveBlendShapeCommand(Command):
r""" RemoveBlendShapeCommand is used to remove blend shapes."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RemoveBlendShapeCommand __swig_destroy__ = _py3dnacalib.delete_RemoveBlendShapeCommand
@ -292,9 +407,23 @@ class RemoveBlendShapeCommand(Command):
_py3dnacalib.RemoveBlendShapeCommand_swiginit(self, _py3dnacalib.new_RemoveBlendShapeCommand(*args)) _py3dnacalib.RemoveBlendShapeCommand_swiginit(self, _py3dnacalib.new_RemoveBlendShapeCommand(*args))
def setBlendShapeIndex(self, blendShapeIndex): def setBlendShapeIndex(self, blendShapeIndex):
r"""
Method for setting the index of the blend shape to remove.
:type blendShapeIndex: int
:param blendShapeIndex:
The index of the blend shape.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set blend shape(s) will be removed.
"""
return _py3dnacalib.RemoveBlendShapeCommand_setBlendShapeIndex(self, blendShapeIndex) return _py3dnacalib.RemoveBlendShapeCommand_setBlendShapeIndex(self, blendShapeIndex)
def setBlendShapeIndices(self, blendShapeIndices): def setBlendShapeIndices(self, blendShapeIndices):
r"""
Method for setting the indices of blend shapes to remove.
:type blendShapeIndices: dnac::ConstArrayView< std::uint16_t >
:param blendShapeIndices:
The blend shape indices.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set blend shape(s) will be removed.
"""
return _py3dnacalib.RemoveBlendShapeCommand_setBlendShapeIndices(self, blendShapeIndices) return _py3dnacalib.RemoveBlendShapeCommand_setBlendShapeIndices(self, blendShapeIndices)
def run(self, output): def run(self, output):
@ -304,6 +433,8 @@ class RemoveBlendShapeCommand(Command):
_py3dnacalib.RemoveBlendShapeCommand_swigregister(RemoveBlendShapeCommand) _py3dnacalib.RemoveBlendShapeCommand_swigregister(RemoveBlendShapeCommand)
class RemoveJointAnimationCommand(Command): class RemoveJointAnimationCommand(Command):
r""" RemoveJointAnimationCommand is used to remove joint animation data."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RemoveJointAnimationCommand __swig_destroy__ = _py3dnacalib.delete_RemoveJointAnimationCommand
@ -312,9 +443,23 @@ class RemoveJointAnimationCommand(Command):
_py3dnacalib.RemoveJointAnimationCommand_swiginit(self, _py3dnacalib.new_RemoveJointAnimationCommand(*args)) _py3dnacalib.RemoveJointAnimationCommand_swiginit(self, _py3dnacalib.new_RemoveJointAnimationCommand(*args))
def setJointIndex(self, jointIndex): def setJointIndex(self, jointIndex):
r"""
Method for setting the index of a joint whose animation data to remove.
:type jointIndex: int
:param jointIndex:
The index of the joint.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set joint animation(s) will be removed.
"""
return _py3dnacalib.RemoveJointAnimationCommand_setJointIndex(self, jointIndex) return _py3dnacalib.RemoveJointAnimationCommand_setJointIndex(self, jointIndex)
def setJointIndices(self, jointIndices): def setJointIndices(self, jointIndices):
r"""
Method for setting the indices of joints whose animation data to remove.
:type jointIndices: dnac::ConstArrayView< std::uint16_t >
:param jointIndices:
The joint indices.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set joint animation(s) will be removed.
"""
return _py3dnacalib.RemoveJointAnimationCommand_setJointIndices(self, jointIndices) return _py3dnacalib.RemoveJointAnimationCommand_setJointIndices(self, jointIndices)
def run(self, output): def run(self, output):
@ -324,6 +469,8 @@ class RemoveJointAnimationCommand(Command):
_py3dnacalib.RemoveJointAnimationCommand_swigregister(RemoveJointAnimationCommand) _py3dnacalib.RemoveJointAnimationCommand_swigregister(RemoveJointAnimationCommand)
class RemoveJointCommand(Command): class RemoveJointCommand(Command):
r""" RemoveJointCommand is used to remove joints."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RemoveJointCommand __swig_destroy__ = _py3dnacalib.delete_RemoveJointCommand
@ -332,9 +479,23 @@ class RemoveJointCommand(Command):
_py3dnacalib.RemoveJointCommand_swiginit(self, _py3dnacalib.new_RemoveJointCommand(*args)) _py3dnacalib.RemoveJointCommand_swiginit(self, _py3dnacalib.new_RemoveJointCommand(*args))
def setJointIndex(self, jointIndex): def setJointIndex(self, jointIndex):
r"""
Method for setting the index of the joint to remove.
:type jointIndex: int
:param jointIndex:
The index of the joint.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set joint(s) will be removed.
"""
return _py3dnacalib.RemoveJointCommand_setJointIndex(self, jointIndex) return _py3dnacalib.RemoveJointCommand_setJointIndex(self, jointIndex)
def setJointIndices(self, jointIndices): def setJointIndices(self, jointIndices):
r"""
Method for setting the indices of joints to remove.
:type jointIndices: dnac::ConstArrayView< std::uint16_t >
:param jointIndices:
The joint indices.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set joint(s) will be removed.
"""
return _py3dnacalib.RemoveJointCommand_setJointIndices(self, jointIndices) return _py3dnacalib.RemoveJointCommand_setJointIndices(self, jointIndices)
def run(self, output): def run(self, output):
@ -344,6 +505,8 @@ class RemoveJointCommand(Command):
_py3dnacalib.RemoveJointCommand_swigregister(RemoveJointCommand) _py3dnacalib.RemoveJointCommand_swigregister(RemoveJointCommand)
class RemoveMeshCommand(Command): class RemoveMeshCommand(Command):
r""" RemoveMeshCommand is used to remove meshes."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RemoveMeshCommand __swig_destroy__ = _py3dnacalib.delete_RemoveMeshCommand
@ -352,9 +515,22 @@ class RemoveMeshCommand(Command):
_py3dnacalib.RemoveMeshCommand_swiginit(self, _py3dnacalib.new_RemoveMeshCommand(*args)) _py3dnacalib.RemoveMeshCommand_swiginit(self, _py3dnacalib.new_RemoveMeshCommand(*args))
def setMeshIndex(self, meshIndex): def setMeshIndex(self, meshIndex):
r"""
Method for setting the index of the mesh to remove.
:type meshIndex: int
:param meshIndex:
The index of the mesh.
"""
return _py3dnacalib.RemoveMeshCommand_setMeshIndex(self, meshIndex) return _py3dnacalib.RemoveMeshCommand_setMeshIndex(self, meshIndex)
def setMeshIndices(self, meshIndices): def setMeshIndices(self, meshIndices):
r"""
Method for setting the indices of meshes to remove.
:type meshIndices: dnac::ConstArrayView< std::uint16_t >
:param meshIndices:
The mesh indices.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set mesh(es) will be removed.
"""
return _py3dnacalib.RemoveMeshCommand_setMeshIndices(self, meshIndices) return _py3dnacalib.RemoveMeshCommand_setMeshIndices(self, meshIndices)
def run(self, output): def run(self, output):
@ -364,6 +540,8 @@ class RemoveMeshCommand(Command):
_py3dnacalib.RemoveMeshCommand_swigregister(RemoveMeshCommand) _py3dnacalib.RemoveMeshCommand_swigregister(RemoveMeshCommand)
class RenameAnimatedMapCommand(Command): class RenameAnimatedMapCommand(Command):
r""" RenameAnimatedMapCommand is used to rename an animated map."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RenameAnimatedMapCommand __swig_destroy__ = _py3dnacalib.delete_RenameAnimatedMapCommand
@ -372,6 +550,31 @@ class RenameAnimatedMapCommand(Command):
_py3dnacalib.RenameAnimatedMapCommand_swiginit(self, _py3dnacalib.new_RenameAnimatedMapCommand(*args)) _py3dnacalib.RenameAnimatedMapCommand_swiginit(self, _py3dnacalib.new_RenameAnimatedMapCommand(*args))
def setName(self, *args): def setName(self, *args):
r"""
*Overload 1:*
Method for setting a new name for animated map with given index.
:type animatedMapIndex: int
:param animatedMapIndex:
The index of the animated map whose name to change.
:type newName: string
:param newName:
The new name for the animated map.
|
*Overload 2:*
Method for setting a new name for animated map with given name.
Notes:
The renaming will not happen if there is no animated map with given current name.
:type oldName: string
:param oldName:
The current name of the animated map whose name to change.
:type newName: string
:param newName:
The new name for the animated map.
"""
return _py3dnacalib.RenameAnimatedMapCommand_setName(self, *args) return _py3dnacalib.RenameAnimatedMapCommand_setName(self, *args)
def run(self, output): def run(self, output):
@ -381,6 +584,8 @@ class RenameAnimatedMapCommand(Command):
_py3dnacalib.RenameAnimatedMapCommand_swigregister(RenameAnimatedMapCommand) _py3dnacalib.RenameAnimatedMapCommand_swigregister(RenameAnimatedMapCommand)
class RenameBlendShapeCommand(Command): class RenameBlendShapeCommand(Command):
r""" RenameBlendShapeCommand is used to rename a blend shape channel."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RenameBlendShapeCommand __swig_destroy__ = _py3dnacalib.delete_RenameBlendShapeCommand
@ -389,6 +594,31 @@ class RenameBlendShapeCommand(Command):
_py3dnacalib.RenameBlendShapeCommand_swiginit(self, _py3dnacalib.new_RenameBlendShapeCommand(*args)) _py3dnacalib.RenameBlendShapeCommand_swiginit(self, _py3dnacalib.new_RenameBlendShapeCommand(*args))
def setName(self, *args): def setName(self, *args):
r"""
*Overload 1:*
Method for setting a new name for blend shape channel with given index.
:type blendShapeIndex: int
:param blendShapeIndex:
The index of the blend shape channel whose name to change.
:type newName: string
:param newName:
The new name for the blend shape channel.
|
*Overload 2:*
Method for setting a new name for blend shape channel with given name.
Notes:
The renaming will not happen if there is no blend shape channel with given current name.
:type oldName: string
:param oldName:
The current name of the blend shape channel whose name to change.
:type newName: string
:param newName:
The new name for the blend shape channel.
"""
return _py3dnacalib.RenameBlendShapeCommand_setName(self, *args) return _py3dnacalib.RenameBlendShapeCommand_setName(self, *args)
def run(self, output): def run(self, output):
@ -398,6 +628,8 @@ class RenameBlendShapeCommand(Command):
_py3dnacalib.RenameBlendShapeCommand_swigregister(RenameBlendShapeCommand) _py3dnacalib.RenameBlendShapeCommand_swigregister(RenameBlendShapeCommand)
class RenameJointCommand(Command): class RenameJointCommand(Command):
r""" RenameJointCommand is used to rename a joint."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RenameJointCommand __swig_destroy__ = _py3dnacalib.delete_RenameJointCommand
@ -406,6 +638,31 @@ class RenameJointCommand(Command):
_py3dnacalib.RenameJointCommand_swiginit(self, _py3dnacalib.new_RenameJointCommand(*args)) _py3dnacalib.RenameJointCommand_swiginit(self, _py3dnacalib.new_RenameJointCommand(*args))
def setName(self, *args): def setName(self, *args):
r"""
*Overload 1:*
Method for setting a new name for joint with given index.
:type jointIndex: int
:param jointIndex:
The index of the joint whose name to change.
:type newName: string
:param newName:
The new name for the joint.
|
*Overload 2:*
Method for setting a new name for joint with given name.
Notes:
The renaming will not happen if there is no joint with given current name.
:type oldName: string
:param oldName:
The current name of the joint whose name to change.
:type newName: string
:param newName:
The new name for the joint.
"""
return _py3dnacalib.RenameJointCommand_setName(self, *args) return _py3dnacalib.RenameJointCommand_setName(self, *args)
def run(self, output): def run(self, output):
@ -415,6 +672,8 @@ class RenameJointCommand(Command):
_py3dnacalib.RenameJointCommand_swigregister(RenameJointCommand) _py3dnacalib.RenameJointCommand_swigregister(RenameJointCommand)
class RenameMeshCommand(Command): class RenameMeshCommand(Command):
r""" RenameMeshCommand is used to rename a mesh."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RenameMeshCommand __swig_destroy__ = _py3dnacalib.delete_RenameMeshCommand
@ -423,6 +682,31 @@ class RenameMeshCommand(Command):
_py3dnacalib.RenameMeshCommand_swiginit(self, _py3dnacalib.new_RenameMeshCommand(*args)) _py3dnacalib.RenameMeshCommand_swiginit(self, _py3dnacalib.new_RenameMeshCommand(*args))
def setName(self, *args): def setName(self, *args):
r"""
*Overload 1:*
Method for setting a new name for mesh with given index.
:type meshIndex: int
:param meshIndex:
The index of the mesh whose name to change.
:type newName: string
:param newName:
The new name for the mesh.
|
*Overload 2:*
Method for setting a new name for mesh with given name.
Notes:
The renaming will not happen if there is no mesh with given current name.
:type oldName: string
:param oldName:
The current name of the mesh whose name to change.
:type newName: string
:param newName:
The new name for the mesh.
"""
return _py3dnacalib.RenameMeshCommand_setName(self, *args) return _py3dnacalib.RenameMeshCommand_setName(self, *args)
def run(self, output): def run(self, output):
@ -432,6 +716,14 @@ class RenameMeshCommand(Command):
_py3dnacalib.RenameMeshCommand_swigregister(RenameMeshCommand) _py3dnacalib.RenameMeshCommand_swigregister(RenameMeshCommand)
class RotateCommand(Command): class RotateCommand(Command):
r"""
RotateCommand is used to rotate neutral joints and vertex positions around given origin.
Notes:
Joint rotations are represented in parent space, so it is enough to rotate only root joints, as that rotation will be propagated to the rest of the joints.
If the origin is not set, the assumed origin is (0, 0, 0).
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RotateCommand __swig_destroy__ = _py3dnacalib.delete_RotateCommand
@ -440,9 +732,21 @@ class RotateCommand(Command):
_py3dnacalib.RotateCommand_swiginit(self, _py3dnacalib.new_RotateCommand(*args)) _py3dnacalib.RotateCommand_swiginit(self, _py3dnacalib.new_RotateCommand(*args))
def setRotation(self, degrees): def setRotation(self, degrees):
r"""
Method for setting the rotation angles.
:type degrees: dnac::Vector3
:param degrees:
Rotation angles in degrees.
"""
return _py3dnacalib.RotateCommand_setRotation(self, degrees) return _py3dnacalib.RotateCommand_setRotation(self, degrees)
def setOrigin(self, origin): def setOrigin(self, origin):
r"""
Method for setting the rotation origin.
:type origin: dnac::Vector3
:param origin:
Origin coordinates.
"""
return _py3dnacalib.RotateCommand_setOrigin(self, origin) return _py3dnacalib.RotateCommand_setOrigin(self, origin)
def run(self, output): def run(self, output):
@ -452,6 +756,12 @@ class RotateCommand(Command):
_py3dnacalib.RotateCommand_swigregister(RotateCommand) _py3dnacalib.RotateCommand_swigregister(RotateCommand)
class ScaleCommand(Command): class ScaleCommand(Command):
r"""
ScaleCommand is used to scale neutral joints, vertex positions and joint and blendshape deltas by a factor.
Notes:
Only translation attributes of neutral joints and joint deltas are scaled.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_ScaleCommand __swig_destroy__ = _py3dnacalib.delete_ScaleCommand
@ -460,9 +770,22 @@ class ScaleCommand(Command):
_py3dnacalib.ScaleCommand_swiginit(self, _py3dnacalib.new_ScaleCommand(*args)) _py3dnacalib.ScaleCommand_swiginit(self, _py3dnacalib.new_ScaleCommand(*args))
def setScale(self, scale): def setScale(self, scale):
r"""
Method for setting the scale factor to multiply with.
:type scale: float
:param scale:
Scale factor.
"""
return _py3dnacalib.ScaleCommand_setScale(self, scale) return _py3dnacalib.ScaleCommand_setScale(self, scale)
def setOrigin(self, origin): def setOrigin(self, origin):
r"""
Method for setting the origin.
Notes: The origin is used to properly scale position values (vertex positions and neutral joint translations).
:type origin: dnac::Vector3
:param origin:
Origin coordinates.
"""
return _py3dnacalib.ScaleCommand_setOrigin(self, origin) return _py3dnacalib.ScaleCommand_setOrigin(self, origin)
def run(self, output): def run(self, output):
@ -472,6 +795,8 @@ class ScaleCommand(Command):
_py3dnacalib.ScaleCommand_swigregister(ScaleCommand) _py3dnacalib.ScaleCommand_swigregister(ScaleCommand)
class SetBlendShapeTargetDeltasCommand(Command): class SetBlendShapeTargetDeltasCommand(Command):
r""" SetBlendShapeTargetDeltasCommand is used to change blend shape target deltas."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_SetBlendShapeTargetDeltasCommand __swig_destroy__ = _py3dnacalib.delete_SetBlendShapeTargetDeltasCommand
@ -480,21 +805,85 @@ class SetBlendShapeTargetDeltasCommand(Command):
_py3dnacalib.SetBlendShapeTargetDeltasCommand_swiginit(self, _py3dnacalib.new_SetBlendShapeTargetDeltasCommand(*args)) _py3dnacalib.SetBlendShapeTargetDeltasCommand_swiginit(self, _py3dnacalib.new_SetBlendShapeTargetDeltasCommand(*args))
def setMeshIndex(self, meshIndex): def setMeshIndex(self, meshIndex):
r"""
Method for setting the index of the mesh whose blend shape target to change.
:type meshIndex: int
:param meshIndex:
The mesh index.
"""
return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setMeshIndex(self, meshIndex) return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setMeshIndex(self, meshIndex)
def setBlendShapeTargetIndex(self, blendShapeTargetIndex): def setBlendShapeTargetIndex(self, blendShapeTargetIndex):
r"""
Method for setting the index of the blend shape target to change.
:type blendShapeTargetIndex: int
:param blendShapeTargetIndex:
The blend shape target index.
"""
return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setBlendShapeTargetIndex(self, blendShapeTargetIndex) return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setBlendShapeTargetIndex(self, blendShapeTargetIndex)
def setDeltas(self, *args): def setDeltas(self, *args):
r"""
*Overload 1:*
Method for setting the values used to calculate new deltas for blend shape target.
:type deltas: dnac::ConstArrayView< dnac::Vector3 >
:param deltas:
The values used in calculation.
|
*Overload 2:*
Method for setting the values used to calculate new deltas for blend shape target.
:type xs: dnac::ConstArrayView< float >
:param xs:
The X values for each delta.
:type ys: dnac::ConstArrayView< float >
:param ys:
The Y values for each delta.
:type zs: dnac::ConstArrayView< float >
:param zs:
The Z values for each delta.
"""
return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setDeltas(self, *args) return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setDeltas(self, *args)
def setVertexIndices(self, vertexIndices): def setVertexIndices(self, vertexIndices):
r"""
Method for setting the vertex indices that correspond to new deltas.
:type vertexIndices: dnac::ConstArrayView< std::uint32_t >
:param vertexIndices:
The vertexIndices.
"""
return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setVertexIndices(self, vertexIndices) return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setVertexIndices(self, vertexIndices)
def setMasks(self, masks): def setMasks(self, masks):
r"""
Method for setting masks used to calculate new deltas for blend shape target.
Notes:
If no masks are set, default weight value of 1 is used for each delta.
:type masks: dnac::ConstArrayView< float >
:param masks:
The weights for each delta.
"""
return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setMasks(self, masks) return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setMasks(self, masks)
def setOperation(self, operation): def setOperation(self, operation):
r"""
Method for setting the type of operation used to calculate new deltas for blend shape target.
Notes:
Available operations are: Interpolate, Add, Subtract and Multiply. Each delta is calculated based on the provided operation type in the following way:
Interpolate: = previousValue * (1 - weight) + setValue * weight:math:`\n Add: \f$newValue = previousValue + (setValue * weight)`
Subtract: = previousValue - (setValue * weight):math:`\n Multiply: \f$newValue = previousValue * (setValue * weight)`
setValue is the value from new deltas that were set, and weight is the value from masks array.
:type operation: int
:param operation:
The operation to use.
"""
return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setOperation(self, operation) return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setOperation(self, operation)
def run(self, output): def run(self, output):
@ -509,6 +898,8 @@ SetBlendShapeTargetDeltasCommand.DeltasVertexIndicesCountMismatch = _py3dnacalib
SetBlendShapeTargetDeltasCommand.DeltasMasksCountMismatch = _py3dnacalib.cvar.SetBlendShapeTargetDeltasCommand_DeltasMasksCountMismatch SetBlendShapeTargetDeltasCommand.DeltasMasksCountMismatch = _py3dnacalib.cvar.SetBlendShapeTargetDeltasCommand_DeltasMasksCountMismatch
class SetLODsCommand(Command): class SetLODsCommand(Command):
r""" SetLODsCommand is used to specify LODs to use. Joints, blend shapes, animated maps and meshes that are not in specified LODs are removed from the DNA."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_SetLODsCommand __swig_destroy__ = _py3dnacalib.delete_SetLODsCommand
@ -517,6 +908,12 @@ class SetLODsCommand(Command):
_py3dnacalib.SetLODsCommand_swiginit(self, _py3dnacalib.new_SetLODsCommand(*args)) _py3dnacalib.SetLODsCommand_swiginit(self, _py3dnacalib.new_SetLODsCommand(*args))
def setLODs(self, lods): def setLODs(self, lods):
r"""
Method for setting the LODs to keep.
:type lods: dnac::ConstArrayView< std::uint16_t >
:param lods:
New LODs to be used.
"""
return _py3dnacalib.SetLODsCommand_setLODs(self, lods) return _py3dnacalib.SetLODsCommand_setLODs(self, lods)
def run(self, output): def run(self, output):
@ -526,6 +923,8 @@ class SetLODsCommand(Command):
_py3dnacalib.SetLODsCommand_swigregister(SetLODsCommand) _py3dnacalib.SetLODsCommand_swigregister(SetLODsCommand)
class SetNeutralJointRotationsCommand(Command): class SetNeutralJointRotationsCommand(Command):
r""" SetNeutralJointRotationsCommand is used to set new rotation values to neutral joints."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_SetNeutralJointRotationsCommand __swig_destroy__ = _py3dnacalib.delete_SetNeutralJointRotationsCommand
@ -534,6 +933,29 @@ class SetNeutralJointRotationsCommand(Command):
_py3dnacalib.SetNeutralJointRotationsCommand_swiginit(self, _py3dnacalib.new_SetNeutralJointRotationsCommand(*args)) _py3dnacalib.SetNeutralJointRotationsCommand_swiginit(self, _py3dnacalib.new_SetNeutralJointRotationsCommand(*args))
def setRotations(self, *args): def setRotations(self, *args):
r"""
*Overload 1:*
Method for setting the neutral joint rotations.
:type rotations: dnac::ConstArrayView< dnac::Vector3 >
:param rotations:
Rotation values for each joint.
|
*Overload 2:*
Method for setting the neutral joint rotations.
:type xs: dnac::ConstArrayView< float >
:param xs:
The X rotation value for each joint.
:type ys: dnac::ConstArrayView< float >
:param ys:
The Y rotation value for each joint.
:type zs: dnac::ConstArrayView< float >
:param zs:
The Z rotation value for each joint.
"""
return _py3dnacalib.SetNeutralJointRotationsCommand_setRotations(self, *args) return _py3dnacalib.SetNeutralJointRotationsCommand_setRotations(self, *args)
def run(self, output): def run(self, output):
@ -543,6 +965,8 @@ class SetNeutralJointRotationsCommand(Command):
_py3dnacalib.SetNeutralJointRotationsCommand_swigregister(SetNeutralJointRotationsCommand) _py3dnacalib.SetNeutralJointRotationsCommand_swigregister(SetNeutralJointRotationsCommand)
class SetNeutralJointTranslationsCommand(Command): class SetNeutralJointTranslationsCommand(Command):
r""" SetNeutralJointTranslationsCommand is used to set new translation values to neutral joints."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_SetNeutralJointTranslationsCommand __swig_destroy__ = _py3dnacalib.delete_SetNeutralJointTranslationsCommand
@ -551,6 +975,29 @@ class SetNeutralJointTranslationsCommand(Command):
_py3dnacalib.SetNeutralJointTranslationsCommand_swiginit(self, _py3dnacalib.new_SetNeutralJointTranslationsCommand(*args)) _py3dnacalib.SetNeutralJointTranslationsCommand_swiginit(self, _py3dnacalib.new_SetNeutralJointTranslationsCommand(*args))
def setTranslations(self, *args): def setTranslations(self, *args):
r"""
*Overload 1:*
Method for setting the neutral joint translations.
:type translations: dnac::ConstArrayView< dnac::Vector3 >
:param translations:
Translation values for each joint.
|
*Overload 2:*
Method for setting the neutral joint translations.
:type xs: dnac::ConstArrayView< float >
:param xs:
The X translation value for each joint.
:type ys: dnac::ConstArrayView< float >
:param ys:
The Y translation value for each joint.
:type zs: dnac::ConstArrayView< float >
:param zs:
The Z translation value for each joint.
"""
return _py3dnacalib.SetNeutralJointTranslationsCommand_setTranslations(self, *args) return _py3dnacalib.SetNeutralJointTranslationsCommand_setTranslations(self, *args)
def run(self, output): def run(self, output):
@ -560,6 +1007,8 @@ class SetNeutralJointTranslationsCommand(Command):
_py3dnacalib.SetNeutralJointTranslationsCommand_swigregister(SetNeutralJointTranslationsCommand) _py3dnacalib.SetNeutralJointTranslationsCommand_swigregister(SetNeutralJointTranslationsCommand)
class SetSkinWeightsCommand(Command): class SetSkinWeightsCommand(Command):
r""" SetSkinWeightsCommand is used to set new skin weights for a vertex in a mesh."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_SetSkinWeightsCommand __swig_destroy__ = _py3dnacalib.delete_SetSkinWeightsCommand
@ -568,15 +1017,39 @@ class SetSkinWeightsCommand(Command):
_py3dnacalib.SetSkinWeightsCommand_swiginit(self, _py3dnacalib.new_SetSkinWeightsCommand(*args)) _py3dnacalib.SetSkinWeightsCommand_swiginit(self, _py3dnacalib.new_SetSkinWeightsCommand(*args))
def setMeshIndex(self, meshIndex): def setMeshIndex(self, meshIndex):
r"""
Method for setting the index of the targeted mesh.
:type meshIndex: int
:param meshIndex:
The mesh index.
"""
return _py3dnacalib.SetSkinWeightsCommand_setMeshIndex(self, meshIndex) return _py3dnacalib.SetSkinWeightsCommand_setMeshIndex(self, meshIndex)
def setVertexIndex(self, vertexIndex): def setVertexIndex(self, vertexIndex):
r"""
Method for setting the index of the vertex to change.
:type vertexIndex: int
:param vertexIndex:
The vertex index.
"""
return _py3dnacalib.SetSkinWeightsCommand_setVertexIndex(self, vertexIndex) return _py3dnacalib.SetSkinWeightsCommand_setVertexIndex(self, vertexIndex)
def setWeights(self, weights): def setWeights(self, weights):
r"""
Method for setting the weights with which joints influence the vertex in question.
:type weights: dnac::ConstArrayView< float >
:param weights:
Weights for each joint that has an influence on the vertex.
"""
return _py3dnacalib.SetSkinWeightsCommand_setWeights(self, weights) return _py3dnacalib.SetSkinWeightsCommand_setWeights(self, weights)
def setJointIndices(self, jointIndices): def setJointIndices(self, jointIndices):
r"""
Method for setting the joint indices of joints that influence the vertex in question.
:type jointIndices: dnac::ConstArrayView< std::uint16_t >
:param jointIndices:
Joint indices of joints that have an influence on the vertex.
"""
return _py3dnacalib.SetSkinWeightsCommand_setJointIndices(self, jointIndices) return _py3dnacalib.SetSkinWeightsCommand_setJointIndices(self, jointIndices)
def run(self, output): def run(self, output):
@ -586,6 +1059,8 @@ class SetSkinWeightsCommand(Command):
_py3dnacalib.SetSkinWeightsCommand_swigregister(SetSkinWeightsCommand) _py3dnacalib.SetSkinWeightsCommand_swigregister(SetSkinWeightsCommand)
class SetVertexPositionsCommand(Command): class SetVertexPositionsCommand(Command):
r""" SetVertexPositionsCommand is used to change vertex positions values."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_SetVertexPositionsCommand __swig_destroy__ = _py3dnacalib.delete_SetVertexPositionsCommand
@ -594,15 +1069,67 @@ class SetVertexPositionsCommand(Command):
_py3dnacalib.SetVertexPositionsCommand_swiginit(self, _py3dnacalib.new_SetVertexPositionsCommand(*args)) _py3dnacalib.SetVertexPositionsCommand_swiginit(self, _py3dnacalib.new_SetVertexPositionsCommand(*args))
def setMeshIndex(self, meshIndex): def setMeshIndex(self, meshIndex):
r"""
Method for setting the index of the mesh to change.
:type meshIndex: int
:param meshIndex:
The mesh index.
"""
return _py3dnacalib.SetVertexPositionsCommand_setMeshIndex(self, meshIndex) return _py3dnacalib.SetVertexPositionsCommand_setMeshIndex(self, meshIndex)
def setPositions(self, *args): def setPositions(self, *args):
r"""
*Overload 1:*
Method for setting the vertex positions used to calculate new values.
:type positions: dnac::ConstArrayView< dnac::Vector3 >
:param positions:
The vertex positions.
|
*Overload 2:*
Method for setting the vertex positions used to calculate new values.
:type xs: dnac::ConstArrayView< float >
:param xs:
The X coordinates for each vertex.
:type ys: dnac::ConstArrayView< float >
:param ys:
The Y coordinates for each vertex.
:type zs: dnac::ConstArrayView< float >
:param zs:
The Z coordinates for each vertex.
"""
return _py3dnacalib.SetVertexPositionsCommand_setPositions(self, *args) return _py3dnacalib.SetVertexPositionsCommand_setPositions(self, *args)
def setMasks(self, masks): def setMasks(self, masks):
r"""
Method for setting vertex masks used to calculate new vertex position values.
Notes:
If no masks are set, default weight value of 1 is used for each vertex.
:type masks: dnac::ConstArrayView< float >
:param masks:
The weights for each vertex.
"""
return _py3dnacalib.SetVertexPositionsCommand_setMasks(self, masks) return _py3dnacalib.SetVertexPositionsCommand_setMasks(self, masks)
def setOperation(self, operation): def setOperation(self, operation):
r"""
Method for setting the type of operation used to calculate new vertex position values.
Notes:
Available operations are: Interpolate, Add, Subtract and Multiply. Each position is calculated based on the provided operation type in the following way:
Interpolate: = previousValue * (1 - weight) + setValue * weight:math:`\n Add: \f$newValue = previousValue + (setValue * weight)`
Subtract: = previousValue - (setValue * weight):math:`\n Multiply: \f$newValue = previousValue * (setValue * weight)`
setValue is the value from new positions that were set, and weight is the value from masks array.
:type operation: int
:param operation:
The operation to use.
"""
return _py3dnacalib.SetVertexPositionsCommand_setOperation(self, operation) return _py3dnacalib.SetVertexPositionsCommand_setOperation(self, operation)
def run(self, output): def run(self, output):
@ -613,6 +1140,12 @@ _py3dnacalib.SetVertexPositionsCommand_swigregister(SetVertexPositionsCommand)
SetVertexPositionsCommand.PositionsMasksCountMismatch = _py3dnacalib.cvar.SetVertexPositionsCommand_PositionsMasksCountMismatch SetVertexPositionsCommand.PositionsMasksCountMismatch = _py3dnacalib.cvar.SetVertexPositionsCommand_PositionsMasksCountMismatch
class TranslateCommand(Command): class TranslateCommand(Command):
r"""
TranslateCommand is used to translate neutral joints and vertex positions.
Notes:
Joint translations are represented in parent space, so it is enough to translate only root joints, as that translation will be propagated to the rest of the joints.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_TranslateCommand __swig_destroy__ = _py3dnacalib.delete_TranslateCommand
@ -621,6 +1154,12 @@ class TranslateCommand(Command):
_py3dnacalib.TranslateCommand_swiginit(self, _py3dnacalib.new_TranslateCommand(*args)) _py3dnacalib.TranslateCommand_swiginit(self, _py3dnacalib.new_TranslateCommand(*args))
def setTranslation(self, translation): def setTranslation(self, translation):
r"""
Method for setting the translation vector.
:type translation: dnac::Vector3
:param translation:
The translation vector.
"""
return _py3dnacalib.TranslateCommand_setTranslation(self, translation) return _py3dnacalib.TranslateCommand_setTranslation(self, translation)
def run(self, output): def run(self, output):

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,18 @@
# Do not make changes to this file unless you know what you are doing--modify # Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead. # the SWIG interface file instead.
import os
if hasattr(os, 'add_dll_directory'):
for path in os.environ.get('PATH', '').split(';'):
try:
if path:
os.add_dll_directory(path)
except Exception:
pass
from sys import version_info as _swig_python_version_info from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0): if _swig_python_version_info < (2, 7, 0):
raise RuntimeError("Python 2.7 or later required") raise RuntimeError("Python 2.7 or later required")
@ -62,20 +74,16 @@ class _SwigNonDynamicMeta(type):
def __new_decorator(factory_func, original_new): def with_metaclass(meta, *bases):
@staticmethod class metaclass(type):
def __new(cls, *args, **kwargs):
# FIXME: while this workaround solves the immediate issue with the set of classes we currently have,
# it will fail for classes that use a factory function but need no parameters at all, in which case
# the factory function will never be invoked, only the original __new__ function.
if args or kwargs:
return factory_func(*args, **kwargs)
return original_new(cls)
return __new
def __managed_init(self, *args, **kwargs): def __new__(cls, name, this_bases, d):
self._args = args return meta(name, bases, d)
self._kwargs = kwargs
@classmethod
def __prepare__(cls, name, this_bases):
return meta.__prepare__(name, bases)
return type.__new__(metaclass, 'temporary_class', (), {})
import dna import dna
class VersionInfo(object): class VersionInfo(object):
@ -142,13 +150,50 @@ def DNACalibDNAReader_destroy(instance):
return _py3dnacalib.DNACalibDNAReader_destroy(instance) return _py3dnacalib.DNACalibDNAReader_destroy(instance)
DNACalibDNAReader.__new__ = __new_decorator(DNACalibDNAReader_create, DNACalibDNAReader.__new__) DNACalibDNAReaderImpl = DNACalibDNAReader
DNACalibDNAReader.__del__ = lambda instance: DNACalibDNAReader_destroy(instance)
DNACalibDNAReader.__init__ = __managed_init class DNACalibDNAReaderImplReflectionMixin(type):
del DNACalibDNAReader.create
del DNACalibDNAReader.destroy def __getattr__(cls, name):
return getattr(DNACalibDNAReaderImpl, name)
def __dir__(cls):
return [name for name in dir(DNACalibDNAReaderImpl) if name not in ("create","destroy")]
class DNACalibDNAReader(with_metaclass(DNACalibDNAReaderImplReflectionMixin, object)):
__slots__ = ('_args', '_kwargs', '_instance')
def __init__(self, *args, **kwargs):
self._args = args
self._kwargs = kwargs
self._instance = DNACalibDNAReaderImpl.create(*args, **kwargs)
def __del__(self):
DNACalibDNAReaderImpl.destroy(self._instance)
def _in_slots(self, attr):
for cls in type(self).__mro__:
if attr in getattr(cls, '__slots__', []):
return True
return False
def __getattr__(self, attr):
if self._in_slots(attr):
return object.__getattr__(self, attr)
return getattr(self._instance, attr)
def __setattr__(self, attr, value):
if self._in_slots(attr):
object.__setattr__(self, attr, value)
else:
setattr(self._instance, attr, value)
def __dir__(self):
return [name for name in self._instance.__dir__() if name not in ("create","destroy")]
class Command(object): class Command(object):
r""" Command is an abstract class whose implementations are expected to modify the DNA provided in the run() method in some way."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -167,6 +212,14 @@ VectorOperation_Add = _py3dnacalib.VectorOperation_Add
VectorOperation_Subtract = _py3dnacalib.VectorOperation_Subtract VectorOperation_Subtract = _py3dnacalib.VectorOperation_Subtract
VectorOperation_Multiply = _py3dnacalib.VectorOperation_Multiply VectorOperation_Multiply = _py3dnacalib.VectorOperation_Multiply
class CommandSequence(Command): class CommandSequence(Command):
r"""
CommandSequence is used to run a sequence of commands on the same DNA.
Notes:
Commands will be run in the order in which they were added to the sequence.
CommandSequence holds pointers to commands, but does not own them.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_CommandSequence __swig_destroy__ = _py3dnacalib.delete_CommandSequence
@ -178,15 +231,34 @@ class CommandSequence(Command):
return _py3dnacalib.CommandSequence_run(self, output) return _py3dnacalib.CommandSequence_run(self, output)
def add(self, command): def add(self, command):
r"""
Method for adding a command to a sequence of commands to run.
:type command: :py:class:`Command`
:param command:
The command to add.
"""
return _py3dnacalib.CommandSequence_add(self, command) return _py3dnacalib.CommandSequence_add(self, command)
def remove(self, command): def remove(self, command):
r"""
Method for removing a command from the sequence of commands to run.
:type command: :py:class:`Command`
:param command:
The command to remove.
"""
return _py3dnacalib.CommandSequence_remove(self, command) return _py3dnacalib.CommandSequence_remove(self, command)
def contains(self, command): def contains(self, command):
r"""
Method for checking if the provided command is part of the command sequence.
:type command: :py:class:`Command`
:param command:
The command to check.
"""
return _py3dnacalib.CommandSequence_contains(self, command) return _py3dnacalib.CommandSequence_contains(self, command)
def size(self): def size(self):
r""" Number of commands in command sequence."""
return _py3dnacalib.CommandSequence_size(self) return _py3dnacalib.CommandSequence_size(self)
# Register CommandSequence in _py3dnacalib: # Register CommandSequence in _py3dnacalib:
@ -216,6 +288,12 @@ CommandSequence.add = command_sequence_add(CommandSequence.add)
CommandSequence.remove = command_sequence_remove(CommandSequence.remove) CommandSequence.remove = command_sequence_remove(CommandSequence.remove)
class CalculateMeshLowerLODsCommand(Command): class CalculateMeshLowerLODsCommand(Command):
r"""
CalculateMeshLowerLODsCommand is used to recalculate vertex positions for lower LOD meshes of the specified mesh.
Notes:
The calculation is done based on vertex positions of the specified mesh and vertex texture coordinates of its lower LOD meshes.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_CalculateMeshLowerLODsCommand __swig_destroy__ = _py3dnacalib.delete_CalculateMeshLowerLODsCommand
@ -224,6 +302,12 @@ class CalculateMeshLowerLODsCommand(Command):
_py3dnacalib.CalculateMeshLowerLODsCommand_swiginit(self, _py3dnacalib.new_CalculateMeshLowerLODsCommand(*args)) _py3dnacalib.CalculateMeshLowerLODsCommand_swiginit(self, _py3dnacalib.new_CalculateMeshLowerLODsCommand(*args))
def setMeshIndex(self, meshIndex): def setMeshIndex(self, meshIndex):
r"""
Method for setting the index of the mesh to calculate lower LOD meshes from.
:type meshIndex: int
:param meshIndex:
The index of the mesh.
"""
return _py3dnacalib.CalculateMeshLowerLODsCommand_setMeshIndex(self, meshIndex) return _py3dnacalib.CalculateMeshLowerLODsCommand_setMeshIndex(self, meshIndex)
def run(self, output): def run(self, output):
@ -233,6 +317,11 @@ class CalculateMeshLowerLODsCommand(Command):
_py3dnacalib.CalculateMeshLowerLODsCommand_swigregister(CalculateMeshLowerLODsCommand) _py3dnacalib.CalculateMeshLowerLODsCommand_swigregister(CalculateMeshLowerLODsCommand)
class ClearBlendShapesCommand(Command): class ClearBlendShapesCommand(Command):
r"""
ClearBlendShapesCommand is used to clear all blend shapes data from a DNA.
Notes: This command clears blend shape target deltas and blend shape animation data. By doing so, it transforms the DNA to be "joints only".
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_ClearBlendShapesCommand __swig_destroy__ = _py3dnacalib.delete_ClearBlendShapesCommand
@ -247,6 +336,8 @@ class ClearBlendShapesCommand(Command):
_py3dnacalib.ClearBlendShapesCommand_swigregister(ClearBlendShapesCommand) _py3dnacalib.ClearBlendShapesCommand_swigregister(ClearBlendShapesCommand)
class PruneBlendShapeTargetsCommand(Command): class PruneBlendShapeTargetsCommand(Command):
r""" PruneBlendShapeTargetsCommand is used to prune blend shape target deltas whose absolute magnitude is less than or equal to the specified threshold."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_PruneBlendShapeTargetsCommand __swig_destroy__ = _py3dnacalib.delete_PruneBlendShapeTargetsCommand
@ -255,6 +346,12 @@ class PruneBlendShapeTargetsCommand(Command):
_py3dnacalib.PruneBlendShapeTargetsCommand_swiginit(self, _py3dnacalib.new_PruneBlendShapeTargetsCommand(*args)) _py3dnacalib.PruneBlendShapeTargetsCommand_swiginit(self, _py3dnacalib.new_PruneBlendShapeTargetsCommand(*args))
def setThreshold(self, threshold): def setThreshold(self, threshold):
r"""
Method for setting the threshold for pruning blend shape target deltas.
:type threshold: float
:param threshold:
The threshold to use.
"""
return _py3dnacalib.PruneBlendShapeTargetsCommand_setThreshold(self, threshold) return _py3dnacalib.PruneBlendShapeTargetsCommand_setThreshold(self, threshold)
def run(self, output): def run(self, output):
@ -264,6 +361,8 @@ class PruneBlendShapeTargetsCommand(Command):
_py3dnacalib.PruneBlendShapeTargetsCommand_swigregister(PruneBlendShapeTargetsCommand) _py3dnacalib.PruneBlendShapeTargetsCommand_swigregister(PruneBlendShapeTargetsCommand)
class RemoveAnimatedMapCommand(Command): class RemoveAnimatedMapCommand(Command):
r""" RemoveAnimatedMapCommand is used to remove animated maps."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RemoveAnimatedMapCommand __swig_destroy__ = _py3dnacalib.delete_RemoveAnimatedMapCommand
@ -272,9 +371,23 @@ class RemoveAnimatedMapCommand(Command):
_py3dnacalib.RemoveAnimatedMapCommand_swiginit(self, _py3dnacalib.new_RemoveAnimatedMapCommand(*args)) _py3dnacalib.RemoveAnimatedMapCommand_swiginit(self, _py3dnacalib.new_RemoveAnimatedMapCommand(*args))
def setAnimatedMapIndex(self, animatedMapIndex): def setAnimatedMapIndex(self, animatedMapIndex):
r"""
Method for setting the index of the animated map to remove.
:type animatedMapIndex: int
:param animatedMapIndex:
The index of the animated map.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set animated map(s) will be removed.
"""
return _py3dnacalib.RemoveAnimatedMapCommand_setAnimatedMapIndex(self, animatedMapIndex) return _py3dnacalib.RemoveAnimatedMapCommand_setAnimatedMapIndex(self, animatedMapIndex)
def setAnimatedMapIndices(self, animatedMapIndices): def setAnimatedMapIndices(self, animatedMapIndices):
r"""
Method for setting the indices of animated maps to remove.
:type animatedMapIndices: dnac::ConstArrayView< std::uint16_t >
:param animatedMapIndices:
The animated map indices.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set animated map(s) will be removed.
"""
return _py3dnacalib.RemoveAnimatedMapCommand_setAnimatedMapIndices(self, animatedMapIndices) return _py3dnacalib.RemoveAnimatedMapCommand_setAnimatedMapIndices(self, animatedMapIndices)
def run(self, output): def run(self, output):
@ -284,6 +397,8 @@ class RemoveAnimatedMapCommand(Command):
_py3dnacalib.RemoveAnimatedMapCommand_swigregister(RemoveAnimatedMapCommand) _py3dnacalib.RemoveAnimatedMapCommand_swigregister(RemoveAnimatedMapCommand)
class RemoveBlendShapeCommand(Command): class RemoveBlendShapeCommand(Command):
r""" RemoveBlendShapeCommand is used to remove blend shapes."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RemoveBlendShapeCommand __swig_destroy__ = _py3dnacalib.delete_RemoveBlendShapeCommand
@ -292,9 +407,23 @@ class RemoveBlendShapeCommand(Command):
_py3dnacalib.RemoveBlendShapeCommand_swiginit(self, _py3dnacalib.new_RemoveBlendShapeCommand(*args)) _py3dnacalib.RemoveBlendShapeCommand_swiginit(self, _py3dnacalib.new_RemoveBlendShapeCommand(*args))
def setBlendShapeIndex(self, blendShapeIndex): def setBlendShapeIndex(self, blendShapeIndex):
r"""
Method for setting the index of the blend shape to remove.
:type blendShapeIndex: int
:param blendShapeIndex:
The index of the blend shape.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set blend shape(s) will be removed.
"""
return _py3dnacalib.RemoveBlendShapeCommand_setBlendShapeIndex(self, blendShapeIndex) return _py3dnacalib.RemoveBlendShapeCommand_setBlendShapeIndex(self, blendShapeIndex)
def setBlendShapeIndices(self, blendShapeIndices): def setBlendShapeIndices(self, blendShapeIndices):
r"""
Method for setting the indices of blend shapes to remove.
:type blendShapeIndices: dnac::ConstArrayView< std::uint16_t >
:param blendShapeIndices:
The blend shape indices.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set blend shape(s) will be removed.
"""
return _py3dnacalib.RemoveBlendShapeCommand_setBlendShapeIndices(self, blendShapeIndices) return _py3dnacalib.RemoveBlendShapeCommand_setBlendShapeIndices(self, blendShapeIndices)
def run(self, output): def run(self, output):
@ -304,6 +433,8 @@ class RemoveBlendShapeCommand(Command):
_py3dnacalib.RemoveBlendShapeCommand_swigregister(RemoveBlendShapeCommand) _py3dnacalib.RemoveBlendShapeCommand_swigregister(RemoveBlendShapeCommand)
class RemoveJointAnimationCommand(Command): class RemoveJointAnimationCommand(Command):
r""" RemoveJointAnimationCommand is used to remove joint animation data."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RemoveJointAnimationCommand __swig_destroy__ = _py3dnacalib.delete_RemoveJointAnimationCommand
@ -312,9 +443,23 @@ class RemoveJointAnimationCommand(Command):
_py3dnacalib.RemoveJointAnimationCommand_swiginit(self, _py3dnacalib.new_RemoveJointAnimationCommand(*args)) _py3dnacalib.RemoveJointAnimationCommand_swiginit(self, _py3dnacalib.new_RemoveJointAnimationCommand(*args))
def setJointIndex(self, jointIndex): def setJointIndex(self, jointIndex):
r"""
Method for setting the index of a joint whose animation data to remove.
:type jointIndex: int
:param jointIndex:
The index of the joint.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set joint animation(s) will be removed.
"""
return _py3dnacalib.RemoveJointAnimationCommand_setJointIndex(self, jointIndex) return _py3dnacalib.RemoveJointAnimationCommand_setJointIndex(self, jointIndex)
def setJointIndices(self, jointIndices): def setJointIndices(self, jointIndices):
r"""
Method for setting the indices of joints whose animation data to remove.
:type jointIndices: dnac::ConstArrayView< std::uint16_t >
:param jointIndices:
The joint indices.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set joint animation(s) will be removed.
"""
return _py3dnacalib.RemoveJointAnimationCommand_setJointIndices(self, jointIndices) return _py3dnacalib.RemoveJointAnimationCommand_setJointIndices(self, jointIndices)
def run(self, output): def run(self, output):
@ -324,6 +469,8 @@ class RemoveJointAnimationCommand(Command):
_py3dnacalib.RemoveJointAnimationCommand_swigregister(RemoveJointAnimationCommand) _py3dnacalib.RemoveJointAnimationCommand_swigregister(RemoveJointAnimationCommand)
class RemoveJointCommand(Command): class RemoveJointCommand(Command):
r""" RemoveJointCommand is used to remove joints."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RemoveJointCommand __swig_destroy__ = _py3dnacalib.delete_RemoveJointCommand
@ -332,9 +479,23 @@ class RemoveJointCommand(Command):
_py3dnacalib.RemoveJointCommand_swiginit(self, _py3dnacalib.new_RemoveJointCommand(*args)) _py3dnacalib.RemoveJointCommand_swiginit(self, _py3dnacalib.new_RemoveJointCommand(*args))
def setJointIndex(self, jointIndex): def setJointIndex(self, jointIndex):
r"""
Method for setting the index of the joint to remove.
:type jointIndex: int
:param jointIndex:
The index of the joint.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set joint(s) will be removed.
"""
return _py3dnacalib.RemoveJointCommand_setJointIndex(self, jointIndex) return _py3dnacalib.RemoveJointCommand_setJointIndex(self, jointIndex)
def setJointIndices(self, jointIndices): def setJointIndices(self, jointIndices):
r"""
Method for setting the indices of joints to remove.
:type jointIndices: dnac::ConstArrayView< std::uint16_t >
:param jointIndices:
The joint indices.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set joint(s) will be removed.
"""
return _py3dnacalib.RemoveJointCommand_setJointIndices(self, jointIndices) return _py3dnacalib.RemoveJointCommand_setJointIndices(self, jointIndices)
def run(self, output): def run(self, output):
@ -344,6 +505,8 @@ class RemoveJointCommand(Command):
_py3dnacalib.RemoveJointCommand_swigregister(RemoveJointCommand) _py3dnacalib.RemoveJointCommand_swigregister(RemoveJointCommand)
class RemoveMeshCommand(Command): class RemoveMeshCommand(Command):
r""" RemoveMeshCommand is used to remove meshes."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RemoveMeshCommand __swig_destroy__ = _py3dnacalib.delete_RemoveMeshCommand
@ -352,9 +515,22 @@ class RemoveMeshCommand(Command):
_py3dnacalib.RemoveMeshCommand_swiginit(self, _py3dnacalib.new_RemoveMeshCommand(*args)) _py3dnacalib.RemoveMeshCommand_swiginit(self, _py3dnacalib.new_RemoveMeshCommand(*args))
def setMeshIndex(self, meshIndex): def setMeshIndex(self, meshIndex):
r"""
Method for setting the index of the mesh to remove.
:type meshIndex: int
:param meshIndex:
The index of the mesh.
"""
return _py3dnacalib.RemoveMeshCommand_setMeshIndex(self, meshIndex) return _py3dnacalib.RemoveMeshCommand_setMeshIndex(self, meshIndex)
def setMeshIndices(self, meshIndices): def setMeshIndices(self, meshIndices):
r"""
Method for setting the indices of meshes to remove.
:type meshIndices: dnac::ConstArrayView< std::uint16_t >
:param meshIndices:
The mesh indices.
Notes: Call to either setter overwrites previous setter calls. When running the command, the last set mesh(es) will be removed.
"""
return _py3dnacalib.RemoveMeshCommand_setMeshIndices(self, meshIndices) return _py3dnacalib.RemoveMeshCommand_setMeshIndices(self, meshIndices)
def run(self, output): def run(self, output):
@ -364,6 +540,8 @@ class RemoveMeshCommand(Command):
_py3dnacalib.RemoveMeshCommand_swigregister(RemoveMeshCommand) _py3dnacalib.RemoveMeshCommand_swigregister(RemoveMeshCommand)
class RenameAnimatedMapCommand(Command): class RenameAnimatedMapCommand(Command):
r""" RenameAnimatedMapCommand is used to rename an animated map."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RenameAnimatedMapCommand __swig_destroy__ = _py3dnacalib.delete_RenameAnimatedMapCommand
@ -372,6 +550,31 @@ class RenameAnimatedMapCommand(Command):
_py3dnacalib.RenameAnimatedMapCommand_swiginit(self, _py3dnacalib.new_RenameAnimatedMapCommand(*args)) _py3dnacalib.RenameAnimatedMapCommand_swiginit(self, _py3dnacalib.new_RenameAnimatedMapCommand(*args))
def setName(self, *args): def setName(self, *args):
r"""
*Overload 1:*
Method for setting a new name for animated map with given index.
:type animatedMapIndex: int
:param animatedMapIndex:
The index of the animated map whose name to change.
:type newName: string
:param newName:
The new name for the animated map.
|
*Overload 2:*
Method for setting a new name for animated map with given name.
Notes:
The renaming will not happen if there is no animated map with given current name.
:type oldName: string
:param oldName:
The current name of the animated map whose name to change.
:type newName: string
:param newName:
The new name for the animated map.
"""
return _py3dnacalib.RenameAnimatedMapCommand_setName(self, *args) return _py3dnacalib.RenameAnimatedMapCommand_setName(self, *args)
def run(self, output): def run(self, output):
@ -381,6 +584,8 @@ class RenameAnimatedMapCommand(Command):
_py3dnacalib.RenameAnimatedMapCommand_swigregister(RenameAnimatedMapCommand) _py3dnacalib.RenameAnimatedMapCommand_swigregister(RenameAnimatedMapCommand)
class RenameBlendShapeCommand(Command): class RenameBlendShapeCommand(Command):
r""" RenameBlendShapeCommand is used to rename a blend shape channel."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RenameBlendShapeCommand __swig_destroy__ = _py3dnacalib.delete_RenameBlendShapeCommand
@ -389,6 +594,31 @@ class RenameBlendShapeCommand(Command):
_py3dnacalib.RenameBlendShapeCommand_swiginit(self, _py3dnacalib.new_RenameBlendShapeCommand(*args)) _py3dnacalib.RenameBlendShapeCommand_swiginit(self, _py3dnacalib.new_RenameBlendShapeCommand(*args))
def setName(self, *args): def setName(self, *args):
r"""
*Overload 1:*
Method for setting a new name for blend shape channel with given index.
:type blendShapeIndex: int
:param blendShapeIndex:
The index of the blend shape channel whose name to change.
:type newName: string
:param newName:
The new name for the blend shape channel.
|
*Overload 2:*
Method for setting a new name for blend shape channel with given name.
Notes:
The renaming will not happen if there is no blend shape channel with given current name.
:type oldName: string
:param oldName:
The current name of the blend shape channel whose name to change.
:type newName: string
:param newName:
The new name for the blend shape channel.
"""
return _py3dnacalib.RenameBlendShapeCommand_setName(self, *args) return _py3dnacalib.RenameBlendShapeCommand_setName(self, *args)
def run(self, output): def run(self, output):
@ -398,6 +628,8 @@ class RenameBlendShapeCommand(Command):
_py3dnacalib.RenameBlendShapeCommand_swigregister(RenameBlendShapeCommand) _py3dnacalib.RenameBlendShapeCommand_swigregister(RenameBlendShapeCommand)
class RenameJointCommand(Command): class RenameJointCommand(Command):
r""" RenameJointCommand is used to rename a joint."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RenameJointCommand __swig_destroy__ = _py3dnacalib.delete_RenameJointCommand
@ -406,6 +638,31 @@ class RenameJointCommand(Command):
_py3dnacalib.RenameJointCommand_swiginit(self, _py3dnacalib.new_RenameJointCommand(*args)) _py3dnacalib.RenameJointCommand_swiginit(self, _py3dnacalib.new_RenameJointCommand(*args))
def setName(self, *args): def setName(self, *args):
r"""
*Overload 1:*
Method for setting a new name for joint with given index.
:type jointIndex: int
:param jointIndex:
The index of the joint whose name to change.
:type newName: string
:param newName:
The new name for the joint.
|
*Overload 2:*
Method for setting a new name for joint with given name.
Notes:
The renaming will not happen if there is no joint with given current name.
:type oldName: string
:param oldName:
The current name of the joint whose name to change.
:type newName: string
:param newName:
The new name for the joint.
"""
return _py3dnacalib.RenameJointCommand_setName(self, *args) return _py3dnacalib.RenameJointCommand_setName(self, *args)
def run(self, output): def run(self, output):
@ -415,6 +672,8 @@ class RenameJointCommand(Command):
_py3dnacalib.RenameJointCommand_swigregister(RenameJointCommand) _py3dnacalib.RenameJointCommand_swigregister(RenameJointCommand)
class RenameMeshCommand(Command): class RenameMeshCommand(Command):
r""" RenameMeshCommand is used to rename a mesh."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RenameMeshCommand __swig_destroy__ = _py3dnacalib.delete_RenameMeshCommand
@ -423,6 +682,31 @@ class RenameMeshCommand(Command):
_py3dnacalib.RenameMeshCommand_swiginit(self, _py3dnacalib.new_RenameMeshCommand(*args)) _py3dnacalib.RenameMeshCommand_swiginit(self, _py3dnacalib.new_RenameMeshCommand(*args))
def setName(self, *args): def setName(self, *args):
r"""
*Overload 1:*
Method for setting a new name for mesh with given index.
:type meshIndex: int
:param meshIndex:
The index of the mesh whose name to change.
:type newName: string
:param newName:
The new name for the mesh.
|
*Overload 2:*
Method for setting a new name for mesh with given name.
Notes:
The renaming will not happen if there is no mesh with given current name.
:type oldName: string
:param oldName:
The current name of the mesh whose name to change.
:type newName: string
:param newName:
The new name for the mesh.
"""
return _py3dnacalib.RenameMeshCommand_setName(self, *args) return _py3dnacalib.RenameMeshCommand_setName(self, *args)
def run(self, output): def run(self, output):
@ -432,6 +716,14 @@ class RenameMeshCommand(Command):
_py3dnacalib.RenameMeshCommand_swigregister(RenameMeshCommand) _py3dnacalib.RenameMeshCommand_swigregister(RenameMeshCommand)
class RotateCommand(Command): class RotateCommand(Command):
r"""
RotateCommand is used to rotate neutral joints and vertex positions around given origin.
Notes:
Joint rotations are represented in parent space, so it is enough to rotate only root joints, as that rotation will be propagated to the rest of the joints.
If the origin is not set, the assumed origin is (0, 0, 0).
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_RotateCommand __swig_destroy__ = _py3dnacalib.delete_RotateCommand
@ -440,9 +732,21 @@ class RotateCommand(Command):
_py3dnacalib.RotateCommand_swiginit(self, _py3dnacalib.new_RotateCommand(*args)) _py3dnacalib.RotateCommand_swiginit(self, _py3dnacalib.new_RotateCommand(*args))
def setRotation(self, degrees): def setRotation(self, degrees):
r"""
Method for setting the rotation angles.
:type degrees: dnac::Vector3
:param degrees:
Rotation angles in degrees.
"""
return _py3dnacalib.RotateCommand_setRotation(self, degrees) return _py3dnacalib.RotateCommand_setRotation(self, degrees)
def setOrigin(self, origin): def setOrigin(self, origin):
r"""
Method for setting the rotation origin.
:type origin: dnac::Vector3
:param origin:
Origin coordinates.
"""
return _py3dnacalib.RotateCommand_setOrigin(self, origin) return _py3dnacalib.RotateCommand_setOrigin(self, origin)
def run(self, output): def run(self, output):
@ -452,6 +756,12 @@ class RotateCommand(Command):
_py3dnacalib.RotateCommand_swigregister(RotateCommand) _py3dnacalib.RotateCommand_swigregister(RotateCommand)
class ScaleCommand(Command): class ScaleCommand(Command):
r"""
ScaleCommand is used to scale neutral joints, vertex positions and joint and blendshape deltas by a factor.
Notes:
Only translation attributes of neutral joints and joint deltas are scaled.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_ScaleCommand __swig_destroy__ = _py3dnacalib.delete_ScaleCommand
@ -460,9 +770,22 @@ class ScaleCommand(Command):
_py3dnacalib.ScaleCommand_swiginit(self, _py3dnacalib.new_ScaleCommand(*args)) _py3dnacalib.ScaleCommand_swiginit(self, _py3dnacalib.new_ScaleCommand(*args))
def setScale(self, scale): def setScale(self, scale):
r"""
Method for setting the scale factor to multiply with.
:type scale: float
:param scale:
Scale factor.
"""
return _py3dnacalib.ScaleCommand_setScale(self, scale) return _py3dnacalib.ScaleCommand_setScale(self, scale)
def setOrigin(self, origin): def setOrigin(self, origin):
r"""
Method for setting the origin.
Notes: The origin is used to properly scale position values (vertex positions and neutral joint translations).
:type origin: dnac::Vector3
:param origin:
Origin coordinates.
"""
return _py3dnacalib.ScaleCommand_setOrigin(self, origin) return _py3dnacalib.ScaleCommand_setOrigin(self, origin)
def run(self, output): def run(self, output):
@ -472,6 +795,8 @@ class ScaleCommand(Command):
_py3dnacalib.ScaleCommand_swigregister(ScaleCommand) _py3dnacalib.ScaleCommand_swigregister(ScaleCommand)
class SetBlendShapeTargetDeltasCommand(Command): class SetBlendShapeTargetDeltasCommand(Command):
r""" SetBlendShapeTargetDeltasCommand is used to change blend shape target deltas."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_SetBlendShapeTargetDeltasCommand __swig_destroy__ = _py3dnacalib.delete_SetBlendShapeTargetDeltasCommand
@ -480,21 +805,85 @@ class SetBlendShapeTargetDeltasCommand(Command):
_py3dnacalib.SetBlendShapeTargetDeltasCommand_swiginit(self, _py3dnacalib.new_SetBlendShapeTargetDeltasCommand(*args)) _py3dnacalib.SetBlendShapeTargetDeltasCommand_swiginit(self, _py3dnacalib.new_SetBlendShapeTargetDeltasCommand(*args))
def setMeshIndex(self, meshIndex): def setMeshIndex(self, meshIndex):
r"""
Method for setting the index of the mesh whose blend shape target to change.
:type meshIndex: int
:param meshIndex:
The mesh index.
"""
return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setMeshIndex(self, meshIndex) return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setMeshIndex(self, meshIndex)
def setBlendShapeTargetIndex(self, blendShapeTargetIndex): def setBlendShapeTargetIndex(self, blendShapeTargetIndex):
r"""
Method for setting the index of the blend shape target to change.
:type blendShapeTargetIndex: int
:param blendShapeTargetIndex:
The blend shape target index.
"""
return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setBlendShapeTargetIndex(self, blendShapeTargetIndex) return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setBlendShapeTargetIndex(self, blendShapeTargetIndex)
def setDeltas(self, *args): def setDeltas(self, *args):
r"""
*Overload 1:*
Method for setting the values used to calculate new deltas for blend shape target.
:type deltas: dnac::ConstArrayView< dnac::Vector3 >
:param deltas:
The values used in calculation.
|
*Overload 2:*
Method for setting the values used to calculate new deltas for blend shape target.
:type xs: dnac::ConstArrayView< float >
:param xs:
The X values for each delta.
:type ys: dnac::ConstArrayView< float >
:param ys:
The Y values for each delta.
:type zs: dnac::ConstArrayView< float >
:param zs:
The Z values for each delta.
"""
return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setDeltas(self, *args) return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setDeltas(self, *args)
def setVertexIndices(self, vertexIndices): def setVertexIndices(self, vertexIndices):
r"""
Method for setting the vertex indices that correspond to new deltas.
:type vertexIndices: dnac::ConstArrayView< std::uint32_t >
:param vertexIndices:
The vertexIndices.
"""
return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setVertexIndices(self, vertexIndices) return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setVertexIndices(self, vertexIndices)
def setMasks(self, masks): def setMasks(self, masks):
r"""
Method for setting masks used to calculate new deltas for blend shape target.
Notes:
If no masks are set, default weight value of 1 is used for each delta.
:type masks: dnac::ConstArrayView< float >
:param masks:
The weights for each delta.
"""
return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setMasks(self, masks) return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setMasks(self, masks)
def setOperation(self, operation): def setOperation(self, operation):
r"""
Method for setting the type of operation used to calculate new deltas for blend shape target.
Notes:
Available operations are: Interpolate, Add, Subtract and Multiply. Each delta is calculated based on the provided operation type in the following way:
Interpolate: = previousValue * (1 - weight) + setValue * weight:math:`\n Add: \f$newValue = previousValue + (setValue * weight)`
Subtract: = previousValue - (setValue * weight):math:`\n Multiply: \f$newValue = previousValue * (setValue * weight)`
setValue is the value from new deltas that were set, and weight is the value from masks array.
:type operation: int
:param operation:
The operation to use.
"""
return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setOperation(self, operation) return _py3dnacalib.SetBlendShapeTargetDeltasCommand_setOperation(self, operation)
def run(self, output): def run(self, output):
@ -509,6 +898,8 @@ SetBlendShapeTargetDeltasCommand.DeltasVertexIndicesCountMismatch = _py3dnacalib
SetBlendShapeTargetDeltasCommand.DeltasMasksCountMismatch = _py3dnacalib.cvar.SetBlendShapeTargetDeltasCommand_DeltasMasksCountMismatch SetBlendShapeTargetDeltasCommand.DeltasMasksCountMismatch = _py3dnacalib.cvar.SetBlendShapeTargetDeltasCommand_DeltasMasksCountMismatch
class SetLODsCommand(Command): class SetLODsCommand(Command):
r""" SetLODsCommand is used to specify LODs to use. Joints, blend shapes, animated maps and meshes that are not in specified LODs are removed from the DNA."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_SetLODsCommand __swig_destroy__ = _py3dnacalib.delete_SetLODsCommand
@ -517,6 +908,12 @@ class SetLODsCommand(Command):
_py3dnacalib.SetLODsCommand_swiginit(self, _py3dnacalib.new_SetLODsCommand(*args)) _py3dnacalib.SetLODsCommand_swiginit(self, _py3dnacalib.new_SetLODsCommand(*args))
def setLODs(self, lods): def setLODs(self, lods):
r"""
Method for setting the LODs to keep.
:type lods: dnac::ConstArrayView< std::uint16_t >
:param lods:
New LODs to be used.
"""
return _py3dnacalib.SetLODsCommand_setLODs(self, lods) return _py3dnacalib.SetLODsCommand_setLODs(self, lods)
def run(self, output): def run(self, output):
@ -526,6 +923,8 @@ class SetLODsCommand(Command):
_py3dnacalib.SetLODsCommand_swigregister(SetLODsCommand) _py3dnacalib.SetLODsCommand_swigregister(SetLODsCommand)
class SetNeutralJointRotationsCommand(Command): class SetNeutralJointRotationsCommand(Command):
r""" SetNeutralJointRotationsCommand is used to set new rotation values to neutral joints."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_SetNeutralJointRotationsCommand __swig_destroy__ = _py3dnacalib.delete_SetNeutralJointRotationsCommand
@ -534,6 +933,29 @@ class SetNeutralJointRotationsCommand(Command):
_py3dnacalib.SetNeutralJointRotationsCommand_swiginit(self, _py3dnacalib.new_SetNeutralJointRotationsCommand(*args)) _py3dnacalib.SetNeutralJointRotationsCommand_swiginit(self, _py3dnacalib.new_SetNeutralJointRotationsCommand(*args))
def setRotations(self, *args): def setRotations(self, *args):
r"""
*Overload 1:*
Method for setting the neutral joint rotations.
:type rotations: dnac::ConstArrayView< dnac::Vector3 >
:param rotations:
Rotation values for each joint.
|
*Overload 2:*
Method for setting the neutral joint rotations.
:type xs: dnac::ConstArrayView< float >
:param xs:
The X rotation value for each joint.
:type ys: dnac::ConstArrayView< float >
:param ys:
The Y rotation value for each joint.
:type zs: dnac::ConstArrayView< float >
:param zs:
The Z rotation value for each joint.
"""
return _py3dnacalib.SetNeutralJointRotationsCommand_setRotations(self, *args) return _py3dnacalib.SetNeutralJointRotationsCommand_setRotations(self, *args)
def run(self, output): def run(self, output):
@ -543,6 +965,8 @@ class SetNeutralJointRotationsCommand(Command):
_py3dnacalib.SetNeutralJointRotationsCommand_swigregister(SetNeutralJointRotationsCommand) _py3dnacalib.SetNeutralJointRotationsCommand_swigregister(SetNeutralJointRotationsCommand)
class SetNeutralJointTranslationsCommand(Command): class SetNeutralJointTranslationsCommand(Command):
r""" SetNeutralJointTranslationsCommand is used to set new translation values to neutral joints."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_SetNeutralJointTranslationsCommand __swig_destroy__ = _py3dnacalib.delete_SetNeutralJointTranslationsCommand
@ -551,6 +975,29 @@ class SetNeutralJointTranslationsCommand(Command):
_py3dnacalib.SetNeutralJointTranslationsCommand_swiginit(self, _py3dnacalib.new_SetNeutralJointTranslationsCommand(*args)) _py3dnacalib.SetNeutralJointTranslationsCommand_swiginit(self, _py3dnacalib.new_SetNeutralJointTranslationsCommand(*args))
def setTranslations(self, *args): def setTranslations(self, *args):
r"""
*Overload 1:*
Method for setting the neutral joint translations.
:type translations: dnac::ConstArrayView< dnac::Vector3 >
:param translations:
Translation values for each joint.
|
*Overload 2:*
Method for setting the neutral joint translations.
:type xs: dnac::ConstArrayView< float >
:param xs:
The X translation value for each joint.
:type ys: dnac::ConstArrayView< float >
:param ys:
The Y translation value for each joint.
:type zs: dnac::ConstArrayView< float >
:param zs:
The Z translation value for each joint.
"""
return _py3dnacalib.SetNeutralJointTranslationsCommand_setTranslations(self, *args) return _py3dnacalib.SetNeutralJointTranslationsCommand_setTranslations(self, *args)
def run(self, output): def run(self, output):
@ -560,6 +1007,8 @@ class SetNeutralJointTranslationsCommand(Command):
_py3dnacalib.SetNeutralJointTranslationsCommand_swigregister(SetNeutralJointTranslationsCommand) _py3dnacalib.SetNeutralJointTranslationsCommand_swigregister(SetNeutralJointTranslationsCommand)
class SetSkinWeightsCommand(Command): class SetSkinWeightsCommand(Command):
r""" SetSkinWeightsCommand is used to set new skin weights for a vertex in a mesh."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_SetSkinWeightsCommand __swig_destroy__ = _py3dnacalib.delete_SetSkinWeightsCommand
@ -568,15 +1017,39 @@ class SetSkinWeightsCommand(Command):
_py3dnacalib.SetSkinWeightsCommand_swiginit(self, _py3dnacalib.new_SetSkinWeightsCommand(*args)) _py3dnacalib.SetSkinWeightsCommand_swiginit(self, _py3dnacalib.new_SetSkinWeightsCommand(*args))
def setMeshIndex(self, meshIndex): def setMeshIndex(self, meshIndex):
r"""
Method for setting the index of the targeted mesh.
:type meshIndex: int
:param meshIndex:
The mesh index.
"""
return _py3dnacalib.SetSkinWeightsCommand_setMeshIndex(self, meshIndex) return _py3dnacalib.SetSkinWeightsCommand_setMeshIndex(self, meshIndex)
def setVertexIndex(self, vertexIndex): def setVertexIndex(self, vertexIndex):
r"""
Method for setting the index of the vertex to change.
:type vertexIndex: int
:param vertexIndex:
The vertex index.
"""
return _py3dnacalib.SetSkinWeightsCommand_setVertexIndex(self, vertexIndex) return _py3dnacalib.SetSkinWeightsCommand_setVertexIndex(self, vertexIndex)
def setWeights(self, weights): def setWeights(self, weights):
r"""
Method for setting the weights with which joints influence the vertex in question.
:type weights: dnac::ConstArrayView< float >
:param weights:
Weights for each joint that has an influence on the vertex.
"""
return _py3dnacalib.SetSkinWeightsCommand_setWeights(self, weights) return _py3dnacalib.SetSkinWeightsCommand_setWeights(self, weights)
def setJointIndices(self, jointIndices): def setJointIndices(self, jointIndices):
r"""
Method for setting the joint indices of joints that influence the vertex in question.
:type jointIndices: dnac::ConstArrayView< std::uint16_t >
:param jointIndices:
Joint indices of joints that have an influence on the vertex.
"""
return _py3dnacalib.SetSkinWeightsCommand_setJointIndices(self, jointIndices) return _py3dnacalib.SetSkinWeightsCommand_setJointIndices(self, jointIndices)
def run(self, output): def run(self, output):
@ -586,6 +1059,8 @@ class SetSkinWeightsCommand(Command):
_py3dnacalib.SetSkinWeightsCommand_swigregister(SetSkinWeightsCommand) _py3dnacalib.SetSkinWeightsCommand_swigregister(SetSkinWeightsCommand)
class SetVertexPositionsCommand(Command): class SetVertexPositionsCommand(Command):
r""" SetVertexPositionsCommand is used to change vertex positions values."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_SetVertexPositionsCommand __swig_destroy__ = _py3dnacalib.delete_SetVertexPositionsCommand
@ -594,15 +1069,67 @@ class SetVertexPositionsCommand(Command):
_py3dnacalib.SetVertexPositionsCommand_swiginit(self, _py3dnacalib.new_SetVertexPositionsCommand(*args)) _py3dnacalib.SetVertexPositionsCommand_swiginit(self, _py3dnacalib.new_SetVertexPositionsCommand(*args))
def setMeshIndex(self, meshIndex): def setMeshIndex(self, meshIndex):
r"""
Method for setting the index of the mesh to change.
:type meshIndex: int
:param meshIndex:
The mesh index.
"""
return _py3dnacalib.SetVertexPositionsCommand_setMeshIndex(self, meshIndex) return _py3dnacalib.SetVertexPositionsCommand_setMeshIndex(self, meshIndex)
def setPositions(self, *args): def setPositions(self, *args):
r"""
*Overload 1:*
Method for setting the vertex positions used to calculate new values.
:type positions: dnac::ConstArrayView< dnac::Vector3 >
:param positions:
The vertex positions.
|
*Overload 2:*
Method for setting the vertex positions used to calculate new values.
:type xs: dnac::ConstArrayView< float >
:param xs:
The X coordinates for each vertex.
:type ys: dnac::ConstArrayView< float >
:param ys:
The Y coordinates for each vertex.
:type zs: dnac::ConstArrayView< float >
:param zs:
The Z coordinates for each vertex.
"""
return _py3dnacalib.SetVertexPositionsCommand_setPositions(self, *args) return _py3dnacalib.SetVertexPositionsCommand_setPositions(self, *args)
def setMasks(self, masks): def setMasks(self, masks):
r"""
Method for setting vertex masks used to calculate new vertex position values.
Notes:
If no masks are set, default weight value of 1 is used for each vertex.
:type masks: dnac::ConstArrayView< float >
:param masks:
The weights for each vertex.
"""
return _py3dnacalib.SetVertexPositionsCommand_setMasks(self, masks) return _py3dnacalib.SetVertexPositionsCommand_setMasks(self, masks)
def setOperation(self, operation): def setOperation(self, operation):
r"""
Method for setting the type of operation used to calculate new vertex position values.
Notes:
Available operations are: Interpolate, Add, Subtract and Multiply. Each position is calculated based on the provided operation type in the following way:
Interpolate: = previousValue * (1 - weight) + setValue * weight:math:`\n Add: \f$newValue = previousValue + (setValue * weight)`
Subtract: = previousValue - (setValue * weight):math:`\n Multiply: \f$newValue = previousValue * (setValue * weight)`
setValue is the value from new positions that were set, and weight is the value from masks array.
:type operation: int
:param operation:
The operation to use.
"""
return _py3dnacalib.SetVertexPositionsCommand_setOperation(self, operation) return _py3dnacalib.SetVertexPositionsCommand_setOperation(self, operation)
def run(self, output): def run(self, output):
@ -613,6 +1140,12 @@ _py3dnacalib.SetVertexPositionsCommand_swigregister(SetVertexPositionsCommand)
SetVertexPositionsCommand.PositionsMasksCountMismatch = _py3dnacalib.cvar.SetVertexPositionsCommand_PositionsMasksCountMismatch SetVertexPositionsCommand.PositionsMasksCountMismatch = _py3dnacalib.cvar.SetVertexPositionsCommand_PositionsMasksCountMismatch
class TranslateCommand(Command): class TranslateCommand(Command):
r"""
TranslateCommand is used to translate neutral joints and vertex positions.
Notes:
Joint translations are represented in parent space, so it is enough to translate only root joints, as that translation will be propagated to the rest of the joints.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _py3dnacalib.delete_TranslateCommand __swig_destroy__ = _py3dnacalib.delete_TranslateCommand
@ -621,6 +1154,12 @@ class TranslateCommand(Command):
_py3dnacalib.TranslateCommand_swiginit(self, _py3dnacalib.new_TranslateCommand(*args)) _py3dnacalib.TranslateCommand_swiginit(self, _py3dnacalib.new_TranslateCommand(*args))
def setTranslation(self, translation): def setTranslation(self, translation):
r"""
Method for setting the translation vector.
:type translation: dnac::Vector3
:param translation:
The translation vector.
"""
return _py3dnacalib.TranslateCommand_setTranslation(self, translation) return _py3dnacalib.TranslateCommand_setTranslation(self, translation)
def run(self, output): def run(self, output):

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

4298
lib/Maya2024/linux/dna.py Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

3862
lib/Maya2024/windows/dna.py Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.