Use FileHandlers in the View 3d #117728

Merged
Jesse Yurkovich merged 6 commits from guishe/blender:image-as-plane-fh into main 2024-03-26 20:01:20 +01:00
Contributor

Use File Handlers to handle file drag-n-drop in the
View 3d. Drop-boxes still remains since they handle
Textures ID drag-n-drop.

This will allow users to install add-ons that may handle
drag-n-drop images or movies files in the View 3d
since FileHandlers let user choose which FileHandler to use.

Use File Handlers to handle file drag-n-drop in the View 3d. Drop-boxes still remains since they handle Textures ID drag-n-drop. This will allow users to install add-ons that may handle drag-n-drop images or movies files in the View 3d since FileHandlers let user choose which FileHandler to use.
Guillermo Venegas added 1 commit 2024-02-01 17:02:06 +01:00
Guillermo Venegas added 1 commit 2024-02-01 17:15:02 +01:00
Jesse Yurkovich requested review from Jesse Yurkovich 2024-02-01 18:51:11 +01:00
Guillermo Venegas added 1 commit 2024-02-01 19:46:58 +01:00
Jesse Yurkovich approved these changes 2024-02-06 03:58:35 +01:00
Jesse Yurkovich left a comment
Member

This one looks ok from my side and I didn't run into any obvious workflow issues.

CC @JulianEisel

This one looks ok from my side and I didn't run into any obvious workflow issues. CC @JulianEisel
Jesse Yurkovich requested review from Julian Eisel 2024-02-06 03:58:57 +01:00
Julian Eisel reviewed 2024-02-07 13:48:03 +01:00
@ -262,0 +266,4 @@
bl_idname = "VIEW3D_FH_image_plane"
bl_label = "Add image plane"
bl_import_operator = "OBJECT_OT_drop_named_image"
bl_file_extensions = ';'.join(bpy.path.extensions_image) + ';'.join(bpy.path.extensions_movie)
Member

Doesn't this need another ; in between the image and movie extensions? (Same below)

Doesn't this need another `;` in between the image and movie extensions? (Same below)
guishe marked this conversation as resolved
Guillermo Venegas added 1 commit 2024-02-07 17:08:16 +01:00
Author
Contributor

To note: if more file handlers are used in the 3D view with image/video files, the menu will be displayed, the mouse coordinates in the event when the operator is invoked might not match the mouse coordinates when the drop it is done.

To note: if more file handlers are used in the 3D view with image/video files, the menu will be displayed, the mouse coordinates in the event when the operator is invoked might not match the mouse coordinates when the drop it is done. <video src="/attachments/376548f9-1856-460d-be84-94ff88bc2976" title="2024-02-07 12-29-26.mp4" controls></video>
Member

To note: if more file handlers are used in the 3D view with image/video files, the menu will be displayed, the mouse coordinates in the event when the operator is invoked might not match the mouse coordinates when the drop it is done.

In that case we should be able to store the mouse position at the moment of the drop. E.g. it can be an operator property.

> To note: if more file handlers are used in the 3D view with image/video files, the menu will be displayed, the mouse coordinates in the event when the operator is invoked might not match the mouse coordinates when the drop it is done. In that case we should be able to store the mouse position at the moment of the drop. E.g. it can be an operator property.
Julian Eisel approved these changes 2024-02-07 19:44:08 +01:00

Is this, and the similar #117707, acceptable for the 4.1 branch or only main?

Is this, and the similar #117707, acceptable for the 4.1 branch or only main?
Member

Technically this is a new feature, so shouldn't go in during bcon3, unless we have a good enough reason to make an exception. Don't think that's the case here though, merging this for 4.2 seems fine as well.

Technically this is a new feature, so shouldn't go in during bcon3, unless we have a good enough reason to make an exception. Don't think that's the case here though, merging this for 4.2 seems fine as well.

The tricky part about these 2 PRs is that they can be seen as "fixes" to the FileHandler APIs introduced in 4.1. Without them, if a user tries to create a custom FileHandler for images targeting the Image or Viewport editors, the existing drag-drop boxes will "steal" the input and never trigger the user's handler. Just want to be sure we're on the same page for that scenario. We can of course save it for 4.2 as there are more places where this stealing can occur and maybe it's better to fix them all in the same release.

The tricky part about these 2 PRs is that they can be seen as "fixes" to the FileHandler APIs introduced in 4.1. Without them, if a user tries to create a custom FileHandler for images targeting the Image or Viewport editors, the existing drag-drop boxes will "steal" the input and never trigger the user's handler. Just want to be sure we're on the same page for that scenario. We can of course save it for 4.2 as there are more places where this stealing can occur and maybe it's better to fix them all in the same release.

Looks like commit 013cd3d1ba changed both operator names so this PR no longer works. Can you update and I'll get this checked in soon afterwards.

Looks like commit 013cd3d1bac73a6df877043067bc57d040e5ef76 changed both operator names so this PR no longer works. Can you update and I'll get this checked in soon afterwards.
Guillermo Venegas added 2 commits 2024-03-26 16:39:44 +01:00
Author
Contributor

fixed fh names too to align with operators

fixed fh names too to align with operators
Jesse Yurkovich merged commit 8b6a21c122 into main 2024-03-26 20:01:20 +01:00
Guillermo Venegas deleted branch image-as-plane-fh 2024-03-26 20:27:11 +01:00
First-time contributor

Hello. It is interesting if it will be possible to drag the textures into the object using this? Now the textures can be pulled by the Cheze browser into the nodes, or as a reference, but it is impossible to directly on the object.

Hello. It is interesting if it will be possible to drag the textures into the object using this? Now the textures can be pulled by the Cheze browser into the nodes, or as a reference, but it is impossible to directly on the object.
Sign in to join this conversation.
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
4 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#117728
No description provided.