Files
test2/source/blender/editors/io/io_ops.cc
Guillermo Venegas d4bc3bd08d IO: Add file handlers to c++ import operators
Adds file handlers for the C++ import operators.
This will allow these operators to be invoked with drag-and-drop
filepath data in the 3D Viewport or the Outliner.

When the operators are called with drag-and-drop data a dialog popup
will be used instead of invoking the file select window.

Previously OPTYPE_REGISTER tag had no effect, now since these operators
can run as popup dialogs this flag is removed to prevent heavy io
operations in the redo panel.

Also includes drawing functions for ply and stl and a missing
event notifications to collada import.

Important: Presets can override file path properties, so if a preset is
used, file paths provided by drag and drop will be lost. This will be
addressed in follow up changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/116873
2024-01-27 23:38:44 +01:00

89 lines
2.1 KiB
C++

/* SPDX-FileCopyrightText: 2008 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup collada
*/
#include "io_ops.hh" /* own include */
#include "WM_api.hh"
#ifdef WITH_COLLADA
# include "io_collada.hh"
#endif
#ifdef WITH_ALEMBIC
# include "io_alembic.hh"
#endif
#ifdef WITH_USD
# include "io_usd.hh"
#endif
#include "io_cache.hh"
#include "io_drop_import_file.hh"
#include "io_gpencil.hh"
#include "io_obj.hh"
#include "io_ply_ops.hh"
#include "io_stl_ops.hh"
void ED_operatortypes_io()
{
using namespace blender;
#ifdef WITH_COLLADA
/* Collada operators: */
WM_operatortype_append(WM_OT_collada_export);
WM_operatortype_append(WM_OT_collada_import);
ed::io::collada_file_handler_add();
#endif
#ifdef WITH_ALEMBIC
WM_operatortype_append(WM_OT_alembic_import);
WM_operatortype_append(WM_OT_alembic_export);
ed::io::alembic_file_handler_add();
#endif
#ifdef WITH_USD
WM_operatortype_append(WM_OT_usd_import);
WM_operatortype_append(WM_OT_usd_export);
ed::io::usd_file_handler_add();
#endif
#ifdef WITH_IO_GPENCIL
WM_operatortype_append(WM_OT_gpencil_import_svg);
ed::io::gpencil_file_handler_add();
# ifdef WITH_PUGIXML
WM_operatortype_append(WM_OT_gpencil_export_svg);
# endif
# ifdef WITH_HARU
WM_operatortype_append(WM_OT_gpencil_export_pdf);
# endif
#endif
WM_operatortype_append(CACHEFILE_OT_open);
WM_operatortype_append(CACHEFILE_OT_reload);
WM_operatortype_append(CACHEFILE_OT_layer_add);
WM_operatortype_append(CACHEFILE_OT_layer_remove);
WM_operatortype_append(CACHEFILE_OT_layer_move);
#ifdef WITH_IO_WAVEFRONT_OBJ
WM_operatortype_append(WM_OT_obj_export);
WM_operatortype_append(WM_OT_obj_import);
ed::io::obj_file_handler_add();
#endif
#ifdef WITH_IO_PLY
WM_operatortype_append(WM_OT_ply_export);
WM_operatortype_append(WM_OT_ply_import);
ed::io::ply_file_handler_add();
#endif
#ifdef WITH_IO_STL
WM_operatortype_append(WM_OT_stl_import);
WM_operatortype_append(WM_OT_stl_export);
ed::io::stl_file_handler_add();
#endif
WM_operatortype_append(WM_OT_drop_import_file);
ED_dropbox_drop_import_file();
}