Meshes vertex normals changed via Python API are not used by dupli vert instances #97018
Labels
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#97018
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 512.15
Blender Version
Broken: version: 3.1.2, branch: master, commit date: 2022-03-31 17:40, hash:
cc66d1020c
Worked: 3.0.1
Short description of error
Changing the normals of a mesh via the Python API (with mesh.vertices- [x].normal) does not modify the orientation of dupli vert instances placed on each vertex of that mesh. It assumed there are no edges nor faces, only verts for instances placement.
Exact steps for others to reproduce the error
m = bpy.data.meshes['Plane']
m.vertices- [x].normal = 1,0,0
This bug makes it impossible to place lots of instances objects in a scene using only vertices, I use it a lot.
Added subscriber: @piiichan
Added subscriber: @PratikPB2123
Added subscriber: @OmarEmaraDev
Changed status from 'Needs Triage' to: 'Needs User Info'
This doesn't seem to be working either on 3.0 using the blend file you provided. No matter what I assign to the normal, it is always
Vector((-0.7070833444595337, -0.7070833444595337, 0.0))
. Should I have done something differently?Here is a video that shows that for me assigning a normal does change its value, but not in the viewport.
demo.mp4
In Blender 3.0, true it is the same behavior using this method, but if you create a complete new mesh with Python, it works. Using the same demo .blend file, type in the Python console:
m = bpy.data.meshes.new("new_mesh")
m.from_pydata(vertices=[(1,0,0)], edges=- [ ], faces=[])
m.vertices- [x].normal = 0,0,1
Then swap the plane mesh with the newly created one, and the corresponding dupli vert instance will be rotated.
In the end, both ways should work.
Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'
I can replicate a change in the behavior across versions. In 3.0, changes to vertex normals take effect but are overwritten later, when going to edit mode for instance. In 3.1, changes to normals are written, but do not take effect at all.
Tried
BKE_mesh_vertex_normals_clear_dirty(mesh);
inBKE_mesh_vertex_normals_clear_dirty(mesh);
, but that didn't work. The original behavior is suspicious to me, so tagging the module for more information.Yes going to edit mode erases all vertex normals set via Python. This behavior goes way back to... I don't know... blender 2.49 at least. The best solution would be: custom vertex normals take effect AND going into edit mode doesn't erase them.
Added subscribers: @HooglyBoogly, @EAW
This was changed in 3.1 in the moving of normals out of MVert. See:
cfa53e0fbe
See the Python_API release notes here:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.1/Python_API
In
b7fe27314b
, there is the note:@HooglyBoogly do you have a suggested workaround?
Changed status from 'Needs Developer To Reproduce' to: 'Archived'
Added subscriber: @Hans-6
Setting the normal was always problematic and should never have been possible, since many operations would overwrite them anyway. Vertex normals are derived data, not something that's meant to be editable by the user.
I'd suggest using a vector attribute and the geometry nodes instance on points node for creating instances.
So, I don't think this is a bug, just a weird part of the Python API.
I see, I'll try the geometry nodes alternative, thank you.
The vertex normal attribute should be made read-only in the Python API, to avoid confusion for users.
Thanks, good idea. I did that here:
891268aa82
Great! :)