bpy.ops.screen.area_join not working anymore #90731

Open
opened 2021-08-17 14:10:23 +02:00 by Oleg · 12 comments

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 461.40

Blender Version
Broken: version: 3.0.0 Alpha, branch: master, commit date: 2021-08-16 16:57, hash: 4dba206011
Worked: 2.93.3 Release Candidate, branch: master, commit date: 2021-08-12 15:05, hash: 1eeae9be15

Short description of error
It seems that area_join operator no longer working after adding new join behavior.

Exact steps for others to reproduce the error

  • Open Scripting tab
  • Run following command and press "T" to refresh the area

bpy.ops.screen.area_join(cursor=(C.area.x, C.area.y + C.area.height))

  • Expected result - Python Console should joint into View 3D area

2.93.3 3.0
Blender 2021-08-18 10-20-29.mp4 Blender 2021-08-18 10-18-09.mp4
**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 461.40 **Blender Version** Broken: version: 3.0.0 Alpha, branch: master, commit date: 2021-08-16 16:57, hash: `4dba206011` Worked: 2.93.3 Release Candidate, branch: master, commit date: 2021-08-12 15:05, hash: `1eeae9be15` **Short description of error** It seems that area_join operator no longer working after adding new join behavior. **Exact steps for others to reproduce the error** - Open Scripting tab - Run following command and press "T" to refresh the area > bpy.ops.screen.area_join(cursor=(C.area.x, C.area.y + C.area.height)) - Expected result - Python Console should joint into View 3D area --- | 2.93.3 | 3.0 | | -- | -- | | [Blender 2021-08-18 10-20-29.mp4](https://archive.blender.org/developer/F10287145/Blender_2021-08-18_10-20-29.mp4) | [Blender 2021-08-18 10-18-09.mp4](https://archive.blender.org/developer/F10287136/Blender_2021-08-18_10-18-09.mp4) |
Author

Added subscriber: @DotBow

Added subscriber: @DotBow
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Added subscriber: @Harley

Added subscriber: @Harley
Member

Sorry, but not that familiar with using Python for this, so could you explain a bit better how this worked in earlier versions? Your “cursor” here is specifying a singular location at the top-left of one area. The code there has always started at the cursor location and expanded out to find two areas to join. But it could find 0-4 areas depending on where that point is. So I think you’d also have to pass a join direction for it to know what to do, otherwise how do you specify which area is subsumed by the other?

Sorry, but not that familiar with using Python for this, so could you explain a bit better how this worked in earlier versions? Your “cursor” here is specifying a singular location at the top-left of one area. The code there has always started at the cursor location and expanded out to find two areas to join. But it could find 0-4 areas depending on where that point is. So I think you’d also have to pass a join direction for it to know what to do, otherwise how do you specify which area is subsumed by the other?
Author

In #90731#1207529, @Harley wrote:
Sorry, but not that familiar with using Python for this, so could you explain a bit better how this worked in earlier versions? Your “cursor” here is specifying a singular location at the top-left of one area. The code there has always started at the cursor location and expanded out to find two areas to join. But it could find 0-4 areas depending on where that point is. So I think you’d also have to pass a join direction for it to know what to do, otherwise how do you specify which area is subsumed by the other?

It uses active area as a starting point, so you should only specify a second one using cursor location. It is super weird and unintuitive, but it is what it is...

Here is the doc page:
https://docs.blender.org/api/2.93/bpy.ops.screen.html?highlight=area_join#bpy.ops.screen.area_join

> In #90731#1207529, @Harley wrote: > Sorry, but not that familiar with using Python for this, so could you explain a bit better how this worked in earlier versions? Your “cursor” here is specifying a singular location at the top-left of one area. The code there has always started at the cursor location and expanded out to find two areas to join. But it could find 0-4 areas depending on where that point is. So I think you’d also have to pass a join direction for it to know what to do, otherwise how do you specify which area is subsumed by the other? It uses active area as a starting point, so you should only specify a second one using cursor location. It is super weird and unintuitive, but it is what it is... Here is the doc page: https://docs.blender.org/api/2.93/bpy.ops.screen.html?highlight=area_join#bpy.ops.screen.area_join
Member

@DotBow - It uses active area as a starting point, so you should only specify a second one using cursor location. It is super weird and unintuitive, but it is what it is...

AFAIK it has always been a bit broken, in that the C source not only requires a point (that can be used to locate multiple area neighbors) but also a direction to merge from and to. When called from python the only parameter is that cursor location which isn't enough to do so. When running your example in 2.93 it closes Console (but only seen after forcing a screen draw) and I can't see how you could merge in a different direction.

I think the only real way to fix area_join for python is to add a "Direction" property so in your example you'd also supply a direction='South' (or similar) and could use 'North" top merge Console into 3DView. Or obviously you could use a cursor location at Console right edge and "East" to merge Control into the text editor area. Sound Reasonable?

> @DotBow - It uses active area as a starting point, so you should only specify a second one using cursor location. It is super weird and unintuitive, but it is what it is... AFAIK it has always been a bit broken, in that the C source not only requires a point (that can be used to locate multiple area neighbors) but also a direction to merge from and to. When called from python the only parameter is that cursor location which isn't enough to do so. When running your example in 2.93 it closes Console (but only seen after forcing a screen draw) and I can't see how you could merge in a different direction. I think the only real way to fix area_join for python is to add a "Direction" property so in your example you'd also supply a direction='South' (or similar) and could use 'North" top merge Console into 3DView. Or obviously you could use a cursor location at Console right edge and "East" to merge Control into the text editor area. Sound Reasonable?
Author

@Harley yes, that's true - there is no way to set direction, so the only way I found for my add-on is to swap areas and after join them.
Yes, using area corner position and direction sounds like a great way to improve an operator!

@Harley yes, that's true - there is no way to set direction, so the only way I found for my add-on is to swap areas and after join them. Yes, using area corner position and direction sounds like a great way to improve an operator!
Member

Interesting is that for both "Join" and new "Close", I'm pretty sure I can get them working as you want from python, except for the specific example you are showing here. So far I'm not finding a way of having Console destroy itself this way without a ton of hurt. I see solutions that will work with all other areas, but not situations where Console (or Text editor running a script) can close themselves. Not sure if that is a major issue though and I can show a nice error message in this situation.

Interesting is that for both "Join" and new "Close", I'm pretty sure I can get them working as you want from python, **except** for the specific example you are showing here. So far I'm not finding a way of having Console destroy *itself* this way without a ton of hurt. I see solutions that will work with all other areas, but not situations where Console (or Text editor running a script) can close themselves. Not sure if that is a major issue though and I can show a nice error message in this situation.
Author

In #90731#1208042, @Harley wrote:
Interesting is that for both "Join" and new "Close", I'm pretty sure I can get them working as you want from python, except for the specific example you are showing here. So far I'm not finding a way of having Console destroy itself this way without a ton of hurt. I see solutions that will work with all other areas, but not situations where Console (or Text editor running a script) can close themselves. Not sure if that is a major issue though and I can show a nice error message in this situation.

I used it from Console only for quick demonstration purposes, it's not a real life case.

> In #90731#1208042, @Harley wrote: > Interesting is that for both "Join" and new "Close", I'm pretty sure I can get them working as you want from python, **except** for the specific example you are showing here. So far I'm not finding a way of having Console destroy *itself* this way without a ton of hurt. I see solutions that will work with all other areas, but not situations where Console (or Text editor running a script) can close themselves. Not sure if that is a major issue though and I can show a nice error message in this situation. I used it from Console only for quick demonstration purposes, it's not a real life case.
Author

Using new operator from D12307 works like a charm!
Thanks @Harley !

Using new operator from [D12307](https://archive.blender.org/developer/D12307) works like a charm! Thanks @Harley !
Philipp Oeser removed the
Interest
Python API
label 2023-02-10 09:04:31 +01:00

Is there any news, when bpy.ops.screen.area_join will be fixed?

I need very much to create area most left and can not do it with Python without area join operator

image

Is there any news, when `bpy.ops.screen.area_join` will be fixed? I need very much to create area most left and can not do it with Python without area join operator ![image](/attachments/3e435ce0-74de-43a5-928b-ba3f22258b89)
162 KiB
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#90731
No description provided.