diff options
Diffstat (limited to 'source/blender/editors/io')
-rw-r--r-- | source/blender/editors/io/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/editors/io/io_alembic.c | 18 | ||||
-rw-r--r-- | source/blender/editors/io/io_collada.c | 53 |
3 files changed, 29 insertions, 43 deletions
diff --git a/source/blender/editors/io/CMakeLists.txt b/source/blender/editors/io/CMakeLists.txt index b3bbce939a5..4d3f106a5d6 100644 --- a/source/blender/editors/io/CMakeLists.txt +++ b/source/blender/editors/io/CMakeLists.txt @@ -24,6 +24,7 @@ set(INC ../../blenlib ../../blentranslation ../../bmesh + ../../depsgraph ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/blender/editors/io/io_alembic.c b/source/blender/editors/io/io_alembic.c index 08181af2ef3..b584782e183 100644 --- a/source/blender/editors/io/io_alembic.c +++ b/source/blender/editors/io/io_alembic.c @@ -545,20 +545,10 @@ static int wm_alembic_import_exec(bContext *C, wmOperator *op) } } - /* Switch to object mode to avoid being stuck in other modes (T54326). */ - if (CTX_data_mode_enum(C) != CTX_MODE_OBJECT) { - Object *obedit = CTX_data_edit_object(C); - - if (obedit != NULL) { - ED_object_mode_toggle(C, obedit->mode); - } - else { - Object *ob = CTX_data_active_object(C); - - if (ob) { - ED_object_mode_toggle(C, ob->mode); - } - } + /* Switch out of edit mode to avoid being stuck in it (T54326). */ + Object *obedit = CTX_data_edit_object(C); + if (obedit) { + ED_object_mode_toggle(C, OB_MODE_EDIT); } bool ok = ABC_import(C, filename, scale, is_sequence, set_frame_range, diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c index e6c9b924c7f..a42aeee912b 100644 --- a/source/blender/editors/io/io_collada.c +++ b/source/blender/editors/io/io_collada.c @@ -28,7 +28,7 @@ * \ingroup collada */ #ifdef WITH_COLLADA -#include "DNA_scene_types.h" +#include "DNA_space_types.h" #include "BLT_translation.h" @@ -36,12 +36,13 @@ #include "BLI_utildefines.h" #include "BKE_context.h" -#include "BKE_depsgraph.h" #include "BKE_global.h" #include "BKE_main.h" #include "BKE_report.h" #include "BKE_object.h" +#include "DEG_depsgraph.h" + #include "ED_screen.h" #include "ED_object.h" @@ -58,6 +59,8 @@ #include "io_collada.h" +#include "DEG_depsgraph.h" + static int wm_collada_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { if (!RNA_struct_property_is_set(op->ptr, "filepath")) { @@ -80,6 +83,7 @@ static int wm_collada_export_invoke(bContext *C, wmOperator *op, const wmEvent * /* function used for WM_OT_save_mainfile too */ static int wm_collada_export_exec(bContext *C, wmOperator *op) { + EvaluationContext eval_ctx; char filepath[FILE_MAX]; int apply_modifiers; int export_mesh_type; @@ -93,7 +97,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) int sample_animations; int sampling_rate; - int export_texture_type; + int include_material_textures; int use_texture_copies; int active_uv_only; @@ -109,6 +113,8 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) int export_count; + CTX_data_eval_ctx(C, &eval_ctx); + if (!RNA_struct_property_is_set(op->ptr, "filepath")) { BKE_report(op->reports, RPT_ERROR, "No filename given"); return OPERATOR_CANCELLED; @@ -149,7 +155,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) deform_bones_only = RNA_boolean_get(op->ptr, "deform_bones_only"); - export_texture_type = RNA_enum_get(op->ptr, "export_texture_type_selection"); + include_material_textures = RNA_boolean_get(op->ptr, "include_material_textures"); use_texture_copies = RNA_boolean_get(op->ptr, "use_texture_copies"); active_uv_only = RNA_boolean_get(op->ptr, "active_uv_only"); @@ -166,8 +172,9 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) /* get editmode results */ ED_object_editmode_load(CTX_data_edit_object(C)); - EvaluationContext *eval_ctx = G.main->eval_ctx; Scene *scene = CTX_data_scene(C); + CTX_data_eval_ctx(C, &eval_ctx); + ExportSettings export_settings; export_settings.filepath = filepath; @@ -183,7 +190,6 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) export_settings.sampling_rate = sampling_rate; export_settings.active_uv_only = active_uv_only != 0; - export_settings.export_texture_type = export_texture_type; export_settings.use_texture_copies = use_texture_copies != 0; export_settings.triangulate = triangulate != 0; @@ -199,8 +205,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) if (export_settings.include_armatures) includeFilter |= OB_REL_MOD_ARMATURE; if (export_settings.include_children) includeFilter |= OB_REL_CHILDREN_RECURSIVE; - - export_count = collada_export(eval_ctx, + export_count = collada_export(&eval_ctx, scene, &export_settings ); @@ -273,7 +278,7 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr) uiItemR(row, imfptr, "active_uv_only", 0, NULL, ICON_NONE); row = uiLayoutRow(box, false); - uiItemR(row, imfptr, "export_texture_type_selection", 0, "", ICON_NONE); + uiItemR(row, imfptr, "include_material_textures", 0, NULL, ICON_NONE); row = uiLayoutRow(box, false); uiItemR(row, imfptr, "use_texture_copies", 1, NULL, ICON_NONE); @@ -350,15 +355,9 @@ void WM_OT_collada_export(wmOperatorType *ot) }; static const EnumPropertyItem prop_bc_export_transformation_type[] = { - { BC_TRANSFORMATION_TYPE_MATRIX, "matrix", 0, "Matrix", "Use <matrix> to specify transformations" }, - { BC_TRANSFORMATION_TYPE_TRANSROTLOC, "transrotloc", 0, "TransRotLoc", "Use <translate>, <rotate>, <scale> to specify transformations" }, - { 0, NULL, 0, NULL, NULL } - }; - - static const EnumPropertyItem prop_bc_export_texture_type[] = { - { BC_TEXTURE_TYPE_MAT, "mat", 0, "Materials", "Export Materials" }, - { BC_TEXTURE_TYPE_UV, "uv", 0, "UV Textures", "Export UV Textures (Face textures) as materials" }, - { 0, NULL, 0, NULL, NULL } + {BC_TRANSFORMATION_TYPE_MATRIX, "matrix", 0, "Matrix", "Use <matrix> to specify transformations"}, + {BC_TRANSFORMATION_TYPE_TRANSROTLOC, "transrotloc", 0, "TransRotLoc", "Use <translate>, <rotate>, <scale> to specify transformations"}, + {0, NULL, 0, NULL, NULL} }; ot->name = "Export COLLADA"; @@ -412,9 +411,13 @@ void WM_OT_collada_export(wmOperatorType *ot) RNA_def_int(func, "sampling_rate", 1, 1, INT_MAX, "Sampling Rate", "The distance between 2 keyframes. 1 means: Every frame is keyed", 1, INT_MAX); + RNA_def_boolean(func, "active_uv_only", 0, "Only Selected UV Map", "Export only the selected UV Map"); + RNA_def_boolean(func, "include_material_textures", 0, "Include Material Textures", + "Export textures assigned to the object Materials"); + RNA_def_boolean(func, "use_texture_copies", 1, "Copy", "Copy textures to same folder where the .dae file is exported"); @@ -431,20 +434,11 @@ void WM_OT_collada_export(wmOperatorType *ot) RNA_def_boolean(func, "sort_by_name", 0, "Sort by Object name", "Sort exported data by Object name"); - RNA_def_int(func, "export_transformation_type", 0, INT_MIN, INT_MAX, - "Transform", "Transformation type for translation, scale and rotation", INT_MIN, INT_MAX); + "Transform", "Transformation type for translation, scale and rotation", INT_MIN, INT_MAX); RNA_def_enum(func, "export_transformation_type_selection", prop_bc_export_transformation_type, 0, - "Transform", "Transformation type for translation, scale and rotation"); - - - RNA_def_int(func, "export_texture_type", 0, INT_MIN, INT_MAX, - "Texture Type", "Type for exported Textures (UV or MAT)", INT_MIN, INT_MAX); - - RNA_def_enum(func, "export_texture_type_selection", prop_bc_export_texture_type, 0, - "Texture Type", "Type for exported Textures (UV or MAT)"); - + "Transform", "Transformation type for translation, scale and rotation"); RNA_def_boolean(func, "open_sim", 0, "Export to SL/OpenSim", "Compatibility mode for SL, OpenSim and other compatible online worlds"); @@ -498,6 +492,7 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op) if (collada_import(C, &import_settings) ) { + DEG_id_tag_update(&CTX_data_scene(C)->id, DEG_TAG_BASE_FLAGS_UPDATE); return OPERATOR_FINISHED; } else { |