Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/io/io_obj.c
| Show First 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | if (RNA_enum_get(op->ptr, "forward_axis") % TOTAL_AXES == | ||||
| RNA_enum_set(op->ptr, "up_axis", RNA_enum_get(op->ptr, "up_axis") % TOTAL_AXES + 1); | RNA_enum_set(op->ptr, "up_axis", RNA_enum_get(op->ptr, "up_axis") % TOTAL_AXES + 1); | ||||
| changed = true; | changed = true; | ||||
| } | } | ||||
| return changed; | return changed; | ||||
| } | } | ||||
| void WM_OT_obj_export(struct wmOperatorType *ot) | void WM_OT_obj_export(struct wmOperatorType *ot) | ||||
| { | { | ||||
| PropertyRNA *prop; | |||||
| ot->name = "Export Wavefront OBJ"; | ot->name = "Export Wavefront OBJ"; | ||||
| ot->description = "Save the scene to a Wavefront OBJ file"; | ot->description = "Save the scene to a Wavefront OBJ file"; | ||||
| ot->idname = "WM_OT_obj_export"; | ot->idname = "WM_OT_obj_export"; | ||||
| ot->invoke = wm_obj_export_invoke; | ot->invoke = wm_obj_export_invoke; | ||||
| ot->exec = wm_obj_export_exec; | ot->exec = wm_obj_export_exec; | ||||
| ot->poll = WM_operator_winactive; | ot->poll = WM_operator_winactive; | ||||
| ot->ui = wm_obj_export_draw; | ot->ui = wm_obj_export_draw; | ||||
| ot->check = wm_obj_export_check; | ot->check = wm_obj_export_check; | ||||
| ot->flag |= OPTYPE_PRESET; | ot->flag |= OPTYPE_PRESET; | ||||
| WM_operator_properties_filesel(ot, | WM_operator_properties_filesel(ot, | ||||
| FILE_TYPE_FOLDER | FILE_TYPE_OBJECT_IO, | FILE_TYPE_FOLDER, | ||||
| FILE_BLENDER, | FILE_BLENDER, | ||||
| FILE_SAVE, | FILE_SAVE, | ||||
| WM_FILESEL_FILEPATH | WM_FILESEL_SHOW_PROPS, | WM_FILESEL_FILEPATH | WM_FILESEL_SHOW_PROPS, | ||||
| FILE_DEFAULTDISPLAY, | FILE_DEFAULTDISPLAY, | ||||
| FILE_SORT_ALPHA); | FILE_SORT_ALPHA); | ||||
| /* Animation options. */ | /* Animation options. */ | ||||
| RNA_def_boolean(ot->srna, | RNA_def_boolean(ot->srna, | ||||
| ▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | void WM_OT_obj_export(struct wmOperatorType *ot) | ||||
| RNA_def_boolean( | RNA_def_boolean( | ||||
| ot->srna, | ot->srna, | ||||
| "export_smooth_groups", | "export_smooth_groups", | ||||
| false, | false, | ||||
| "Export Smooth Groups", | "Export Smooth Groups", | ||||
| "Every smooth-shaded face is assigned group \"1\" and every flat-shaded face \"off\""); | "Every smooth-shaded face is assigned group \"1\" and every flat-shaded face \"off\""); | ||||
| RNA_def_boolean( | RNA_def_boolean( | ||||
| ot->srna, "smooth_group_bitflags", false, "Generate Bitflags for Smooth Groups", ""); | ot->srna, "smooth_group_bitflags", false, "Generate Bitflags for Smooth Groups", ""); | ||||
| /* Only show .obj or .mtl files by default. */ | |||||
| prop = RNA_def_string(ot->srna, "filter_glob", "*.obj;*.mtl", 0, "Extension Filter", ""); | |||||
| RNA_def_property_flag(prop, PROP_HIDDEN); | |||||
| } | } | ||||
| static int wm_obj_import_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | static int wm_obj_import_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | ||||
| { | { | ||||
| WM_event_add_fileselect(C, op); | WM_event_add_fileselect(C, op); | ||||
| return OPERATOR_RUNNING_MODAL; | return OPERATOR_RUNNING_MODAL; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | static void wm_obj_import_draw(bContext *C, wmOperator *op) | ||||
| PointerRNA ptr; | PointerRNA ptr; | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); | RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); | ||||
| ui_obj_import_settings(op->layout, &ptr); | ui_obj_import_settings(op->layout, &ptr); | ||||
| } | } | ||||
| void WM_OT_obj_import(struct wmOperatorType *ot) | void WM_OT_obj_import(struct wmOperatorType *ot) | ||||
| { | { | ||||
| PropertyRNA *prop; | |||||
| ot->name = "Import Wavefront OBJ"; | ot->name = "Import Wavefront OBJ"; | ||||
| ot->description = "Load a Wavefront OBJ scene"; | ot->description = "Load a Wavefront OBJ scene"; | ||||
| ot->idname = "WM_OT_obj_import"; | ot->idname = "WM_OT_obj_import"; | ||||
| ot->invoke = wm_obj_import_invoke; | ot->invoke = wm_obj_import_invoke; | ||||
| ot->exec = wm_obj_import_exec; | ot->exec = wm_obj_import_exec; | ||||
| ot->poll = WM_operator_winactive; | ot->poll = WM_operator_winactive; | ||||
| ot->ui = wm_obj_import_draw; | ot->ui = wm_obj_import_draw; | ||||
| WM_operator_properties_filesel(ot, | WM_operator_properties_filesel(ot, | ||||
| FILE_TYPE_FOLDER | FILE_TYPE_OBJECT_IO, | FILE_TYPE_FOLDER, | ||||
Severin: The reason for this change is not obvious - Basically this file filter and the `filter_glob`… | |||||
| FILE_BLENDER, | FILE_BLENDER, | ||||
| FILE_OPENFILE, | FILE_OPENFILE, | ||||
| WM_FILESEL_FILEPATH | WM_FILESEL_SHOW_PROPS, | WM_FILESEL_FILEPATH | WM_FILESEL_SHOW_PROPS, | ||||
| FILE_DEFAULTDISPLAY, | FILE_DEFAULTDISPLAY, | ||||
| FILE_SORT_ALPHA); | FILE_SORT_ALPHA); | ||||
| RNA_def_float( | RNA_def_float( | ||||
| ot->srna, | ot->srna, | ||||
| "clamp_size", | "clamp_size", | ||||
| Show All 11 Lines | RNA_def_enum(ot->srna, | ||||
| "Forward Axis", | "Forward Axis", | ||||
| ""); | ""); | ||||
| RNA_def_enum(ot->srna, "up_axis", io_obj_transform_axis_up, OBJ_AXIS_Y_UP, "Up Axis", ""); | RNA_def_enum(ot->srna, "up_axis", io_obj_transform_axis_up, OBJ_AXIS_Y_UP, "Up Axis", ""); | ||||
| RNA_def_boolean(ot->srna, | RNA_def_boolean(ot->srna, | ||||
| "validate_meshes", | "validate_meshes", | ||||
| false, | false, | ||||
| "Validate Meshes", | "Validate Meshes", | ||||
| "Check imported mesh objects for invalid data (slow)"); | "Check imported mesh objects for invalid data (slow)"); | ||||
| /* Only show .obj or .mtl files by default. */ | |||||
| prop = RNA_def_string(ot->srna, "filter_glob", "*.obj;*.mtl", 0, "Extension Filter", ""); | |||||
| RNA_def_property_flag(prop, PROP_HIDDEN); | |||||
| } | } | ||||
The reason for this change is not obvious - Basically this file filter and the filter_glob are OR'ed, so if the file is of any format covered by FILE_TYPE_OBJECT_IO, it will be shown.
This is done in a better way in D14863.