Gizmo bl_idname not working #72932

Closed
opened 2020-01-06 12:17:42 +01:00 by Cédric · 4 comments
Member

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

Blender Version
Broken: version: 2.82 (sub 6), branch: master, commit date: 2020-01-03 10:02, hash: 9b74e648c5

Short description of error
According to the documentation, the bl_idname of the gizmo should be blank by default and not read only :
Link for bl_idname

bl_idname
Type: string, default “”, (never None)

Or the bl_idname always return the type of the gizmo (i.e. "GIZMO_GT_arrow_3d") and it is not possible to change it.
I want to give a custom name so I can find wich one is the active gizmo and I can't find any name in the bpy_struct of the Gizmo, only the bl_idname.

Exact steps for others to reproduce the error
Using the default startup scene,
Select the point light
Copy/paste and execute the script bellow and look for the print in the console, it should return "Cutom_Gizmo" or open the custom_gizmo.blend file in attachment.

Thanks for your help.


- Example of a group that edits a single property
- using the predefined gizmo arrow.
#
- Usage: Select a light in the 3D view and drag the arrow at it's rear
- to change it's energy value.
#
import bpy
from bpy.types import (
    GizmoGroup,
)


class MyLightWidgetGroup(GizmoGroup):
    bl_idname = "OBJECT_GGT_light_test"
    bl_label = "Test Light Widget"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'WINDOW'
    bl_options = {'3D', 'PERSISTENT'}

    @classmethod
    def poll(cls, context):
        ob = context.object
        return (ob and ob.type == 'LIGHT')

    def setup(self, context):
        # Arrow gizmo has one 'offset' property we can assign to the light energy.
        ob = context.object
        mpr = self.gizmos.new("GIZMO_GT_arrow_3d")
        mpr.target_set_prop("offset", ob.data, "energy")
        mpr.matrix_basis = ob.matrix_world.normalized()
        mpr.draw_style = 'BOX'
        mpr.bl_idname = 'Custom_Gizmo'

        mpr.color = 1.0, 0.5, 0.0
        mpr.alpha = 0.5

        mpr.color_highlight = 1.0, 0.5, 1.0
        mpr.alpha_highlight = 0.5

        self.energy_widget = mpr

    def refresh(self, context):
        ob = context.object
        mpr = self.energy_widget
        mpr.matrix_basis = ob.matrix_world.normalized()
        print("Name: ", mpr.bl_idname)


bpy.utils.register_class(MyLightWidgetGroup)

custom_gizmo.blend

**System Information** Operating system: Windows-10-10.0.17763-SP0 64 Bits Graphics card: GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 441.66 **Blender Version** Broken: version: 2.82 (sub 6), branch: master, commit date: 2020-01-03 10:02, hash: `9b74e648c5` **Short description of error** According to the documentation, the bl_idname of the gizmo should be blank by default and not read only : [Link for bl_idname ](https://docs.blender.org/api/blender2.8/bpy.types.Gizmo.html?highlight=bl_idname) > bl_idname > Type: string, default “”, (never None) Or the bl_idname always return the type of the gizmo (i.e. "GIZMO_GT_arrow_3d") and it is not possible to change it. I want to give a custom name so I can find wich one is the active gizmo and I can't find any name in the bpy_struct of the Gizmo, only the bl_idname. **Exact steps for others to reproduce the error** Using the default startup scene, Select the point light Copy/paste and execute the script bellow and look for the print in the console, it should return "Cutom_Gizmo" or open the custom_gizmo.blend file in attachment. Thanks for your help. ``` - Example of a group that edits a single property - using the predefined gizmo arrow. # - Usage: Select a light in the 3D view and drag the arrow at it's rear - to change it's energy value. # import bpy from bpy.types import ( GizmoGroup, ) class MyLightWidgetGroup(GizmoGroup): bl_idname = "OBJECT_GGT_light_test" bl_label = "Test Light Widget" bl_space_type = 'VIEW_3D' bl_region_type = 'WINDOW' bl_options = {'3D', 'PERSISTENT'} @classmethod def poll(cls, context): ob = context.object return (ob and ob.type == 'LIGHT') def setup(self, context): # Arrow gizmo has one 'offset' property we can assign to the light energy. ob = context.object mpr = self.gizmos.new("GIZMO_GT_arrow_3d") mpr.target_set_prop("offset", ob.data, "energy") mpr.matrix_basis = ob.matrix_world.normalized() mpr.draw_style = 'BOX' mpr.bl_idname = 'Custom_Gizmo' mpr.color = 1.0, 0.5, 0.0 mpr.alpha = 0.5 mpr.color_highlight = 1.0, 0.5, 1.0 mpr.alpha_highlight = 0.5 self.energy_widget = mpr def refresh(self, context): ob = context.object mpr = self.energy_widget mpr.matrix_basis = ob.matrix_world.normalized() print("Name: ", mpr.bl_idname) bpy.utils.register_class(MyLightWidgetGroup) ``` [custom_gizmo.blend](https://archive.blender.org/developer/F8262062/custom_gizmo.blend)
Author
Member

Added subscriber: @Clarkx

Added subscriber: @Clarkx

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Thanks for the report but this is not a bug.

GIZMO_GT_arrow_3d is builtin.
You cannot change the bl_idname of builtin Gizmos.
Only those made in python.

(And it's not good practice to change bl_name at runtime)

Thanks for the report but this is not a bug. `GIZMO_GT_arrow_3d` is builtin. You cannot change the `bl_idname` of builtin Gizmos. Only those made in python. (And it's not good practice to change `bl_name` at runtime)

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

Changed status from 'Needs Triage' to: 'Archived'
Germano Cavalcante self-assigned this 2020-01-07 15:21:37 +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
2 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#72932
No description provided.