Log In
New Account
Home My Page Projects Blender 2.x BF release
Summary Activity Tracker SCM Files

Blender 2.6 Bug Tracker: Browse

[#24742] materials.pop() doesn't decrement user count [patch]

Date:
2010-11-16 01:39
Priority:
3
State:
Closed
Submitted by:
Dan Eicher (dna)
Assigned to:
Campbell Barton (campbellbarton)
Category:
Python
Status:
Fixed / Closed
Relates to:
Duplicates:
Patches:
 
Summary:
materials.pop() doesn't decrement user count [patch]
Detailed description
append() and pop() don't seem to fit in with the whole rna thing either but that's another subject altogether...



Index: source/blender/blenkernel/intern/material.c
===================================================================
--- source/blender/blenkernel/intern/material.c (revision 33087)
+++ source/blender/blenkernel/intern/material.c (working copy)
@@ -492,6 +492,7 @@
short *totcol= give_totcolp_id(id);
if(index >= 0 && index < (*totcol)) {
ret= (*matar)[index];
+ id_us_min((ID *)ret);
if(*totcol <= 1) {
*totcol= 0;
MEM_freeN(*matar);

Followup

Message
  • Date: 2010-11-16 03:26
  • Sender: Campbell Barton
  • committed r33090.

    reasoning for append/pop

    - .add/remove() is for anonymous elements - like a vertex or a meta-ball.
    - .new/remove() is for elements which can only exist in the collection, like bones, meshes, groups.
    - .link/unlink() is for data which exists outside the collection but is being added where it is an unordered collection of unique items.
    - .append/pop() is used for materials because the order matters and they can exist more then once in the same list.
 

Attached Files:

No Files Currently Attached

Changes:

Field Old Value Date By
ResolutionFixed2010-11-16 05:44campbellbarton
close_date2010-11-16 05:442010-11-16 05:44campbellbarton
ResolutionNone2010-11-16 03:26campbellbarton
close_date2010-11-16 03:262010-11-16 03:26campbellbarton
assigned_tonone2010-11-16 03:26campbellbarton
status_idOpen2010-11-16 03:26campbellbarton