[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48390] branches/soc-2012-bratwurst: - bf_fbx: FBX gets its own module, menu item and file handling ( even though the import function currently just invokes bf_assimp).
Alexander Gessler
alexander.gessler at gmx.net
Fri Jun 29 01:32:00 CEST 2012
Revision: 48390
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48390
Author: aramis_acg
Date: 2012-06-28 23:31:50 +0000 (Thu, 28 Jun 2012)
Log Message:
-----------
- bf_fbx: FBX gets its own module, menu item and file handling (even though the import function currently just invokes bf_assimp).
Modified Paths:
--------------
branches/soc-2012-bratwurst/CMakeLists.txt
branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_info.py
branches/soc-2012-bratwurst/source/blender/CMakeLists.txt
branches/soc-2012-bratwurst/source/blender/editors/space_file/file_draw.c
branches/soc-2012-bratwurst/source/blender/editors/space_file/filelist.c
branches/soc-2012-bratwurst/source/blender/editors/space_file/filesel.c
branches/soc-2012-bratwurst/source/blender/makesdna/DNA_space_types.h
branches/soc-2012-bratwurst/source/blender/windowmanager/CMakeLists.txt
branches/soc-2012-bratwurst/source/blender/windowmanager/intern/wm_operators.c
branches/soc-2012-bratwurst/source/creator/CMakeLists.txt
Added Paths:
-----------
branches/soc-2012-bratwurst/source/blender/fbx/
branches/soc-2012-bratwurst/source/blender/fbx/CMakeLists.txt
branches/soc-2012-bratwurst/source/blender/fbx/bfbx.cpp
branches/soc-2012-bratwurst/source/blender/fbx/bfbx.h
Modified: branches/soc-2012-bratwurst/CMakeLists.txt
===================================================================
--- branches/soc-2012-bratwurst/CMakeLists.txt 2012-06-28 22:42:12 UTC (rev 48389)
+++ branches/soc-2012-bratwurst/CMakeLists.txt 2012-06-28 23:31:50 UTC (rev 48390)
@@ -213,6 +213,7 @@
# disable opencollada on non-apple unix because opencollada has no package for debian
option(WITH_OPENCOLLADA "Enable OpenCollada Support (http://www.opencollada.org)" OFF)
option(WITH_ASSIMP "Enable Assimp Support (http://www.assimp.sourceforge.net)" OFF)
+option(WITH_FBX "Enable FBX support using Assimp" OFF)
# Sound output
option(WITH_SDL "Enable SDL for sound and joystick support" ON)
@@ -354,6 +355,10 @@
message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON")
endif()
+if(NOT WITH_ASSIMP AND WITH_FBX)
+ message(FATAL_ERROR "WITH_FBX requires WITH_ASSIMP")
+endif()
+
# may as well build python module without a UI
if(WITH_PYTHON_MODULE)
set(WITH_HEADLESS ON)
@@ -1792,6 +1797,7 @@
info_cfg_option(WITH_IK_ITASC)
info_cfg_option(WITH_OPENCOLLADA)
info_cfg_option(WITH_ASSIMP)
+ info_cfg_option(WITH_FBX)
info_cfg_option(WITH_FFTW3)
info_cfg_option(WITH_INTERNATIONAL)
info_cfg_option(WITH_INPUT_NDOF)
Modified: branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_info.py
===================================================================
--- branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_info.py 2012-06-28 22:42:12 UTC (rev 48389)
+++ branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_info.py 2012-06-28 23:31:50 UTC (rev 48390)
@@ -159,6 +159,8 @@
self.layout.operator("wm.collada_import", text="Collada (Default) (.dae)")
if hasattr(bpy.types, "WM_OT_assimp_import"):
self.layout.operator("wm.assimp_import", text="Open Asset Import Library (Default) (multiple)")
+ if hasattr(bpy.types, "WM_OT_fbx_import"):
+ self.layout.operator("wm.fbx_import", text="FBX (.fbx)")
class INFO_MT_file_export(Menu):
Modified: branches/soc-2012-bratwurst/source/blender/CMakeLists.txt
===================================================================
--- branches/soc-2012-bratwurst/source/blender/CMakeLists.txt 2012-06-28 22:42:12 UTC (rev 48389)
+++ branches/soc-2012-bratwurst/source/blender/CMakeLists.txt 2012-06-28 23:31:50 UTC (rev 48390)
@@ -135,3 +135,7 @@
if(WITH_ASSIMP)
add_subdirectory(assimp)
endif()
+
+if(WITH_FBX)
+ add_subdirectory(fbx)
+endif()
Modified: branches/soc-2012-bratwurst/source/blender/editors/space_file/file_draw.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/space_file/file_draw.c 2012-06-28 22:42:12 UTC (rev 48389)
+++ branches/soc-2012-bratwurst/source/blender/editors/space_file/file_draw.c 2012-06-28 23:31:50 UTC (rev 48390)
@@ -274,6 +274,8 @@
return ICON_FILE_BLANK;
else if (file->flags & ASSIMPFILE)
return ICON_FILE_BLANK;
+ else if (file->flags & FBXFILE)
+ return ICON_FILE_BLANK;
else
return ICON_FILE_BLANK;
}
Modified: branches/soc-2012-bratwurst/source/blender/editors/space_file/filelist.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/space_file/filelist.c 2012-06-28 22:42:12 UTC (rev 48389)
+++ branches/soc-2012-bratwurst/source/blender/editors/space_file/filelist.c 2012-06-28 23:31:50 UTC (rev 48390)
@@ -790,6 +790,9 @@
else if (BLI_testextensie(relname, ".dae")) {
return COLLADAFILE;
}
+ else if (BLI_testextensie(relname, ".fbx")) {
+ return FBXFILE;
+ }
else if (BLI_testextensie_array(relname, imb_ext_image) ||
(G.have_quicktime && BLI_testextensie_array(relname, imb_ext_image_qt)))
{
@@ -839,8 +842,10 @@
return ICON_FILE_BLANK;
else if (type == COLLADAFILE)
return ICON_FILE_BLANK;
- else if (type == ASSIMPFILE)
+ else if (type == ASSIMPFILE)
return ICON_FILE_BLANK;
+ else if (type == FBXFILE)
+ return ICON_FILE_BLANK;
return ICON_FILE_BLANK;
}
Modified: branches/soc-2012-bratwurst/source/blender/editors/space_file/filesel.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/space_file/filesel.c 2012-06-28 22:42:12 UTC (rev 48389)
+++ branches/soc-2012-bratwurst/source/blender/editors/space_file/filesel.c 2012-06-28 23:31:50 UTC (rev 48390)
@@ -183,6 +183,8 @@
params->filter |= RNA_boolean_get(op->ptr, "filter_collada") ? COLLADAFILE : 0;
if (RNA_struct_find_property(op->ptr, "filter_assimp"))
params->filter |= RNA_boolean_get(op->ptr, "filter_assimp") ? ASSIMPFILE : 0;
+ if (RNA_struct_find_property(op->ptr, "filter_fbx"))
+ params->filter |= RNA_boolean_get(op->ptr, "filter_fbx") ? FBXFILE : 0;
if (RNA_struct_find_property(op->ptr, "filter_glob")) {
RNA_string_get(op->ptr, "filter_glob", params->filter_glob);
params->filter |= (OPERATORFILE | FOLDERFILE);
Added: branches/soc-2012-bratwurst/source/blender/fbx/CMakeLists.txt
===================================================================
--- branches/soc-2012-bratwurst/source/blender/fbx/CMakeLists.txt (rev 0)
+++ branches/soc-2012-bratwurst/source/blender/fbx/CMakeLists.txt 2012-06-28 23:31:50 UTC (rev 48390)
@@ -0,0 +1,54 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# The Original Code is Copyright (C) 2006, Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): Alexander Gessler.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+remove_strict_flags()
+
+set(INC
+ .
+ ../blenkernel
+ ../blenlib
+ ../blenloader
+ ../editors/include
+ ../makesdna
+ ../makesrna
+ ../windowmanager
+ ../../../intern/guardedalloc
+)
+
+
+set(INC_SYS
+)
+
+set(SRC
+
+ bfbx.cpp
+ bfbx.h
+)
+
+if(WITH_BUILDINFO)
+ add_definitions(-DWITH_BUILDINFO)
+endif()
+
+blender_add_lib(bf_fbx "${SRC}" "${INC}" "${INC_SYS}")
Added: branches/soc-2012-bratwurst/source/blender/fbx/bfbx.cpp
===================================================================
--- branches/soc-2012-bratwurst/source/blender/fbx/bfbx.cpp (rev 0)
+++ branches/soc-2012-bratwurst/source/blender/fbx/bfbx.cpp 2012-06-28 23:31:50 UTC (rev 48390)
@@ -0,0 +1,55 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Alexander Gessler
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/assimp/bfbx.cpp
+ * \ingroup fbx
+ */
+
+#include <cassert>
+#include "../assimp/SceneImporter.h"
+
+extern "C"
+{
+#include "BKE_scene.h"
+#include "BKE_context.h"
+
+/* make dummy file */
+#include "BLI_fileops.h"
+#include "BLI_path_util.h"
+
+ int bfbx_import(bContext *C, const char *filepath)
+ {
+ assert(C);
+ assert(filepath);
+
+ bassimp::SceneImporter imp(filepath,*C);
+ return imp.import() != 0 && imp.apply() != 0;
+ }
+
+ /*
+ // export to fbx not currently implemented
+ int bfbx_export(Scene *sce, const char *filepath, int selected, int apply_modifiers)
+ {
+
+ return 0;
+ } */
+}
Added: branches/soc-2012-bratwurst/source/blender/fbx/bfbx.h
===================================================================
--- branches/soc-2012-bratwurst/source/blender/fbx/bfbx.h (rev 0)
+++ branches/soc-2012-bratwurst/source/blender/fbx/bfbx.h 2012-06-28 23:31:50 UTC (rev 48390)
@@ -0,0 +1,47 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Alexander Gessler.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file bfbx.h
+ * \ingroup fbx
+ */
+
+#ifndef INCLUDED_BFBX_H
+#define INCLUDED_BFBX_H
+
+struct bContext;
+struct Scene;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /* import/export functions
+ * both return 1 on success, 0 on error
+ */
+ int bfbx_import(bContext *C, const char *filepath);
+ //int bassimp_export(Scene *sce, const char *filepath, int selected, int apply_modifiers);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Modified: branches/soc-2012-bratwurst/source/blender/makesdna/DNA_space_types.h
===================================================================
--- branches/soc-2012-bratwurst/source/blender/makesdna/DNA_space_types.h 2012-06-28 22:42:12 UTC (rev 48389)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list