Page MenuHome

Point Density Texture ID User decrement error related to the Object field
Closed, ResolvedPublic

Description

System Information
Windows 7, AMD x3 455, R7 360

Blender Version
builds 8009564, db8bc1d

Short description of error
Removing an object causes an ID user decrement error: OBCube.001 (from '[Main]'): 0 <= 0 if a Point Density texture has it referenced in the Object Field

Exact steps for others to reproduce the error
Default Scene > Create a new mesh object > add a Cycles material > Enable use nodes > add a Point Density texture in the Node Editor > select a mesh object in the Object field of the texture node > Delete the chosen object

Doesn't matter if the deleted object itself has the material or not nor the Object field is self referencing (the same object has the material and the Object field references it).

The Cloud Generator add-on has the similar error since it uses the Point Density texture in the "DeGenerate" option upon the scripted removal of the objects.

Event Timeline

Sergey Sharybin (sergey) lowered the priority of this task from 90 to 50.

@Bastien Montagne (mont29), selecting Object in PointDensity node doesn't increase user counter, however removing object will try to reduce user counter from PointDensity node. Also, re-loading file after choosing point density object will increase users of that object.

Not sure what would be a proper solution here: either make selecting object in PointDensity to increase user counter (then how?) or do something more like modifiers where user counter is not increased by target objects?

Yuck… yeah, this is really hairy…

We could add exception in libraryquery to not set refcounting flag when DI pointer of a node is an object. This is more consistent with other places where we use Objects (though I really, really dislike that stance of 'no object refcount besides scene instantiation'). But am pretty sure this will not work reliably either, NULL pointer could very easily break things again in that case I guess.

So will rather try to make assigning pointer to Node ID increment usercount, we do it already for others (images etc.) so should not be that difficult ;)