Beispiel #1
0
    def update_cam_position(self):
        objeto = cmds.ls(self.UI_object)
        if len(objeto) < 1:
            return

        # cam position
        obj_pos = cmds.xform(objeto[0], q=True, t=True)

        # interpolacion lineal
        percentage =  0 #float((float(self.slider_timeline.value()) / 100) * 100)
        position = self.cam_pos_start + (self.UI_object_full_rotation * percentage)
        rotation = self.cam_rot_start + ((self.cam_rot_end - self.cam_dist_start) * percentage)
        distance = self.cam_dist_start + ((self.cam_rot_end - self.cam_dist_start) * percentage)
        height = self.cam_height_start + (self.cam_height_end - self.cam_height_start) * percentage

        # update de pos of the camera
        obj_pos[0] += math.sin(math.radians(position)) * distance
        obj_pos[1] += (float(height) / 100) * self.UI_object_height
        obj_pos[2] += math.cos(math.radians(position)) * distance

        cmds.xform(self.UI_camera, t=obj_pos)

        # update the rotation with the inverse of the position angle in obj space
        rotation_percentage = float(rotation) / 100
        xpos = self.UI_object_bottom[0]
        ypos = self.UI_object_bottom[1] + rotation_percentage * self.UI_object_height
        zpos = self.UI_object_bottom[2]

        try:
            cmds.viewPlace(self.UI_cameraShape, la=(xpos,ypos,zpos))
        except:
            cmds.viewFit(self.UI_cameraShape , all=True)
Beispiel #2
0
def place_cameras(points):
	for i in points:
		cmds.camera(centerOfInterest=5, focalLength=35, lensSqueezeRatio=1, cameraScale=1, horizontalFilmAperture=1.41732, horizontalFilmOffset=0, 
			verticalFilmAperture=0.94488, verticalFilmOffset=0, filmFit="fill", overscan=1, motionBlur=0, shutterAngle=144, nearClipPlane=0.1,
			farClipPlane=10000, orthographic=0, orthographicWidth=30, panZoomEnabled=0, horizontalPan=0, verticalPan=0, zoom=1)
		cmds.move(i[0], 5.0, i[1])
		#cmds.rotate(0.0, i[2]+90, 0.0, absolute=True, objectSpace=True, forceOrderXYZ=True)
		cmds.viewPlace(lookAt=[0, 3.0, 0])
Beispiel #3
0
def camera_init(points):
	"""initiate camera at first point"""
	camera = cmds.camera(centerOfInterest=5, focalLength=35, lensSqueezeRatio=1, cameraScale=1, horizontalFilmAperture=1.41732, horizontalFilmOffset=0, 
	verticalFilmAperture=0.94488, verticalFilmOffset=0, filmFit="fill", overscan=1, motionBlur=0, shutterAngle=144, nearClipPlane=0.1,
	farClipPlane=10000, orthographic=0, orthographicWidth=30, panZoomEnabled=0, horizontalPan=0, verticalPan=0, zoom=1)
	cmds.move(points[0][0], 5.0, points[0][1])
	cmds.viewPlace(lookAt=[0, 3.0, 0])
	return camera
Beispiel #4
0
def camera_anim(points, camera):
	# cameras = cmds.listCameras(perspective=True)
	cmds.select([camera], replace=True)
	for i in points:
	# cmds.camera(centerOfInterest=5, focalLength=35, lensSqueezeRatio=1, cameraScale=1, horizontalFilmAperture=1.41732, horizontalFilmOffset=0, 
	# 	verticalFilmAperture=0.94488, verticalFilmOffset=0, filmFit="fill", overscan=1, motionBlur=0, shutterAngle=144, nearClipPlane=0.1,
	# 	farClipPlane=10000, orthographic=0, orthographicWidth=30, panZoomEnabled=0, horizontalPan=0, verticalPan=0, zoom=1)
		cmds.currentTime(i+1)
		# cmds.select([camera], replace=True)
		cmds.move(i[0], 5.0, i[1])
		cmds.viewPlace(lookAt=[0, 3.0, 0])
		cmds.setKeyframe()