Revision: 49805
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49805
Author:   aramis_acg
Date:     2012-08-11 13:42:44 +0000 (Sat, 11 Aug 2012)
Log Message:
-----------
- bf_fbx: add settings parameter to entry point, enable the assimp log pipe by 
default.

Modified Paths:
--------------
    branches/soc-2012-bratwurst/source/blender/assimp/SceneImporter.cpp
    branches/soc-2012-bratwurst/source/blender/assimp/SceneImporter.h
    branches/soc-2012-bratwurst/source/blender/fbx/bfbx.cpp
    branches/soc-2012-bratwurst/source/blender/fbx/bfbx.h
    
branches/soc-2012-bratwurst/source/blender/windowmanager/intern/wm_operators.c

Modified: branches/soc-2012-bratwurst/source/blender/assimp/SceneImporter.cpp
===================================================================
--- branches/soc-2012-bratwurst/source/blender/assimp/SceneImporter.cpp 
2012-08-11 13:41:59 UTC (rev 49804)
+++ branches/soc-2012-bratwurst/source/blender/assimp/SceneImporter.cpp 
2012-08-11 13:42:44 UTC (rev 49805)
@@ -103,6 +103,12 @@
 }
 
 
+Assimp::Importer& SceneImporter::get_importer()
+{
+       return importer;
+}
+
+
 const char* SceneImporter::get_file_path() const
 {
        return path;

Modified: branches/soc-2012-bratwurst/source/blender/assimp/SceneImporter.h
===================================================================
--- branches/soc-2012-bratwurst/source/blender/assimp/SceneImporter.h   
2012-08-11 13:41:59 UTC (rev 49804)
+++ branches/soc-2012-bratwurst/source/blender/assimp/SceneImporter.h   
2012-08-11 13:42:44 UTC (rev 49805)
@@ -102,6 +102,8 @@
 
        SceneImporter(const char* path, bContext& C, const 
bassimp_import_settings& settings);
        ~SceneImporter();
+
+       Assimp::Importer& get_importer();
        
        bool import();
        bool apply();

Modified: branches/soc-2012-bratwurst/source/blender/fbx/bfbx.cpp
===================================================================
--- branches/soc-2012-bratwurst/source/blender/fbx/bfbx.cpp     2012-08-11 
13:41:59 UTC (rev 49804)
+++ branches/soc-2012-bratwurst/source/blender/fbx/bfbx.cpp     2012-08-11 
13:42:44 UTC (rev 49805)
@@ -27,6 +27,8 @@
 #include <cassert>
 #include "../assimp/SceneImporter.h"
 
+#include "bfbx.h"
+
 extern "C"
 {
 #include "BKE_scene.h"
@@ -36,18 +38,27 @@
 #include "BLI_fileops.h"
 #include "BLI_path_util.h"
 
-       int bfbx_import(bContext *C, const char *filepath)
+       int bfbx_import(bContext *C, const char *filepath, const 
bfbx_import_settings* settings)
        {
                assert(C);
                assert(filepath);
 
-               bassimp_import_settings defaults;
-               defaults.enableAssimpLog = 0;
-               defaults.reports = NULL;
-               defaults.nolines = 0;
-               defaults.triangulate = 0;
+               bfbx_import_settings defaults;
 
-               bassimp::SceneImporter imp(filepath,*C,defaults);
+               defaults.assimp_settings.enableAssimpLog = 0;
+               defaults.assimp_settings.reports = NULL;
+               defaults.assimp_settings.nolines = 0;
+               defaults.assimp_settings.triangulate = 0;
+
+               if(!settings) {
+                       settings = &defaults;
+               }
+
+               bassimp::SceneImporter 
imp(filepath,*C,settings->assimp_settings);
+
+               //Assimp::Importer& ai_imp = imp.get_importer();
+               
//importer.SetPropertyInteger(AI_CONFIG_IMPORT_FBX_STRICT_MODE,settings->strict_mode);
+
                return imp.import() != 0 && imp.apply() != 0;
        }
 

Modified: branches/soc-2012-bratwurst/source/blender/fbx/bfbx.h
===================================================================
--- branches/soc-2012-bratwurst/source/blender/fbx/bfbx.h       2012-08-11 
13:41:59 UTC (rev 49804)
+++ branches/soc-2012-bratwurst/source/blender/fbx/bfbx.h       2012-08-11 
13:42:44 UTC (rev 49805)
@@ -34,11 +34,23 @@
 extern "C" {
 #endif
 
+       /* fbx import settings */
+       typedef struct bfbx_import_settings
+       {
+               /* settings for assimp */
+               bassimp_import_settings assimp_settings;
 
+               /* in strict mode, only the 2013 fbx format will be read. In 
non-strict
+                * mode the importer attempts to make the best out of the data 
it gets.*/
+               int strict_mode;
+
+       } bfbx_import_settings;
+
+
        /* import/export functions
         * both return 1 on success, 0 on error
         */
-       int bfbx_import(bContext *C, const char *filepath);
+       int bfbx_import(bContext *C, const char *filepath, const 
bfbx_import_settings* settings);
        //int bassimp_export(Scene *sce, const char *filepath, int selected, 
int apply_modifiers);
 #ifdef __cplusplus
 }

Modified: 
branches/soc-2012-bratwurst/source/blender/windowmanager/intern/wm_operators.c
===================================================================
--- 
branches/soc-2012-bratwurst/source/blender/windowmanager/intern/wm_operators.c  
    2012-08-11 13:41:59 UTC (rev 49804)
+++ 
branches/soc-2012-bratwurst/source/blender/windowmanager/intern/wm_operators.c  
    2012-08-11 13:42:44 UTC (rev 49805)
@@ -2233,6 +2233,7 @@
 /* function used for WM_OT_save_mainfile too */
 static int wm_fbx_import_exec(bContext *C, wmOperator *op)
 {
+       bfbx_import_settings settings;
        char filename[FILE_MAX];
 
        if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
@@ -2241,8 +2242,18 @@
        }
 
        RNA_string_get(op->ptr, "filepath", filename);
-       if (bfbx_import(C, filename)) return OPERATOR_FINISHED;
 
+       settings.assimp_settings.reports = op->reports;
+       settings.assimp_settings.triangulate = 0;
+       settings.assimp_settings.nolines = 0;
+       settings.assimp_settings.enableAssimpLog = 1;
+
+       settings.strict_mode = 0;
+
+       if (bfbx_import(C, filename, &settings)) { 
+               return OPERATOR_FINISHED;
+       }
+
        BKE_report(op->reports, RPT_ERROR, "Errors found during importing. 
Please see console for error log.");
 
        return OPERATOR_FINISHED;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to