bpy.context.scene.statistics no longer exists in the Python API #79816

Closed
opened 2020-08-16 05:06:19 +02:00 by Ethan Simon · 25 comments

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 451.77

Blender Version
Broken: version: 2.90.0 Beta, branch: master, commit date: 2020-08-14 20:34, hash: c300fc56c3
Worked: (newest version of Blender that worked as expected)

Short description of error
So I actually read from the string that bpy.context.scene.statistics returns in one of my add-ons, but in 2.9 it seems that they are gone. This may not be a bug, but I feel like removing it entirely is just going to destroy parts of my script for seemingly no reason. If there is a better way to collect that information I would be appreciative, I know this isn't a place for add-on creation help but some of the code seems deprecated now.

**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 451.77 **Blender Version** Broken: version: 2.90.0 Beta, branch: master, commit date: 2020-08-14 20:34, hash: `c300fc56c3` Worked: (newest version of Blender that worked as expected) **Short description of error** So I actually read from the string that bpy.context.scene.statistics returns in one of my add-ons, but in 2.9 it seems that they are gone. This may not be a bug, but I feel like removing it entirely is just going to destroy parts of my script for seemingly no reason. If there is a better way to collect that information I would be appreciative, I know this isn't a place for add-on creation help but some of the code seems deprecated now.
Author

Added subscriber: @razed

Added subscriber: @razed

Added subscriber: @deadpin

Added subscriber: @deadpin

I also feel like this was an unnecessary breaking change. It's not listed in the Release Notes either. I haven't got much traction in getting it put back in when I bring this up on occasion but maybe this bug will change some minds.

I also feel like this was an unnecessary breaking change. It's not listed in the Release Notes either. I haven't got much traction in getting it put back in when I bring this up on occasion but maybe this bug will change some minds.
Author

This roadmap also explicitly states zero breakage in the API, when it obviously isn't true. image.png

This roadmap also explicitly states zero breakage in the API, when it obviously isn't true. ![image.png](https://archive.blender.org/developer/F8785946/image.png)
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Member

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

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

I think the reason it was removed is that you can now toggle which settings to display. Maybe these settings could be overriden though.

I asked the UI team about this, the result will be either of these options, not sure which right now:

  1. Change is documented in the release notes and we have an asterisk on "No API breakage"
  2. We find some way to restore the function
I think the reason it was removed is that you can now toggle which settings to display. Maybe these settings could be overriden though. I asked the UI team about this, the result will be either of these options, not sure which right now: 1. Change is documented in the release notes and we have an asterisk on "No API breakage" 2. We find some way to restore the function
Author

If there isn't a way to restore the function is there any alternative route I can take? I ended up using this bit of the API because I was unable to find any other efficient way of getting total selected vertices. I would rather not loop through every vertex in a scene.

If there isn't a way to restore the function is there any alternative route I can take? I ended up using this bit of the API because I was unable to find any other efficient way of getting total selected vertices. I would rather not loop through every vertex in a scene.

Added subscriber: @Dogway

Added subscriber: @Dogway
Member

Added subscriber: @Calra

Added subscriber: @Calra
Hans Goudey was assigned by Dalai Felinto 2020-08-17 09:53:47 +02:00

Added subscribers: @JulianEisel, @dfelinto

Added subscribers: @JulianEisel, @dfelinto

I think this API change should be reverted, there is little reason for this to break the API. @JulianEisel said he will look into its feasibility and see with @HooglyBoogly who can tackle this.

I think this API change should be reverted, there is little reason for this to break the API. @JulianEisel said he will look into its feasibility and see with @HooglyBoogly who can tackle this.
Member

Added subscriber: @Harley

Added subscriber: @Harley
Member

We can bring back the old API function. The only reason why this needs to be called via the screen currently, is that the screen holds the string buffer of the returned string. We can move that buffer back to the View Layer, where it was before.
@Harley are you available to work on this before bcon4 (Wednesday)? Otherwise I'll pass this on to @HooglyBoogly.


A note on the No API breakage thing:
For every release there are smaller changes done to the API - an argument renamed here, a value changed from a boolean to an enum there, etc. For the 2.90 release there are a few such changes too . These should be avoided if that can be done in a clean way, but they are usual.*No API breakage// was meant to say there are no changes planned, but I find that a bit of a misleading way to put that. Small changes may still happen.
They must be documented in the release notes in any case though.

We can bring back the old API function. The only reason why this needs to be called via the screen currently, is that the screen holds the string buffer of the returned string. We can move that buffer back to the View Layer, where it was before. @Harley are you available to work on this before bcon4 (Wednesday)? Otherwise I'll pass this on to @HooglyBoogly. --- A note on the *No API breakage* thing: For every release there are smaller changes done to the API - an argument renamed here, a value changed from a boolean to an enum there, etc. For the 2.90 release [there are a few such changes too ](https:*wiki.blender.org/wiki/Reference/Release_Notes/2.90/Python_API#Compatibility). These should be avoided if that can be done in a clean way, but they are usual.*No API breakage// was meant to say there are no changes **planned**, but I find that a bit of a misleading way to put that. Small changes may still happen. They **must** be documented in the release notes in any case though.
Member

Trying to remember the history of this thing, which is complex only because it had a few detours along the way. LOL.

At the beginning my idea was to have the 3DView overlay stats be just a new option, without changing or removing the footer stats - which is how it ended up in the end. But...

When I first showed this off it was then Brecht's opinion that either the code duplication be fixed or the footer stats removed. William's preference was to remove the footer stats. The other (important) comment is that we would eventually want the overlay stats to show local stats, not just overall scene stats. This is why the stats were removed from scene. There was only the one set of stats (as a 3DView overlay) and those would (eventually) not only be only per-scene, but would be able to differ per-view.

Later we backtracked and we (for good reason) went back to my original idea that the overlay stats could be enabled separately from the footer stats. So we'd now have two versions, one in the footer that would remain per-scene and the overlay could move toward showing local stats.

I can't think of any reasons off the top of my head on why the footer stats can't be from bpy.context.scene.statistics as they were before. Seems reasonable.

@JulianEisel - are you available to work on this before bcon4 (Wednesday)?

Sorry no. I probably won't have much time to spare for Blender stuff for about a month or so, then will have piles of time through the winter.

Trying to remember the history of this thing, which is complex only because it had a few detours along the way. LOL. At the beginning my idea was to have the 3DView overlay stats be just a new option, without changing or removing the footer stats - **which is how it ended up in the end**. But... When I first showed this off it was then Brecht's opinion that either the code duplication be fixed or the footer stats removed. William's preference was to remove the footer stats. The other (important) comment is that we would eventually want the overlay stats to show local stats, not just overall scene stats. This is why the stats were removed from scene. There was only the one set of stats (as a 3DView overlay) and those would (eventually) not only be only per-scene, but would be able to differ per-view. Later we backtracked and we (for good reason) went back to my original idea that the overlay stats could be enabled separately from the footer stats. So we'd now have two versions, one in the footer that would remain per-scene and the overlay could move toward showing local stats. I can't think of any reasons off the top of my head on why the **footer stats** can't be from bpy.context.scene.statistics as they were before. Seems reasonable. > @JulianEisel - are you available to work on this before bcon4 (Wednesday)? Sorry no. I probably won't have much time to spare for Blender stuff for about a month or so, then will have piles of time through the winter.
Member

In #79816#997442, @Harley wrote:
Sorry no. I probably won't have much time to spare for Blender stuff for about a month or so, then will have piles of time through the winter.

No worries! I'll post a patch today or tomorrow. Thanks for the context.

> In #79816#997442, @Harley wrote: > Sorry no. I probably won't have much time to spare for Blender stuff for about a month or so, then will have piles of time through the winter. No worries! I'll post a patch today or tomorrow. Thanks for the context.
Author

Hans do you think it would be possible to return bpy.context.scene.statistics as something other than just a string (maybe a list) so it is easier to access? Currently I need to split the strings

Hans do you think it would be possible to return bpy.context.scene.statistics as something other than just a string (maybe a list) so it is easier to access? Currently I need to split the strings
Member

In #79816#997494, @razed wrote:
Hans do you think it would be possible to return bpy.context.scene.statistics as something other than just a string (maybe a list) so it is easier to access? Currently I need to split the strings

Since the goal is to avoid the API breakage I don't think we'll work on that now, but that might be a good improvement in the future.

> In #79816#997494, @razed wrote: > Hans do you think it would be possible to return bpy.context.scene.statistics as something other than just a string (maybe a list) so it is easier to access? Currently I need to split the strings Since the goal is to avoid the API breakage I don't think we'll work on that now, but that might be a good improvement in the future.
Author

Should I make a feature request for it? Not sure where I would go to request something for the Python API. I can think of some more put together ideas for improvements regarding it.

Should I make a feature request for it? Not sure where I would go to request something for the Python API. I can think of some more put together ideas for improvements regarding it.

+1 The important bit right now is that the API exists at all. Returning a proper "Stat" structure/dictionary back to python would be nice but that could happen later esp. considering the proximity to release right now.

Perhaps the Stat change could be done at the same time as supporting local view more properly, if/when that occurs that is, since that might break the api again anyhow.

+1 The important bit right now is that the API exists at all. Returning a proper "Stat" structure/dictionary back to python would be nice but that could happen later esp. considering the proximity to release right now. Perhaps the Stat change could be done at the same time as supporting local view more properly, if/when that occurs that is, since that might break the api again anyhow.
Member

As far as I know the 3D view stats are completely separate now, so that shouldn't be a problem in the future. A detailed feature request could go on right click select, and maybe end up in a design task. But a patch would be best : )

As far as I know the 3D view stats are completely separate now, so that shouldn't be a problem in the future. A detailed feature request could go on right click select, and maybe end up in a design task. But a patch would be best : )
Contributor

Added subscriber: @Raimund58

Added subscriber: @Raimund58

This issue was referenced by 8cbfc4c76e

This issue was referenced by 8cbfc4c76ed7747111e387863ad511939d389d87

This issue was referenced by 83c78529b9

This issue was referenced by 83c78529b9ef024f87ad96bc260fb25583fb9e7b
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Thomas Dinges added this to the 2.90 milestone 2023-02-08 16:25:41 +01:00
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
10 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#79816
No description provided.