Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/phantom_camera/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="Phantom Camera"
description="Control the movement and dynamically tween 2D & 3D cameras positions. Built for Godot 4. Inspired by Cinemachine."
author="Marcus Skov"
version="0.11"
version="0.11.0.2"
script="plugin.gd"
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ var _is_child_of_camera: bool = false
var _is_2d: bool = false

var _viewfinder_node: Control = null
var _viewfinder_needed_check: bool = true

var _camera_zoom: Vector2 = Vector2.ONE

Expand Down Expand Up @@ -671,17 +670,11 @@ func _assign_new_active_pcam(pcam: Node) -> void:
viewfinder_update.emit(false)

if _is_2d:
if _active_pcam_2d.show_viewfinder_in_play:
_viewfinder_needed_check = true

_active_pcam_2d.set_is_active(self, true)
_active_pcam_2d.became_active.emit()
pcam_became_active.emit(_active_pcam_2d)
_camera_zoom = camera_2d.zoom
else:
if _active_pcam_3d.show_viewfinder_in_play:
_viewfinder_needed_check = true

_active_pcam_3d.set_is_active(self, true)
_active_pcam_3d.became_active.emit()
pcam_became_active.emit(_active_pcam_3d)
Expand All @@ -690,6 +683,8 @@ func _assign_new_active_pcam(pcam: Node) -> void:
camera_3d.cull_mask = _active_pcam_3d.cull_mask
camera_3d.projection = _active_pcam_3d.projection

_check_viewfinder_in_play()

if no_previous_pcam:
if _is_2d:
_prev_active_pcam_2d_transform = _active_pcam_2d.get_transform_output()
Expand Down Expand Up @@ -922,10 +917,6 @@ func _pcam_follow(_delta: float) -> void:
else:
camera_3d.global_transform = _active_pcam_3d_glob_transform

if _viewfinder_needed_check:
_show_viewfinder_in_play()
_viewfinder_needed_check = false

if Engine.is_editor_hint():
if not _is_2d:
# TODO - Signal-based solution pending merge of: https://github.com/godotengine/godot/pull/99729
Expand Down Expand Up @@ -1238,9 +1229,9 @@ func _tween_interpolate_value(from: Variant, to: Variant) -> Variant:
)


func _show_viewfinder_in_play() -> void:
func _check_viewfinder_in_play() -> void:
# Don't show the viewfinder in the actual editor or project builds
if Engine.is_editor_hint() or !OS.has_feature("editor"): return
if Engine.is_editor_hint() or not OS.has_feature("editor"): return

# Default the viewfinder node to be hidden
if is_instance_valid(_phantom_camera_manager.get_viewfinder()):
Expand All @@ -1258,7 +1249,7 @@ func _show_viewfinder_in_play() -> void:

# Instantiate the viewfinder scene if it isn't already
if not is_instance_valid(_phantom_camera_manager.get_viewfinder()):
var _viewfinder_scene: PackedScene = preload("res://addons/phantom_camera/panel/viewfinder/viewfinder_panel.tscn")
var _viewfinder_scene: PackedScene = load("res://addons/phantom_camera/panel/viewfinder/viewfinder_panel.tscn")
_phantom_camera_manager.set_viewfinder(self, _viewfinder_scene.instantiate())
canvas_layer.add_child(_phantom_camera_manager.get_viewfinder())
# _phantom_camera_manager.viewfinder = _viewfinder_node
Expand Down
Loading