def build_grease_pencil(data): object_path, start = common.decode_string(data, 0) grease_pencil_name, start = common.decode_string(data, start) grease_pencil = share_data.blender_grease_pencils.get(grease_pencil_name) if not grease_pencil: grease_pencil = bpy.data.grease_pencils.new(grease_pencil_name) get_or_create_object_data(object_path, grease_pencil)
def build_light(data): light_path, start = common.decode_string(data, 0) light_name, start = common.decode_string(data, start) logger.info("build_light %s", light_path) light_type, start = common.decode_int(data, start) blighttype = "POINT" if light_type == common.LightType.SUN.value: blighttype = "SUN" elif light_type == common.LightType.POINT.value: blighttype = "POINT" elif light_type == common.LightType.AREA.value: blighttype = "AREA" else: blighttype = "SPOT" light = get_or_create_light(light_name, blighttype) shadow, start = common.decode_int(data, start) if shadow != 0: light.use_shadow = True else: light.use_shadow = False color, start = common.decode_color(data, start) light.color = (color[0], color[1], color[2]) light.energy, start = common.decode_float(data, start) if light_type == common.LightType.SPOT.value: light.spot_size, start = common.decode_float(data, start) light.spot_blend, start = common.decode_float(data, start) get_or_create_object_data(light_path, light)
def build_camera(data): camera_path, start = common.decode_string(data, 0) logger.info("build_camera %s", camera_path) camera_name, start = common.decode_string(data, start) camera = get_or_create_camera(camera_name) camera.lens, start = common.decode_float(data, start) camera.clip_start, start = common.decode_float(data, start) camera.clip_end, start = common.decode_float(data, start) camera.dof.use_dof, start = common.decode_bool(data, start) camera.dof.aperture_fstop, start = common.decode_float(data, start) colimator_name, start = common.decode_string(data, start) sensor_fit, start = common.decode_int(data, start) camera.sensor_width, start = common.decode_float(data, start) camera.sensor_height, start = common.decode_float(data, start) if sensor_fit == 0: camera.sensor_fit = "AUTO" elif sensor_fit == 1: camera.sensor_fit = "VERTICAL" else: camera.sensor_fit = "HORIZONTAL" get_or_create_object_data(camera_path, camera) # colimator if len(colimator_name) > 0: camera.dof.use_dof = True camera.dof.focus_object = get_or_create_path(colimator_name)
def build_grease_pencil_connection(data): path, start = common.decode_string(data, 0) grease_pencil_name, start = common.decode_string(data, start) gp = share_data.blender_grease_pencils[grease_pencil_name] get_or_create_object_data(path, gp)