| Message |
 |
- Date: 2010-11-11 19:44
- Sender: Tom Edwards
- I also consider it a bug that the user count isn't lower bounded to 0 (or to 1 if there is a fake user). Going under should be an assert() condition, not something that users are exposed to!
|
- Date: 2010-11-11 19:48
- Sender: Ton Roosendaal
- How do you assign the armature to object? That code is relevant too!
I still find it confusing, why would an object remove (of type armature) delete actions too? Assigned to campbell for feedback.
(BTW: bug reporters can open/close own reports too :)
|
- Date: 2010-11-11 20:14
- Sender: Tom Edwards
- Actually, I'm not sure if Armatures really should affect Action users: ops.object.delete() removes a user, but changing which action an armature is using affects the usercount of neither action involved.
I suspect this is the same bug rearing its head, just less obvious because when you use ops.object.delete() the datablock goes away too.
(Yup: I just got an action onto -1 users through the UI only)
Ton, there is no visible way for a user to change a bug's state once it has been submitted. There is an option when you are first writing it up though.
|
- Date: 2010-11-12 14:46
- Sender: Ton Roosendaal
- Just to be sure we understand each other well:
- deleting an object is allowed to unlink its actions, and decrementing user count - action user counter should be done correctly on load - if action counter is zero, the action is not saved in files, unless it has "Fake user" set. - Blender does not delete actions ever, they only get unlinked.
This should all work fine for using Blender via UI.
What you do is apparently using a script to perform unlinking and linking. Campbell can check the calls you are using. I'm not familiar with the Python API, but you probably can help Campbell by precisely adding here the sections of your script with link/unlink or deletions.
|
- Date: 2010-11-12 14:58
- Sender: Tom Edwards
- 1. No, that's the bug. It should NOT decrement user count.
2. I don't know what that means.
3. No, the fake user being set only delays the problem. If the action has -5 users, giving it a fake user only leads to it having -4. It will still not be saved.
4. No, Blender does delete actions. This is the result of the bug.
As I said in comment 3, this bug can be triggered via the UI. Delete the armature, make a new armature, assign the action to the new one, repeat; the usercount will drop and drop.
|
- Date: 2010-11-12 17:38
- Sender: Ton Roosendaal
- 1) By definition it decrements user counts on unlinking. Already since V 1.0, and that's how it is meant to work.
2) User counters are being set on file loading, and should be always correct then. 3) negative user counts are bugs, and when it happens we should fix it. 4) No, blender never deletes actions. You can only have them disappearing on file save/load. You can verify this easily
I added 5 armatures, added one action to it. Refcount is 2. Delete armature: refcount is 1. Add it to another armature and refcount is 2 again. And so on. I am not using python though, the bug can be there.
|
- Date: 2010-11-12 18:37
- Sender: Tom Edwards
- I see why you're confused about doing this through the UI:
- When I use the standard control at Dopesheet > Action Editor, the user count changes correctly.
- It's only when I use the same control on my custom Properties > Armature Data panel that the user count is not changed. Install http://code.google.com/p/blender-smd/source/browse/trunk/io_smd_tools.py and select an armature with animation data to see the new panel.
And you were right that deleting the object should change the action's users. The action is at Object.animation_data.action, and isn't used by the datablock like I was thinking.
Here is a script that permanently reduces an action's user count:
import bpy
bpy.ops.object.add(type='ARMATURE')
bpy.context.active_object.animation_data_create().action = bpy.data.actions[0]
bpy.ops.object.delete()
I've attached a blend containing it, along with a freshly-created two user action.
|
- Date: 2010-11-12 18:42
- Sender: Tom Edwards
- Bonus bug: actions created with bpy.data.actions.new() don't have a fake user like those created through the UI. Nevertheless, their user count is 1.
|
- Date: 2010-11-12 18:51
- Sender: Ton Roosendaal
- I'll let campbell check the python api code why it differs from UI ops :)
|
- Date: 2010-11-14 10:22
- Sender: Campbell Barton
- fixed r33055.
This was an RNA bug, not python.
Setting the "action" through RNA wasn't increasing the user count when it should have (since this is done in readfile on load).
|
- Date: 2010-11-14 10:22
- Sender: Campbell Barton
- fixed r33055.
This was an RNA bug, not python.
Setting the "action" through RNA wasn't increasing the user count when it should have (since this is done in readfile on load).
|