diff --git a/doc/luxcore_api_tips.md b/doc/luxcore_api_tips.md index df500e33..77a1d905 100644 --- a/doc/luxcore_api_tips.md +++ b/doc/luxcore_api_tips.md @@ -1,6 +1,6 @@ When one property of a key is set, all other (previously defined) properties of the key will be deleted. Example: -Let"s say we have set the following properties: +Let's say we have set the following properties: ``` props.Set(pyluxcore.Property("scene.materials.test.type", "matte")) props.Set(pyluxcore.Property("scene.materials.test.kd", [0.7, 0.7, 0.7])) diff --git a/export/__init__.py b/export/__init__.py index e6291d5c..20ecb690 100644 --- a/export/__init__.py +++ b/export/__init__.py @@ -203,6 +203,8 @@ def create_session(self, engine, scene, context=None): if enabled and blur_settings.shutter > 0: motion_blur_props = motion_blur.convert(context, scene, objs, self.exported_objects) + if camera_blur: + motion_blur_props.Set(camera_props) scene_props.Set(motion_blur_props) # World diff --git a/export/camera.py b/export/camera.py index 55c1bee1..ea640e22 100644 --- a/export/camera.py +++ b/export/camera.py @@ -35,7 +35,9 @@ def convert(scene, context=None): _clipping_plane(scene, definitions) _motion_blur(scene, definitions, context) - return utils.create_props(prefix, definitions) + p = utils.create_props(prefix, definitions) + print(p) + return p except Exception as error: msg = 'Camera: %s' % error scene.luxcore.errorlog.add_warning(msg) @@ -207,21 +209,20 @@ def _motion_blur(scene, definitions, context): return # TODO why does this not work as expected? - # definitions["shutteropen"] = -moblur_settings.shutter * 0.5 - # definitions["shutterclose"] = moblur_settings.shutter * 0.5 + definitions["shutteropen"] = -moblur_settings.shutter * 0.5 + definitions["shutterclose"] = moblur_settings.shutter * 0.5 # # Don't export camera blur in viewport render - # if moblur_settings.camera_blur and not context and motion_blur.is_camera_moving(context, scene): - # # Make sure lookup is defined - this function should be the last to modify it - # assert "lookat.orig" in definitions - # assert "lookat.target" in definitions - # assert "up" in definitions - # # Reset lookat - it's handled by motion.x.transformation - # # TODO: seems like this is not needed - why? - # definitions["lookat.orig"] = [0, 0, 0] - # definitions["lookat.target"] = [0, 0, -1] - # definitions["up"] = [0, 1, 0] - # # Note: camera motion system is defined in export/motion_blur.py + if moblur_settings.camera_blur and not context and motion_blur.is_camera_moving(context, scene): + # Make sure lookup is defined - this function should be the last to modify it + assert "lookat.orig" in definitions + assert "lookat.target" in definitions + assert "up" in definitions + # Reset lookat - it's handled by motion.x.transformation + definitions["lookat.orig"] = [0, 0, 0] + definitions["lookat.target"] = [0, 0, -1] + definitions["up"] = [0, 1, 0] + # Note: camera motion system is defined in export/motion_blur.py def _calc_lookat(cam_matrix): diff --git a/export/motion_blur.py b/export/motion_blur.py index 7f78db26..3f5a3b95 100644 --- a/export/motion_blur.py +++ b/export/motion_blur.py @@ -49,6 +49,7 @@ def convert(context, scene, objects, exported_objects): "motion.%d.transformation" % step: transformation, } props.Set(utils.create_props(prefix, definitions)) + print(props) return props @@ -77,11 +78,13 @@ def _get_matrices(context, scene, steps, times, objects=None, exported_objects=N _append_object_matrices(objects, exported_objects, matrices, step) if motion_blur.camera_blur and not context: - matrix = scene.camera.matrix_world.copy() + matrix = scene.camera.matrix_world.inverted() + # TODO: This is so stupid. I have no idea what I'm doing - rotate = Matrix.Rotation(math.radians(180), 4, "X") - scale = Matrix.Scale(-1, 4, (0, 1, 0)) - matrix = matrix * rotate * scale + # rotate = Matrix.Rotation(math.radians(180), 4, "X") + # scale = Matrix.Scale(-1, 4, (0, 1, 0)) + # matrix = matrix * rotate * scale + prefix = "scene.camera." _append_matrix(matrices, prefix, matrix, step) print("appended camera matrix")