Fix some RNA physics accessors creating data.

Accessing data through RNA should never implicitely create it. Objects'
and particles' forcefields and collision settings were doing this.

Note that UI code also had to be tweaked to properly handle `None`
(NULL) cases.

Differential Revision: https://developer.blender.org/D11341
This commit is contained in:
2021-05-21 14:57:29 +02:00
parent adf2f146d8
commit 24deeee09e
4 changed files with 13 additions and 31 deletions

View File

@@ -79,7 +79,7 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel):
col = flow.column()
if obj.field.type == 'NONE':
if not obj.field or obj.field.type == 'NONE':
col.operator("object.forcefield_toggle", text="Force Field", icon='FORCE_FORCE')
else:
col.operator("object.forcefield_toggle", text="Force Field", icon='X')