[Bf-committers] Blender Python changes

Kai Kostack kaikostack at gmx.net
Wed Oct 26 09:18:11 CEST 2016


Dear Blender devs, 

I'd like to provide some feedback about a recent change in BPY... OK, and share 
some frustration about it. ;) 

Just until recently you could unlink a lot of datablock types via their 
corresponding remove() methods without any problems. Now with Blender 2.78 
someone has decided to change some of these methods in a way that they throw an 
exception when there are still other users left on a default unlink attempt: 
"RuntimeError: Error: Text 'export.txt' must have zero users to be removed, 
found 1 (try with do_unlink=True parameter)" 

I thought, "Okaaay, just another parameter to add, no problem." - Why that 
would be necessary, since you could have checked for other users anyway before 
unlinking, was beyond me. - But then I realized that there are 27 datablock 
types that use an updated remove() method while others remained unchanged. I 
have like 100 scripts for Blender 2.76 at my disposal and ca. 30 of them have 
at least one ".remove(" in the code. "Wow, that's a lot of scripts that might 
have been broken by now", I thought. Note that you can't easily go over them 
and add the parameter because not all remove methods of Blender would accept it 
(not to mention general Python list removes). So I had to look up each and 
every line with 'remove' in the API if they were changed or not. That was fun. 
 
While the scripts will (probably) all work by now again, I got first complains 
that some of my Add-ons wouldn't work with 2.77 builds anymore. Great. To make 
a long story short, I have decided to implement BOTH ways of calling remove via 
try & except now, just to make sure the code will work in both versions, 2.77 
and 2.78. 
 
I remember a statement along the lines that breaking things will be postponed 
until 2.8 and that 2.7x should be kept in a working state. - This is not a call 
to change it back, I just want to give you a glimpse of what seemingly appears 
to be a clever and small change in design can mean to users, and that they 
eventually have to include more and more workarounds and hacks just to 
circumvent your 'clever design' to make things just work. Sometimes less is 
more. 

With respect, 

-- Kai 


More information about the Bf-committers mailing list