SVG: Batch import SVG as curves files #134795

Merged
Sergey Sharybin merged 3 commits from Maxime-Cots/blender:feat-svg-batch-import into main 2025-02-21 12:41:34 +01:00
Contributor

Hello,

I found that SVG was missing batch import of multiple files during my work on an other issue, so I implemented it

Feel free to comment ! And report if I missed something !

Hello, I found that SVG was missing batch import of multiple files during my work on an other issue, so I implemented it Feel free to comment ! And report if I missed something !
Maxime-Cots added 1 commit 2025-02-19 12:03:48 +01:00
Maxime-Cots requested review from Sergey Sharybin 2025-02-19 12:03:49 +01:00
RedMser reviewed 2025-02-19 15:43:40 +01:00
@ -34,13 +38,30 @@ class ImportSVG(bpy.types.Operator, ImportHelper):
bl_label = "Import SVG"
bl_options = {'UNDO'}
directory: StringProperty()
Contributor

Seems to be unused.

Seems to be unused.
Author
Contributor

I removed it ! Thanks

I removed it ! Thanks
Maxime-Cots marked this conversation as resolved
Maxime-Cots added 1 commit 2025-02-19 21:19:17 +01:00
Sergey Sharybin requested review from Campbell Barton 2025-02-20 11:04:43 +01:00

Thanks for looking into it!

It seems you need to run autopep8 in the file to correct style and remove trailing whitespace. Running make format should take care of that. There are some details in the documentation.

What I am not sure is whether it is required to explicitly handle single file import, similar to glTF. @ideasman42 is it something you can help with?

Thanks for looking into it! It seems you need to run autopep8 in the file to correct style and remove trailing whitespace. Running `make format` should take care of that. There are some details in the [documentation](https://developer.blender.org/docs/handbook/guidelines/python/#automated-formatting). What I am not sure is whether it is required to explicitly handle single file import, similar to [glTF](https://projects.blender.org/blender/blender/src/branch/main/scripts/addons_core/io_scene_gltf2/__init__.py#L1974). @ideasman42 is it something you can help with?

@Sergey while from the file selector files should always be set to contain the file (even if it's not selected), I think it's best to handle both as it's expected that IO operators can take a filepath argument (when called from Python).

So this PR LGTM.

@Sergey while from the file selector `files` should always be set to contain the file (even if it's not selected), I think it's best to handle both as it's expected that IO operators can take a `filepath` argument (when called from Python). So this PR LGTM.

@ideasman42 I am confused. The current PR does not handle filepath, so it needs to be added?

@ideasman42 I am confused. The current PR does not handle `filepath`, so it needs to be added?
Campbell Barton requested changes 2025-02-20 12:01:57 +01:00
Dismissed
@ -40,2 +50,4 @@
def execute(self, context):
from . import import_svg
if not self.files:

These checks would be a bit easier to follow (as glTF uses)

if self.files:
    .... use files ...
else:
   .... use filepath ...

Edit I don't feel too strongly about this, an early return can be OK too, it's just that most scripts in Blender check files first instead of the not self.files case.

These checks would be a bit easier to follow (as glTF uses) ``` if self.files: .... use files ... else: .... use filepath ... ``` *Edit* I don't feel too strongly about this, an early return can be OK too, it's just that most scripts in Blender check files first instead of the `not self.files` case.
Author
Contributor

I removed it 👍

I removed it 👍
Maxime-Cots marked this conversation as resolved

@ideasman42 I am confused. The current PR does not handle filepath, so it needs to be added?

The code does but it was handled as an early return, requested to follow the same checks as glTF although I don't feel that strongly about it.

> @ideasman42 I am confused. The current PR does not handle `filepath`, so it needs to be added? The code does but it was handled as an early return, requested to follow the same checks as glTF although I don't feel that strongly about it.
Maxime-Cots added 1 commit 2025-02-21 09:27:51 +01:00
Author
Contributor

Early return and trailing whitespace removed !

Early return and trailing whitespace removed !
Campbell Barton approved these changes 2025-02-21 11:08:52 +01:00

Thanks for the PR and review!

Thanks for the PR and review!
Sergey Sharybin merged commit 251cd8eb10 into main 2025-02-21 12:41:34 +01:00
Sergey Sharybin deleted branch feat-svg-batch-import 2025-02-21 12:41:35 +01:00
Sign in to join this conversation.
No Label
4 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blender/blender#134795
No description provided.