Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/io/io_alembic.c
| Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | |||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "io_alembic.h" | #include "io_alembic.h" | ||||
| #include "ABC_alembic.h" | #include "ABC_alembic.h" | ||||
| static int wm_alembic_export_invoke(bContext *C, wmOperator *op, const wmEvent *event) | static int wm_alembic_export_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| { | { | ||||
| if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) { | |||||
| RNA_boolean_set(op->ptr, "as_background_job", true); | |||||
| } | |||||
| RNA_boolean_set(op->ptr, "init_scene_frame_range", true); | RNA_boolean_set(op->ptr, "init_scene_frame_range", true); | ||||
| if (!RNA_struct_property_is_set(op->ptr, "filepath")) { | if (!RNA_struct_property_is_set(op->ptr, "filepath")) { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| char filepath[FILE_MAX]; | char filepath[FILE_MAX]; | ||||
| if (BKE_main_blendfile_path(bmain)[0] == '\0') { | if (BKE_main_blendfile_path(bmain)[0] == '\0') { | ||||
| BLI_strncpy(filepath, "untitled", sizeof(filepath)); | BLI_strncpy(filepath, "untitled", sizeof(filepath)); | ||||
| ▲ Show 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | RNA_def_enum(ot->srna, "quad_method", rna_enum_modifier_triangulate_quad_method_items, | ||||
| MOD_TRIANGULATE_QUAD_SHORTEDGE, "Quad Method", "Method for splitting the quads into triangles"); | MOD_TRIANGULATE_QUAD_SHORTEDGE, "Quad Method", "Method for splitting the quads into triangles"); | ||||
| RNA_def_enum(ot->srna, "ngon_method", rna_enum_modifier_triangulate_quad_method_items, | RNA_def_enum(ot->srna, "ngon_method", rna_enum_modifier_triangulate_quad_method_items, | ||||
| MOD_TRIANGULATE_NGON_BEAUTY, "Polygon Method", "Method for splitting the polygons into triangles"); | MOD_TRIANGULATE_NGON_BEAUTY, "Polygon Method", "Method for splitting the polygons into triangles"); | ||||
| RNA_def_boolean(ot->srna, "export_hair", 1, "Export Hair", "Exports hair particle systems as animated curves"); | RNA_def_boolean(ot->srna, "export_hair", 1, "Export Hair", "Exports hair particle systems as animated curves"); | ||||
| RNA_def_boolean(ot->srna, "export_particles", 1, "Export Particles", "Exports non-hair particle systems"); | RNA_def_boolean(ot->srna, "export_particles", 1, "Export Particles", "Exports non-hair particle systems"); | ||||
| RNA_def_boolean(ot->srna, "as_background_job", true, "Run as Background Job", | RNA_def_boolean(ot->srna, "as_background_job", false, "Run as Background Job", | ||||
| "Enable this to run the import in the background, disable to block Blender while importing"); | "Enable this to run the import in the background, disable to block Blender while importing. " | ||||
| "This option is deprecated; EXECUTE this operator to run in the foreground, and INVOKE it " | |||||
| "to run as a background job"); | |||||
| /* This dummy prop is used to check whether we need to init the start and | /* This dummy prop is used to check whether we need to init the start and | ||||
| * end frame values to that of the scene's, otherwise they are reset at | * end frame values to that of the scene's, otherwise they are reset at | ||||
| * every change, draw update. */ | * every change, draw update. */ | ||||
| RNA_def_boolean(ot->srna, "init_scene_frame_range", false, "", ""); | RNA_def_boolean(ot->srna, "init_scene_frame_range", false, "", ""); | ||||
| } | } | ||||
| /* ************************************************************************** */ | /* ************************************************************************** */ | ||||
| ▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | |||||
| static void wm_alembic_import_draw(bContext *UNUSED(C), wmOperator *op) | static void wm_alembic_import_draw(bContext *UNUSED(C), wmOperator *op) | ||||
| { | { | ||||
| PointerRNA ptr; | PointerRNA ptr; | ||||
| RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); | RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); | ||||
| ui_alembic_import_settings(op->layout, &ptr); | ui_alembic_import_settings(op->layout, &ptr); | ||||
| } | } | ||||
| /* op->invoke, opens fileselect if path property not set, otherwise executes */ | |||||
| static int wm_alembic_import_invoke(bContext *C, wmOperator *op, const wmEvent *event) | |||||
| { | |||||
| if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) { | |||||
| RNA_boolean_set(op->ptr, "as_background_job", true); | |||||
| } | |||||
| return WM_operator_filesel(C, op, event); | |||||
| } | |||||
| static int wm_alembic_import_exec(bContext *C, wmOperator *op) | static int wm_alembic_import_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| if (!RNA_struct_property_is_set(op->ptr, "filepath")) { | if (!RNA_struct_property_is_set(op->ptr, "filepath")) { | ||||
| BKE_report(op->reports, RPT_ERROR, "No filename given"); | BKE_report(op->reports, RPT_ERROR, "No filename given"); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| char filename[FILE_MAX]; | char filename[FILE_MAX]; | ||||
| Show All 30 Lines | |||||
| } | } | ||||
| void WM_OT_alembic_import(wmOperatorType *ot) | void WM_OT_alembic_import(wmOperatorType *ot) | ||||
| { | { | ||||
| ot->name = "Import Alembic"; | ot->name = "Import Alembic"; | ||||
| ot->description = "Load an Alembic archive"; | ot->description = "Load an Alembic archive"; | ||||
| ot->idname = "WM_OT_alembic_import"; | ot->idname = "WM_OT_alembic_import"; | ||||
| ot->invoke = WM_operator_filesel; | ot->invoke = wm_alembic_import_invoke; | ||||
| ot->exec = wm_alembic_import_exec; | ot->exec = wm_alembic_import_exec; | ||||
| ot->poll = WM_operator_winactive; | ot->poll = WM_operator_winactive; | ||||
| ot->ui = wm_alembic_import_draw; | ot->ui = wm_alembic_import_draw; | ||||
| WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_ALEMBIC, | WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_ALEMBIC, | ||||
| FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, | FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, | ||||
| FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA); | FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA); | ||||
| RNA_def_float(ot->srna, "scale", 1.0f, 0.0001f, 1000.0f, "Scale", | RNA_def_float(ot->srna, "scale", 1.0f, 0.0001f, 1000.0f, "Scale", | ||||
| "Value by which to enlarge or shrink the objects with respect to the world's origin", | "Value by which to enlarge or shrink the objects with respect to the world's origin", | ||||
| 0.0001f, 1000.0f); | 0.0001f, 1000.0f); | ||||
| RNA_def_boolean(ot->srna, "set_frame_range", true, | RNA_def_boolean(ot->srna, "set_frame_range", true, | ||||
| "Set Frame Range", | "Set Frame Range", | ||||
| "If checked, update scene's start and end frame to match those of the Alembic archive"); | "If checked, update scene's start and end frame to match those of the Alembic archive"); | ||||
| RNA_def_boolean(ot->srna, "validate_meshes", 0, | RNA_def_boolean(ot->srna, "validate_meshes", 0, | ||||
| "Validate Meshes", "Check imported mesh objects for invalid data (slow)"); | "Validate Meshes", "Check imported mesh objects for invalid data (slow)"); | ||||
| RNA_def_boolean(ot->srna, "is_sequence", false, "Is Sequence", | RNA_def_boolean(ot->srna, "is_sequence", false, "Is Sequence", | ||||
| "Set to true if the cache is split into separate files"); | "Set to true if the cache is split into separate files"); | ||||
| RNA_def_boolean(ot->srna, "as_background_job", true, "Run as Background Job", | RNA_def_boolean(ot->srna, "as_background_job", false, "Run as Background Job", | ||||
| "Enable this to run the export in the background, disable to block Blender while exporting"); | "Enable this to run the export in the background, disable to block Blender while exporting. " | ||||
| "This option is deprecated; EXECUTE this operator to run in the foreground, and INVOKE it " | |||||
| "to run as a background job"); | |||||
| } | } | ||||
| #endif | #endif | ||||