When set value of "custom property" by python , driver not up-date correctly #63793

Closed
opened 2019-04-22 07:26:59 +02:00 by takeshi funahashi · 25 comments

System Information
Operating system: Windows-10-10.0.17134 64 Bits
Graphics card: GeForce GTX 980 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 419.67

Blender Version
Broken: version: 2.80 (sub 58), branch: master, commit date: 2019-04-21 20:30, hash: 797539e76c

Short description of error
[Please fill out a short description of the error here]
When set custom property value by script (use console, or code), it not up-date pose-bone driven value. To up-date it, need to toggle pose-mode,
or need to clcik "Update Dependencies" of driver editor.

Exact steps for others to reproduce the error

  1. load attached blend file for 2.8 or current 2.7 beta build
    noupdate-driver.blend

  2. Select armature (if not), then goto properties editor>object>Custom properties

  3. change "prop" value to 1.0

  4. It move "Bone" to (1.0, 0, 0) by driver

  5. Open python console, and input, C.object["prop"] = 0.00

  6. it change "prop" value to 0.00 (properties editor>object>Customproperties >prop value)
    7 but it not update 3d view bone location.
    8 toggle mode to object, or toggle mode to pose, bone move correctly to (0, 0, 0)
    9 or need to use driver editor> "Update Dependencies" then bone locate correctly (driver up-date)

And there seems no good way to force up-date , without change mode.
"update dependencies" can not access by python.

I know there are already some reports for driver up-date (or dependency graph), but could not find about this specific case.

so just reported. Though I offer most simple case, but plug in often change "rig custom property values" from UI.
When direct input and change value , it up-date correctly., but if use function, (eg reset value of all proeprties) with UI button, it not up-date correctly.
Then I hope to know way to force up-date . (at current I toggle object pose-mode by python, then force up-date, but it is not good way I think)

if it is already reported , merge and close this please.

**System Information** Operating system: Windows-10-10.0.17134 64 Bits Graphics card: GeForce GTX 980 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 419.67 **Blender Version** Broken: version: 2.80 (sub 58), branch: master, commit date: 2019-04-21 20:30, hash: `797539e76c` **Short description of error** [Please fill out a short description of the error here] When set custom property value by script (use console, or code), it not up-date pose-bone driven value. To up-date it, need to toggle pose-mode, or need to clcik "Update Dependencies" of driver editor. **Exact steps for others to reproduce the error** 1. load attached blend file for 2.8 or current 2.7 beta build [noupdate-driver.blend](https://archive.blender.org/developer/F6965945/noupdate-driver.blend) 2. Select armature (if not), then goto properties editor>object>Custom properties 3. change "prop" value to 1.0 4. It move "Bone" to (1.0, 0, 0) by driver 5. Open python console, and input, C.object["prop"] = 0.00 6. it change "prop" value to 0.00 (properties editor>object>Customproperties >prop value) 7 but it not update 3d view bone location. 8 toggle mode to object, or toggle mode to pose, bone move correctly to (0, 0, 0) 9 or need to use driver editor> "Update Dependencies" then bone locate correctly (driver up-date) And there seems no good way to force up-date , without change mode. "update dependencies" can not access by python. I know there are already some reports for driver up-date (or dependency graph), but could not find about this specific case. so just reported. Though I offer most simple case, but plug in often change "rig custom property values" from UI. When direct input and change value , it up-date correctly., but if use function, (eg reset value of all proeprties) with UI button, it not up-date correctly. Then I hope to know way to force up-date . (at current I toggle object pose-mode by python, then force up-date, but it is not good way I think) if it is already reported , merge and close this please.

Added subscriber: @TakeshiFunahashi

Added subscriber: @TakeshiFunahashi

#91588 was marked as duplicate of this issue

#91588 was marked as duplicate of this issue

#91140 was marked as duplicate of this issue

#91140 was marked as duplicate of this issue
Sebastian Parborg self-assigned this 2019-04-25 14:52:48 +02:00
Sebastian Parborg removed their assignment 2019-04-25 15:04:55 +02:00
Campbell Barton was assigned by Sebastian Parborg 2019-04-25 15:04:55 +02:00

Added subscriber: @ZedDB

Added subscriber: @ZedDB

Even though it will not be solved soon,, Is not there good way to force up-date from add-on(script) side?
which method or function, I can use ?

for 2.7 " toggle edit mode" only work. ( toggle-pose-mode work for 2.8)
But about Proxy rig, we can not use toggle edit mode (for rig obj ID properties) ,to up-date driver dependency graph, I think.

Even though it will not be solved soon,, Is not there good way to force up-date from add-on(script) side? which method or function, I can use ? for 2.7 " toggle edit mode" only work. ( toggle-pose-mode work for 2.8) But about Proxy rig, we can not use toggle edit mode (for rig obj ID properties) ,to up-date driver dependency graph, I think.

I expected if recent depthgraph change solve this issue,
but it seems not work still.

after step 5
I tried to update depthgraph by console

depth = C.evaluated_depsgraph_get()
depth.update()

but it do nothing for this case. the custom property of armature actually get value as 0.5
then it should drive bone location (X) but not adapted untill I toggle mode, or change seleciton etc.
Is not there more better way to up-date with dependency?

I expected if recent depthgraph change solve this issue, but it seems not work still. after step 5 I tried to update depthgraph by console ``` depth = C.evaluated_depsgraph_get() depth.update() ``` but it do nothing for this case. the custom property of armature actually get value as 0.5 then it should drive bone location (X) but not adapted untill I toggle mode, or change seleciton etc. Is not there more better way to up-date with dependency?

Added subscriber: @AlfonsoAnnarumma

Added subscriber: @AlfonsoAnnarumma

Same problem with driver on generic props (scale, node value etc...).
I've script with UI and custom prop attached to driver.
When I use the UI, the custom prop change the driver value.
When I use console or python script to change the custom prop, the driver value not change.

Same problem with driver on generic props (scale, node value etc...). I've script with UI and custom prop attached to driver. When I use the UI, the custom prop change the driver value. When I use console or python script to change the custom prop, the driver value not change.

Yes it seems not only about pose bone. when script change "custom-prop" which drive other properties, manually change value can up-date driver, but change value by python, driver not work. There were many up-date about dependency graph, So if there is method to force it. but I can not find it.

I hope developer solve this issue, or offer way for bpy, if there were already simple solution, teach us please. Or for each case, we need many try and erroer and add un-necessary step, just up-date driver.

Yes it seems not only about pose bone. when script change "custom-prop" which drive other properties, manually change value can up-date driver, but change value by python, driver not work. There were many up-date about dependency graph, So if there is method to force it. but I can not find it. I hope developer solve this issue, or offer way for bpy, if there were already simple solution, teach us please. Or for each case, we need many try and erroer and add un-necessary step, just up-date driver.

Any workaround?

Any workaround?
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

note: #48975 might be related/duplicate...

note: #48975 might be related/duplicate...
takeshi funahashi changed title from When set value of "custom property" by python , driver not up-date correctly (for posed bone) to When set value of "custom property" by python , driver not up-date correctly 2019-07-04 10:23:11 +02:00

Added subscriber: @StanislasPaillereau

Added subscriber: @StanislasPaillereau

Added subscriber: @1seby

Added subscriber: @1seby
Campbell Barton was unassigned by Dalai Felinto 2019-12-23 16:34:37 +01:00

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Added subscribers: @Sergey, @dr.sybren

Added subscribers: @Sergey, @dr.sybren

@Sergey @ideasman42 do you know of any reason why setting a custom property via Python wouldn't trigger a depsgraph update?

@Sergey @ideasman42 do you know of any reason why setting a custom property via Python wouldn't trigger a depsgraph update?

Added subscriber: @MarcelLegindi

Added subscriber: @MarcelLegindi

Added subscriber: @FinbarrORiordan

Added subscriber: @FinbarrORiordan

Added subscriber: @TuomoKeskitalo

Added subscriber: @TuomoKeskitalo

This is the same issue as #74000. The issue is that an object is not "tagged for update" in the dependency graph when a custom property is changed by Python. "Tagged for update" means that Blender understands that the object (and everything that depends on it) should be updated. This is done for a few reasons:

  • Tagging the object for update requires a reference to that object. This is available for simple cases like some_ob["prop"], but not for nested cases like some_ob["complex_prop"]- [x]["something"].
  • Updating an object could mean recalculating its constraints and modifiers, which can be expensive. This may not even be necessary for that particular custom property, but when exactly this is or is not necessary can be hard to determine. As a result, this could make Blender slower than necessary.

After setting the custom property, call C.object.update_tag(). This should take care of the updates not "being seen" by dependencies. It won't trigger a full redraw of Blender's UI, though, so until that happens things on screen may still show the old status.

This is the same issue as #74000. The issue is that an object is not "tagged for update" in the dependency graph when a custom property is changed by Python. "Tagged for update" means that Blender understands that the object (and everything that depends on it) should be updated. This is done for a few reasons: - Tagging the object for update requires a reference to that object. This is available for simple cases like `some_ob["prop"]`, but not for nested cases like `some_ob["complex_prop"]- [x]["something"]`. - Updating an object could mean recalculating its constraints and modifiers, which can be expensive. This may not even be necessary for that particular custom property, but when exactly this is or is not necessary can be hard to determine. As a result, this could make Blender slower than necessary. After setting the custom property, call `C.object.update_tag()`. This should take care of the updates not "being seen" by dependencies. It won't trigger a full redraw of Blender's UI, though, so until that happens things on screen may still show the old status.

Changed status from 'Confirmed' to: 'Archived'

Changed status from 'Confirmed' to: 'Archived'
Sybren A. Stüvel self-assigned this 2020-02-27 14:45:32 +01:00

Added subscriber: @Nicolas-Maquaire

Added subscriber: @Nicolas-Maquaire

Added subscribers: @SimonThommes, @iss

Added subscribers: @SimonThommes, @iss

Added subscriber: @TeamwinFTW

Added subscriber: @TeamwinFTW
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
14 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#63793
No description provided.