50 "Vertex colors in the file are in sRGB color space"},
55 "Vertex colors in the file are in linear color space"},
56 {0,
nullptr, 0,
nullptr,
nullptr}};
59 {
DAG_EVAL_RENDER,
"DAG_EVAL_RENDER", 0,
"Render",
"Export objects as they appear in render"},
64 "Export objects as they appear in the viewport (Multiresolution modifiers in Sculpt Mode "
65 "will not be evaluated)"},
66 {0,
nullptr, 0,
nullptr,
nullptr}};
91 export_params.global_scale =
RNA_float_get(op->ptr,
"global_scale");
92 export_params.apply_modifiers =
RNA_boolean_get(op->ptr,
"apply_modifiers");
95 export_params.export_selected_objects =
RNA_boolean_get(op->ptr,
"export_selected_objects");
97 export_params.export_normals =
RNA_boolean_get(op->ptr,
"export_normals");
99 export_params.export_attributes =
RNA_boolean_get(op->ptr,
"export_attributes");
100 export_params.export_triangulated_mesh =
RNA_boolean_get(op->ptr,
"export_triangulated_mesh");
105 export_params.reports = op->reports;
122 layout.use_property_split_set(
true);
123 layout.use_property_decorate_set(
false);
148 col.prop(ptr,
"export_attributes",
UI_ITEM_NONE,
IFACE_(
"Vertex Attributes"), ICON_NONE);
152 ptr,
"export_triangulated_mesh",
UI_ITEM_NONE,
IFACE_(
"Triangulated Mesh"), ICON_NONE);
164 bool changed =
false;
179 ot->
name =
"Export PLY";
180 ot->description =
"Save the scene to a PLY file";
181 ot->idname =
"WM_OT_ply_export";
183 ot->invoke = wm_ply_export_invoke;
184 ot->exec = wm_ply_export_exec;
186 ot->ui = wm_ply_export_draw;
187 ot->check = wm_ply_export_check;
211 "Value by which to enlarge or shrink the objects with respect to the world's origin",
216 ot->srna,
"apply_modifiers",
true,
"Apply Modifiers",
"Apply modifiers to exported meshes");
219 io_ply_export_evaluation_mode,
222 "Determines properties like object visibility, modifiers etc., where they differ "
223 "for Render and Viewport");
225 "export_selected_objects",
227 "Export Selected Objects",
228 "Export only selected objects instead of all supported objects");
234 "Export only objects from this collection (and its children)");
242 "Export Vertex Normals",
243 "Export specific vertex normals if available, export calculated normals otherwise");
246 ply_vertex_colors_mode,
248 "Export Vertex Colors",
249 "Export vertex color attributes");
253 "Export Vertex Attributes",
254 "Export custom vertex attributes");
256 "export_triangulated_mesh",
258 "Export Triangulated Mesh",
259 "All ngons with four or more vertices will be triangulated. Meshes in "
260 "the scene will not be affected. Behaves like Triangulate Modifier with "
261 "ngon-method: \"Beauty\", quad-method: \"Shortest Diagonal\", min vertices: 4");
266 "Export file in ASCII format, export as binary otherwise");
269 prop =
RNA_def_string(ot->srna,
"filter_glob",
"*.ply", 0,
"Extension Filter",
"");
279 params.global_scale =
RNA_float_get(op->ptr,
"global_scale");
281 params.import_attributes =
RNA_boolean_get(op->ptr,
"import_attributes");
284 params.reports = op->reports;
288 if (paths.is_empty()) {
292 for (
const auto &path : paths) {
293 STRNCPY(params.filepath, path.c_str());
308 layout.use_property_split_set(
true);
309 layout.use_property_decorate_set(
false);
314 col.prop(ptr,
"use_scene_unit",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
315 col.prop(ptr,
"forward_axis",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
316 col.prop(ptr,
"up_axis",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
322 col.prop(ptr,
"import_colors",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
328 ui_ply_import_settings(
C, *op->layout, op->ptr);
335 ot->
name =
"Import PLY";
336 ot->description =
"Import an PLY file as an object";
337 ot->idname =
"WM_OT_ply_import";
340 ot->exec = wm_ply_import_exec;
341 ot->ui = wm_ply_import_draw;
354 RNA_def_float(ot->srna,
"global_scale", 1.0f, 1e-6f, 1e6f,
"Scale",
"", 0.001f, 1000.0f);
359 "Apply current scene's unit (as defined by unit scale) to imported data");
364 RNA_def_boolean(ot->srna,
"merge_verts",
false,
"Merge Vertices",
"Merges vertices by distance");
367 ply_vertex_colors_mode,
370 "Import vertex color attributes");
372 ot->srna,
"import_attributes",
true,
"Vertex Attributes",
"Import custom vertex attributes");
375 prop =
RNA_def_string(ot->srna,
"filter_glob",
"*.ply", 0,
"Extension Filter",
"");
382 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 *)
Vector< std::string > paths_from_operator_properties(PointerRNA *ptr)
wmOperatorStatus filesel_drop_import_invoke(bContext *C, wmOperator *op, const wmEvent *)
void ply_file_handler_add()
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 RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
void PLY_export(bContext *C, const PLYExportParams ¶ms)
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 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 WM_OT_ply_export(wmOperatorType *ot)
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)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
bool WM_operator_winactive(bContext *C)
Main * CTX_data_main(const 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)
void PLY_import(bContext *C, const PLYImportParams ¶ms)
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)
void WM_OT_ply_import(wmOperatorType *ot)
char file_base_for_tests[FILE_MAX]
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)