42 {
DAG_EVAL_RENDER,
"DAG_EVAL_RENDER", 0,
"Render",
"Export objects as they appear in render"},
47 "Export objects as they appear in the viewport (Multiresolution modifiers in Sculpt Mode "
48 "will not be evaluated)"},
49 {0,
nullptr, 0,
nullptr,
nullptr}};
71 export_params.global_scale =
RNA_float_get(op->ptr,
"global_scale");
72 export_params.apply_modifiers =
RNA_boolean_get(op->ptr,
"apply_modifiers");
74 export_params.export_selected_objects =
RNA_boolean_get(op->ptr,
"export_selected_objects");
75 export_params.use_scene_unit =
RNA_boolean_get(op->ptr,
"use_scene_unit");
81 export_params.reports = op->reports;
98 layout.use_property_split_set(
true);
99 layout.use_property_decorate_set(
false);
111 sub = &col.column(
false,
IFACE_(
"Include"));
112 sub->prop(ptr,
"export_selected_objects",
UI_ITEM_NONE,
IFACE_(
"Selection Only"), ICON_NONE);
134 bool changed =
false;
152 ot->
name =
"Export STL";
153 ot->description =
"Save the scene to an STL file";
154 ot->idname =
"WM_OT_stl_export";
156 ot->invoke = wm_stl_export_invoke;
157 ot->exec = wm_stl_export_exec;
159 ot->ui = wm_stl_export_draw;
160 ot->check = wm_stl_export_check;
176 "Export file in ASCII format, export as binary otherwise");
178 ot->srna,
"use_batch",
false,
"Batch Export",
"Export each object to a separate file");
180 "export_selected_objects",
182 "Export Selected Objects",
183 "Export only selected objects instead of all supported objects");
190 "Export only objects from this collection (and its children)");
193 RNA_def_float(ot->srna,
"global_scale", 1.0f, 1e-6f, 1e6f,
"Scale",
"", 0.001f, 1000.0f);
198 "Apply current scene's unit (as defined by unit scale) to exported data");
207 ot->srna,
"apply_modifiers",
true,
"Apply Modifiers",
"Apply modifiers to exported meshes");
211 io_stl_export_evaluation_mode,
214 "Determines properties like object visibility, modifiers etc., where they differ "
215 "for Render and Viewport");
218 prop =
RNA_def_string(ot->srna,
"filter_glob",
"*.stl", 0,
"Extension Filter",
"");
227 params.use_facet_normal =
RNA_boolean_get(op->ptr,
"use_facet_normal");
229 params.global_scale =
RNA_float_get(op->ptr,
"global_scale");
230 params.use_mesh_validate =
RNA_boolean_get(op->ptr,
"use_mesh_validate");
232 params.reports = op->reports;
236 if (paths.is_empty()) {
240 for (
const auto &path : paths) {
241 STRNCPY(params.filepath, path.c_str());
256 const int num_axes = 3;
269 layout->use_property_split_set(
true);
270 layout->use_property_decorate_set(
false);
275 col.prop(ptr,
"use_scene_unit",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
277 col.prop(ptr,
"up_axis",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
283 col.prop(ptr,
"use_mesh_validate",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
289 ui_stl_import_settings(
C, op->layout, op->ptr);
296 ot->
name =
"Import STL";
297 ot->description =
"Import an STL file as an object";
298 ot->idname =
"WM_OT_stl_import";
301 ot->exec = wm_stl_import_exec;
303 ot->check = wm_stl_import_check;
304 ot->ui = wm_stl_import_draw;
316 RNA_def_float(ot->srna,
"global_scale", 1.0f, 1e-6f, 1e6f,
"Scale",
"", 0.001f, 1000.0f);
321 "Apply current scene's unit (as defined by unit scale) to imported data");
326 "Use (import) facet normals (note that this will still give flat shading)");
335 "Ensure the data is valid "
336 "(when disabled, data may be imported which causes crashes displaying or editing)");
339 prop =
RNA_def_string(ot->srna,
"filter_glob",
"*.stl", 0,
"Extension Filter",
"");
346 auto fh = std::make_unique<bke::FileHandlerType>();
#define STRNCPY_UTF8(dst, src)
void file_handler_add(std::unique_ptr< FileHandlerType > file_handler)
bool poll_file_object_drop(const bContext *C, bke::FileHandlerType *)
void stl_file_handler_add()
Vector< std::string > paths_from_operator_properties(PointerRNA *ptr)
wmOperatorStatus filesel_drop_import_invoke(bContext *C, wmOperator *op, const wmEvent *)
void io_ui_forward_axis_update(Main *, Scene *, PointerRNA *ptr)
char * STRNCPY(char(&dst)[N], const char *src)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void STL_import(bContext *C, const STLImportParams *import_params)
void STL_export(bContext *C, const STLExportParams *export_params)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
bool RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, bool use_ghost)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
void WM_operator_properties_filesel(wmOperatorType *ot, const int filter, const short type, const eFileSel_Action action, const eFileSel_Flag flag, const short display, const short sort)
void ED_outliner_select_sync_from_object_tag(bContext *C)
bool BLI_path_extension_ensure(char *path, size_t path_maxncpy, const char *ext) ATTR_NONNULL(1
void BKE_report(ReportList *reports, eReportType type, const char *message)
void ED_fileselect_ensure_default_filepath(bContext *C, wmOperator *op, const char *extension)
bool BKE_reports_contain(ReportList *reports, eReportType level)
void WM_OT_stl_import(wmOperatorType *ot)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_OT_stl_export(wmOperatorType *ot)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
bool WM_operator_winactive(bContext *C)
bool BLI_path_extension_check(const char *path, const char *ext) ATTR_NONNULL(1
void RNA_def_property_update_runtime(PropertyRNA *prop, RNAPropertyUpdateFunc func)
SpaceFile * CTX_wm_space_file(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
std::string RNA_string_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
const EnumPropertyItem io_transform_axis[]
void io_ui_up_axis_update(Main *, Scene *, PointerRNA *ptr)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
float RNA_float_get(PointerRNA *ptr, const char *name)
void WM_event_add_fileselect(bContext *C, wmOperator *op)
PanelLayout panel(const bContext *C, StringRef idname, bool default_closed)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
Layout & column(bool align)