Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions addons/ofxAssimp/src/Source/ofxAssimpSrcScene.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ struct ImportSettings {
// bool importLights = false;
bool convertToLeftHanded = true; // aiProcess_ConvertToLeftHanded
bool transformRootNode = true; // orient based on src scene root node, helps with correct orientation
bool applyTransformsToMeshesWithoutBones = false; // apply offset transforms to meshes without bones.
std::vector<std::string> excludeNodesContainingStrings;
unsigned int aiFlags = 0; // ai process flags, ie. aiProcess_FixInfacingNormals
};
Expand Down
8 changes: 4 additions & 4 deletions addons/ofxAssimp/src/ofxAssimpMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ std::size_t Mesh::getNumIndices() {
}

//-------------------------------------------
void Mesh::setSrcMesh( std::shared_ptr<ofxAssimp::SrcMesh> aSrcMesh ) {
void Mesh::setSrcMesh( std::shared_ptr<ofxAssimp::SrcMesh> aSrcMesh, bool bApplyTransform ) {
mSrcMesh = aSrcMesh;

// if we have bones, no offset, since we are controlled by the bones //
// if( mSrcMesh->getAiMesh() && mSrcMesh->getAiMesh()->mNumBones < 1 ) {
// setOfNodeFromAiMatrix(mSrcMesh->getAiNode()->mTransformation, this );
// }
if( bApplyTransform && mSrcMesh->getAiMesh() && mSrcMesh->getAiMesh()->mNumBones < 1 ) {
ofxAssimp::Utils::setOfNodeFromAiMatrix(mSrcMesh->getAiNode()->mTransformation, this );
}

if( mSrcMesh ) {
material = mSrcMesh->material;
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxAssimp/src/ofxAssimpMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Mesh : public ofxAssimp::Node {
aiMesh* getAiMesh();
std::size_t getNumIndices();

void setSrcMesh( std::shared_ptr<ofxAssimp::SrcMesh> aSrcMesh );
void setSrcMesh( std::shared_ptr<ofxAssimp::SrcMesh> aSrcMesh, bool bApplyTransform );

ofMesh& getStaticMesh();
ofMesh& getMesh();
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxAssimp/src/ofxAssimpScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void Scene::processSceneNodesRecursive( std::shared_ptr<ofxAssimp::SrcNode> aSrc
if( nodeType == ofxAssimp::NodeType::OFX_ASSIMP_MESH ) {
auto tmesh = make_shared<ofxAssimp::Mesh>();
auto srcMesh = std::dynamic_pointer_cast<ofxAssimp::SrcMesh>(aSrcNode);
tmesh->setSrcMesh( srcMesh );
tmesh->setSrcMesh( srcMesh, mSrcScene->getImportSettings().applyTransformsToMeshesWithoutBones );
mMeshes.push_back(tmesh);
newNode = tmesh;
} else if( nodeType == ofxAssimp::NodeType::OFX_ASSIMP_BONE ) {
Expand Down
Loading