From a21cc86db72bfa9ee46eeffd9963962d43750e17 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Fri, 7 Jul 2023 17:32:11 -0400 Subject: [PATCH] GUI Camera scaling should make things smaller. Our calculations try to fill the entire screen with the GUI objects. So, really, what we want the GUI Camera scaling to do is allow the artist to make the GUI smaller onscreen by pushing the camera away. This is a *less than* 100% scaling. --- korman/exporter/gui.py | 2 +- korman/operators/op_camera.py | 20 +++++++++++++------- korman/properties/modifiers/game_gui.py | 3 +-- korman/properties/modifiers/gui.py | 3 +-- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/korman/exporter/gui.py b/korman/exporter/gui.py index deb55ff..0a0a117 100644 --- a/korman/exporter/gui.py +++ b/korman/exporter/gui.py @@ -80,7 +80,7 @@ class GuiConverter: scene: bpy.types.Scene, objects: Sequence[bpy.types.Object], fov: float, - scale: float = 1.0, + scale: float = 0.75 ) -> mathutils.Matrix: if not objects: raise ExportError("No objects specified for GUI Camera generation.") diff --git a/korman/operators/op_camera.py b/korman/operators/op_camera.py index f2f218b..365dd7e 100644 --- a/korman/operators/op_camera.py +++ b/korman/operators/op_camera.py @@ -32,10 +32,11 @@ class CameraOperator: class PlasmaGameGuiCameraOperator(CameraOperator, bpy.types.Operator): bl_idname = "camera.plasma_create_game_gui_camera" bl_label = "Create Game GUI Camera" + bl_description = "Create a camera looking at all of the objects in this GUI page with a custom scale factor" fov: float = FloatProperty( name="Field of View", - description="", + description="Camera Field of View angle", subtype="ANGLE", default=math.radians(90.0), min=0.0, @@ -50,17 +51,22 @@ class PlasmaGameGuiCameraOperator(CameraOperator, bpy.types.Operator): ) scale: float = FloatProperty( name="GUI Scale", - description="", - default=1.02, - min=0.001, - soft_max=2.0, - precision=2, + description="GUI Camera distance scale factor.", + default=75.0, + min=0.1, + soft_max=100.0, + precision=1, + subtype="PERCENTAGE", options=set() ) mod_id: str = StringProperty(options={"HIDDEN"}) cam_prop_name: str = StringProperty(options={"HIDDEN"}) + def invoke(self, context, event): + context.window_manager.invoke_props_dialog(self) + return {"RUNNING_MODAL"} + def execute(self, context): # If the modifier has been given to us, select all of the objects in the # given GUI page. @@ -80,7 +86,7 @@ class PlasmaGameGuiCameraOperator(CameraOperator, bpy.types.Operator): context.scene, visible_objects, self.fov, - self.scale + self.scale / 100.0 ) except ExportError as e: self.report({"ERROR"}, str(e)) diff --git a/korman/properties/modifiers/game_gui.py b/korman/properties/modifiers/game_gui.py index 4585aa4..d872605 100644 --- a/korman/properties/modifiers/game_gui.py +++ b/korman/properties/modifiers/game_gui.py @@ -239,8 +239,7 @@ class PlasmaGameGuiDialogModifier(PlasmaModifierProperties, _GameGuiMixin): camera_matrix = exporter.gui.calc_camera_matrix( bpy.context.scene, visible_objects, - fov, - 1.02 # FIXME + fov ) # There isn't a real camera, so just pretend like the user didn't set the clipping info. diff --git a/korman/properties/modifiers/gui.py b/korman/properties/modifiers/gui.py index 40e65c0..98874ad 100644 --- a/korman/properties/modifiers/gui.py +++ b/korman/properties/modifiers/gui.py @@ -763,8 +763,7 @@ class PlasmaNotePopupModifier(PlasmaModifierProperties, PlasmaModifierLogicWiz): camera_object.matrix_world = exporter.gui.calc_camera_matrix( bpy.context.scene, visible_objects, - camera_object.data.angle, - 1.02 # FIXME + camera_object.data.angle ) clipping = exporter.gui.calc_clipping( camera_object.matrix_world,