Cant set particles[0].hair_keys[-1].co = Vector((0,0,3)) #60930
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#60930
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?
There is no way in blender 2.8 to write hair_key- [x].co to hair particle system.
Simple blend file with one particle hair and script:
HairKey_Set.blend
Works ok in blender 2.79. I tried to write hair_key.co to depsgraph evaluated object, but it would not work too.
Added subscriber: @JoseConseco
Added subscriber: @YoklJO
I haven't worked on Blender's source before, and found this ticket which seemed debuggable.
I found the culprit, which is in
rna_ParticleHairKey_location_object_info
ofrna_particle.c
.In this check:
if (psmd && psmd->mesh_final && psmd->psys) {
,mesh_final
is null, so it never finds theParticleHairKey
instance to modify. I don't really know what mesh_final is for, but I noticed that it isn't used anywhere in the function, so changing that if statement to:if (psmd && psmd->psys) {
makes the problem in this ticket's description go away. I have no idea if this will cause other problems, because maybe it's important to check thatmesh_final
is not null.Added subscriber: @Jandals
I have run into this same problem writing to hair_key- [x].co and I've also noticed that it's not just the ParticleHairKey that can't be found. When I try to access it, the Particle instance can't be found either.
If I'm looking for
reading from
also fails, which used to work in 2.79.
Added subscriber: @Lichtso
The problem goes far deeper:
Depsgraph copies every object and all their parts including ParticleSystemModifierData.
The copy of ParticleSystemModifierData is used in deformVerts and gets a mesh_final assigned.
However, the rna_ParticleHairKey_location_object_info looks in the original object for the ParticleSystemModifierData and that one never gets a mesh_final.
rna_ParticleHairKey_location_object_info also does a linear search over all hairs for every access to a HairKey which is extremely inefficient.
Thus, rna_ParticleHairKey_location_object_info is fundamentally broken in two ways: Its performance and it can never output a ParticleData pointer.
As the comment in the source code says, a fix would be storing all needed pointers like ParticleSystemModifierData and ParticleData in the ParticleHairKey pointerRNA.
Here an example of how the pointers of copies look like:
Note: The mesh_final is necessary because blender stores all HairKeys relative to their emitter mesh surface if the PSYS_HAIR_DYNAMICS flag is not set. See the use of psys_mat_hair_to_object in rna_ParticleHairKey_location_object_get and rna_ParticleHairKey_location_object_set.
Changed status from 'Open' to: 'Resolved'
After new depsgraph changes I tried to set particle hair keys co again, and got it working. Sollution:
Then tab into particle editmode, and out. I should update hair position. Not sure if there is better way (without tab)
Does not work for me it seems.
It does not matter how much I switch between object, particle and edit modes.
And others still have the same problem:
https://blender.stackexchange.com/questions/134532/blender-2-8-dynamically-set-particle-locations-via-python
@JoseConseco That seems more like a work-around to the actual problem. If the original problem is still there, then this ticket should not be set to Resolved.
But this seems to work ok. There is other problem preventing writing to hair positions: https://developer.blender.org/T64805.
Try adding cache manualy, then solution mentioned 2 posts above will work.