Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/io/io_obj.c
| Context not available. | |||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "IO_path_util_types.h" | |||||
| #include "IO_wavefront_obj.h" | #include "IO_wavefront_obj.h" | ||||
| #include "io_obj.h" | #include "io_obj.h" | ||||
| Context not available. | |||||
| "Export objects as they appear in the viewport"}, | "Export objects as they appear in the viewport"}, | ||||
| {0, NULL, 0, NULL, NULL}}; | {0, NULL, 0, NULL, NULL}}; | ||||
| static const EnumPropertyItem io_obj_path_mode[] = { | |||||
| {PATH_REFERENCE_AUTO, "AUTO", 0, "Auto", "Use Relative paths with subdirectories only"}, | |||||
| {PATH_REFERENCE_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Always write absolute paths"}, | |||||
| {PATH_REFERENCE_RELATIVE, "RELATIVE", 0, "Relative", "Write relative paths where possible"}, | |||||
| {PATH_REFERENCE_MATCH, "MATCH", 0, "Match", "Match Absolute/Relative setting with input path"}, | |||||
| {PATH_REFERENCE_STRIP, "STRIP", 0, "Strip", "Write filename only"}, | |||||
| {PATH_REFERENCE_COPY, "COPY", 0, "Copy", "Copy the file to the destination path"}, | |||||
| {0, NULL, 0, NULL, NULL}}; | |||||
| static int wm_obj_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | static int wm_obj_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | ||||
| { | { | ||||
| if (!RNA_struct_property_is_set(op->ptr, "filepath")) { | if (!RNA_struct_property_is_set(op->ptr, "filepath")) { | ||||
| Context not available. | |||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| struct OBJExportParams export_params; | struct OBJExportParams export_params; | ||||
| export_params.file_base_for_tests[0] = '\0'; | |||||
| RNA_string_get(op->ptr, "filepath", export_params.filepath); | RNA_string_get(op->ptr, "filepath", export_params.filepath); | ||||
| export_params.blen_filepath = CTX_data_main(C)->filepath; | export_params.blen_filepath = CTX_data_main(C)->filepath; | ||||
| export_params.export_animation = RNA_boolean_get(op->ptr, "export_animation"); | export_params.export_animation = RNA_boolean_get(op->ptr, "export_animation"); | ||||
| Context not available. | |||||
| export_params.export_uv = RNA_boolean_get(op->ptr, "export_uv"); | export_params.export_uv = RNA_boolean_get(op->ptr, "export_uv"); | ||||
| export_params.export_normals = RNA_boolean_get(op->ptr, "export_normals"); | export_params.export_normals = RNA_boolean_get(op->ptr, "export_normals"); | ||||
| export_params.export_materials = RNA_boolean_get(op->ptr, "export_materials"); | export_params.export_materials = RNA_boolean_get(op->ptr, "export_materials"); | ||||
| export_params.path_mode = RNA_enum_get(op->ptr, "path_mode"); | |||||
| export_params.export_triangulated_mesh = RNA_boolean_get(op->ptr, "export_triangulated_mesh"); | export_params.export_triangulated_mesh = RNA_boolean_get(op->ptr, "export_triangulated_mesh"); | ||||
| export_params.export_curves_as_nurbs = RNA_boolean_get(op->ptr, "export_curves_as_nurbs"); | export_params.export_curves_as_nurbs = RNA_boolean_get(op->ptr, "export_curves_as_nurbs"); | ||||
| Context not available. | |||||
| static void ui_obj_export_settings(uiLayout *layout, PointerRNA *imfptr) | static void ui_obj_export_settings(uiLayout *layout, PointerRNA *imfptr) | ||||
| { | { | ||||
| const bool export_animation = RNA_boolean_get(imfptr, "export_animation"); | const bool export_animation = RNA_boolean_get(imfptr, "export_animation"); | ||||
| const bool export_smooth_groups = RNA_boolean_get(imfptr, "export_smooth_groups"); | const bool export_smooth_groups = RNA_boolean_get(imfptr, "export_smooth_groups"); | ||||
| const bool export_materials = RNA_boolean_get(imfptr, "export_materials"); | |||||
| uiLayoutSetPropSep(layout, true); | uiLayoutSetPropSep(layout, true); | ||||
| uiLayoutSetPropDecorate(layout, false); | uiLayoutSetPropDecorate(layout, false); | ||||
| Context not available. | |||||
| uiItemR(sub, imfptr, "export_selected_objects", 0, IFACE_("Selected Only"), ICON_NONE); | uiItemR(sub, imfptr, "export_selected_objects", 0, IFACE_("Selected Only"), ICON_NONE); | ||||
| uiItemR(sub, imfptr, "apply_modifiers", 0, IFACE_("Apply Modifiers"), ICON_NONE); | uiItemR(sub, imfptr, "apply_modifiers", 0, IFACE_("Apply Modifiers"), ICON_NONE); | ||||
| uiItemR(sub, imfptr, "export_eval_mode", 0, IFACE_("Properties"), ICON_NONE); | uiItemR(sub, imfptr, "export_eval_mode", 0, IFACE_("Properties"), ICON_NONE); | ||||
| sub = uiLayoutColumn(sub, false); | |||||
| uiLayoutSetEnabled(sub, export_materials); | |||||
| uiItemR(sub, imfptr, "path_mode", 0, IFACE_("Path Mode"), ICON_NONE); | |||||
| /* Options for what to write. */ | /* Options for what to write. */ | ||||
| box = uiLayoutBox(layout); | box = uiLayoutBox(layout); | ||||
| Context not available. | |||||
| uiItemR(sub, imfptr, "export_triangulated_mesh", 0, IFACE_("Triangulated Mesh"), ICON_NONE); | uiItemR(sub, imfptr, "export_triangulated_mesh", 0, IFACE_("Triangulated Mesh"), ICON_NONE); | ||||
| uiItemR(sub, imfptr, "export_curves_as_nurbs", 0, IFACE_("Curves as NURBS"), ICON_NONE); | uiItemR(sub, imfptr, "export_curves_as_nurbs", 0, IFACE_("Curves as NURBS"), ICON_NONE); | ||||
| /* Grouping options. */ | |||||
| box = uiLayoutBox(layout); | box = uiLayoutBox(layout); | ||||
| uiItemL(box, IFACE_("Grouping"), ICON_GROUP); | uiItemL(box, IFACE_("Grouping"), ICON_GROUP); | ||||
| col = uiLayoutColumn(box, false); | col = uiLayoutColumn(box, false); | ||||
| Context not available. | |||||
| "Export Materials", | "Export Materials", | ||||
| "Export MTL library. There must be a Principled-BSDF node for image textures to " | "Export MTL library. There must be a Principled-BSDF node for image textures to " | ||||
| "be exported to the MTL file"); | "be exported to the MTL file"); | ||||
| RNA_def_enum(ot->srna, | |||||
| "path_mode", | |||||
| io_obj_path_mode, | |||||
| PATH_REFERENCE_AUTO, | |||||
| "Path Mode", | |||||
| "Method used to reference paths"); | |||||
| RNA_def_boolean(ot->srna, | RNA_def_boolean(ot->srna, | ||||
| "export_triangulated_mesh", | "export_triangulated_mesh", | ||||
| false, | false, | ||||
| Context not available. | |||||