UI: Import obj files by drag and drop #106871
No reviewers
Labels
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
7 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#106871
Loading…
Reference in New Issue
No description provided.
Delete Branch "guishe:drop-file-obj"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The patch allows users to quickly import obj files by drag and drop. For
quick setup of the import, a popup dialog is displayed allowing the user
to configure the import or use a operator preset.
Here is a video showing what the patch allows:
@ -485,0 +499,4 @@
/* To allow drag and drop obj files, the file path must be tagged as PROP_SKIP_SAVE, this is
* to be able to choose a operator preset without clearing the file path.
*/
RNA_def_property_flag(RNA_struct_type_find_property(ot->srna, "filepath"), PROP_SKIP_SAVE);
The filepath property is now not included in the import obj operator presets, however operator presets saved before the patch may overwrite the file path, to avoid this the presets must be overwritten.
Nice!
The changes in
screen_ops.c
should be within#ifdef WITH_IO_WAVEFRONT_OBJ
directives to ensure that the code you need is compiled in.3905d6c17d
toda53519b42
Done!
Nice! I'm wondering though why only .OBJ and not all the formats that are native to blender (OBJ, USD, Alembic, Collada, PLY, STL)?
I'll be uploading them soon!
da53519b42
tode5c021b75
Looking forward to seeing this merged into master.
Damn I love this. Please don't take any of the following as me asking you to change anything. Just talking out loud...
Thinking about how this would look with a half-dozen importers done the same way. Could we instead have screen_ops.c do a single WM_dropbox_add for a new operator defined in io_ops.c? Possibly just WM_OT_drop_import or similar. And that operator is what checks the file extensions and dispatches the specific importers? That would simplify screen_ops, you wouldn't need the defines there, and it would keep all the import-related stuff together.
Maybe set each
WM_dropbox_add
onED_operatortypes_io
from the fileio_ops.c
It's now like this
Ending up being
obj_file_drop_poll would be defined on io_obj.c
Yes, that sounds pretty nice. Haven't thought of any reasons why it wouldn't work well.
de5c021b75
to0fd960bcc0
0fd960bcc0
to780bdaf45e
Just made the changes, most of the changes are now in the operator file.
From the file explorer you can select multiple .obj files and drag them onto Blender, but it imports just the first one. This feels like a different functionality from the regular file import dialog, where you can select multiple .obj files and they get imported with the same settings.
780bdaf45e
to5b6378089f
5b6378089f
to89f87984a9
I made changes to make it even easier to also apply the changes to the other formats
I'll work on it in another patch
Still works like a magic trick.
The new files this adds would also need the same "SPDX-License-Identifier" header you find on other files nearby.
Not sure if better, but worth considering not having a separate
WM_xxx_dropbox_add
for each importer but create a shared function that takes just operator name and poll function as those would be the only things changing between them AFAICT.Just thought about this for a while, I don't know how easy it would be to invoke OP from another OP in C
It's actually pretty easy, but I like your current plan much better anyway.
But if you ever want to invoke an operator, even from within another operator, it is like this:
89f87984a9
tod9ff390ee1
UI: Import obj files by drag and dropto UI: Import aea, dae, obj and usd files by drag and dropd9ff390ee1
toeee5ecb715
eee5ecb715
to31f262ee4a
31f262ee4a
to36ab0382f7
36ab0382f7
to9eca2b93fc
9eca2b93fc
to10933d0d27
UI: Import aea, dae, obj and usd files by drag and dropto UI: Import obj files by drag and dropDo you plan to have this in 3.6 LTS?
10933d0d27
to642d39a5ba
Cleaner version created, waiting for #108477 to be merged on main to upload improvements
UI: Import obj files by drag and dropto WIP: UI: Import obj files by drag and drop642d39a5ba
to0b2aef0052
with the current state now to add others dropbox is just as seen in the image, PD: I could leave this set and the drop will work, ones will open import window an other will just import
However changes are still required to show the pop-up dialog, and to skip save the file paths in the prefabs, as i did in the obj file
WIP: UI: Import obj files by drag and dropto UI: Import obj files by drag and dropWith this patch and together with this other one #107230, importing multiple files would be ready
Here a video
It would only be necessary to adapt in this patch
files_drop_copy
to copy all file pathsHey @guishe ! Just a quick note to tell you that this PR isn't being ignored, but that review could take longer than you might hope.
This type of interaction has obviously been requested by users for quite a long time. But we have also had implementations submitted over the years that have worked similarly but we couldn't accept back then because they caused issues that frankly I can't remember. But... most importantly... those were before Julian completely overhauled the drag and drop code. Your PR is using the new drag and drop code and seems to work wonderfully.
So basically this new (wonderful) functionality has some history that will cause a bit of thought for the review process. But I have great hope that this can be a Blender 4.0 feature.
Thank you, I know that the release of 3.6 is coming up right now, and although I wanted it to come out for 3.6, I understand that there are other issues that need to be resolved in advance.
I'm still looking forward to seeing this included for 4.0 as well.
Hey! I might be misunderstanding the code here, but is there any chance to put the file extension to operator mapping into Python? That way the code would be extendable for authors of addons that introduce new file formats or for pipeline TDs who want to overwrite on existing file formats which operator with which settings gets executed/exposed to the users.
@Frieder see #111242
Okay, let's close this patch and focus on the new one. I think there's agreement there that the other has the better design. Thanks!
Pull request closed