Open eliabntt opened 2 years ago
Apparently the merge can also be done here. I must have done something wrong on my first test. I do not have extensive time today to check it.
if len(objs) > 1:
bpy.ops.object.select_all(action='DESELECT')
for ob in objs:
ob.blender_obj.select_set(True)
bpy.context.view_layer.objects.active = ob.blender_obj
lo = [ob]
bpy.ops.object.join()
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')
all_objs.extend(lo)
else:
all_objs.extend(objs)
seems to work. (probably on the first test I did not change the extend argument)
As far as I understand this, this would join all objects, of the same .obj
file. Is that correct?
Yep, the idea is that you load the obj, if that obj is made of multiple parts then those are joined together and form a single object that is then used in the scene and in the code.
The change of origin should be removed there though. That is only if one wants to add point lights in the right location.
I agree, it makes sense to merge all objects from one file. This will make the instance separation easier.
At the same time, we can also check and remove the "shadow" object. A lot of files contain a plane below them to catch the shadow, in BlenderProc we do not need it and could remove it.
Is that easily recognizable? My pc is currently occupied, cannot easily check. I'll be happy to address the changes and reopen the pr.
Thank
Apparently the merge can also be done here. I must have done something wrong on my first test. I do not have extensive time today to check it.
if len(objs) > 1: bpy.ops.object.select_all(action='DESELECT') for ob in objs: ob.blender_obj.select_set(True) bpy.context.view_layer.objects.active = ob.blender_obj lo = [ob] bpy.ops.object.join() bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN') all_objs.extend(lo) else: all_objs.extend(objs)
seems to work. (probably on the first test I did not change the extend argument)
This really helps a lot! Thank you!
Note that this won't merge small objects like the kitchen furniture, just objects that have sub-parts that can be merged. To make a single "kitchen cabinet" more reasoned processing is needed
Some objects in the dataset are made of multiple parts/have erratic(strange) loadings. It would be neat to merge them and get a single object for every mesh loaded. In that way instance segmentation can work correctly, and the loaded world will have a greatly reduced number of parts.
Working points for this are either
_move_and_duplicate_furniture
or_load_furniture_objs
.A starting point could be #446.