Cleanup: Move io files to c++ #108477

Merged
Hans Goudey merged 17 commits from guishe/blender:move-io-cpp into main 2023-06-07 00:52:41 +02:00
Contributor

Changes:

  1. UNUSED AND UNUSED_VARS -> /*arg*/
  2. NULL -> nullptr
  3. Function style cast for enums values
  4. void * -> static_cast<T*>
  5. Use standart includes #include <file.h> ->#include <cfile>
  6. Replace designated initializers with member assignment
  7. typdef struct N{...} N; -> struct N{...}

See: #103343

Changes: 1. `UNUSED` AND `UNUSED_VARS` -> `/*arg*/` 2. `NULL` -> `nullptr` 3. `Function style cast` for `enums` values 4. `void *` -> `static_cast<T*>` 5. Use standart includes `#include <file.h>` ->`#include <cfile>` 6. Replace designated initializers with member assignment 7. `typdef struct N{...} N; ` -> `struct N{...}` See: #103343
Guillermo Venegas force-pushed move-io-cpp from db34c14f5a to c6bf23c6b9 2023-05-31 19:43:10 +02:00 Compare
Iliya Katushenock changed title from WIP: IO: Move io files to c++ to WIP: Cleanup: Move io files to c++ 2023-05-31 19:44:47 +02:00
Guillermo Venegas force-pushed move-io-cpp from c6bf23c6b9 to 4660d188c2 2023-05-31 20:48:40 +02:00 Compare
Author
Contributor

Updated whit current state of main

Updated whit current state of main
Guillermo Venegas force-pushed move-io-cpp from ac6a8f8103 to 590f0fe377 2023-06-01 05:54:42 +02:00 Compare
Guillermo Venegas changed title from WIP: Cleanup: Move io files to c++ to Cleanup: Move io files to c++ 2023-06-01 05:58:00 +02:00
Member

@blender-bot build

@blender-bot build
Guillermo Venegas added 1 commit 2023-06-01 06:43:40 +02:00
Guillermo Venegas added 1 commit 2023-06-01 13:39:03 +02:00
Guillermo Venegas added 1 commit 2023-06-01 13:40:36 +02:00
Guillermo Venegas added 1 commit 2023-06-01 13:41:45 +02:00
Guillermo Venegas added 1 commit 2023-06-01 13:55:55 +02:00
Guillermo Venegas added 1 commit 2023-06-01 13:59:58 +02:00
Guillermo Venegas added 1 commit 2023-06-01 14:13:58 +02:00
Guillermo Venegas added 1 commit 2023-06-01 14:19:51 +02:00
buildbot/vexp-code-patch-coordinator Build done. Details
0f73807640
remove UNUSED_VARS
Member

@blender-bot build

@blender-bot build
Author
Contributor

All tests passed except for geo_node_geometry_test_delete_geometry,
which I've seen fail in other builds as well. I think it's ready for review.

image

All tests **`passed`** except for `geo_node_geometry_test_delete_geometry`, which I've seen fail in other builds as well. I think it's ready for review. ![image](/attachments/bf55ae05-3671-4674-8f33-d045832e6ab7)

Not exactly sure what's the policy regarding moving files to C++ 'just for the sake of it'? But am not in the C++ gang either, think @HooglyBoogly , @JacquesLucke or @JulianEisel should be handling these kind of changes.

That being said, did not see anything wrong in the patch, and code compiles and passes tests for me. 👍

Not exactly sure what's the policy regarding moving files to C++ 'just for the sake of it'? But am not in the C++ gang either, think @HooglyBoogly , @JacquesLucke or @JulianEisel should be handling these kind of changes. That being said, did not see anything wrong in the patch, and code compiles and passes tests for me. 👍
Member

Not exactly sure what's the policy regarding moving files to C++ 'just for the sake of it'?

I'd replace "just for the sake of it" with the reasoning in #103343. It doesn't make sense to move a file and do a bunch of refactoring at the same time, which is why you see these "only as many changes as necessary" commits. And yes, it's been done commonly in recent months (years!).

All tests passed except for geo_node_geometry_test_delete_geometry

I updated that test file yesterday, that's probably why.

>Not exactly sure what's the policy regarding moving files to C++ 'just for the sake of it'? I'd replace "just for the sake of it" with the reasoning in #103343. It doesn't make sense to move a file and do a bunch of refactoring at the same time, which is why you see these "only as many changes as necessary" commits. And yes, it's been done commonly in recent months (years!). >All tests passed except for `geo_node_geometry_test_delete_geometry` I updated that test file yesterday, that's probably why.
Hans Goudey requested changes 2023-06-02 14:07:53 +02:00
Hans Goudey left a comment
Member

Thanks for the PR! Some of my comments probably apply in multiple places.

Thanks for the PR! Some of my comments probably apply in multiple places.
@ -0,0 +94,4 @@
char filepath[FILE_MAX];
RNA_string_get(op->ptr, "filepath", filepath);
AlembicExportParams params;
Member

Usually I put a {} on the end like AlembicExportParams params{} to make this a bit safer if new fields are added since this type of struct usually won't have a default constructor.

Usually I put a `{}` on the end like `AlembicExportParams params{}` to make this a bit safer if new fields are added since this type of struct usually won't have a default constructor.
guishe marked this conversation as resolved
@ -0,0 +537,4 @@
continue;
}
CacheFrame *cache_frame = static_cast<CacheFrame *>(
Member

This can use MEM_cnew. Some developers expressed a preference for that when it's trivial like it is here.

This can use `MEM_cnew`. Some developers expressed a preference for that when it's trivial like it is here.
guishe marked this conversation as resolved
@ -0,0 +5,4 @@
/** \file
* \ingroup editor/io
*/
#ifdef __cplusplus
Member

C++ headers shouldn't need to have the extern "C" { block.

C++ headers shouldn't need to have the `extern "C" {` block.
Author
Contributor

This file is used in \source\blender\editors\space_api\spacetypes.c

I get unresolved external symbol error if not

This file is used in \source\blender\editors\space_api\spacetypes.c I get unresolved external symbol error if not
Member

If the header is used by a C file, it should be a .h header rather than .hh.

If the header is used by a C file, it should be a `.h` header rather than `.hh`.
guishe marked this conversation as resolved

@HooglyBoogly am all for moving to c++ prior to working in an area, am just not aware of any scheduled work in editor/io? And nothing is said about it in commit message either.

@HooglyBoogly am all for moving to c++ prior to working in an area, am just not aware of any scheduled work in `editor/io`? And nothing is said about it in commit message either.
Guillermo Venegas added 1 commit 2023-06-02 18:06:45 +02:00
Guillermo Venegas reviewed 2023-06-02 18:09:26 +02:00
@ -0,0 +518,4 @@
const char *basename = BLI_path_basename(filepath);
const int len = strlen(basename) - (numdigit + strlen(ext));
std::vector<CacheFrame> frames{};
Author
Contributor

Here I recently changed the use of ListBase with std::vector

Here I recently changed the use of ListBase with std::vector
Member

Please leave this sort of cleanup to a separate PR. I totally agree with the change, but combining this sort of change with the larger C++ conversions is error-prone and makes review more difficult.

Please leave this sort of cleanup to a separate PR. I totally agree with the change, but combining this sort of change with the larger C++ conversions is error-prone and makes review more difficult.
guishe marked this conversation as resolved
Guillermo Venegas requested review from Hans Goudey 2023-06-02 18:12:43 +02:00
Guillermo Venegas added 1 commit 2023-06-02 18:22:54 +02:00
Member

@HooglyBoogly am all for moving to c++ prior to working in an area, am just not aware of any scheduled work in editor/io? And nothing is said about it in commit message either.

That's right, this is just generally done preemptively to make working with C++ in Blender easier overall.

> @HooglyBoogly am all for moving to c++ prior to working in an area, am just not aware of any scheduled work in `editor/io`? And nothing is said about it in commit message either. That's right, this is just generally done preemptively to make working with C++ in Blender easier overall.
Member

@HooglyBoogly am all for moving to c++ prior to working in an area, am just not aware of any scheduled work in editor/io? And nothing is said about it in commit message either.

That's right, this is just generally done preemptively to make working with C++ in Blender easier overall.

For me one of the main motivations is not needing all those C wrappers & aliases/handles. These add a lot of boilerplate and often limit us (e.g. no proper ownership management using smart pointers because we have to pass things through a layer of C). For the asset system we have plenty of those, but thanks to all the conversions we can soon get rid of many/most of them.

> > @HooglyBoogly am all for moving to c++ prior to working in an area, am just not aware of any scheduled work in `editor/io`? And nothing is said about it in commit message either. > > That's right, this is just generally done preemptively to make working with C++ in Blender easier overall. For me one of the main motivations is not needing all those C wrappers & aliases/handles. These add a lot of boilerplate and often limit us (e.g. no proper ownership management using smart pointers because we have to pass things through a layer of C). For the asset system we have plenty of those, but thanks to all the conversions we can soon get rid of many/most of them.
Guillermo Venegas added 1 commit 2023-06-02 21:06:30 +02:00
Guillermo Venegas added 1 commit 2023-06-02 21:11:20 +02:00
buildbot/vexp-code-patch-coordinator Build done. Details
f67f25965f
reveert misplaced BLI_freelistN
Member

@blender-bot build

@blender-bot build
Author
Contributor

Should I worry about these failures?

image

Should I worry about these failures? ![image](/attachments/ee4d2d49-edfb-4f93-b988-3872b8005503)
Guillermo Venegas added 1 commit 2023-06-03 00:07:42 +02:00
Guillermo Venegas added 1 commit 2023-06-03 04:23:10 +02:00
buildbot/vexp-code-patch-coordinator Build done. Details
3442fd4035
Merge remote-tracking branch 'origin' into move-io-cpp
Member

@blender-bot build

@blender-bot build
Guillermo Venegas added 1 commit 2023-06-06 20:15:42 +02:00
buildbot/vexp-code-patch-coordinator Build done. Details
d656a32005
Merge remote-tracking branch 'origin' into move-io-cpp
Author
Contributor

updated with main, passed all tests locally on windows and ubuntu

updated with main, passed all tests locally on windows and ubuntu
Member

We're getting bad luck with the bots! One more try:

We're getting bad luck with the bots! One more try:
Member

@blender-bot build

@blender-bot build
Author
Contributor

One bot could not be configured, the others run successfully!

One bot could not be configured, the others run successfully!
Hans Goudey approved these changes 2023-06-06 22:02:39 +02:00
@ -0,0 +124,4 @@
static void wm_ply_export_draw(bContext * /*C*/, wmOperator *op)
{
PointerRNA ptr{nullptr};
Member

No need to change this one, it's fully initialized by RNA_pointer_create in the next line. Same in a few other places.

No need to change this one, it's fully initialized by `RNA_pointer_create` in the next line. Same in a few other places.
Author
Contributor

Fixed

Fixed
guishe marked this conversation as resolved
Guillermo Venegas added 1 commit 2023-06-06 22:38:41 +02:00
Hans Goudey merged commit fb348137d5 into main 2023-06-07 00:52:41 +02:00
Guillermo Venegas deleted branch move-io-cpp 2023-06-07 00:54:35 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#108477
No description provided.