Fix: Remove duplicate image_add operators in the 3D view port #118973
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#118973
Loading…
Reference in New Issue
No description provided.
Delete Branch "ZedDB/blender:fix_image_add"
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?
As part of #118623, we discovered that the operator used for adding images in the 3D viewport was not the same when drag and dropping as when adding it from the add menu. This lead to different and potentially confusing behaviour for the user when they use both.
This patch removes the python operator and unifies the functionality into one operator. It also renames the operator to be in line with the other "Add X" object operators.
@ -1284,3 +1322,3 @@
}
void OBJECT_OT_drop_named_image(wmOperatorType *ot)
void OBJECT_OT_image_add(wmOperatorType *ot)
The name
OBJECT_OT_empty_image_add
clearer this makes it more obvious this adds and empty object.@ -1294,3 +1330,3 @@
/* api callbacks */
ot->invoke = empty_drop_named_image_invoke;
ot->invoke = image_add_invoke;
These read as if they handle image data blocks, perhaps
object_image_add_*
could be used as a prefix.@ -877,6 +877,14 @@ static void view3d_id_path_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
{
ID *id = WM_drag_get_local_ID_or_import_from_asset(C, drag, 0);
if (STREQ(drop->opname, "OBJECT_OT_image_add")) {
Initializing defaults here seems odd, this could be set in the
image_add_invoke
code-path that deals with dropping an image, initializing it based on the 3D view-port if the property hasn't been set.@ -591,3 +583,3 @@
}
static bool background_image_add_poll(bContext *C)
static int camera_background_image_add_invoke(bContext *C,
This invoke function can be removed if it's only calling exec.
@ -616,0 +618,4 @@
true,
"Relative Path",
"Select the file relative to the blend file");
RNA_def_property_flag(prop, (PropertyFlag)(PROP_HIDDEN | PROP_SKIP_SAVE));
*picky*
(PropertyFlag)(...)
can use a function style castPropertyFlag(...)
.Accepting with minor requests.
@ -1241,0 +1293,4 @@
/* Check if we should switch to "background" mode. */
RegionView3D *rv3d = CTX_wm_region_view3d(C);
if (rv3d->persp != RV3D_PERSP) {
RNA_boolean_set(op->ptr, "background", true);
This should only be set if the value isn't set,
RNA_struct_property_is_set
.@ -1315,0 +1364,4 @@
RNA_def_property_flag(prop, (PropertyFlag)(PROP_SKIP_SAVE));
/* Hide the filepath and relative path prop */
prop = RNA_struct_type_find_property(ot->srna, "filepath");
RNA_def_property_flag(prop, (PropertyFlag)(PROP_HIDDEN | PROP_SKIP_PRESET));
(PropertyFlag)(...)
->PropertyFlag(...)
@blender-bot build
03fcd4bc54
to25c773eb73