Add "Import Images as Planes" to Blender as an Operator #122223

Manually merged
Campbell Barton merged 8 commits from ideasman42/blender:pr-import-images-as-planes into main 2024-05-28 04:11:00 +02:00

Add the operator from the io_import_images_as_planes add-on,
making it a built-in operator.

The main differences with the add-on are:

  • Compositor integration has been removed.
  • The file handler for dropping images has been removed
    to avoid conflicting with Blender's default drop handler.

Otherwise all other functionality has been kept.


Background: when moving add-ons to extensions this was one of the add-ons many users mentioned as being important to them and preferred it not be moved to an extension. Given this seems to be such a useful feature this PR proposes to make it part of Blender.

Note: I'm sure how significant the compositor integration was, given the workarounds that were needed to make it work, I don't think it's acceptable to include the functionality. There may be some users who want this still.

Add the operator from the io_import_images_as_planes add-on, making it a built-in operator. The main differences with the add-on are: - Compositor integration has been removed. - The file handler for dropping images has been removed to avoid conflicting with Blender's default drop handler. Otherwise all other functionality has been kept. ---- Background: when moving add-ons to extensions this was one of the add-ons many users mentioned as being important to them and preferred it not be moved to an extension. Given this seems to be such a useful feature this PR proposes to make it part of Blender. Note: I'm sure how significant the compositor integration was, given the workarounds that were needed to make it work, I don't think it's acceptable to include the functionality. There may be some users who want this still.
Campbell Barton added 8 commits 2024-05-24 16:11:22 +02:00
Co-authored-by: Aaron Carlisle <carlisle.b3d@gmail.com>
Co-authored-by: Bastien Montagne <bastien@blender.org>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Co-authored-by: Brendon Murphy <meta.androcto1@gmail.com>
Co-authored-by: Campbell Barton <ideasman42@gmail.com>
Co-authored-by: CoDEmanX <codemanx@gmx.de>
Co-authored-by: Dalai Felinto <dalai@blender.org>
Co-authored-by: Damien Picard <dam.pic@free.fr>
Co-authored-by: Daniel Salazar <zanqdo@gmail.com>
Co-authored-by: Florian Meyer <florianfelix@web.de>
Co-authored-by: Jacques Lucke <mail@jlucke.com>
Co-authored-by: Jesse Yurkovich <jesse.y@gmail.com>
Co-authored-by: Jonathan Smith <j.jaydez@gmail.com>
Co-authored-by: Luca Bonavita <mindrones@gmail.com>
Co-authored-by: meta-androcto <meta.androcto1@gmail.com>
Co-authored-by: Philipp Oeser <info@graphics-engineer.com>
Co-authored-by: Pratik Borhade <pratikborhade302@gmail.com>
Co-authored-by: Rick Astley <mrbimax>
Co-authored-by: Sergey Sharybin <sergey@blender.org>
Co-authored-by: Sibo Van Gool <SiboVG>
Co-authored-by: Sun Kim <perplexing.sun@gmail.com>
Co-authored-by: Thomas Dinges <blender@dingto.org>
Co-authored-by: Victor Chedeville <victor-09@noreply.localhost>
This relied on drivers and depsgraph hooks in a way that wouldn't be
acceptable for core scripts.

Also defer imports where possible.
Prefer parenthesis & remove wrapping in some cases.
- Wrap property arguments onto their own lines.
- Avoid declaring variables in the class scope.
Dalai Felinto requested review from Bastien Montagne 2024-05-24 17:39:31 +02:00
Dalai Felinto pinned this 2024-05-24 17:39:35 +02:00
Bastien Montagne approved these changes 2024-05-24 18:37:39 +02:00
Bastien Montagne left a comment
Owner

Generally LGTM, though did not check each and every details.

The main differences with the add-on are:

  • Compositor integration has been removed.

I am indeed unsure about how many users rely on this feature... It feels fairly corner-case? In any case, should it really be needed, I'd hope we could implement it in a way less hacky way nowadays?

But agree this can be left aside for now.

  • The file handler for dropping images has been removed to avoid conflicting with Blender's default drop handler.

Am a bit more unsure about this removal... On one hand it's a very recent one, not present in any release afaik. On the other one, from a usability perspective, I can see it as a big plus - if it was implemented properly.

On the other hand, current implementation is not that useful, since planes are created at point of origin, not oriented to face the current view, etc.

So for this PR I think it's fine to remove it.

We could use a design task to define how both image as empty and image as plane could be integrated into a single drop handler. And/or how to make having more than one handler for the same data effectively usable for the user (current solution, showing an additional choice menu, essentially defeats the purpose of drag'n'drop imho).

Generally LGTM, though did not check each and every details. > The main differences with the add-on are: > * Compositor integration has been removed. I am indeed unsure about how many users rely on this feature... It feels fairly corner-case? In any case, should it really be needed, I'd hope we could implement it in a way less hacky way nowadays? But agree this can be left aside for now. > * The file handler for dropping images has been removed to avoid conflicting with Blender's default drop handler. Am a bit more unsure about this removal... On one hand it's a very recent one, not present in any release afaik. On the other one, from a usability perspective, I can see it as a big plus - if it was implemented properly. On the other hand, current implementation is not that useful, since planes are created at point of origin, not oriented to face the current view, etc. So for this PR I think it's fine to remove it. We could use a design task to define how both `image as empty` and `image as plane` could be integrated into a single drop handler. And/or how to make having more than one handler for the same data effectively usable for the user (current solution, showing an additional choice menu, essentially defeats the purpose of drag'n'drop imho).

@guishe has been doing a lot of work on these kinds of drop handlers as well, maybe he has an idea for how best to integrate this.

@guishe has been doing a lot of work on these kinds of drop handlers as well, maybe he has an idea for how best to integrate this.

You should see a conflict resolution popup if you drag/drop onto a space with multiple handlers enabled for a given file type. For example, using a build from mid April with the Image as Planes addon enabled, you would see:

conflict-resolution.png

You should see a conflict resolution popup if you drag/drop onto a space with multiple handlers enabled for a given file type. For example, using a build from mid April with the Image as Planes addon enabled, you would see: ![conflict-resolution.png](/attachments/0499eff5-f28b-4b7d-a1bc-1d235274a68e)
First-time contributor

I am indeed unsure about how many users rely on this (compositor) feature... It feels fairly corner-case?

Was not even aware it existed, and I don't think that I've needed whatever it is that it does.

>I am indeed unsure about how many users rely on this (compositor) feature... It feels fairly corner-case? Was not even aware it existed, and I don't think that I've needed whatever it is that it does.

You should see a conflict resolution popup if you drag/drop onto a space with multiple handlers enabled for a given file type. For example, using a build from mid April with the Image as Planes addon enabled, you would see:

conflict-resolution.png

Yes it works, but imho this extra clicking defeats the whole purpose of drag'n'drop... If I need to click through two different pop-ups every time I drag an image, I'm likely just as well using the regular import workflow. But this is not really a discussion for this thread anyway. ;)

> You should see a conflict resolution popup if you drag/drop onto a space with multiple handlers enabled for a given file type. For example, using a build from mid April with the Image as Planes addon enabled, you would see: > > ![conflict-resolution.png](/attachments/0499eff5-f28b-4b7d-a1bc-1d235274a68e) Yes it works, but imho this extra clicking defeats the whole purpose of drag'n'drop... If I need to click through two different pop-ups every time I drag an image, I'm likely just as well using the regular import workflow. But this is not really a discussion for this thread anyway. ;)

Yes it works, but imho this extra clicking defeats the whole purpose of drag'n'drop... If I need to click through two different pop-ups every time I drag an image, I'm likely just as well using the regular import workflow. But this is not really a discussion for this thread anyway. ;)

I think the popup is still much more convenient than going through the file browser. It's clicking an option that is right under the mouse, versus easily a dozen clicks to do the same thing through the file browser. Personally I'd vote to keep the popup, especially as I think users want to do this more often than create an image empty.

> Yes it works, but imho this extra clicking defeats the whole purpose of drag'n'drop... If I need to click through two different pop-ups every time I drag an image, I'm likely just as well using the regular import workflow. But this is not really a discussion for this thread anyway. ;) I think the popup is still much more convenient than going through the file browser. It's clicking an option that is right under the mouse, versus easily a dozen clicks to do the same thing through the file browser. Personally I'd vote to keep the popup, especially as I think users want to do this more often than create an image empty.
Contributor

I personally dont want popup, probably ever for this. 9 our of 10 times im importing reference image for sculpting or modeling, as Im sure most users are.

What I think is best solution is what I did for my version of addon. Empty image should have Convert >> Mesh operator that makes it into mesh plane. This code can be reused for that.

Its more consistent with Blender and MUCH better UX i think. Having to click this everytime I import refenrence would annoy the heck out of me. But going through add menu is annoying as well. Drop & concert is fast

I personally dont want popup, probably ever for this. 9 our of 10 times im importing reference image for sculpting or modeling, as Im sure most users are. What I think is best solution is what I did for my version of addon. Empty image should have Convert >> Mesh operator that makes it into mesh plane. This code can be reused for that. Its more consistent with Blender and MUCH better UX i think. Having to click this everytime I import refenrence would annoy the heck out of me. But going through add menu is annoying as well. Drop & concert is fast
Dalai Felinto unpinned this 2024-05-27 11:17:13 +02:00
First-time contributor

It is important to consider that many users, particularly in architectural visualization, import images as planes for use as cutouts or backgrounds in their scenes.

I really like the current popup design as it caters to this common use case by offering a quick and convenient way to convert the image to a mesh plane upon import. This eliminates the extra steps of selecting the image, right-clicking, and navigating through menus to find the conversion option(operator).

While there might be a slight annoyance with the popup for some specific workflow, it significantly improves the experience for many other users. Additionally, popups for drag-and-drop imports is already a thing in blender; providing users with the opportunity to customize their import options.

Perhaps a compromise could be explored where the popup offers a checkbox to "Always import images as empties" for users who prefer such behavior. This way, you can avoid the popup in the future, while others can still benefit from the functionality.

It is important to consider that many users, particularly in architectural visualization, import images as planes for use as cutouts or backgrounds in their scenes. I really like the current popup design as it caters to this common use case by offering a quick and convenient way to convert the image to a mesh plane upon import. This eliminates the extra steps of selecting the image, right-clicking, and navigating through menus to find the conversion option(operator). While there might be a slight annoyance with the popup for some specific workflow, it significantly improves the experience for many other users. Additionally, popups for drag-and-drop imports is already a thing in blender; providing users with the opportunity to customize their import options. Perhaps a compromise could be explored where the popup offers a checkbox to "Always import images as empties" for users who prefer such behavior. This way, you can avoid the popup in the future, while others can still benefit from the functionality.

Follow up task for fixing it for EEVEE next: #122315

Follow up task for fixing it for EEVEE next: https://projects.blender.org/blender/blender/issues/122315
Campbell Barton manually merged commit b5003fa56c into main 2024-05-28 04:11:00 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
Asset Browser Project
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
8 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#122223
No description provided.