13 #include "COLLADASWAsset.h"
14 #include "COLLADASWBaseInputElement.h"
15 #include "COLLADASWBindMaterial.h"
16 #include "COLLADASWCamera.h"
17 #include "COLLADASWColorOrTexture.h"
18 #include "COLLADASWConstants.h"
19 #include "COLLADASWEffectProfile.h"
20 #include "COLLADASWImage.h"
21 #include "COLLADASWInputList.h"
22 #include "COLLADASWInstanceCamera.h"
23 #include "COLLADASWInstanceController.h"
24 #include "COLLADASWInstanceGeometry.h"
25 #include "COLLADASWInstanceLight.h"
26 #include "COLLADASWInstanceNode.h"
27 #include "COLLADASWLibraryAnimations.h"
28 #include "COLLADASWLibraryControllers.h"
29 #include "COLLADASWLibraryEffects.h"
30 #include "COLLADASWLibraryImages.h"
31 #include "COLLADASWLibraryMaterials.h"
32 #include "COLLADASWLibraryVisualScenes.h"
33 #include "COLLADASWNode.h"
34 #include "COLLADASWParamBase.h"
35 #include "COLLADASWParamTemplate.h"
36 #include "COLLADASWPrimitves.h"
37 #include "COLLADASWSampler.h"
38 #include "COLLADASWScene.h"
39 #include "COLLADASWSource.h"
40 #include "COLLADASWSurfaceInitOption.h"
41 #include "COLLADASWTechnique.h"
42 #include "COLLADASWTexture.h"
43 #include "COLLADASWVertices.h"
115 if (layer_index < 0) {
119 return data->layers[layer_index + n].name;
126 if (layer_index < 0) {
130 return data->layers[layer_index].name;
135 : blender_context(blender_context),
136 export_settings(BCExportSettings(export_settings, blender_context))
144 if (name ==
nullptr) {
154 COLLADABU::NativeString native_filename = COLLADABU::NativeString(
155 tempfile, COLLADABU::NativeString::ENCODING_UTF8);
156 return native_filename;
165 Scene *sce = blender_context.get_scene();
166 bContext *
C = blender_context.get_context();
174 COLLADASW::StreamWriter *writer =
new COLLADASW::StreamWriter(native_filename);
177 writer->startDocument();
180 COLLADASW::Asset asset(writer);
187 std::string unitname =
"meter";
188 float linearmeasure =
RNA_float_get(&unit_settings,
"scale_length");
193 if (linearmeasure == 0.001f) {
194 unitname =
"millimeter";
196 else if (linearmeasure == 0.01f) {
197 unitname =
"centimeter";
199 else if (linearmeasure == 0.1f) {
200 unitname =
"decimeter";
202 else if (linearmeasure == 1.0f) {
205 else if (linearmeasure == 1000.0f) {
206 unitname =
"kilometer";
210 if (linearmeasure == 0.0254f) {
213 else if (linearmeasure == 0.3048f) {
216 else if (linearmeasure == 0.9144f) {
224 asset.setUnit(unitname, linearmeasure);
225 asset.setUpAxisType(COLLADASW::Asset::Z_UP);
226 asset.getContributor().mAuthor =
"Blender User";
227 char version_buf[128];
228 #ifdef WITH_BUILDINFO
231 "Blender %s commit date:%s, commit time:%s, hash:%s",
239 asset.getContributor().mAuthoringTool = version_buf;
242 LinkNode *export_set = this->export_settings.get_export_set();
274 ArmatureExporter arm_exporter(blender_context, writer, this->export_settings);
275 ControllerExporter controller_exporter(blender_context, writer, this->export_settings);
277 this->export_settings.get_include_shapekeys()) {
283 SceneExporter se(blender_context, writer, &arm_exporter, this->export_settings);
285 if (this->export_settings.get_include_animations()) {
299 writer->endDocument();
303 fprintf(stdout,
"Collada export to: %s\n", this->export_settings.get_filepath());
304 int status =
BLI_rename(native_filename.c_str(), this->export_settings.get_filepath());
306 status =
BLI_copy(native_filename.c_str(), this->export_settings.get_filepath());
307 BLI_delete(native_filename.c_str(),
false,
false);
Blender kernel action and pose functionality.
const char * BKE_blender_version_string(void)
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_active_layer_index(const struct CustomData *data, int type)
int CustomData_get_layer_index(const struct CustomData *data, int type)
General operations, lookup, etc. for materials.
General operations, lookup, etc. for blender objects.
File and directory operations.
int BLI_delete(const char *file, bool dir, bool recursive) ATTR_NONNULL()
int BLI_rename(const char *from, const char *to) ATTR_NONNULL()
int BLI_copy(const char *file, const char *to) ATTR_NONNULL()
bool BLI_path_extension_ensure(char *path, size_t maxlen, const char *ext) ATTR_NONNULL()
void BLI_join_dirfile(char *__restrict dst, size_t maxlen, const char *__restrict dir, const char *__restrict file) ATTR_NONNULL()
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
Object groups, one object can be in many groups at once.
Object is a sort of wrapper for general info.
#define USER_UNIT_IMPERIAL
char * bc_CustomData_get_active_layer_name(const CustomData *data, int type)
static COLLADABU::NativeString make_temp_filepath(const char *name, const char *extension)
char * bc_CustomData_get_layer_name(const struct CustomData *data, int type, int n)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
void exportCameras(Scene *sce)
void export_controllers()
void exportScenes(const char *filename)
DocumentExporter(BlenderContext &blender_context, ExportSettings *export_settings)
void exportEffects(bContext *C, Scene *sce)
void exportImages(Scene *sce)
void exportLights(Scene *sce)
void exportMaterials(Scene *sce)
std::string translate_id(const char *idString)
void clear_global_id_map()
std::string id_name(void *id)
bool bc_has_object_type(LinkNode *export_set, short obtype)
void * BKE_tempdir_session
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
float RNA_float_get(PointerRNA *ptr, const char *name)
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)