DietCoke4671's picture
Upload BlenderStudio dataset
e27853f verified
import bpy
import math
import numpy as np
# Adjust the camera pose to align with the target image
bpy.data.objects["Camera1"].location = (0.2645, 0.2215, -2.9188)
bpy.data.objects["Camera1"].rotation_euler = (-0.0698, 2.4260, 0.0000)
# a set of helper functions that you can use
# 1) move_to: move the object to location
# 2) move_by: move the object by the vector of change
# DO NOT SURPASS the range for the x, y, z coordinates of all objects:
# x: (0.3 , 3)
# y: (12 ,15)
# z: (0, 3)
def move_to(obj, location):
""" Set the object location.
"""
obj.location = location
bpy.context.view_layer.update()
return obj
def move_by(obj, vector):
""" Shift the object location by a 3D vector
"""
obj.location[0] += vector[0]
obj.location[1] += vector[1]
obj.location[2] += vector[2]
bpy.context.view_layer.update()
return obj
# These are movable objects.
# with open('log.txt', 'w') as f:
# f.write(bpy.data.objects)
cabinet = bpy.data.objects['Cabinet']
plant = bpy.data.objects['Plant']
mirror = bpy.data.objects['Mirror']
sink = bpy.data.objects['Sink']
toilet = bpy.data.objects['Toilet']
# These are the current locations of the movable objects
cabinet.location = (2.4661, 14.201, 0.1277)
plant.location = (3.2168, 14.327, 0.57311)
mirror.location = (0.1374, 13.5573, 1.3960)
sink.location = (1.7123, 14.7161, 0.8306)
toilet.location = (1.9395, 14.5101, 0.4867)
# DO NOT SURPASS the range for the x, y, z coordinates of all objects:
# x: (0.3 , 3)
# y: (12 ,15)
# z: (0, 3)