Files
test/source/blender/editors/io/io_utils.hh
Guillermo Venegas 16129d6a48 Cleanup: Deduplicate operator paths properties reading in io importers
Adds a function that deduplicates operator paths properties reading.

-----

There are other places where this function can be useful, but I'm not sure whether to include `BLI_vector.hh` in RNA_access.hh

Pull Request: https://projects.blender.org/blender/blender/pulls/117644
2024-02-06 17:12:25 +01:00

37 lines
1.0 KiB
C++

/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "WM_types.hh"
#include "BLI_vector.hh"
struct wmOperator;
struct wmOperatorType;
struct wmDrag;
struct wmDropBox;
namespace blender::bke {
struct FileHanlderType;
} // namespace blender::bke
namespace blender::ed::io {
/**
* Shows a import dialog if the operator was invoked with filepath properties set,
* otherwise invokes the file-select window.
*/
int filesel_drop_import_invoke(bContext *C, wmOperator *op, const wmEvent *event);
bool poll_file_object_drop(const bContext *C, blender::bke::FileHandlerType *fh);
/**
* Return all paths stored in the pointer.
* Properties in pointer should include a `directory` #PropertySubType::PROP_FILEPATH property and
* a `files` #RNA_OperatorFileListElement collection property.
* If the pointer has a `filepath` property is also returned as fallback.
*/
Vector<std::string> paths_from_operator_properties(PointerRNA *ptr);
} // namespace blender::ed::io