Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaia Clary <gaia.clary@machinimatrix.org>2018-02-28 19:29:56 +0300
committerGaia Clary <gaia.clary@machinimatrix.org>2018-02-28 19:29:56 +0300
commit4a892adac5937fdaa19d0309e5195a83bdb14e72 (patch)
treec99b8fbccb904a59983e82ee3ede24d967dece03 /source/blender/collada
parente73fe77ac09fdad139447b3a00370203049676fc (diff)
parenta363324f7fbba599522d93c4b20d7ada209967d9 (diff)
merge from master (needed to fix collada headerfiles which have been modified in master and in blender2.8 slightly different)
Diffstat (limited to 'source/blender/collada')
-rw-r--r--source/blender/collada/DocumentExporter.cpp1
-rw-r--r--source/blender/collada/DocumentExporter.h4
-rw-r--r--source/blender/collada/ExportSettings.h27
-rw-r--r--source/blender/collada/ImportSettings.h7
-rw-r--r--source/blender/collada/collada.cpp103
-rw-r--r--source/blender/collada/collada.h54
6 files changed, 52 insertions, 144 deletions
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index 437cdac974b..04af73f2406 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -181,6 +181,7 @@ static COLLADABU::NativeString make_temp_filepath(const char *name, const char *
// COLLADA allows this through multiple <channel>s in <animation>.
// For this to work, we need to know objects that use a certain action.
+
int DocumentExporter::exportCurrentScene(Scene *sce)
{
PointerRNA sceneptr, unit_settings;
diff --git a/source/blender/collada/DocumentExporter.h b/source/blender/collada/DocumentExporter.h
index badf4f5a653..68e1523fbee 100644
--- a/source/blender/collada/DocumentExporter.h
+++ b/source/blender/collada/DocumentExporter.h
@@ -27,10 +27,11 @@
#ifndef __DOCUMENTEXPORTER_H__
#define __DOCUMENTEXPORTER_H__
-#include "ExportSettings.h"
+#include "collada.h"
extern "C" {
#include "DNA_customdata_types.h"
+
}
struct Scene;
@@ -40,6 +41,7 @@ class DocumentExporter
public:
DocumentExporter(EvaluationContext *eval_ctx, const ExportSettings *export_settings);
int exportCurrentScene(Scene *sce);
+
void exportScenes(const char *filename);
private:
const ExportSettings *export_settings;
diff --git a/source/blender/collada/ExportSettings.h b/source/blender/collada/ExportSettings.h
index 620ccedd544..b6a7c1f1b4e 100644
--- a/source/blender/collada/ExportSettings.h
+++ b/source/blender/collada/ExportSettings.h
@@ -27,11 +27,24 @@
#ifndef __EXPORTSETTINGS_H__
#define __EXPORTSETTINGS_H__
-#include "collada.h"
-#include "collada.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "BLI_linklist.h"
+
+typedef enum BC_export_mesh_type {
+ BC_MESH_TYPE_VIEW,
+ BC_MESH_TYPE_RENDER
+} BC_export_mesh_type;
+
+typedef enum BC_export_transformation_type {
+ BC_TRANSFORMATION_TYPE_MATRIX,
+ BC_TRANSFORMATION_TYPE_TRANSROTLOC
+} BC_export_transformation_type;
-struct ExportSettings {
-public:
+
+typedef struct ExportSettings {
bool apply_modifiers;
BC_export_mesh_type export_mesh_type;
@@ -59,6 +72,10 @@ public:
char *filepath;
LinkNode *export_set;
-};
+} ExportSettings;
+
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/source/blender/collada/ImportSettings.h b/source/blender/collada/ImportSettings.h
index 4a2d4e8046a..fb4277b048f 100644
--- a/source/blender/collada/ImportSettings.h
+++ b/source/blender/collada/ImportSettings.h
@@ -27,10 +27,7 @@
#ifndef __IMPORTSETTINGS_H__
#define __IMPORTSETTINGS_H__
-#include "collada.h"
-
-struct ImportSettings {
-public:
+typedef struct ImportSettings {
bool import_units;
bool find_chains;
bool auto_connect;
@@ -38,6 +35,6 @@ public:
int min_chain_length;
char *filepath;
bool keep_bind_info;
-};
+} ImportSettings;
#endif
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index b86246c1399..64e3a4c36ce 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -44,100 +44,29 @@ extern "C"
#include "BLI_fileops.h"
#include "BLI_linklist.h"
-int collada_import(bContext *C,
- const char *filepath,
- int import_units,
- int find_chains,
- int auto_connect,
- int fix_orientation,
- int min_chain_length,
- int keep_bind_info)
+int collada_import(bContext *C, ImportSettings *import_settings)
{
-
- ImportSettings import_settings;
- import_settings.filepath = (char *)filepath;
- import_settings.import_units = import_units != 0;
- import_settings.auto_connect = auto_connect != 0;
- import_settings.find_chains = find_chains != 0;
- import_settings.fix_orientation = fix_orientation != 0;
- import_settings.min_chain_length = min_chain_length;
- import_settings.keep_bind_info = keep_bind_info !=0;
-
- DocumentImporter imp(C, &import_settings);
- if (imp.import()) return 1;
-
- return 0;
+ DocumentImporter imp(C, import_settings);
+ return (imp.import())? 1:0;
}
-int collada_export(
- EvaluationContext *eval_ctx,
- Scene *sce,
- const char *filepath,
-
- int apply_modifiers,
- BC_export_mesh_type export_mesh_type,
-
- int selected,
- int include_children,
- int include_armatures,
- int include_shapekeys,
- int deform_bones_only,
- int include_animations,
- int sampling_rate,
-
- int active_uv_only,
- int include_material_textures,
- int use_texture_copies,
-
- int triangulate,
- int use_object_instantiation,
- int use_blender_profile,
- int sort_by_name,
- BC_export_transformation_type export_transformation_type,
- int open_sim,
- int limit_precision,
- int keep_bind_info)
+int collada_export(EvaluationContext *eval_ctx,
+ Scene *sce,
+ ExportSettings *export_settings)
{
- ExportSettings export_settings;
-
ViewLayer *view_layer = eval_ctx->view_layer;
- export_settings.filepath = (char *)filepath;
-
- export_settings.apply_modifiers = apply_modifiers != 0;
- export_settings.export_mesh_type = export_mesh_type;
- export_settings.selected = selected != 0;
- export_settings.include_children = include_children != 0;
- export_settings.include_armatures = include_armatures != 0;
- export_settings.include_shapekeys = include_shapekeys != 0;
- export_settings.deform_bones_only = deform_bones_only != 0;
- export_settings.include_animations = include_animations;
- export_settings.sampling_rate = sampling_rate;
-
- export_settings.active_uv_only = active_uv_only != 0;
- export_settings.include_material_textures= include_material_textures != 0;
- export_settings.use_texture_copies = use_texture_copies != 0;
-
- export_settings.triangulate = triangulate != 0;
- export_settings.use_object_instantiation = use_object_instantiation != 0;
- export_settings.use_blender_profile = use_blender_profile != 0;
- export_settings.sort_by_name = sort_by_name != 0;
- export_settings.export_transformation_type = export_transformation_type;
- export_settings.open_sim = open_sim != 0;
- export_settings.limit_precision = limit_precision != 0;
- export_settings.keep_bind_info = keep_bind_info !=0;
-
int includeFilter = OB_REL_NONE;
- if (export_settings.include_armatures) includeFilter |= OB_REL_MOD_ARMATURE;
- if (export_settings.include_children) includeFilter |= OB_REL_CHILDREN_RECURSIVE;
+ if (export_settings->include_armatures) includeFilter |= OB_REL_MOD_ARMATURE;
+ if (export_settings->include_children) includeFilter |= OB_REL_CHILDREN_RECURSIVE;
- eObjectSet objectSet = (export_settings.selected) ? OB_SET_SELECTED : OB_SET_ALL;
- export_settings.export_set = BKE_object_relational_superset(view_layer, objectSet, (eObRelationTypes)includeFilter);
+ eObjectSet objectSet = (export_settings->selected) ? OB_SET_SELECTED : OB_SET_ALL;
+ export_settings->export_set = BKE_object_relational_superset(view_layer, objectSet, (eObRelationTypes)includeFilter);
- int export_count = BLI_linklist_count(export_settings.export_set);
+ int export_count = BLI_linklist_count(export_settings->export_set);
if (export_count == 0) {
- if (export_settings.selected) {
+ if (export_settings->selected) {
fprintf(stderr, "Collada: Found no objects to export.\nPlease ensure that all objects which shall be exported are also visible in the 3D Viewport.\n");
}
else {
@@ -145,14 +74,14 @@ int collada_export(
}
}
else {
- if (export_settings.sort_by_name)
- bc_bubble_sort_by_Object_name(export_settings.export_set);
+ if (export_settings->sort_by_name)
+ bc_bubble_sort_by_Object_name(export_settings->export_set);
}
- DocumentExporter exporter(eval_ctx, &export_settings);
+ DocumentExporter exporter(eval_ctx, export_settings);
int status = exporter.exportCurrentScene(sce);
- BLI_linklist_free(export_settings.export_set, NULL);
+ BLI_linklist_free(export_settings->export_set, NULL);
return (status) ? -1:export_count;
}
diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h
index 47272255012..f95fca03b65 100644
--- a/source/blender/collada/collada.h
+++ b/source/blender/collada/collada.h
@@ -28,6 +28,10 @@
#define __COLLADA_H__
#include <stdlib.h>
+
+#include "ImportSettings.h"
+#include "ExportSettings.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -36,16 +40,6 @@ extern "C" {
#include "BLI_path_util.h"
#include "RNA_types.h"
-typedef enum BC_export_mesh_type {
- BC_MESH_TYPE_VIEW,
- BC_MESH_TYPE_RENDER
-} BC_export_mesh_type;
-
-typedef enum BC_export_transformation_type {
- BC_TRANSFORMATION_TYPE_MATRIX,
- BC_TRANSFORMATION_TYPE_TRANSROTLOC
-} BC_export_transformation_type;
-
struct bContext;
struct Scene;
struct ViewLayer;
@@ -55,44 +49,12 @@ struct EvaluationContext;
* both return 1 on success, 0 on error
*/
int collada_import(struct bContext *C,
- const char *filepath,
- int import_units,
- int find_chains,
- int auto_connect,
- int fix_orientation,
- int min_chain_length,
-
- int keep_bind_info);
-
-int collada_export(
- EvaluationContext *eval_ctx,
- Scene *sce,
- const char *filepath,
-
- int apply_modifiers,
- BC_export_mesh_type export_mesh_type,
-
- int selected,
- int include_children,
- int include_armatures,
- int include_shapekeys,
- int deform_bones_only,
- int include_animations,
- int sampling_rate,
-
- int active_uv_only,
- int include_material_textures,
- int use_texture_copies,
+ ImportSettings *import_settings);
- int triangulate,
- int use_object_instantiation,
- int use_blender_profile,
- int sort_by_name,
- BC_export_transformation_type export_transformation_type,
- int open_sim,
- int limit_precision,
- int keep_bind_info);
+int collada_export(struct EvaluationContext *eval_ctx,
+ struct Scene *sce,
+ ExportSettings *export_settings);
#ifdef __cplusplus
}