Loading external library removes all rigid body information #63140

Closed
opened 2019-03-30 22:42:13 +01:00 by Zak Tab · 2 comments

System Information
Operating system: Ubuntu 16.04
Graphics card: MSI 1080TI

Blender Version
Broken: 2.80, 99d4321fef, master, 2019-03-29 and a few releases before
Worked: 2.80, b87b6e8e28, master, 2018-12-12

Short description of error
bpy.data.libraries.load removes rigidbody information for objects in parent file.

Exact steps for others to reproduce the error
Based on the default startup or an attached .blend file (as simple as possible).

  1. Download attached .blend file or use your own (just a blend file with an object in it that you can import with bpy.data.libraries.load()

  2. Create a script test.py with the following:

import bpy

def select_self(obj):
    bpy.ops.object.select_all(action='DESELECT')
    obj.select_set(state=True)
    bpy.context.view_layer.objects.active = obj

def add_rigid_body(obj):
    select_self(obj)
    bpy.ops.rigidbody.object_add()
    obj.rigid_body.type = 'ACTIVE'
    obj.rigid_body.collision_shape = 'CONVEX_HULL'
    obj.rigid_body.collision_margin = 0

def add_solidify_modifier(target_obj, thickness):
    select_self(target_obj)
    mod = target_obj.modifiers.new(type='SOLIDIFY', name='solidify_mod')
    mod.thickness = thickness


# TEST
obj = bpy.data.objects['Cube']

# ADD MODIFIER AND CHECK THAT IT IS IN DATA
add_solidify_modifier(obj, 2)
if list(bpy.data.objects['Cube'].modifiers) is None:
    raise Exception('modifier_never_set')

# ADD RIGID BODY AND CHECK THAT IT IS IN DATA
add_rigid_body(obj)
if bpy.data.objects['Cube'].rigid_body is None:
    raise Exception('rigid_body_never_set')

# LOAD LIBRARY FROM EXTERNAL BLENDER FILE
files = []
with bpy.data.libraries.load('grab_from.blend') as (data_from, data_to):
    for name in data_from.objects:
        files.append({'name': name})

# CHECK TO SEE IF MODIFIERS HAVE BEEN REMOVED
if list(bpy.data.objects['Cube'].modifiers) is None:
    raise Exception('modifier_gone')

# CHECK TO SEE IF RIGID BODY DATA HAS BEEN REMOVED
if bpy.data.objects['Cube'].rigid_body is None:
    raise Exception('rigid_body_gone')
  1. Run:
blender -b --python test.py

In previous versions (such as the one quoted in the description), the script would complete without raising exceptions. In the latest releases, it will raise the final selection stating: rigid_body_gone. If you run it without -b you can see that in previous versions, the modifiers and rigid body info are there, but in the latest the rigid body info has been removed.

**System Information** Operating system: Ubuntu 16.04 Graphics card: MSI 1080TI **Blender Version** Broken: 2.80, 99d4321feff6, master, 2019-03-29 and a few releases before Worked: 2.80, b87b6e8e289, master, 2018-12-12 **Short description of error** `bpy.data.libraries.load` removes rigidbody information for objects in parent file. **Exact steps for others to reproduce the error** Based on the default startup or an attached .blend file (as simple as possible). 1. Download attached .blend file or use your own (just a blend file with an object in it that you can import with `bpy.data.libraries.load()` 2. Create a script `test.py` with the following: ``` import bpy def select_self(obj): bpy.ops.object.select_all(action='DESELECT') obj.select_set(state=True) bpy.context.view_layer.objects.active = obj def add_rigid_body(obj): select_self(obj) bpy.ops.rigidbody.object_add() obj.rigid_body.type = 'ACTIVE' obj.rigid_body.collision_shape = 'CONVEX_HULL' obj.rigid_body.collision_margin = 0 def add_solidify_modifier(target_obj, thickness): select_self(target_obj) mod = target_obj.modifiers.new(type='SOLIDIFY', name='solidify_mod') mod.thickness = thickness # TEST obj = bpy.data.objects['Cube'] # ADD MODIFIER AND CHECK THAT IT IS IN DATA add_solidify_modifier(obj, 2) if list(bpy.data.objects['Cube'].modifiers) is None: raise Exception('modifier_never_set') # ADD RIGID BODY AND CHECK THAT IT IS IN DATA add_rigid_body(obj) if bpy.data.objects['Cube'].rigid_body is None: raise Exception('rigid_body_never_set') # LOAD LIBRARY FROM EXTERNAL BLENDER FILE files = [] with bpy.data.libraries.load('grab_from.blend') as (data_from, data_to): for name in data_from.objects: files.append({'name': name}) # CHECK TO SEE IF MODIFIERS HAVE BEEN REMOVED if list(bpy.data.objects['Cube'].modifiers) is None: raise Exception('modifier_gone') # CHECK TO SEE IF RIGID BODY DATA HAS BEEN REMOVED if bpy.data.objects['Cube'].rigid_body is None: raise Exception('rigid_body_gone') ``` 3. Run: ``` blender -b --python test.py ``` In previous versions (such as the one quoted in the description), the script would complete without raising exceptions. In the latest releases, it will raise the final selection stating: `rigid_body_gone`. If you run it without `-b` you can see that in previous versions, the modifiers and rigid body info are there, but in the latest the rigid body info has been removed.
Author

Added subscriber: @zakleap

Added subscriber: @zakleap

Closed as duplicate of #62005

Closed as duplicate of #62005
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#63140
No description provided.