Geometry Node: Changing modifier input values with python no cause update #87006
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
28 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#87006
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.18362-SP0 64 Bits
Graphics card: GeForce RTX 2080 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 461.72
Blender Version
Broken: version: 2.93.0 Alpha, branch: master, commit date: 2021-03-27 14:01, hash:
a9e7d503dd
Short description of error
Changing modifier input values with python no cause update.
By code:
Value in modifier property was changed. User interface no updated before modifiers panel are not redrawn. Result of modifier didn't updated.
Exact steps for others to reproduce the error
bpy.data.objects["Cube"].modifiers["GeometryNodes"]["Input_7"] = 1.0
in the python consoleThe modifier UI may change, but the Viewport does not.
geom_node_py_bug.blend
Added subscriber: @1029910278
#88545 was marked as duplicate of this issue
#87125 was marked as duplicate of this issue
Added subscriber: @filedescriptor
Changed status from 'Needs Triage' to: 'Needs User Info'
@1029910278 Could you add the
.blend
test file to the report? That would be helpful. Thanks.just record a video for this error. You can see that both the cube and line is not active in viewport. And the cube's property disappear.
2021-03-31 19-58-52.mp4
Changed status from 'Needs User Info' to: 'Needs Triage'
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @mano-wii
Added subscriber: @Pasang
Added subscriber: @VDC
Added subscriber: @JacquesLucke
Think the problem here will also be fixed by D11572, once we found a good solution.
Added subscriber: @MiroHorvath
Added subscriber: @petneb
Is there any progress on fixing this problem? Since the field system will not display the attribute, I have to stick to use the old nodes(The only way to control them is to acess the node tree)
Added subscriber: @TheJeran
Oh no this has been here almost a year?
Added subscriber: @JacobMerrill-1
does this require .update_tag() ?
just tested
bpy.data.objects["Cube"].update_tag()
is all that is required*
I think this can be closed actually
2022-02-04 15-20-35.mp4
The value of Z displayed in the modifier panel seems unchanged?
For me, update_tag() only works if the frame changes manually again. So when I render out an animation nothing happens.
edit:
bpy.data.objects[name].update_tag()
bpy.data.scenes['Scene'].frame_current = currentFrame+1
This works for me, but it's not really what I want.
yeah I just noted that it appears to be disabled somehow from being used continuously :(
a work around is to use a driver and move a empty and use it's X Y and Z as drivers
false alarm* - I was editing slot 1 which is 'geometry'
I think the main issue is we should able to access these inputs by name*
object.modifiers['GeometryNodes'].input['Name'] = Value
Added subscriber: @stilobique
Work to me, not really sure about the 'update_tag' function ; I'm stay here to follow this ticket.
Added subscriber: @Human_Robot
The update_tag() trick doesn't fully work. Yes it will update the modifier once but then it won't dynamically update after that. For example my geometry nodes take a collection as input to drive multiple Set Position. If I change the location of an object in the input collection after running the script that tells blender to use this collection as input, it won't update the geometry nodes output to match the change.
This comment was removed by @Human_Robot
2022-11-15 16-40-27.mp4
Removed subscriber: @filedescriptor
Added subscriber: @Cake-Lover
This issue really needs to be fixed!
but meanwhile, you can use
obj.data.update()
after you've changed the modifier value to display the changesIf you watch the video the issue is still the same with obj.data.update().
In my code, adding drop_shadow_obj.data.update() before or after or instead of drop_shadow_obj.update_tag() doesn't change anything.
Added subscriber: @TestPilot02
+1 for experiencing this problem
Added subscriber: @aisatan.ne
I noticed, if you set it with the type, for example "1.0" instead of just "1", and .data update after
bpy.context.object.modifiers["TestGNMod"]["Input_2"] = 55.0
bpy.context.object.data.update()
Added subscribers: @dr.sybren, @lichtwerk
Just noting that #63793 (When set value of "custom property" by python , driver not up-date correctly) (which seems to be the same underlying thing) was closed by @dr.sybren back then.
Added subscriber: @Sparazza
Added subscriber: @kioku
Added subscriber: @IihT2cWA9xiP30BsYphz3EiEISNoScoe
This doesnt work with curve objects since their data doesnt have an update function :(
I think it would make sense to have it the other way around. Update is always made like in other modifiers, but with the possibility to delay the update if multiple properties are to be modified.
Maybe one solution could be to have a defer-function like I've noticed while working on Windows apps, used like this:
but in Python something like:
would first modify both parameters, then update.
@erik85 While I'm not generally against deferring updates, it something that has to be done with great care because it's a bit against current principles of the RNA/Python API. In this specific case I'm not convinced that it is worth it.
I didn't look into this problem for quite some time now, but please make sure you've seen the discussion in https://archive.blender.org/developer/D11572.
This report doesn't even describe what's going wrong.+Can we at least get a description of what we're discussing here?Ok, there's a video that explains quite a bit more. For the next time, please update the description and put such critical there.
geo nodes not update immediately with pythonto Geometry Node: Changing modifier input values with python no cause updateif we try and change values of geometry node inputs, we can't continuously change the inputs only some of the input values appear to be evaluated / trigger depsgraph to remake the evaluated data.
in upbge I had to move to using drivers as inputs as object.modifiers['GoemetryNodes'].inputs['input_2'] proved unreliable
Is this the same problem?? Blender 3.4
Switching between NodeTrees, the Input Attribute Toggles in the Geo-Node modifier panel get set to their default values of 1.0000. They somehow forget the assigned Input. In my case, see the two images; I have my two vertex selections: named 'Scatter' for a Density Factor and 'WPaint2' for a Value, they changed back to their default 1.0000 values after browsing another node tree . This can easily be duplicated, with either input (happens not only with vertex selections).
cc
rna_access.cc
:So what's the more preferred workaround for now?
I've found that either
object.updat_tag()
orobject.data.update()
works. Is there any difference between them?Attached some quick example for tests.
I also have the same issue.
Using Blender v4 none of the above solutions work. I found a solution that works by running 2 actions:
bpy.ops.wm.save_mainfile()
to save the file.Because of the non-update action, I had all the Geometry Nodes updated, but the Cloth modifier, that came after, doesn't compute the new geometry animation.
To solve this problem, I added remove all bake commands and re-bake the file.
also, I enabled the
bpy.context.object.modifiers["Cloth"].point_cache.use_disk_cache = True
for my cloth modifier, and done it before the bake.I see all the animation working well.
i found that turning off and on the viewport visibility will also refresh it, and cause the changes to appear
you can do it manually, or use this code to do it automatically
Just run
mod.node_group.interface_update(context)
Takes care of this issue where the displayed unit is lost too: https://www.youtube.com/watch?v=WMwDZ0NFZ08
I do mode changes in the video bc it's faster then
obj.update_tag()
, butinterface_update()
actually gets rid of that need too.Well, you need to create that reference to your mod of course.
or
@MACHIN3 thanks, im gonna delete this soon so that this page is easier to read
@MACHIN3 seem this new api work.
In that case I'll close this report. Thanks for the solution @MACHIN3 !