Browse Source

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.
pull/373/head
Adam Johnson 10 months ago
parent
commit
a21cc86db7
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 2
      korman/exporter/gui.py
  2. 20
      korman/operators/op_camera.py
  3. 3
      korman/properties/modifiers/game_gui.py
  4. 3
      korman/properties/modifiers/gui.py

2
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.")

20
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))

3
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.

3
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,

Loading…
Cancel
Save