From a5d0e99548056e42b6b74e033b6d4eec04548869 Mon Sep 17 00:00:00 2001 From: Gordon Chapman Date: Mon, 26 Apr 2021 12:19:20 -0700 Subject: [PATCH 1/3] Fixed error in blendShapeChannel Weighting --- code/AssetLib/FBX/FBXExporter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/AssetLib/FBX/FBXExporter.cpp b/code/AssetLib/FBX/FBXExporter.cpp index 322161411..e519f7e77 100644 --- a/code/AssetLib/FBX/FBXExporter.cpp +++ b/code/AssetLib/FBX/FBXExporter.cpp @@ -1789,13 +1789,13 @@ void FBXExporter::WriteObjects () blendchannel_uid, blendshape_name + FBX::SEPARATOR + "SubDeformer", "BlendShapeChannel" ); sdnode.AddChild("Version", int32_t(100)); - sdnode.AddChild("DeformPercent", int32_t(100)); + sdnode.AddChild("DeformPercent", float_t(0.0)); FBX::Node p("Properties70"); - p.AddP70numberA("DeformPercent", 100.); + p.AddP70numberA("DeformPercent", 0.0); sdnode.AddChild(p); // TODO: Normally just one weight per channel, adding stub for later development std::vectorfFullWeights; - fFullWeights.push_back(0.); + fFullWeights.push_back(100.); sdnode.AddChild("FullWeights", fFullWeights); sdnode.Dump(outstream, binary, indent); From cf498c979a64426f4a0d87a82d8c67b84c90fdb6 Mon Sep 17 00:00:00 2001 From: Jason C Date: Wed, 28 Apr 2021 11:16:49 -0400 Subject: [PATCH 2/3] ASSIMP_ENABLE_DEV_IMPORTERS env var to control registration of wip importers; applied to X3D - GetImporterInstanceList reads ASSIMP_ENABLE_DEV_IMPORTERS env var. Development importers are enabled if the env var is set and is not equal to the literal string "0". - X3D importer will not be registered unless ASSIMP_ENABLE_DEV_IMPORTERS is set; addresses #3647. TODO: If this change is incorporated, it should be documented. NOTE: Effective git branch structure is a better solution. This is an alternate for #3825. --- code/Common/ImporterRegistry.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/code/Common/ImporterRegistry.cpp b/code/Common/ImporterRegistry.cpp index a902fc89d..ddfcf6798 100644 --- a/code/Common/ImporterRegistry.cpp +++ b/code/Common/ImporterRegistry.cpp @@ -48,6 +48,7 @@ corresponding preprocessor flag to selectively disable formats. #include #include +#include // ------------------------------------------------------------------------------------------------ // Importers @@ -204,7 +205,17 @@ corresponding preprocessor flag to selectively disable formats. namespace Assimp { // ------------------------------------------------------------------------------------------------ -void GetImporterInstanceList(std::vector &out) { +void GetImporterInstanceList(std::vector &out) { + + // Some importers may be unimplemented or otherwise unsuitable for general use + // in their current state. Devs can set ASSIMP_ENABLE_DEV_IMPORTERS in their + // local environment to enable them, otherwise they're left out of the registry. + const char *envStr = std::getenv("ASSIMP_ENABLE_DEV_IMPORTERS"); + bool devImportersEnabled = envStr && strcmp(envStr, "0"); + + // Ensure no unused var warnings if all uses are #ifndef'd away below: + (void)devImportersEnabled; + // ---------------------------------------------------------------------------- // Add an instance of each worker class here // (register_new_importers_here) @@ -354,7 +365,9 @@ void GetImporterInstanceList(std::vector &out) { out.push_back(new D3MFImporter()); #endif #ifndef ASSIMP_BUILD_NO_X3D_IMPORTER - out.push_back(new X3DImporter()); + if (devImportersEnabled) { // https://github.com/assimp/assimp/issues/3647 + out.push_back(new X3DImporter()); + } #endif #ifndef ASSIMP_BUILD_NO_MMD_IMPORTER out.push_back(new MMDImporter()); From f17d58cadd714dda9ad186a465234a714727ed63 Mon Sep 17 00:00:00 2001 From: Eric Olson Date: Tue, 4 May 2021 13:38:38 -0500 Subject: [PATCH 3/3] Use POINTER(c_char) for binary data with pyassimp "For a general character pointer that may also point to binary data, POINTER(c_char) must be used." c_char_p is for a zero-terminated string. Reference: https://docs.python.org/3/library/ctypes.html#ctypes.c_char_p Applying this change to the 4.1.4 released python module fixes #2339 for me in Ubuntu. --- port/PyAssimp/pyassimp/structs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/port/PyAssimp/pyassimp/structs.py b/port/PyAssimp/pyassimp/structs.py index 809afae54..e1fba1950 100644 --- a/port/PyAssimp/pyassimp/structs.py +++ b/port/PyAssimp/pyassimp/structs.py @@ -1,6 +1,6 @@ #-*- coding: utf-8 -*- -from ctypes import POINTER, c_void_p, c_uint, c_char, c_float, Structure, c_char_p, c_double, c_ubyte, c_size_t, c_uint32 +from ctypes import POINTER, c_void_p, c_uint, c_char, c_float, Structure, c_double, c_ubyte, c_size_t, c_uint32 class Vector2D(Structure): @@ -1121,7 +1121,7 @@ class Scene(Structure): ("mMetadata", POINTER(Metadata)), # Internal data, do not touch - ("mPrivate", c_char_p), + ("mPrivate", POINTER(c_char)), ] assimp_structs_as_tuple = (Matrix4x4,