Unlinking RigidBodyWorld Collection Objects via Script #110906
Labels
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#110906
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Windows-10-10.0.22621-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 536.67
Blender Version
Broken: version: 3.6.1, branch: blender-v3.6-release, commit date: 2023-07-17 12:50, hash:
8bda729ef4dc
Short description of error
When unlinked from
RigidBodyWorld
before removing the object rigid body settings, the objects are linked to the Main Scene Collection.This was detected when trying this code:
Exact steps for others to reproduce the error
Objects are linked to the Main Collection
From what I saw in the video, the objects are not duplicated.
The same object can be in more than one collection.
This is normal.
But it's strange that the object remains in the Rigid Body collection even after the Rigid Body settings are removed.
However I tried to replicate the problem using this .blend file and was unsuccessful. There must be something wrong with the file shown.
Hi @mano-wii , thank you for the reply.
In the attached screen capture, I am using your file and adding 'Rigid Body' to the Active Object. This creates the collection 'RigidBodyWorld'. I then run the script to add the other selected objects to the 'RigidBodyWorld' collection. When I then use the script to unlink the objects, it's just as you said: the objects aren't removed from the Rigid Body collection.
Hi @KevinCBurke Apparently it should be
elif (not enable) and (o in list(rb_coll)):
, otherwise the logic won't pass. And if changed to this, here it unlinks successfully.@ChengduLittleA Thank you for testing. It don't think that it's because of the logic. The issue for me is when the Scene Property's Rigid Body Collection is using
RigidBodyWorld
(which is what is created when the user adds Rigid Body to a mesh object prior running thebpy.ops.rigidbody.world_add()
operator), it doesn't remove the Rigid Body, even withelif (not enable) and (o in list(rb_coll)):
Check out this demo video (Unlinking 3.mp4, attached), using
elif (not enable) and (o in list(rb_coll)):
. In the beginning of the video, if the Rigid Body collection isRigidBodyWorld
, the unlink in the script doesn't work. When I change the Rigid Body Collection to another Collection that is exposed in the Scene Outliner, it does.RigidBodyWorld
doesn't seem to work with the Python API.Unlinking Rigid Body Collection Objects via Script Duplicates Objectsto Unlinking RigidBodyWorld Collection Objects via Script@KevinCBurke It will of course not "remove a rigid body configuration" of that object. It's just removing the link from that specific collection (in this case
RigidBodyWorld
). Your code works no matter which collection is selected in the rigid body world collection, you can verify in ourliner > Blender File view: After executing the script, those object will get unlinked fromRigidBodyWorld
. It's just a special collection that's not visible directly under scene.The provided Python code is subject to errors in both the Rigid Bodies collection choice and the
enable
logic.Also, there is a misunderstanding in the description when it says that the objects are duplicates.
What happens is that the code strips objects from the
RigidBodyWorld
collection before the configuration is removed.And when removing the Rigid Body setting, Blender sees that the object has only 1 user (assuming it is the
RigidBodyWorld
collection) so, to remove it from the collection without losing the object, the object is linked to the main collection in the scene.It's strange that a Rigid Body object is not in the Rigid Bodies collection but in fact it is possible for this to happen as we can see in this report.
So there really is a kind of bug here.
@mont29, I suspect this has something to do with your commit
30116a5274
.It might be a good idea to check if the object is in the Rigid Bodies collection first (with
BKE_collection_has_object
).This has nothing to do directly with a four years old commit (
30116a5274
), and is the expected behavior.Local objects should always be linked in at least one collection (i.e. be present in at least one scene). So when trying to remove (unlink) them from the only collection they exist in, nothing happen.
@mont29, in this case, the object is in fact only in one collection, but NOT in the collection that will be removed.
Checking the collection would solve the problem.
@mano-wii
but NOT in the collection that will be removed.
the objects are removed from the collection? Where is it about removing the collection itself?Unless what you are talking about is not what the report is about...