Merge branch 'master' into master

pull/3922/head
Kim Kulling 2021-05-29 15:47:24 +02:00 committed by GitHub
commit 8f18820bb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 105 additions and 31 deletions

View File

@ -1,8 +1,8 @@
--- ---
name: Bug report name: Bug report
about: Create a report to help us improve about: Create a report to help us improve
title: '' title: 'Bug:'
labels: '' labels: 'Bug'
assignees: '' assignees: ''
--- ---
@ -23,16 +23,10 @@ A clear and concise description of what you expected to happen.
**Screenshots** **Screenshots**
If applicable, add screenshots to help explain your problem. If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):** **Platform (please complete the following information):**
- OS: [e.g. iOS] - OS: [e.g. iOS]
- Browser [e.g. chrome, safari] - Browser [e.g. chrome, safari]
- Version [e.g. 22] - Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context** **Additional context**
Add any other context about the problem here. Add any other context about the problem here.

View File

@ -2,7 +2,7 @@
name: Feature request name: Feature request
about: Suggest an idea for this project about: Suggest an idea for this project
title: '' title: ''
labels: '' labels: 'Feature-Request'
assignees: '' assignees: ''
--- ---

View File

@ -0,0 +1,25 @@
---
name: Technical debt
about: Create a report to help us to fix and detect tech debts
title: ''
labels: 'Techdebt'
assignees: ''
---
**Describe the technical debt**
A clear and concise description of what the tech debt is about.
**Better solution**
A clear and concise description of what you would expect.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@ -419,7 +419,8 @@ bool PLY::DOM::ParseHeader(IOStreamBuffer<char> &streamBuffer, std::vector<char>
if (PLY::Element::ParseElement(streamBuffer, buffer, &out)) { if (PLY::Element::ParseElement(streamBuffer, buffer, &out)) {
// add the element to the list of elements // add the element to the list of elements
alElements.push_back(out); alElements.push_back(out);
} else if (TokenMatch(buffer, "end_header", 10)) { } else if ( TokenMatch(buffer, "end_header\r", 11) || //checks for header end with /r/n ending
TokenMatch(buffer, "end_header", 10)) { //checks for /n ending, if it doesn't end with /r/n
// we have reached the end of the header // we have reached the end of the header
break; break;
} else { } else {

View File

@ -58,7 +58,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma clang diagnostic ignored "-Wsign-compare" #pragma clang diagnostic ignored "-Wsign-compare"
#elif defined(__GNUC__) #elif defined(__GNUC__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#if (__GNUC__ > 4)
#pragma GCC diagnostic ignored "-Wbool-compare" #pragma GCC diagnostic ignored "-Wbool-compare"
#endif
#pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Wsign-compare"
#endif #endif

View File

@ -1137,6 +1137,9 @@ ELSE()
TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror) TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror)
ENDIF() ENDIF()
# adds C_FLAGS required to compile zip.c on old GCC 4.x compiler
TARGET_COMPILE_FEATURES(assimp PUBLIC c_std_99)
TARGET_INCLUDE_DIRECTORIES ( assimp PUBLIC TARGET_INCLUDE_DIRECTORIES ( assimp PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../include> $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../include>

View File

@ -344,8 +344,10 @@ const aiExportDataBlob* Exporter::ExportToBlob( const aiScene* pScene, const cha
pimpl->blob = nullptr; pimpl->blob = nullptr;
} }
auto baseName = pProperties ? pProperties->GetPropertyString(AI_CONFIG_EXPORT_BLOB_NAME, AI_BLOBIO_MAGIC) : AI_BLOBIO_MAGIC;
std::shared_ptr<IOSystem> old = pimpl->mIOSystem; std::shared_ptr<IOSystem> old = pimpl->mIOSystem;
BlobIOSystem* blobio = new BlobIOSystem(); BlobIOSystem *blobio = new BlobIOSystem(baseName);
pimpl->mIOSystem = std::shared_ptr<IOSystem>( blobio ); pimpl->mIOSystem = std::shared_ptr<IOSystem>( blobio );
if (AI_SUCCESS != Export(pScene,pFormatId,blobio->GetMagicFileName(), pPreprocessing, pProperties)) { if (AI_SUCCESS != Export(pScene,pFormatId,blobio->GetMagicFileName(), pPreprocessing, pProperties)) {

View File

@ -194,8 +194,14 @@ class BlobIOSystem : public IOSystem {
friend class BlobIOStream; friend class BlobIOStream;
typedef std::pair<std::string, aiExportDataBlob *> BlobEntry; typedef std::pair<std::string, aiExportDataBlob *> BlobEntry;
public: public:
BlobIOSystem() { BlobIOSystem() :
baseName{AI_BLOBIO_MAGIC} {
}
BlobIOSystem(const std::string &baseName) :
baseName(baseName) {
} }
virtual ~BlobIOSystem() { virtual ~BlobIOSystem() {
@ -207,27 +213,32 @@ public:
public: public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
const char *GetMagicFileName() const { const char *GetMagicFileName() const {
return AI_BLOBIO_MAGIC; return baseName.c_str();
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------
aiExportDataBlob *GetBlobChain() { aiExportDataBlob *GetBlobChain() {
const auto magicName = std::string(this->GetMagicFileName());
const bool hasBaseName = baseName != AI_BLOBIO_MAGIC;
// one must be the master // one must be the master
aiExportDataBlob *master = nullptr, *cur; aiExportDataBlob *master = nullptr, *cur;
for (const BlobEntry &blobby : blobs) { for (const BlobEntry &blobby : blobs) {
if (blobby.first == AI_BLOBIO_MAGIC) { if (blobby.first == magicName) {
master = blobby.second; master = blobby.second;
master->name.Set(hasBaseName ? blobby.first : "");
break; break;
} }
} }
if (!master) { if (!master) {
ASSIMP_LOG_ERROR("BlobIOSystem: no data written or master file was not closed properly."); ASSIMP_LOG_ERROR("BlobIOSystem: no data written or master file was not closed properly.");
return nullptr; return nullptr;
} }
master->name.Set("");
cur = master; cur = master;
for (const BlobEntry &blobby : blobs) { for (const BlobEntry &blobby : blobs) {
if (blobby.second == master) { if (blobby.second == master) {
continue; continue;
@ -236,10 +247,14 @@ public:
cur->next = blobby.second; cur->next = blobby.second;
cur = cur->next; cur = cur->next;
if (hasBaseName) {
cur->name.Set(blobby.first);
} else {
// extract the file extension from the file written // extract the file extension from the file written
const std::string::size_type s = blobby.first.find_first_of('.'); const std::string::size_type s = blobby.first.find_first_of('.');
cur->name.Set(s == std::string::npos ? blobby.first : blobby.first.substr(s + 1)); cur->name.Set(s == std::string::npos ? blobby.first : blobby.first.substr(s + 1));
} }
}
// give up blob ownership // give up blob ownership
blobs.clear(); blobs.clear();
@ -283,6 +298,7 @@ private:
} }
private: private:
std::string baseName;
std::set<std::string> created; std::set<std::string> created;
std::vector<BlobEntry> blobs; std::vector<BlobEntry> blobs;
}; };

View File

@ -88,9 +88,17 @@ public:
underlying << sin; underlying << sin;
} }
// Same problem as the copy constructor below, but with root cause is that stream move
// is not permitted on older GCC versions. Small performance impact on those platforms.
#if defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ <= 9)
basic_formatter(basic_formatter&& other) {
underlying << (string)other;
}
#else
basic_formatter(basic_formatter&& other) basic_formatter(basic_formatter&& other)
: underlying(std::move(other.underlying)) { : underlying(std::move(other.underlying)) {
} }
#endif
// The problem described here: // The problem described here:
// https://sourceforge.net/tracker/?func=detail&atid=1067632&aid=3358562&group_id=226462 // https://sourceforge.net/tracker/?func=detail&atid=1067632&aid=3358562&group_id=226462

View File

@ -137,7 +137,7 @@ struct aiCamera
*/ */
C_STRUCT aiVector3D mLookAt; C_STRUCT aiVector3D mLookAt;
/** Half horizontal field of view angle, in radians. /** Horizontal field of view angle, in radians.
* *
* The field of view angle is the angle between the center * The field of view angle is the angle between the center
* line of the screen and the left or right border. * line of the screen and the left or right border.

View File

@ -205,16 +205,22 @@ struct aiExportDataBlob {
void *data; void *data;
/** Name of the blob. An empty string always /** Name of the blob. An empty string always
indicates the first (and primary) blob, * indicates the first (and primary) blob,
which contains the actual file data. * which contains the actual file data.
Any other blobs are auxiliary files produced * Any other blobs are auxiliary files produced
by exporters (i.e. material files). Existence * by exporters (i.e. material files). Existence
of such files depends on the file format. Most * of such files depends on the file format. Most
formats don't split assets across multiple files. * formats don't split assets across multiple files.
*
If used, blob names usually contain the file * If used, blob names usually contain the file
extension that should be used when writing * extension that should be used when writing
the data to disc. * the data to disc.
*
* The blob names generated can be influenced by
* setting the #AI_CONFIG_EXPORT_BLOB_NAME export
* property to the name that is used for the master
* blob. All other names are typically derived from
* the base name, by the file format exporter.
*/ */
C_STRUCT aiString name; C_STRUCT aiString name;

View File

@ -1075,6 +1075,23 @@ enum aiComponent
*/ */
#define AI_CONFIG_EXPORT_POINT_CLOUDS "EXPORT_POINT_CLOUDS" #define AI_CONFIG_EXPORT_POINT_CLOUDS "EXPORT_POINT_CLOUDS"
/**
* @brief Specifies the blob name, assimp uses for exporting.
*
* Some formats require auxiliary files to be written, that need to be linked back into
* the original file. For example, OBJ files export materials to a separate MTL file and
* use the `mtllib` keyword to reference this file.
*
* When exporting blobs using #ExportToBlob, assimp does not know the name of the blob
* file and thus outputs `mtllib $blobfile.mtl`, which might not be desired, since the
* MTL file might be called differently.
*
* This property can be used to give the exporter a hint on how to use the magic
* `$blobfile` keyword. If the exporter detects the keyword and is provided with a name
* for the blob, it instead uses this name.
*/
#define AI_CONFIG_EXPORT_BLOB_NAME "EXPORT_BLOB_NAME"
/** /**
* @brief Specifies a gobal key factor for scale, float value * @brief Specifies a gobal key factor for scale, float value
*/ */