Creating a new attribute does not get selected if it's a face #114760

Closed
opened 2023-11-12 14:12:28 +01:00 by Daniel Gryningstjerna · 1 comment

System Information
Operating system: Windows-10-10.0.19045-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3060/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 536.67

Blender Version
Broken: version: 4.1.0 Alpha, branch: main, commit date: 2023-11-10 13:41, hash: cb5f650a5aa1

Short description of error
Create an edge or point attribute it gets selected in the list automaticly every time, when create a face attribute it does not get selected.

This is very inconsistatnt and makes it harder to make addons that use attributes.

Exact steps for others to reproduce the error
This works as expected when using point or edge:
image
image

When using face it does not get selected in the list:
image
image

This is my current workaround, very hacky and bad and should not be necessary:

def select_atribute(attribute_name):
    C = bpy.context
    ip_name = attribute_name
    named_attributes = C.object.data.attributes

    set_act = named_attributes.get(ip_name)
    C.object.data.attributes.active = set_act
    set_act_index = C.object.data.attributes.find(ip_name)
    C.object.data.attributes.active_index = set_act_index
        elif self.type == "Vertex":
            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
            bpy.ops.geometry.attribute_add(name="Vertex_Group", data_type='BOOLEAN', domain='POINT')
            bpy.ops.keyops.atri_op(type="Assign")

        elif self.type == "Edge":
            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
            bpy.ops.geometry.attribute_add(name="Edge_Group", data_type='BOOLEAN', domain='EDGE')
            bpy.ops.keyops.atri_op(type="Assign")

        elif self.type == "Face":
            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE')
            named_attributes = bpy.context.object.data.attributes
            attribute_name = "Face_Group"
            set_act = named_attributes.get(attribute_name)
            if set_act is not None:
                select_atribute(attribute_name)
            else:
                mesh = bpy.context.object.data
                mesh.attributes.new(name="Face_Group", domain='FACE', type='BOOLEAN')
                select_atribute(attribute_name)
            bpy.ops.keyops.atri_op(type="Assign")
**System Information** Operating system: Windows-10-10.0.19045-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3060/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 536.67 **Blender Version** Broken: version: 4.1.0 Alpha, branch: main, commit date: 2023-11-10 13:41, hash: `cb5f650a5aa1` **Short description of error** Create an edge or point attribute it gets selected in the list automaticly every time, when create a face attribute it does not get selected. This is very inconsistatnt and makes it harder to make addons that use attributes. **Exact steps for others to reproduce the error** This works as expected when using point or edge: ![image](/attachments/aabccd18-8fc0-4dc1-8513-cf672611b359) ![image](/attachments/16885238-4450-4021-a39d-c9e3adc7e971) When using face it does not get selected in the list: ![image](/attachments/636ec7b8-433f-4124-bbb3-29b3e66860bd) ![image](/attachments/91fbfe6e-0432-46e0-97d8-89b7487a24a6) This is my current workaround, very hacky and bad and should not be necessary: ``` def select_atribute(attribute_name): C = bpy.context ip_name = attribute_name named_attributes = C.object.data.attributes set_act = named_attributes.get(ip_name) C.object.data.attributes.active = set_act set_act_index = C.object.data.attributes.find(ip_name) C.object.data.attributes.active_index = set_act_index ``` ``` elif self.type == "Vertex": bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT') bpy.ops.geometry.attribute_add(name="Vertex_Group", data_type='BOOLEAN', domain='POINT') bpy.ops.keyops.atri_op(type="Assign") elif self.type == "Edge": bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE') bpy.ops.geometry.attribute_add(name="Edge_Group", data_type='BOOLEAN', domain='EDGE') bpy.ops.keyops.atri_op(type="Assign") elif self.type == "Face": bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE') named_attributes = bpy.context.object.data.attributes attribute_name = "Face_Group" set_act = named_attributes.get(attribute_name) if set_act is not None: select_atribute(attribute_name) else: mesh = bpy.context.object.data mesh.attributes.new(name="Face_Group", domain='FACE', type='BOOLEAN') select_atribute(attribute_name) bpy.ops.keyops.atri_op(type="Assign") ```
Daniel Gryningstjerna added the
Severity
Normal
Type
Report
Status
Needs Triage
labels 2023-11-12 14:12:29 +01:00
Richard Antalik added
Module
User Interface
Status
Confirmed
Interest
Modeling
and removed
Status
Needs Triage
labels 2023-11-12 19:59:25 +01:00
Member

I can check on this

I can check on this
Philipp Oeser self-assigned this 2023-11-13 11:31:44 +01:00
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-12-07 15:34:40 +01:00
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
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
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#114760
No description provided.