Page MenuHome

Use BKE_report in the C++ .stl importer
Changes PlannedPublic

Authored by Iyad Ahmed (iyadahmed2001) on Jun 13 2022, 6:52 PM.

Details

Diff Detail

Repository
rB Blender

Event Timeline

Iyad Ahmed (iyadahmed2001) requested review of this revision.Jun 13 2022, 6:52 PM
Iyad Ahmed (iyadahmed2001) created this revision.

I see more C++ I/O operators are not doing this correctly, but we should be using the BKE_reports systems to report errors like this, with op->reports.

That way they get propagated to the status bar, log editor, Python exceptions, etc.

I see more C++ I/O operators are not doing this correctly, but we should be using the BKE_reports systems to report errors like this, with op->reports.

That way they get propagated to the status bar, log editor, Python exceptions, etc.

will make a separate revision for that issue

or actually let me just make in this revision

Iyad Ahmed (iyadahmed2001) retitled this revision from Fix native STL importer unused function result warning to Use BKE_report in the C++ .stl importer.Jun 13 2022, 10:23 PM

The whole importer could use a refactor, it is not too bad currently though

Iyad Ahmed (iyadahmed2001) planned changes to this revision.Jun 14 2022, 10:51 AM

Waiting for D15189

Vitor Boschi (vitorboschi) added inline comments.
source/blender/io/stl/importer/stl_import.cc
62

This doesn't look safe to me: if the read fails, code will just assume it's an ascii stl

Thanks for working on this.

source/blender/io/stl/importer/stl_import.cc
49

RPT_ERROR generally should go along with doing nothing and returning OPERATOR_CANCELLED from the operator.

source/blender/io/stl/importer/stl_import_ascii_reader.cc
124

This seems like it's the same case as the binary importer, and so should be RPT_ERROR also.

source/blender/io/stl/importer/stl_import_binary_reader.cc
39

I don't know the STL specification, but I would guess this should also be an RPT_ERROR and the operator should then do nothing, not even create an empty mesh.