Related to #24653: added scene.collada_export() function, to use instead of an
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 12 Nov 2010 14:36:58 +0000 (14:36 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 12 Nov 2010 14:36:58 +0000 (14:36 +0000)
operator for external render engines, since operators should not be called in
the render() callback.

source/blender/makesrna/SConscript
source/blender/makesrna/intern/CMakeLists.txt
source/blender/makesrna/intern/SConscript
source/blender/makesrna/intern/rna_scene_api.c

index d8937d0..d03d7c6 100644 (file)
@@ -48,6 +48,9 @@ if env['WITH_BF_LCMS']:
 if env['WITH_BF_GAMEENGINE']:
     defs.append('WITH_GAMEENGINE')
 
+if env['WITH_BF_COLLADA']:
+    defs.append('WITH_COLLADA')
+
 if env['BF_UNIT_TEST']:
     defs.append('UNIT_TEST')
 
index d021900..8ca2f8a 100644 (file)
@@ -136,6 +136,10 @@ IF(WITH_JACK)
        ADD_DEFINITIONS(-DWITH_JACK)
 ENDIF(WITH_JACK)
 
+IF(WITH_OPENCOLLADA)
+       ADD_DEFINITIONS(-DWITH_COLLADA)
+ENDIF(WITH_OPENCOLLADA)
+
 # Build makesrna executable
 ADD_EXECUTABLE(makesrna ${SRC} ${INC_FILES})
 TARGET_LINK_LIBRARIES(makesrna bf_dna)
index b8e30bc..ec58831 100644 (file)
@@ -88,6 +88,9 @@ if env['BF_UNIT_TEST']:
 if env['WITH_BF_PYTHON']:
     defs.append('WITH_PYTHON')
 
+if env['WITH_BF_COLLADA']:
+    defs.append('WITH_COLLADA')
+
 if env['OURPLATFORM'] == 'linux2':
     cflags='-pthread'
     incs += ' ../../../extern/binreloc/include'
index 4b5edb5..97a762b 100644 (file)
@@ -71,6 +71,17 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name
                BKE_makepicstring(name, rd->pic, (frame==INT_MIN) ? rd->cfra : frame, rd->imtype, rd->scemode & R_EXTENSION);
 }
 
+#ifdef WITH_COLLADA
+
+#include "../../collada/collada.h"
+
+static void rna_Scene_collada_export(Scene *scene, char *filepath)
+{
+       collada_export(scene, filepath);
+}
+
+#endif
+
 #else
 
 void RNA_api_scene(StructRNA *srna)
@@ -86,6 +97,14 @@ void RNA_api_scene(StructRNA *srna)
 
        func= RNA_def_function(srna, "update", "rna_Scene_update_tagged");
        RNA_def_function_ui_description(func, "Update data tagged to be updated from previous access to data or operators.");
+
+#ifdef WITH_COLLADA
+       func= RNA_def_function(srna, "collada_export", "rna_Scene_collada_export");
+       parm= RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file.");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+       RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */
+       RNA_def_function_ui_description(func, "Export to collada file.");
+#endif
 }
 
 void RNA_api_scene_render(StructRNA *srna)