-
-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Converted blender object doesn't keep its parent/children relations #1716
Comments
Hello, I did a test branch here: fc116a8 named insta_col_runtime_test. I only tested 1 case (test file at bottom -> it is to add objects with a rigid body constraint) If you want you can test for your cases (children and track to) USING instance collections to see if it works properly. |
I'll link test files here and edit when i test something:
https://github.com/UPBGE/upbge/files/10789612/insta_col_runtime_test.zip
And I share a test build: (it is the build of the branch to test to convert instance collections during runtime). (the ufile.io link expires in 1 month or something like that) |
UPBGE: Test converting instance collections at runtime It's to try to anwer this limitation: #1716 There are example files in the issue. I'm a bit reluctant to do such things because it's complex and idk what bugs it can generate, but we can try anyway to include it in master to experiment I guess. For now I only tested with the files included in the issue report, and I did not debug anything, I didn't even print scene.objects after conversion to see if something was wrong. For now, I just put it in PR list if someone wants to test/review it, but there is no ermergency and if someone think it can lead to issues, we can abandon it. I see 1 case where it could be problematic: When we add an instance collection with Full Duplication option checked (not tested). EDIT: - Tested in debug build and no problem noticed - Tested with print(scene.objects) and no problem noticed - Fixed issue with Full Duplication option in this commit: 6f49f09 Test file for the Full Duplication bug before this commit: [insta_col_spawn_duplica_rb_joint.zip](https://github.com/UPBGE/upbge/files/10810635/insta_col_spawn_duplica_rb_joint.zip) EDIT2: The issue with full duplication option is that each time blenderdataconversion is done, it adds a new dupligroup/groupobj to object list and DupliGroupRecurse is called for ALL objects in objeclist/active gameobjects list. I guess anyway blenderdataconversion was not meant to be called during runtime, then it was not really an issue. For now, I think that this commit 6f49f09 is enough but another way to fix this specific issue (if we have a new report one day), would just be to remove dupligroup objects from active gamobj list after DupligroupRecurse has been called (at the very end of blenderdataconversion) SUB-EDIT: Finally, I tried to arrange this issue in these commits: 282f292 effc031 5764b04 but we can keep "safeguards" to avoid "Full Duplication" of an instance collection because idk in what case it could be useful. EDIT3: Try adding instance collection several times after this commit 282f292 Test file for add insta col sevral times: [insta_col_added_several_times.zip](https://github.com/UPBGE/upbge/files/10821088/insta_col_added_several_times.zip) EDIT4: I noticed a bit weird behaviours in some cases early this morning in some cases (instance collection is sometimes visibled whereas only the instance_col objects should be visibled), but it can be fixed with python or i'll change the code later after merge to always hide instances collections in active list (if INSTANCE_SPAWN). Thanks very much @lordloki for tests and review!
Fixed here: 40fffb4 It sometimes needs some tweaks with python to have it working properly |
Hi, i test the new master but it seems that is not possible to iterate trough all objects..Do i have to convert one by one? |
you have to convert instance collection 1 by one but instance collection contains as many objects as you want. The instance collection can be either converted to active list (scene.objects) or inactive list (scene.objectsInactive). maybe print scene.objects and scene.objectsInactive to see what is is active list and in inactive list, you will see what has been added inside. |
also, you can have a look at https://upbge.org/docs/latest/api/bge.types.KX_GameObject.html#bge.types.KX_GameObject.groupMembers it's same than in bge 2.7 |
As stated in this thread: https://blenderartists.org/t/upbge-0-3-append-external-blend/1389754
Trying to append a rigged model from another file in game, using bpy.ops.wm.append and convertBlenderObjectsList() but after import the object to the actual scene, i lost all objects relations (parent/children)
blend.zip
.
The text was updated successfully, but these errors were encountered: