Problem with parent_vertices attribute #96556

Open
opened 2022-03-17 12:28:40 +01:00 by Anys Bouchafra · 10 comments

System Information
Operating system: Microsoft Windows 10 Professionnel
Graphics card: Nvidia Gefroce RTX 2080 Super

Blender Version
Blender 3.0.0, hash: f1cca30557 , branch: master

Short description of the bug
The attributes parent_vertices is by default to [0,0,0] but it cause some problem :
When you select the 0th vertex of a mesh and parent an other object with the vertex_parent_set() function the list still be the same [0,0,0].
So when the parent mesh is deleted you cannot know if there were a parent before.
Maybe set the default list to [None, None, None] will avoid the problem.

**System Information** Operating system: Microsoft Windows 10 Professionnel Graphics card: Nvidia Gefroce RTX 2080 Super **Blender Version** Blender 3.0.0, hash: f1cca3055776 , branch: master **Short description of the bug** The attributes parent_vertices is by default to [0,0,0] but it cause some problem : When you select the 0th vertex of a mesh and parent an other object with the vertex_parent_set() function the list still be the same [0,0,0]. So when the parent mesh is deleted you cannot know if there were a parent before. Maybe set the default list to [None, None, None] will avoid the problem.
Author

Added subscriber: @Anys-Bouchafra

Added subscriber: @Anys-Bouchafra

Added subscriber: @iss

Added subscriber: @iss

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'

Can you provide sample .blend file with script to demonstrate this issue?

Can you provide sample .blend file with script to demonstrate this issue?
Author

parent_vertices_problem.blend

Just run the first script, it will parent the sphere to the cube with vertex_parent_set() to the 0th vertex. Then go to object mode and run the second script. It will delete the cube and print the index of the vertex that was parent to the sphere. It will print 0, 0, 0 so we can't re-assign properly a cube in a scene just with this information. (It's not very problematic because I can use custom attributes to store informations but I think that default value to 0 is a bad idea when there are some 0th vertex)

[parent_vertices_problem.blend](https://archive.blender.org/developer/F12933200/parent_vertices_problem.blend) Just run the first script, it will parent the sphere to the cube with vertex_parent_set() to the 0th vertex. Then go to object mode and run the second script. It will delete the cube and print the index of the vertex that was parent to the sphere. It will print 0, 0, 0 so we can't re-assign properly a cube in a scene just with this information. (It's not very problematic because I can use custom attributes to store informations but I think that default value to 0 is a bad idea when there are some 0th vertex)

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'

So if I understand correctly, the issue is that you don't know whether there was any relationship in first place? I am not sure if such information should be preserved after parent has been removed in first place however.

I would imagine normally you would do something like this:

if objects['Sphere'].parent_type == 'VERTEX':
  vert_index = objects["Sphere"].parent_vertices[0]
  ...

Will have to check on this with other devs.

So if I understand correctly, the issue is that you don't know whether there was any relationship in first place? I am not sure if such information should be preserved after parent has been removed in first place however. I would imagine normally you would do something like this: ``` if objects['Sphere'].parent_type == 'VERTEX': vert_index = objects["Sphere"].parent_vertices[0] ... ``` Will have to check on this with other devs.

Added subscriber: @Sergey

Added subscriber: @Sergey

The parent_vertices requires some semantic treatment from the script writer:

  • The number of effective elements depends on the parent_type.
  • Reading the value without parent, or outside of effective number of elements is not well-defined.

For the scripts it is always better to build logic around properties visible to artists and script writers, than to rely on specific of internal memory representation.

Thanks for the report, but it is not really a bug.

The `parent_vertices` requires some semantic treatment from the script writer: - The number of effective elements depends on the `parent_type`. - Reading the value without parent, or outside of effective number of elements is not well-defined. For the scripts it is always better to build logic around properties visible to artists and script writers, than to rely on specific of internal memory representation. Thanks for the report, but it is not really a bug.
Member

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

Changed status from 'Needs Triage' to: 'Confirmed'
Philipp Oeser removed the
Interest
Modeling
label 2023-02-09 15:27:57 +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
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#96556
No description provided.