I have two objects in the same collection. How can I edit(like transform) the second object only? I can only edit both objects in the same time.
(for example, I have object1 from mesh1, and object 2 from mesh2, and I use codes below)
ob = bpy.context.edit_object
me = ob.data
bm = bmesh.from_edit_mesh(me)
for v in bm.verts:
v.co.z *= -1
bmesh.update_edit_mesh(me)
The codes seem only edit the whole meshes and objects.
I only want object2 to be done like this, and leave object1 the same as before.
Thank you for your answer! However can you show me the resolution using my style of codes below? I only want to change obj2 but the codes changes obj1 and obj2 at the same time.
mesh1 = bpy.data.meshes.new('mesh1')
obj1 = bpy.data.objects.new('obj1', mesh1)
bpy.context.scene.collection.objects.link(obj1)
mesh2 = bpy.data.meshes.new('mesh2')
obj2 = bpy.data.objects.new('obj2', mesh2) ;
bpy.context.scene.collection.objects.link(obj2)
bpy.context.view_layer.objects.active = obj2
bpy.ops.object.mode_set(mode='EDIT')
ob = bpy.context.edit_object
me = ob.data
bm = bmesh.from_edit_mesh(me)
for v in bm.verts:
v.co.z *= -1
bmesh.update_edit_mesh(me)
And the two meshes( or two objects ) change at the same time, how to correct my codes to make changes to obj2 only? (this code is only an example, what I want to see is the way to edit the obj2 instead of both obj1 and obj2, so can you please just write some codes in general, thats enough for me, not for specific codes to create real obj1 and obj2)