This patch will delete all associated objects from a group instance (dupli group) if the are deleted.
Details
Diff Detail
Event Timeline
This patch is useful if you want to delete a ragdoll.
Test files can be found in T36388.
I don't see how this patch relates to the blend file attached to T36388. Can you create a blend file that shows just this feature? We'll need it anyway for the release, since Ton asked for a demo blend file for each new feature.
I don't see how this patch relates to the blend file attached to T36388.
The blend file in T36388 is related to this patch, and shows exactly the new feature. The complexity of the test file was necessary to test also adding and multiple dupli groups.
I reduced the test file to the minimum that is necessary to show the new feature.
When I open the attached blend file and start the BGE, Blender crashes:
/home/sybren/workspace-local/blender-git/build_debug/bin/blender(BLI_system_backtrace+0x35) [0x2a9e161] /home/sybren/workspace-local/blender-git/build_debug/bin/blender() [0x19124b4] /home/sybren/workspace-local/blender-git/build_debug/bin/blender() [0x1912692] /lib/x86_64-linux-gnu/libc.so.6(+0x36eb0) [0x7fc8576cdeb0] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(_ZNK24CcdOverlapFilterCallBack23needBroadphaseCollisionEP17btBroadphaseProxyS1_+0x4d) [0x2ca8a49] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(_ZNK28btHashedOverlappingPairCache24needsBroadphaseCollisionEP17btBroadphaseProxyS1_+0x48) [0x2e60f8c] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(_ZN28btHashedOverlappingPairCache18addOverlappingPairEP17btBroadphaseProxyS1_+0x40) [0x2e6101c] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(_ZN18btDbvtTreeCollider7ProcessEPK10btDbvtNodeS2_+0x6e) [0x2e5e1d8] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(_ZN18btDbvtTreeCollider7ProcessEPK10btDbvtNode+0x37) [0x2e5e229] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(_ZNK6btDbvt9collideTVEPK10btDbvtNodeRK12btDbvtAabbMmRNS_8ICollideE+0x16c) [0x2e5da74] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(_ZN16btDbvtBroadphase11createProxyERK9btVector3S2_iPvssP12btDispatcherS3_+0x1ad) [0x2e5b1b9] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(_ZN16btCollisionWorld18addCollisionObjectEP17btCollisionObjectss+0x1b1) [0x2e63b09] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(_ZN23btDiscreteDynamicsWorld18addCollisionObjectEP17btCollisionObjectss+0x32) [0x2ecb934] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(_ZN23btDiscreteDynamicsWorld12addRigidBodyEP11btRigidBodyss+0xe0) [0x2ecbbf2] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(_ZN21CcdPhysicsEnvironment26UpdateCcdPhysicsControllerEP20CcdPhysicsControllerfiss+0x169) [0x2ca4799] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(_ZN20CcdPhysicsController17RefreshCollisionsEv+0x104) [0x2cc8518] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(_ZN13KX_GameObject21SetUserCollisionGroupEt+0x58) [0x2d2730a] /home/sybren/workspace-local/blender-git/build_debug/bin/blender() [0x2c51fcd] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(_Z24BL_ConvertBlenderObjectsP4MainP8KX_SceneP15KX_KetsjiEngine15e_PhysicsEngineP15RAS_IRasterizerP11RAS_ICanvasP24KX_BlenderSceneConverterbb+0x1738) [0x2c55b41] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(_ZN24KX_BlenderSceneConverter12ConvertSceneEP8KX_SceneP15RAS_IRasterizerP11RAS_ICanvasb+0x13d) [0x2c7598f] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(StartKetsjiShell+0x1134) [0x2c4838e] /home/sybren/workspace-local/blender-git/build_debug/bin/blender() [0x1a696d0] /home/sybren/workspace-local/blender-git/build_debug/bin/blender() [0x191f096] /home/sybren/workspace-local/blender-git/build_debug/bin/blender() [0x1920642] /home/sybren/workspace-local/blender-git/build_debug/bin/blender() [0x1920f16] /home/sybren/workspace-local/blender-git/build_debug/bin/blender() [0x19212d1] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(wm_event_do_handlers+0x75d) [0x1922144] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(WM_main+0x24) [0x1915ed7] /home/sybren/workspace-local/blender-git/build_debug/bin/blender(main+0x49a) [0x1914fea] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7fc8576b8ec5] /home/sybren/workspace-local/blender-git/build_debug/bin/blender() [0x1911a2a]
That's with or without this patch, so probably has nothing to do with it, but it does make it hard to assert its correctness.
| source/gameengine/Ketsji/KX_Scene.cpp | ||
|---|---|---|
| 1006 | A change to if (!newobj->IsDupliGroup()) return; simplifies the function, as it decreases the indentation level. | |
I've worked around the crash just to see how your patch works, and it looks good to me.
I feel like this should be handled in KX_Scene::NewRemoveObject(), but then I don't think we'll properly handle physics. So, this approach is probably fine.
Address the inline comment (either make the member function private or explain why it should remain public), and make sure the patch has been tested. After that, the patch should be good to commit. What kind of test cases have you tried? I think the following would be good to check:
- LibLoad/LibFree
- Constraints
- Memory leaks
| source/gameengine/Ketsji/KX_Scene.h | ||
|---|---|---|
| 341 | This should be made private. I don't see much need for anything outside of KX_Scene calling this. | |
I have tested:
normal objects (still working)
normal grouped objects (still working)
Dupligroup
Dupligroup in Dupligroup
Dupligroup with grouped objects
Dupligroup in Dupligroup with grouped objects
Dupligroup with Constraints
Dupligroup in Dupligroup with Constraints
Scene linked Dupligroup
Scene linked Dupligroup in Dupligroup
Scene linked Dupligroup with Constraints
Scene linked Dupligroup in Dupligroup with Constraints
File linked Dupligroup
File linked Dupligroup in Dupligroup
File linked Dupligroup with Constraints
File linked Dupligroup in Dupligroup with Constraints
LibLoad/LibFree Dupligroup
LibLoad/LibFree Dupligroup in Dupligroup
LibLoad/LibFree Dupligroup with Constraints (but due to a bug in LibLoad the constrains are not working)
LibLoad/LibFree file linked Dupligroup with Constraints (but due to a bug in LibLoad the constrains are not working)
I don't tested about Memory leaks. I don't know how to on Windows.
There is no new memory leaks with this patch on Windows. Tested with Visual Leak Detector.