bpy.types.SpaceSpreadsheet.draw_handler_add - TypeError: unknown space type 'SpaceSpreadsheet' #94685

Closed
opened 2022-01-06 12:46:58 +01:00 by Jakub Uhlik · 7 comments

System Information
Operating system: macOS-10.13.6-x86_64-i386-64bit 64 Bits

Blender Version
Broken: version: 3.0.0, branch: master, commit date: 2021-12-02 18:35, hash: f1cca30557
Worked: never?

Short description of error
not being able to add draw handler on spreadsheet

Exact steps for others to reproduce the error
run code (taken from gpu examples, only space type is changed)

import bpy
import gpu
from gpu_extras.batch import batch_for_shader

vertices = (
    (100, 100), (300, 100),
    (100, 200), (300, 200))

indices = (
    (0, 1, 2), (2, 1, 3))

shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices)


def draw():
    shader.bind()
    shader.uniform_float("color", (0, 0.5, 0.5, 1.0))
    batch.draw(shader)


bpy.types.SpaceSpreadsheet.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')

this results in:

Traceback (most recent call last):
  File "/Text", line 22, in <module>
TypeError: unknown space type 'SpaceSpreadsheet'
Error: Python script failed, check the message in the system console

if you change on last line from SpaceSpreadsheet to any other space, for example SpaceInfo or SpaceConsole, handler is added and rectangle is drawn

**System Information** Operating system: macOS-10.13.6-x86_64-i386-64bit 64 Bits **Blender Version** Broken: version: 3.0.0, branch: master, commit date: 2021-12-02 18:35, hash: `f1cca30557` Worked: never? **Short description of error** not being able to add draw handler on spreadsheet **Exact steps for others to reproduce the error** run code (taken from gpu examples, only space type is changed) ``` import bpy import gpu from gpu_extras.batch import batch_for_shader vertices = ( (100, 100), (300, 100), (100, 200), (300, 200)) indices = ( (0, 1, 2), (2, 1, 3)) shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR') batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices) def draw(): shader.bind() shader.uniform_float("color", (0, 0.5, 0.5, 1.0)) batch.draw(shader) bpy.types.SpaceSpreadsheet.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL') ``` this results in: ``` Traceback (most recent call last): File "/Text", line 22, in <module> TypeError: unknown space type 'SpaceSpreadsheet' Error: Python script failed, check the message in the system console ``` if you change on last line from `SpaceSpreadsheet` to any other space, for example `SpaceInfo` or `SpaceConsole`, handler is added and rectangle is drawn
Author

Added subscriber: @JakubUhlik

Added subscriber: @JakubUhlik
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

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

Changed status from 'Needs Triage' to: 'Confirmed'
Philipp Oeser self-assigned this 2022-01-06 13:23:04 +01:00
Member

Can confirm, will check

Can confirm, will check

This issue was referenced by a597164ea6

This issue was referenced by a597164ea67c6aa196f8ecfdcddd9c5b6b4db396

This issue was referenced by 08aa7861d6

This issue was referenced by 08aa7861d6a4c2c9397833322f959fad4df4885f
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
Asset Browser Project
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
3 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#94685
No description provided.