diff --git a/Assets/Editor/ObjectIcons/AreaTrigger.bmp b/Assets/Editor/ObjectIcons/AreaTrigger.bmp
deleted file mode 100644
index 779e9bd30f..0000000000
--- a/Assets/Editor/ObjectIcons/AreaTrigger.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:4cf08659d31a337ceb28de2765b0177abf404f3e671f5277dd7a280f2fd6c60d
-size 3128
diff --git a/Assets/Editor/ObjectIcons/AudioAreaAmbience.bmp b/Assets/Editor/ObjectIcons/AudioAreaAmbience.bmp
deleted file mode 100644
index 052eb463cb..0000000000
--- a/Assets/Editor/ObjectIcons/AudioAreaAmbience.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:706b12b37518596b01fc6c5cdb3aadc5fdbe76b668e9989ba2bb03ee23376dbf
-size 3126
diff --git a/Assets/Editor/ObjectIcons/AudioAreaEntity.bmp b/Assets/Editor/ObjectIcons/AudioAreaEntity.bmp
deleted file mode 100644
index b490f91bc4..0000000000
--- a/Assets/Editor/ObjectIcons/AudioAreaEntity.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:7e67540926b2d55c70ac5867266ac9688437fc139b459f165f9d52d9b351851c
-size 3128
diff --git a/Assets/Editor/ObjectIcons/AudioAreaRandom.bmp b/Assets/Editor/ObjectIcons/AudioAreaRandom.bmp
deleted file mode 100644
index 73a0a21256..0000000000
--- a/Assets/Editor/ObjectIcons/AudioAreaRandom.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:96ec04e8126bcffb7fe391dc55ea1aa6a82419825c8305117f9b0ae72b40e63e
-size 3126
diff --git a/Assets/Editor/ObjectIcons/Camera.bmp b/Assets/Editor/ObjectIcons/Camera.bmp
deleted file mode 100644
index fd89801011..0000000000
--- a/Assets/Editor/ObjectIcons/Camera.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:4168676b803b7e3b03a90fb69502204a418b6598941c75f0c36e589a31455db5
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Checkpoint.bmp b/Assets/Editor/ObjectIcons/Checkpoint.bmp
deleted file mode 100644
index fd31d3c446..0000000000
--- a/Assets/Editor/ObjectIcons/Checkpoint.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:b11c94da25b704a36f2b437dae98c04a5cea54f02022567306e2cf82837bf7a1
-size 3128
diff --git a/Assets/Editor/ObjectIcons/ClipVolume.bmp b/Assets/Editor/ObjectIcons/ClipVolume.bmp
deleted file mode 100644
index dba0aa32ba..0000000000
--- a/Assets/Editor/ObjectIcons/ClipVolume.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8ca14c966de6d392beb4d154221b622a417163fcdf92eb049638bf8495c13774
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Clock.bmp b/Assets/Editor/ObjectIcons/Clock.bmp
deleted file mode 100644
index 1557a7e8dc..0000000000
--- a/Assets/Editor/ObjectIcons/Clock.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:6d11fd9413f06706bc706a97f39cc72b1ae6ff7cb6c506cf2fcda98660e2a92f
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Clouds.bmp b/Assets/Editor/ObjectIcons/Clouds.bmp
deleted file mode 100644
index 4530661aac..0000000000
--- a/Assets/Editor/ObjectIcons/Clouds.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:1f5fd7032f82fbb7364cd0a96989918defd63f26a899836c61b039541cf3b3af
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Comment.bmp b/Assets/Editor/ObjectIcons/Comment.bmp
deleted file mode 100644
index 78a8d8f4fa..0000000000
--- a/Assets/Editor/ObjectIcons/Comment.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9201d97225c19b8fc2fc208ab913ab100a94328b64b026ab65be9c4cd9c4e28a
-size 3128
diff --git a/Assets/Editor/ObjectIcons/DeadBody.bmp b/Assets/Editor/ObjectIcons/DeadBody.bmp
deleted file mode 100644
index ffebc73608..0000000000
--- a/Assets/Editor/ObjectIcons/DeadBody.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a2937837233d9f313b2500232c74952cee3f4e7497ee0e1099b301ef2fa49bf8
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Decal.bmp b/Assets/Editor/ObjectIcons/Decal.bmp
deleted file mode 100644
index 4b33fe7422..0000000000
--- a/Assets/Editor/ObjectIcons/Decal.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ffbe8438c19ac2a9b6614beb78f0d651184dbe5cf2998063257dc7272c9c2c10
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Dialog.bmp b/Assets/Editor/ObjectIcons/Dialog.bmp
deleted file mode 100644
index 0722f5f1e4..0000000000
--- a/Assets/Editor/ObjectIcons/Dialog.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:63640478bd3258aa310dd639014cde714780ebaa168aa784093e74fc0da23a4c
-size 3126
diff --git a/Assets/Editor/ObjectIcons/Flash.bmp b/Assets/Editor/ObjectIcons/Flash.bmp
deleted file mode 100644
index d7f02ed44b..0000000000
--- a/Assets/Editor/ObjectIcons/Flash.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:b66daefbb3f11f527d9c10ff1dd54f87635e6561cc546a762ae2e72793ae6ef6
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Fog.bmp b/Assets/Editor/ObjectIcons/Fog.bmp
deleted file mode 100644
index 2af489a79a..0000000000
--- a/Assets/Editor/ObjectIcons/Fog.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:42e0c1dc60809958d74145ae14030c22e351ef3b72ed6d820fdb19632b691c89
-size 3128
diff --git a/Assets/Editor/ObjectIcons/FogVolume.bmp b/Assets/Editor/ObjectIcons/FogVolume.bmp
deleted file mode 100644
index 78d20bff41..0000000000
--- a/Assets/Editor/ObjectIcons/FogVolume.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:2cbb23fc09d47d16b2414d622fd16b330d9f684398dcfc44e0fb44378dfd3287
-size 3128
diff --git a/Assets/Editor/ObjectIcons/GravitySphere.bmp b/Assets/Editor/ObjectIcons/GravitySphere.bmp
deleted file mode 100644
index 06168d4698..0000000000
--- a/Assets/Editor/ObjectIcons/GravitySphere.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:26b6e2f28ed72b9cdb90410351e3a22fee3c0498ac315e71d966a1ffb77742fe
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Item.bmp b/Assets/Editor/ObjectIcons/Item.bmp
deleted file mode 100644
index 15c610cad2..0000000000
--- a/Assets/Editor/ObjectIcons/Item.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:bd6f39152affb52a7b3c4361032d1d7d77e7e94841613a83d7e2cdea9eaab553
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Ladder.bmp b/Assets/Editor/ObjectIcons/Ladder.bmp
deleted file mode 100644
index dbd4a288e7..0000000000
--- a/Assets/Editor/ObjectIcons/Ladder.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:077502953026981b6e8cc5e40ab58722fc514947f175021508e6af8058340f32
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Light.bmp b/Assets/Editor/ObjectIcons/Light.bmp
deleted file mode 100644
index 6a3347e78c..0000000000
--- a/Assets/Editor/ObjectIcons/Light.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:c9ecfc056ab66b3221be3175889d182229c0e49bf9604abd7946fe58cc7d29a9
-size 3128
diff --git a/Assets/Editor/ObjectIcons/LightPropagationVolume.bmp b/Assets/Editor/ObjectIcons/LightPropagationVolume.bmp
deleted file mode 100644
index 4ad9437883..0000000000
--- a/Assets/Editor/ObjectIcons/LightPropagationVolume.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:206820d3bb5d6a4d26bf87fc0b91a36adcbd0f154149b7cb5f5ce067f5ee4d67
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Lightning.bmp b/Assets/Editor/ObjectIcons/Lightning.bmp
deleted file mode 100644
index 5c02d0368c..0000000000
--- a/Assets/Editor/ObjectIcons/Lightning.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d7c81a8000339695f73277bcebaedb0cfeacdff547f51c1ff7f4761c75927ca4
-size 3126
diff --git a/Assets/Editor/ObjectIcons/Magnet.bmp b/Assets/Editor/ObjectIcons/Magnet.bmp
deleted file mode 100644
index 68b6e4e7e4..0000000000
--- a/Assets/Editor/ObjectIcons/Magnet.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:560c3af6e8f2fb98ddc8638b0ea4786131e75b6fe0acece964bfdb28f8c3ec9f
-size 3128
diff --git a/Assets/Editor/ObjectIcons/MultiTrigger.bmp b/Assets/Editor/ObjectIcons/MultiTrigger.bmp
deleted file mode 100644
index e96dc6f1b7..0000000000
--- a/Assets/Editor/ObjectIcons/MultiTrigger.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8a3a64d33b65c4cd5d666c11abf03b4148acadfe69e4c80e79382b56d2906ae6
-size 3128
diff --git a/Assets/Editor/ObjectIcons/ODD.bmp b/Assets/Editor/ObjectIcons/ODD.bmp
deleted file mode 100644
index 5c5a7bbd89..0000000000
--- a/Assets/Editor/ObjectIcons/ODD.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:113d0a416da49ce24dae2c47514318b75e0ca4d7dc257a9927e0db4bdad35d91
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Particles.bmp b/Assets/Editor/ObjectIcons/Particles.bmp
deleted file mode 100644
index 8f71edb74f..0000000000
--- a/Assets/Editor/ObjectIcons/Particles.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:6ca81d96a5450660f7e17f75565595368fb7c0071df9589bcbfda2ba54d5c0ae
-size 3128
diff --git a/Assets/Editor/ObjectIcons/PrecacheCamera.bmp b/Assets/Editor/ObjectIcons/PrecacheCamera.bmp
deleted file mode 100644
index 8f1dca751a..0000000000
--- a/Assets/Editor/ObjectIcons/PrecacheCamera.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:73629b1903365aa6acf35fd7846896c23c38401fac12bc23b23285e5ed9ae89d
-size 3126
diff --git a/Assets/Editor/ObjectIcons/Prefab.bmp b/Assets/Editor/ObjectIcons/Prefab.bmp
deleted file mode 100644
index 539a0f5a56..0000000000
--- a/Assets/Editor/ObjectIcons/Prefab.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:6d7fbb76f67165492a51e6b8715ee3716040d44bd5419b12481e2c9cc627c291
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Prompt.bmp b/Assets/Editor/ObjectIcons/Prompt.bmp
deleted file mode 100644
index 1e9b18a97c..0000000000
--- a/Assets/Editor/ObjectIcons/Prompt.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:2482da67fbf513a9597b3919562a65d361a4c8264fcc8510ef45321b4192ce4d
-size 3128
diff --git a/Assets/Editor/ObjectIcons/SavePoint.bmp b/Assets/Editor/ObjectIcons/SavePoint.bmp
deleted file mode 100644
index ce602eeeb4..0000000000
--- a/Assets/Editor/ObjectIcons/SavePoint.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:06f866e66e0458ccf3e014a30fef2dfaab832d9b4b1179f98b7cdd716b358b48
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Seed.bmp b/Assets/Editor/ObjectIcons/Seed.bmp
deleted file mode 100644
index 3a9452d982..0000000000
--- a/Assets/Editor/ObjectIcons/Seed.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:fdcea1e14d3b01b1ed6ea123767343eddc646969ee447b4bf725c233fd7946f4
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Sound.bmp b/Assets/Editor/ObjectIcons/Sound.bmp
deleted file mode 100644
index 06ab261be3..0000000000
--- a/Assets/Editor/ObjectIcons/Sound.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:14a4003a9faf9a2fb3a17d2f87825c8497aeaca364c592ab75970d00e77aa203
-size 3128
diff --git a/Assets/Editor/ObjectIcons/SpawnPoint.bmp b/Assets/Editor/ObjectIcons/SpawnPoint.bmp
deleted file mode 100644
index b04a20e8c0..0000000000
--- a/Assets/Editor/ObjectIcons/SpawnPoint.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f7e109f57e5e9bc6bcaee7176a479bb6434353bc49a8021ab96e016ce27f41a1
-size 3128
diff --git a/Assets/Editor/ObjectIcons/T.bmp b/Assets/Editor/ObjectIcons/T.bmp
deleted file mode 100644
index 767782c43d..0000000000
--- a/Assets/Editor/ObjectIcons/T.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:4c2288c239604402f7e85d753141fbd8a82fde9f18e4f95006b039ceeec41d0c
-size 3128
diff --git a/Assets/Editor/ObjectIcons/TagPoint.bmp b/Assets/Editor/ObjectIcons/TagPoint.bmp
deleted file mode 100644
index 36727d9c4a..0000000000
--- a/Assets/Editor/ObjectIcons/TagPoint.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8f58cabe21df546914abc1e8f2604989d87b4a3471c1902956a4e1e1be9930b8
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Trigger.bmp b/Assets/Editor/ObjectIcons/Trigger.bmp
deleted file mode 100644
index ef712e4b09..0000000000
--- a/Assets/Editor/ObjectIcons/Trigger.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e9cfb325abea577e8737b837098ff3cecd564e302b2c30925b3d35a62fa6c7c3
-size 3128
diff --git a/Assets/Editor/ObjectIcons/UiCanvasRefEntity.bmp b/Assets/Editor/ObjectIcons/UiCanvasRefEntity.bmp
deleted file mode 100644
index c1ff4d3291..0000000000
--- a/Assets/Editor/ObjectIcons/UiCanvasRefEntity.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:bcd9a1efaab42cdea4557265e544f2370565872115d21cc84af6e6998bb7ad01
-size 3128
diff --git a/Assets/Editor/ObjectIcons/User.bmp b/Assets/Editor/ObjectIcons/User.bmp
deleted file mode 100644
index 780242c15c..0000000000
--- a/Assets/Editor/ObjectIcons/User.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:56a379a337a44617cb6ed5a20560286b8263c75871742ca04cc61cac49736a2a
-size 3128
diff --git a/Assets/Editor/ObjectIcons/VVVArea.bmp b/Assets/Editor/ObjectIcons/VVVArea.bmp
deleted file mode 100644
index 82712dda92..0000000000
--- a/Assets/Editor/ObjectIcons/VVVArea.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9cab80e4ce74155a3eaf771fa9b2464c1f3b36bce6de55d3f5aa180576cabec2
-size 3128
diff --git a/Assets/Editor/ObjectIcons/W.bmp b/Assets/Editor/ObjectIcons/W.bmp
deleted file mode 100644
index 40448a6334..0000000000
--- a/Assets/Editor/ObjectIcons/W.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:6ebc8eacd6695caafd131d5c8ca29b45fea16bc2147cdb169478e391d6f13b70
-size 3128
diff --git a/Assets/Editor/ObjectIcons/Water.bmp b/Assets/Editor/ObjectIcons/Water.bmp
deleted file mode 100644
index fb7d6c7b51..0000000000
--- a/Assets/Editor/ObjectIcons/Water.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e5d24ecf0878409dc3f7ed0f447734061bb9e313e4adb767580bd961b0038236
-size 3126
diff --git a/Assets/Editor/ObjectIcons/animobject.bmp b/Assets/Editor/ObjectIcons/animobject.bmp
deleted file mode 100644
index d28e4c016a..0000000000
--- a/Assets/Editor/ObjectIcons/animobject.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:514fb756bd23f0376a03ba7222a5a8479408eb68efbfcecac30957142580e494
-size 3128
diff --git a/Assets/Editor/ObjectIcons/bird.bmp b/Assets/Editor/ObjectIcons/bird.bmp
deleted file mode 100644
index b6431dc2cf..0000000000
--- a/Assets/Editor/ObjectIcons/bird.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e7d72d46274c9c0863e7e34caccfdf78a7c8c77262caf1b7f4305a822ac0145c
-size 3128
diff --git a/Assets/Editor/ObjectIcons/bug.bmp b/Assets/Editor/ObjectIcons/bug.bmp
deleted file mode 100644
index 86cb76bed0..0000000000
--- a/Assets/Editor/ObjectIcons/bug.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d238a0d17e3469c499249bd907b5aba0b924fb8539259a1b92af64e39820b619
-size 3128
diff --git a/Assets/Editor/ObjectIcons/character.bmp b/Assets/Editor/ObjectIcons/character.bmp
deleted file mode 100644
index a37997e7bf..0000000000
--- a/Assets/Editor/ObjectIcons/character.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:4b7bd2ee00f000d13ef096bd4d430fbca5cd35f3d641d44f4698c1270423b484
-size 3128
diff --git a/Assets/Editor/ObjectIcons/death.bmp b/Assets/Editor/ObjectIcons/death.bmp
deleted file mode 100644
index 98c673af1d..0000000000
--- a/Assets/Editor/ObjectIcons/death.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9d93aa4486316a2ba269f860d64f741da15359fec6111da1049331a5a75dee02
-size 3128
diff --git a/Assets/Editor/ObjectIcons/door.bmp b/Assets/Editor/ObjectIcons/door.bmp
deleted file mode 100644
index 3c95318ef9..0000000000
--- a/Assets/Editor/ObjectIcons/door.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:4be7c244d9350a46c18161222ace0eaea1213dd1e7ed5ba02fa94ee5a98dc728
-size 3128
diff --git a/Assets/Editor/ObjectIcons/elevator.bmp b/Assets/Editor/ObjectIcons/elevator.bmp
deleted file mode 100644
index b256426aef..0000000000
--- a/Assets/Editor/ObjectIcons/elevator.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:6c1cf46f0825ecf1d3331bdca3d5f6a0d348aa6346af9fb1fdb3b75cfc5564dd
-size 3128
diff --git a/Assets/Editor/ObjectIcons/environmentProbe.bmp b/Assets/Editor/ObjectIcons/environmentProbe.bmp
deleted file mode 100644
index 0a23ebb9f4..0000000000
--- a/Assets/Editor/ObjectIcons/environmentProbe.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:27c8ae2924af50058207e7a1e1f4e35799f27abd7cb2e0778b8903ce00e99732
-size 4152
diff --git a/Assets/Editor/ObjectIcons/explosion.bmp b/Assets/Editor/ObjectIcons/explosion.bmp
deleted file mode 100644
index 27213da651..0000000000
--- a/Assets/Editor/ObjectIcons/explosion.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a93e2e2164781ed0de1be34bbbd0c85d630a31efd3fe568ea7f3c026646209c8
-size 3128
diff --git a/Assets/Editor/ObjectIcons/fish.bmp b/Assets/Editor/ObjectIcons/fish.bmp
deleted file mode 100644
index 9c1d0b2d21..0000000000
--- a/Assets/Editor/ObjectIcons/fish.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:590e0458bbc0d528ba71cd048b6019ebb8d1764a55cc3b9b3e2b1446182cfaa9
-size 3128
diff --git a/Assets/Editor/ObjectIcons/forbiddenarea.bmp b/Assets/Editor/ObjectIcons/forbiddenarea.bmp
deleted file mode 100644
index b41c47bf72..0000000000
--- a/Assets/Editor/ObjectIcons/forbiddenarea.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:6a8eac076d5094c722513bcdb6b71def9116ae063d453017d7bb0b38068c3a7e
-size 3128
diff --git a/Assets/Editor/ObjectIcons/hazard.bmp b/Assets/Editor/ObjectIcons/hazard.bmp
deleted file mode 100644
index 4779f3730a..0000000000
--- a/Assets/Editor/ObjectIcons/hazard.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:71c3e9e9ccf404c3c17f71f806cd6ee0e4b48f6f2e172b52aeca78cc28668ac3
-size 3128
diff --git a/Assets/Editor/ObjectIcons/health.bmp b/Assets/Editor/ObjectIcons/health.bmp
deleted file mode 100644
index 01833903c3..0000000000
--- a/Assets/Editor/ObjectIcons/health.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:3ded11545905ac937fe6e28929e57c10abe55befa74b44260dee5b206cdf3d15
-size 3128
diff --git a/Assets/Editor/ObjectIcons/ledge.bmp b/Assets/Editor/ObjectIcons/ledge.bmp
deleted file mode 100644
index 3d6784fb44..0000000000
--- a/Assets/Editor/ObjectIcons/ledge.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:c43daede42eb72eca0f80454b0e70de1e03156b5f098bcc8dbc080117c34380a
-size 3128
diff --git a/Assets/Editor/ObjectIcons/mine.bmp b/Assets/Editor/ObjectIcons/mine.bmp
deleted file mode 100644
index 8f4394a2dd..0000000000
--- a/Assets/Editor/ObjectIcons/mine.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:da1bb03a55949c6dc80ac18e3cf87c962e30fe2eacfd4fac74cc93db58552ac5
-size 3128
diff --git a/Assets/Editor/ObjectIcons/physicsobject.bmp b/Assets/Editor/ObjectIcons/physicsobject.bmp
deleted file mode 100644
index 00bb3f2380..0000000000
--- a/Assets/Editor/ObjectIcons/physicsobject.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:74cdfbf6f61029fa6f1262f78c2787afb9dddc0218911b53349962c4ed548bbf
-size 3128
diff --git a/Assets/Editor/ObjectIcons/prefabbuilding.bmp b/Assets/Editor/ObjectIcons/prefabbuilding.bmp
deleted file mode 100644
index e416cbafe1..0000000000
--- a/Assets/Editor/ObjectIcons/prefabbuilding.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:98aaf6d6e532f5a3f31cdc08676432e30b4e52fd4f376331f4610379f288a191
-size 3128
diff --git a/Assets/Editor/ObjectIcons/proceduralbuilding.bmp b/Assets/Editor/ObjectIcons/proceduralbuilding.bmp
deleted file mode 100644
index e416cbafe1..0000000000
--- a/Assets/Editor/ObjectIcons/proceduralbuilding.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:98aaf6d6e532f5a3f31cdc08676432e30b4e52fd4f376331f4610379f288a191
-size 3128
diff --git a/Assets/Editor/ObjectIcons/proceduralobject.bmp b/Assets/Editor/ObjectIcons/proceduralobject.bmp
deleted file mode 100644
index e416cbafe1..0000000000
--- a/Assets/Editor/ObjectIcons/proceduralobject.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:98aaf6d6e532f5a3f31cdc08676432e30b4e52fd4f376331f4610379f288a191
-size 3128
diff --git a/Assets/Editor/ObjectIcons/proximitytrigger.bmp b/Assets/Editor/ObjectIcons/proximitytrigger.bmp
deleted file mode 100644
index a776094539..0000000000
--- a/Assets/Editor/ObjectIcons/proximitytrigger.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ac364f478ca4dfa0186069fb69d19b8005a8d1da74cff34ced76bb85cf4402e7
-size 3128
diff --git a/Assets/Editor/ObjectIcons/river.bmp b/Assets/Editor/ObjectIcons/river.bmp
deleted file mode 100644
index bf831c356a..0000000000
--- a/Assets/Editor/ObjectIcons/river.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:910d8f788514dc2d66c58027cb841a16e7d5194ee1f1ff3ccfcf5badd86c768a
-size 3128
diff --git a/Assets/Editor/ObjectIcons/road.bmp b/Assets/Editor/ObjectIcons/road.bmp
deleted file mode 100644
index 91a8b0916f..0000000000
--- a/Assets/Editor/ObjectIcons/road.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9e92c9792886fab49007891c38addf2f62719d6563a36cd81250de13c50fbf61
-size 3128
diff --git a/Assets/Editor/ObjectIcons/rope.bmp b/Assets/Editor/ObjectIcons/rope.bmp
deleted file mode 100644
index d7f7fddb67..0000000000
--- a/Assets/Editor/ObjectIcons/rope.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:738525640cf00402ebd807ce9a35d6d7ed67be39cde7def7930b136596977a2e
-size 3128
diff --git a/Assets/Editor/ObjectIcons/sequence.bmp b/Assets/Editor/ObjectIcons/sequence.bmp
deleted file mode 100644
index 8e76c924f1..0000000000
--- a/Assets/Editor/ObjectIcons/sequence.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e339afca6ba8ffa2463bf6b367615e66bb953fced380d739996d52c2971feab5
-size 3128
diff --git a/Assets/Editor/ObjectIcons/shake.bmp b/Assets/Editor/ObjectIcons/shake.bmp
deleted file mode 100644
index 5275a0aac9..0000000000
--- a/Assets/Editor/ObjectIcons/shake.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f3130dcb95136d806aff1882d3933eb3f7ee88aaa9876423b53dbf73f02c8cd3
-size 3128
diff --git a/Assets/Editor/ObjectIcons/smartobject.bmp b/Assets/Editor/ObjectIcons/smartobject.bmp
deleted file mode 100644
index 5ecf9a273e..0000000000
--- a/Assets/Editor/ObjectIcons/smartobject.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e908579e0a62d74a1402ee786876e88eadb0ef0de0542617d02291947504078b
-size 3128
diff --git a/Assets/Editor/ObjectIcons/spawngroup.bmp b/Assets/Editor/ObjectIcons/spawngroup.bmp
deleted file mode 100644
index 00626fc17f..0000000000
--- a/Assets/Editor/ObjectIcons/spawngroup.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:28111b13e60816f31f3916131d4632ce2d0c48c1a7712421593f79dff79c99d0
-size 3128
diff --git a/Assets/Editor/ObjectIcons/spectator.bmp b/Assets/Editor/ObjectIcons/spectator.bmp
deleted file mode 100644
index 6798c841c0..0000000000
--- a/Assets/Editor/ObjectIcons/spectator.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9a2885b3eb0845b48571f1af08d9e685b52361c78c31485c64f8e1efb38e8cc4
-size 3128
diff --git a/Assets/Editor/ObjectIcons/switch.bmp b/Assets/Editor/ObjectIcons/switch.bmp
deleted file mode 100644
index 50f4e790b2..0000000000
--- a/Assets/Editor/ObjectIcons/switch.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9bdce356a35d214c4d806ba568d2de72af636410eb433be5c0390eae67d8478a
-size 3128
diff --git a/Assets/Editor/ObjectIcons/territory.bmp b/Assets/Editor/ObjectIcons/territory.bmp
deleted file mode 100644
index edd8b5178e..0000000000
--- a/Assets/Editor/ObjectIcons/territory.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:dc350e4d3226531a35ac810fa5ebe1894bfdcafac605334afffcdd3a14416f94
-size 3128
diff --git a/Assets/Editor/ObjectIcons/tornado.bmp b/Assets/Editor/ObjectIcons/tornado.bmp
deleted file mode 100644
index e30b642441..0000000000
--- a/Assets/Editor/ObjectIcons/tornado.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:c54df0fb1c9b8abeee30adc5e983bfd7dd524c551909b26466a9d8b6422a094a
-size 3128
diff --git a/Assets/Editor/ObjectIcons/vehicle.bmp b/Assets/Editor/ObjectIcons/vehicle.bmp
deleted file mode 100644
index f65e5bb7bf..0000000000
--- a/Assets/Editor/ObjectIcons/vehicle.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:50e0b4d6a86953c33b0c3ace60bb53d119fa5acd193f4d9aa2c0934f3074cb19
-size 3128
diff --git a/Assets/Editor/ObjectIcons/voxel.bmp b/Assets/Editor/ObjectIcons/voxel.bmp
deleted file mode 100644
index dba0aa32ba..0000000000
--- a/Assets/Editor/ObjectIcons/voxel.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8ca14c966de6d392beb4d154221b622a417163fcdf92eb049638bf8495c13774
-size 3128
diff --git a/Assets/Editor/ObjectIcons/wave.bmp b/Assets/Editor/ObjectIcons/wave.bmp
deleted file mode 100644
index 0465b41c38..0000000000
--- a/Assets/Editor/ObjectIcons/wave.bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:573d22719ad010351a58733b63315a9a0fc07545dde71f3931f37371dfe44ce3
-size 3128
diff --git a/Assets/Editor/Prefabs/Default_Level.prefab b/Assets/Editor/Prefabs/Default_Level.prefab
index 64656e1e2f..d02d669f53 100644
--- a/Assets/Editor/Prefabs/Default_Level.prefab
+++ b/Assets/Editor/Prefabs/Default_Level.prefab
@@ -212,10 +212,10 @@
"Configuration": {
"ModelAsset": {
"assetId": {
- "guid": "{935F694A-8639-515B-8133-81CDC7948E5B}",
- "subId": 277333723
+ "guid": "{0CD745C0-6AA8-569A-A68A-73A3270986C4}",
+ "subId": 277889906
},
- "assetHint": "objects/groudplane/groundplane_521x521m.azmodel"
+ "assetHint": "objects/groudplane/groundplane_512x512m.azmodel"
}
}
}
diff --git a/Assets/Editor/Scripts/Shelves/icons/Albedo.png b/Assets/Editor/Scripts/Shelves/icons/Albedo.png
deleted file mode 100644
index f3225255c7..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/Albedo.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a91ea78d1ffd91490f20efcf76ad8790e450836240b8a77dda719da963235c85
-size 2987
diff --git a/Assets/Editor/Scripts/Shelves/icons/Diffuse_Lighting.png b/Assets/Editor/Scripts/Shelves/icons/Diffuse_Lighting.png
deleted file mode 100644
index 4709ee81d0..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/Diffuse_Lighting.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:2d8eadc0bdc63391e88936b0acfd0616c2d7bce550ea82cee1f967f971ace8a6
-size 2905
diff --git a/Assets/Editor/Scripts/Shelves/icons/Diffuse_Texture_Res_360.png b/Assets/Editor/Scripts/Shelves/icons/Diffuse_Texture_Res_360.png
deleted file mode 100644
index 25c686e46a..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/Diffuse_Texture_Res_360.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9cdb92de995635eadfbb6dceb25f44a737dde744e09f0fcfe7016de981dce786
-size 2975
diff --git a/Assets/Editor/Scripts/Shelves/icons/Empty_Wireframe.png b/Assets/Editor/Scripts/Shelves/icons/Empty_Wireframe.png
deleted file mode 100644
index b4329c1beb..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/Empty_Wireframe.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:268a5b239b9988be0ae13a2f42a99ac39ac2db9988f92604154630b661b89999
-size 2865
diff --git a/Assets/Editor/Scripts/Shelves/icons/Exit.png b/Assets/Editor/Scripts/Shelves/icons/Exit.png
deleted file mode 100644
index 3706ddc01c..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/Exit.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:030f4dc71dac36f220cd7e7c07eb24bda2df3c1e14b054e48fc6274573734bdb
-size 2898
diff --git a/Assets/Editor/Scripts/Shelves/icons/Fuzziness.png b/Assets/Editor/Scripts/Shelves/icons/Fuzziness.png
deleted file mode 100644
index 6ca7e20209..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/Fuzziness.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e0fa6d24bbb7f969a71b9e761f2dc4ec990a7e522201af9b13b2651d0565e1f0
-size 3607
diff --git a/Assets/Editor/Scripts/Shelves/icons/Gloss.png b/Assets/Editor/Scripts/Shelves/icons/Gloss.png
deleted file mode 100644
index 5063b7f01e..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/Gloss.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d5b949330e86f02662bb3b25db123fd77be31c910ad7e1e21223a543820ce46a
-size 2959
diff --git a/Assets/Editor/Scripts/Shelves/icons/Normal_Texture_Res_360.png b/Assets/Editor/Scripts/Shelves/icons/Normal_Texture_Res_360.png
deleted file mode 100644
index 3ca3270344..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/Normal_Texture_Res_360.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:49086e4fa1736415d79d7d1d5ed8484b49582db8c27957148ef2a6d7f5dec189
-size 3176
diff --git a/Assets/Editor/Scripts/Shelves/icons/PrefabAddLibrary.png b/Assets/Editor/Scripts/Shelves/icons/PrefabAddLibrary.png
deleted file mode 100644
index 899b8cbc57..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/PrefabAddLibrary.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e0d9c3f0be3c978deaa053d458a49908e99d8d0f7e87169b5b03b7f500e37f55
-size 3248
diff --git a/Assets/Editor/Scripts/Shelves/icons/PrefabAddSelection.png b/Assets/Editor/Scripts/Shelves/icons/PrefabAddSelection.png
deleted file mode 100644
index 6144e48a2b..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/PrefabAddSelection.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:5d98fa218cf0c13100584611e1c4d536bdd9cf78a4a10dd1a0a49e4265b5292d
-size 503
diff --git a/Assets/Editor/Scripts/Shelves/icons/PrefabBreak.png b/Assets/Editor/Scripts/Shelves/icons/PrefabBreak.png
deleted file mode 100644
index 9982a71078..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/PrefabBreak.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e538188411092f7a172ef364035df77dc228bc91d43cfc35ffbbd824e716800e
-size 3231
diff --git a/Assets/Editor/Scripts/Shelves/icons/PrefabConvert.png b/Assets/Editor/Scripts/Shelves/icons/PrefabConvert.png
deleted file mode 100644
index cdbd6d2ac7..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/PrefabConvert.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:52b2c98b0f50fcfdd8334bcde259aef0a0533055f6caa1a1606536f5d2eca23f
-size 3079
diff --git a/Assets/Editor/Scripts/Shelves/icons/PrefabCreate.png b/Assets/Editor/Scripts/Shelves/icons/PrefabCreate.png
deleted file mode 100644
index 1aad8f3446..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/PrefabCreate.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:40905f7865cd5a71bfdace3943ccdd8fe532ee111419fb023befac357256eb07
-size 490
diff --git a/Assets/Editor/Scripts/Shelves/icons/PrefabIsolate.png b/Assets/Editor/Scripts/Shelves/icons/PrefabIsolate.png
deleted file mode 100644
index 4c1a1766b5..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/PrefabIsolate.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:31f8f9a5ff20b33bdf86af8da579717cda40e097db6f893ec4e2fffab720f90e
-size 3211
diff --git a/Assets/Editor/Scripts/Shelves/icons/Scattering.png b/Assets/Editor/Scripts/Shelves/icons/Scattering.png
deleted file mode 100644
index 3c2c5cff38..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/Scattering.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9ec02e421b4e832f73576d1f1bf2b6bc60879521f3a8abbb554925982574c374
-size 3146
diff --git a/Assets/Editor/Scripts/Shelves/icons/Solid_Wireframe.png b/Assets/Editor/Scripts/Shelves/icons/Solid_Wireframe.png
deleted file mode 100644
index e439baed1b..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/Solid_Wireframe.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:bcc61dfe03d5bae6060c1fc6814b7be299705803fdb9058cabe6227f386ddeef
-size 2872
diff --git a/Assets/Editor/Scripts/Shelves/icons/Spec_Amount.png b/Assets/Editor/Scripts/Shelves/icons/Spec_Amount.png
deleted file mode 100644
index 7561feb7c0..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/Spec_Amount.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a67c8e063331c5c6ce256892abdde113f405c60854115ba87f6798d06f57eb02
-size 2892
diff --git a/Assets/Editor/Scripts/Shelves/icons/Spec_Lighting.png b/Assets/Editor/Scripts/Shelves/icons/Spec_Lighting.png
deleted file mode 100644
index f08a036519..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/Spec_Lighting.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:927d3b2f83e6e962a492ea625240bb5f336e30aa2052d1f8699b76a86a5e475d
-size 2897
diff --git a/Assets/Editor/Scripts/Shelves/icons/Texel_Per_Meter_1024.png b/Assets/Editor/Scripts/Shelves/icons/Texel_Per_Meter_1024.png
deleted file mode 100644
index 2d4b08f5fb..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/Texel_Per_Meter_1024.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a3861aa38f3e521127a48f08e6c24e12e61c15450bb4d10ef27a0a95c2c420c0
-size 2889
diff --git a/Assets/Editor/Scripts/Shelves/icons/Texel_Per_Meter_256.png b/Assets/Editor/Scripts/Shelves/icons/Texel_Per_Meter_256.png
deleted file mode 100644
index 4b1ceef8ab..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/Texel_Per_Meter_256.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:5ecc3596974c0c9f1703d51e60de2ca00a479012d98f11316966686cc891f982
-size 2922
diff --git a/Assets/Editor/Scripts/Shelves/icons/Texel_Per_Meter_512.png b/Assets/Editor/Scripts/Shelves/icons/Texel_Per_Meter_512.png
deleted file mode 100644
index 4f328adf91..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/Texel_Per_Meter_512.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ce1ca5c1d89cd6d7a0cf35142be114904ec469afab2fa69a12afe6824055b67b
-size 2913
diff --git a/Assets/Editor/Scripts/Shelves/icons/all.png b/Assets/Editor/Scripts/Shelves/icons/all.png
deleted file mode 100644
index 1b6e3b12d6..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/all.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ffcf54b92f48aa06f38e94826a76f350b425ad9d46c0e2170455730123a69a6d
-size 3693
diff --git a/Assets/Editor/Scripts/Shelves/icons/beams.png b/Assets/Editor/Scripts/Shelves/icons/beams.png
deleted file mode 100644
index 9263cc070a..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/beams.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:68c4333ba27b39baed2696fa90040cc4e669dbc5e9fab43b11abd854d5482474
-size 613
diff --git a/Assets/Editor/Scripts/Shelves/icons/blanker.png b/Assets/Editor/Scripts/Shelves/icons/blanker.png
deleted file mode 100644
index 277a067134..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/blanker.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:adac9f1fc606475d1d86ca8f5b2376570ebc70161e4b5240ede3cb8f176b8f41
-size 2810
diff --git a/Assets/Editor/Scripts/Shelves/icons/bounding_box.png b/Assets/Editor/Scripts/Shelves/icons/bounding_box.png
deleted file mode 100644
index 854a9f957c..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/bounding_box.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f00fa9904ce4687aaf21f1553d03bf1d47390d007fd38513ad959f324a4b6ebb
-size 3618
diff --git a/Assets/Editor/Scripts/Shelves/icons/brushes.png b/Assets/Editor/Scripts/Shelves/icons/brushes.png
deleted file mode 100644
index 283af0629c..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/brushes.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ed21a97324849633d156ec03f949a3cf21b8b682a3a6ad1dcfac6eee9df7a497
-size 734
diff --git a/Assets/Editor/Scripts/Shelves/icons/cloud.png b/Assets/Editor/Scripts/Shelves/icons/cloud.png
deleted file mode 100644
index 8f28b28613..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/cloud.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:11599538b6bc197e92f07db149ccdfee50ddea630f095865bac9782254a7c06f
-size 387
diff --git a/Assets/Editor/Scripts/Shelves/icons/cloud_dark.png b/Assets/Editor/Scripts/Shelves/icons/cloud_dark.png
deleted file mode 100644
index 28d1d0281b..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/cloud_dark.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:559ec911f9cac84de411e92d746913c3828ebf1d1f8c7bab794fb9c768c1581d
-size 387
diff --git a/Assets/Editor/Scripts/Shelves/icons/cloud_dark_rain.png b/Assets/Editor/Scripts/Shelves/icons/cloud_dark_rain.png
deleted file mode 100644
index 7119b0387f..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/cloud_dark_rain.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:88d11b32db70a437fd8ff8c845b4ff26182d28f5b7a2f6b3de4fce61dffff98d
-size 489
diff --git a/Assets/Editor/Scripts/Shelves/icons/collisions.png b/Assets/Editor/Scripts/Shelves/icons/collisions.png
deleted file mode 100644
index af947db919..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/collisions.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:0510fa11c090234a2008703917834ad0455bc6e5e9a2d2375ebd0fc279b41851
-size 3491
diff --git a/Assets/Editor/Scripts/Shelves/icons/create_ao_volume_box.png b/Assets/Editor/Scripts/Shelves/icons/create_ao_volume_box.png
deleted file mode 100644
index 558a3eba64..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/create_ao_volume_box.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:24fc2750f740f0b85ca720beedb564f2a01bbeed229cb89c6d8f395d5cf5d439
-size 844
diff --git a/Assets/Editor/Scripts/Shelves/icons/create_both_vis_box_envprobe.png b/Assets/Editor/Scripts/Shelves/icons/create_both_vis_box_envprobe.png
deleted file mode 100644
index d4b1023cdb..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/create_both_vis_box_envprobe.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:000effa8925a61313fdf420830857172bc69c38cb8a14737a389b9c9df1b36df
-size 745
diff --git a/Assets/Editor/Scripts/Shelves/icons/create_envprobe.png b/Assets/Editor/Scripts/Shelves/icons/create_envprobe.png
deleted file mode 100644
index bdaf8fdf2c..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/create_envprobe.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9d91f30f31576dc957f57d59e2b94d6e45c9aef28f321240c31639c148f62aea
-size 803
diff --git a/Assets/Editor/Scripts/Shelves/icons/create_portal_box.png b/Assets/Editor/Scripts/Shelves/icons/create_portal_box.png
deleted file mode 100644
index 416952b279..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/create_portal_box.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:6452c7e2baef1d8d285a96e72d053a8af80430e52a149ce14795c946d55896fb
-size 807
diff --git a/Assets/Editor/Scripts/Shelves/icons/create_vis_box.png b/Assets/Editor/Scripts/Shelves/icons/create_vis_box.png
deleted file mode 100644
index 74ac6eac4d..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/create_vis_box.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e0d5e21ccaec784d3118a2609e5f26caca4a26901a92db0821e2e0f18e555534
-size 833
diff --git a/Assets/Editor/Scripts/Shelves/icons/create_vis_box_and_portal_box.png b/Assets/Editor/Scripts/Shelves/icons/create_vis_box_and_portal_box.png
deleted file mode 100644
index 5da50020d9..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/create_vis_box_and_portal_box.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e5717c6fde94577b831b8d83104733f86ed82f030664624d62cb4a6d26dd5646
-size 822
diff --git a/Assets/Editor/Scripts/Shelves/icons/create_vis_box_env_probe_and_portal.png b/Assets/Editor/Scripts/Shelves/icons/create_vis_box_env_probe_and_portal.png
deleted file mode 100644
index cd39aade30..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/create_vis_box_env_probe_and_portal.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:07e831e8cab5e1e222b4a4d6a64932bbb8a9a5fcb7cae020432905a7c1e53402
-size 782
diff --git a/Assets/Editor/Scripts/Shelves/icons/cubemap.png b/Assets/Editor/Scripts/Shelves/icons/cubemap.png
deleted file mode 100644
index d55d04b978..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/cubemap.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9775b4823563dbff4c3410c1751f022e2985f91202e6d691f86172ef1f820f4b
-size 3353
diff --git a/Assets/Editor/Scripts/Shelves/icons/decals.png b/Assets/Editor/Scripts/Shelves/icons/decals.png
deleted file mode 100644
index b9e4c92bd7..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/decals.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:c12d69b2d85c339bbff06011fff7c2468a2b2e6c67726ad7fb0ab82384eb39df
-size 918
diff --git a/Assets/Editor/Scripts/Shelves/icons/default_material.png b/Assets/Editor/Scripts/Shelves/icons/default_material.png
deleted file mode 100644
index 9fda69eaab..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/default_material.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:98146b9b75602ddc8a46529fe0427303491dfe4584cadb914d3774377593c7ef
-size 3809
diff --git a/Assets/Editor/Scripts/Shelves/icons/default_material_with_normals.png b/Assets/Editor/Scripts/Shelves/icons/default_material_with_normals.png
deleted file mode 100644
index cbb0f9bbf2..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/default_material_with_normals.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a1c7e790dad53937ed0845cb89c5651c7932a696d7d34d85df6fc8c4b09c7245
-size 3106
diff --git a/Assets/Editor/Scripts/Shelves/icons/designer.png b/Assets/Editor/Scripts/Shelves/icons/designer.png
deleted file mode 100644
index 9018385ebb..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/designer.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e790bb52b7f7d52e79b2c5b84ee4a4587a721c7e3c70d2d7e0eb683b478b51f7
-size 1015
diff --git a/Assets/Editor/Scripts/Shelves/icons/diff_acc.png b/Assets/Editor/Scripts/Shelves/icons/diff_acc.png
deleted file mode 100644
index df3eac041c..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/diff_acc.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:b341792fb1c13db8144f74c3895942251c07e67e87ac374c09df21e3459b3610
-size 3930
diff --git a/Assets/Editor/Scripts/Shelves/icons/display_info.png b/Assets/Editor/Scripts/Shelves/icons/display_info.png
deleted file mode 100644
index 22572bc6e5..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/display_info.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:0fc2408c2f1801de3f625dcbdf960104195c1d47d7e240f4ec9391a7b645399c
-size 3623
diff --git a/Assets/Editor/Scripts/Shelves/icons/dual_layer_mask.png b/Assets/Editor/Scripts/Shelves/icons/dual_layer_mask.png
deleted file mode 100644
index c47a0f7350..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/dual_layer_mask.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:80bca215bbcec9d9e1e33abfbf0b17d6032327a175d6f9d4d76bfefd5c7f2480
-size 3517
diff --git a/Assets/Editor/Scripts/Shelves/icons/dynamiclights.png b/Assets/Editor/Scripts/Shelves/icons/dynamiclights.png
deleted file mode 100644
index 541d8f9304..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/dynamiclights.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ef3cae03d5f38bdf9e82ff29b1a77133a44e5e859cfdb063c449ee5609902367
-size 780
diff --git a/Assets/Editor/Scripts/Shelves/icons/entities.png b/Assets/Editor/Scripts/Shelves/icons/entities.png
deleted file mode 100644
index 0bf2eda8cc..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/entities.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:42de1878f5cef5c3f80dd56e042584eeb8759cacd58a0b22115644ed38800836
-size 870
diff --git a/Assets/Editor/Scripts/Shelves/icons/eye_adaptation_speed.png b/Assets/Editor/Scripts/Shelves/icons/eye_adaptation_speed.png
deleted file mode 100644
index a485e39655..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/eye_adaptation_speed.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f1b4a6d4cca72740f14e97239bf8490d23ccb3d9283d4ff558f0302d9fa773ad
-size 1017
diff --git a/Assets/Editor/Scripts/Shelves/icons/fog.png b/Assets/Editor/Scripts/Shelves/icons/fog.png
deleted file mode 100644
index 68137429de..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/fog.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:4dea1c985077475184c32562609e27b7919cd1c08776174a83f38f095a11f3d4
-size 394
diff --git a/Assets/Editor/Scripts/Shelves/icons/fogvolumes.png b/Assets/Editor/Scripts/Shelves/icons/fogvolumes.png
deleted file mode 100644
index 8c305abb4a..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/fogvolumes.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:bbf140c23e75f1c1035defd58ec8522230abdb5fc7538953ed88eb3bc06c9ca3
-size 349
diff --git a/Assets/Editor/Scripts/Shelves/icons/freeze_particles.png b/Assets/Editor/Scripts/Shelves/icons/freeze_particles.png
deleted file mode 100644
index 963374b096..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/freeze_particles.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:52986df9e8a866606cbfbe8a9702f15483a6f3bfa0b15563e64a5c6d208dab55
-size 4076
diff --git a/Assets/Editor/Scripts/Shelves/icons/full_shading.png b/Assets/Editor/Scripts/Shelves/icons/full_shading.png
deleted file mode 100644
index 4decb4c800..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/full_shading.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:339d6542b6a259feeb7dc8ebc536ca6fed44a91faaf021b1453a735b39d98450
-size 3021
diff --git a/Assets/Editor/Scripts/Shelves/icons/gamma.png b/Assets/Editor/Scripts/Shelves/icons/gamma.png
deleted file mode 100644
index 43b16f55a6..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/gamma.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:b93bb51dd54685b9dd1a37b535c7cb456110b45c62ae64eaaceb61a58b99f254
-size 1418
diff --git a/Assets/Editor/Scripts/Shelves/icons/gi.png b/Assets/Editor/Scripts/Shelves/icons/gi.png
deleted file mode 100644
index 51fb05190c..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/gi.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:cbc47ed9888c792af55b4e0ab5d5c7a7b8a582fdb202fa035e21b974c7df1022
-size 885
diff --git a/Assets/Editor/Scripts/Shelves/icons/lens_flare.png b/Assets/Editor/Scripts/Shelves/icons/lens_flare.png
deleted file mode 100644
index 2da269b7c7..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/lens_flare.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e2cbf9570c227884d49ac2a702377821891d06eaa91b6bf92861088508927796
-size 670
diff --git a/Assets/Editor/Scripts/Shelves/icons/lighting_only.png b/Assets/Editor/Scripts/Shelves/icons/lighting_only.png
deleted file mode 100644
index bd4590053c..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/lighting_only.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:695dcdc3004705d1489b5b2a0a750bf6d30940d343a62bc8ff06bc103d3ae6f7
-size 2870
diff --git a/Assets/Editor/Scripts/Shelves/icons/lods.png b/Assets/Editor/Scripts/Shelves/icons/lods.png
deleted file mode 100644
index a6ad158679..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/lods.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:266450829046d2be9557c86f8061f1b50d8f55795436b608689d6c117c5b970d
-size 1156
diff --git a/Assets/Editor/Scripts/Shelves/icons/lsao.png b/Assets/Editor/Scripts/Shelves/icons/lsao.png
deleted file mode 100644
index 127b421a30..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/lsao.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:7a253c696ce28fb7699b6879c35e874d906033b59e89224d307bf029dd9257e6
-size 3926
diff --git a/Assets/Editor/Scripts/Shelves/icons/lsao_toggle.png b/Assets/Editor/Scripts/Shelves/icons/lsao_toggle.png
deleted file mode 100644
index c264be14bd..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/lsao_toggle.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:734ca55bc936d229c56abb4f141a746fe64affc570570d182308f6f0d8f21638
-size 3952
diff --git a/Assets/Editor/Scripts/Shelves/icons/lsro.png b/Assets/Editor/Scripts/Shelves/icons/lsro.png
deleted file mode 100644
index ff4099a887..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/lsro.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a100211ce724c005cd2fadecb4ca3c36feacad4f7cb4bbccd8761ae622d59aa3
-size 1153
diff --git a/Assets/Editor/Scripts/Shelves/icons/normals.png b/Assets/Editor/Scripts/Shelves/icons/normals.png
deleted file mode 100644
index 1f723ef0d1..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/normals.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:58e65981a6b66482ac3443f644fe210d9c90d01b4a5ab381796d37bf6d5be289
-size 3215
diff --git a/Assets/Editor/Scripts/Shelves/icons/normals_x.png b/Assets/Editor/Scripts/Shelves/icons/normals_x.png
deleted file mode 100644
index 98a705b559..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/normals_x.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:1be96cc2682443b03bfc4696403d5c3d98eec709878acac0b690dbb635d04ea9
-size 3227
diff --git a/Assets/Editor/Scripts/Shelves/icons/normals_y.png b/Assets/Editor/Scripts/Shelves/icons/normals_y.png
deleted file mode 100644
index 8c109bee9b..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/normals_y.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:2eaf04f15e42ac910dc7c29fb61034dc5126a80832b6a0bc0a842b549c23eaf7
-size 3118
diff --git a/Assets/Editor/Scripts/Shelves/icons/normals_z.png b/Assets/Editor/Scripts/Shelves/icons/normals_z.png
deleted file mode 100644
index 078ceded6c..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/normals_z.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:0c8ec3131755522c3f1a4fc45cef0b9ace4641316d890d3f6f042557f220d6ba
-size 3152
diff --git a/Assets/Editor/Scripts/Shelves/icons/ocean.png b/Assets/Editor/Scripts/Shelves/icons/ocean.png
deleted file mode 100644
index 04c4fff0fc..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/ocean.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:1407119e10f378a6ae375f3951dbfe42505560f75a88687f4c03e0ac2e85a05e
-size 700
diff --git a/Assets/Editor/Scripts/Shelves/icons/particles.png b/Assets/Editor/Scripts/Shelves/icons/particles.png
deleted file mode 100644
index daecfbc256..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/particles.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d9875276bc1b8055f306d0bf95b0ba3f6c8f9a49447a68f75334e86b360f4359
-size 713
diff --git a/Assets/Editor/Scripts/Shelves/icons/particles_bounds.png b/Assets/Editor/Scripts/Shelves/icons/particles_bounds.png
deleted file mode 100644
index 04321c8ed5..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/particles_bounds.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:231f6c7939361f71b9926f551bbf2eb93ca4ec8394318dcfed0fa413ccd58e66
-size 4073
diff --git a/Assets/Editor/Scripts/Shelves/icons/particles_off.png b/Assets/Editor/Scripts/Shelves/icons/particles_off.png
deleted file mode 100644
index ed7fe76f44..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/particles_off.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:b6e656417153394c5466a207bd6ff21072c6ef82fe6972380ceda7fa6e60c478
-size 4053
diff --git a/Assets/Editor/Scripts/Shelves/icons/particles_overdraw.png b/Assets/Editor/Scripts/Shelves/icons/particles_overdraw.png
deleted file mode 100644
index 86a8a72b52..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/particles_overdraw.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8f021d07012f712d8ab70af609974e1cb0933d571bbe0f184e0e7479ee172834
-size 3004
diff --git a/Assets/Editor/Scripts/Shelves/icons/particles_screen_coverage.png b/Assets/Editor/Scripts/Shelves/icons/particles_screen_coverage.png
deleted file mode 100644
index fd20e416b2..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/particles_screen_coverage.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:387a799eeb739b6183f3d47186c122ea51c8998664bd0cff76e28f8de2cf49ee
-size 4024
diff --git a/Assets/Editor/Scripts/Shelves/icons/placeholder.png b/Assets/Editor/Scripts/Shelves/icons/placeholder.png
deleted file mode 100644
index f3225255c7..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/placeholder.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a91ea78d1ffd91490f20efcf76ad8790e450836240b8a77dda719da963235c85
-size 2987
diff --git a/Assets/Editor/Scripts/Shelves/icons/prefab.png b/Assets/Editor/Scripts/Shelves/icons/prefab.png
deleted file mode 100644
index 84d2b08397..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/prefab.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:332071c8b20030de53ec194dfe853b29f45a0de04d99dcd1b1c4b32dcf2946a5
-size 683
diff --git a/Assets/Editor/Scripts/Shelves/icons/reflections.png b/Assets/Editor/Scripts/Shelves/icons/reflections.png
deleted file mode 100644
index 0fc82618b8..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/reflections.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ee9fdf1b6ab47cfc72c3794a46b6886b9993e691a7d097b3d109127ddcde46ac
-size 640
diff --git a/Assets/Editor/Scripts/Shelves/icons/reset.png b/Assets/Editor/Scripts/Shelves/icons/reset.png
deleted file mode 100644
index 8cc13235ae..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/reset.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:120be39c58db0bab5450db22604f94cf31eb68a480f06daf3d4f76828461385b
-size 4076
diff --git a/Assets/Editor/Scripts/Shelves/icons/selfocc.png b/Assets/Editor/Scripts/Shelves/icons/selfocc.png
deleted file mode 100644
index f3a1ece6a3..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/selfocc.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:83e8233f9f0594151e734583f9fd3835250f370dac8b648554f1060d79efa43b
-size 2935
diff --git a/Assets/Editor/Scripts/Shelves/icons/shaded_wireframe.png b/Assets/Editor/Scripts/Shelves/icons/shaded_wireframe.png
deleted file mode 100644
index 79d4148d9c..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/shaded_wireframe.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f514eebcdcd02d8195d8b51966ad84cfb8162c3811facc6da9fc0a71e10443bc
-size 3041
diff --git a/Assets/Editor/Scripts/Shelves/icons/shadows.png b/Assets/Editor/Scripts/Shelves/icons/shadows.png
deleted file mode 100644
index 06fd30ee05..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/shadows.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:281c6d85ab6d7e706f73865a7beb523bf64e505d8fd2b3c367f6ad56b008a77e
-size 818
diff --git a/Assets/Editor/Scripts/Shelves/icons/showlines.png b/Assets/Editor/Scripts/Shelves/icons/showlines.png
deleted file mode 100644
index b4329c1beb..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/showlines.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:268a5b239b9988be0ae13a2f42a99ac39ac2db9988f92604154630b661b89999
-size 2865
diff --git a/Assets/Editor/Scripts/Shelves/icons/sky.png b/Assets/Editor/Scripts/Shelves/icons/sky.png
deleted file mode 100644
index 86d018f2d8..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/sky.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:3598e1bdc4c47d6be99ad6ff10e91b307bb4a94286fff57a0c339d6aaed2e0a3
-size 620
diff --git a/Assets/Editor/Scripts/Shelves/icons/spec_acc.png b/Assets/Editor/Scripts/Shelves/icons/spec_acc.png
deleted file mode 100644
index b66acb25ca..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/spec_acc.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ee2c46410495a75862d8f5d2e69cce11c94745680ef03b50ba7b17af9c137656
-size 3334
diff --git a/Assets/Editor/Scripts/Shelves/icons/spec_lum.png b/Assets/Editor/Scripts/Shelves/icons/spec_lum.png
deleted file mode 100644
index 7561feb7c0..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/spec_lum.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a67c8e063331c5c6ce256892abdde113f405c60854115ba87f6798d06f57eb02
-size 2892
diff --git a/Assets/Editor/Scripts/Shelves/icons/spec_occ.png b/Assets/Editor/Scripts/Shelves/icons/spec_occ.png
deleted file mode 100644
index 624f8481ad..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/spec_occ.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:23a7074e8ced66649cc8c2f69db33559bd600658709aaf287a9d9de9c98a05f6
-size 3182
diff --git a/Assets/Editor/Scripts/Shelves/icons/ssao.png b/Assets/Editor/Scripts/Shelves/icons/ssao.png
deleted file mode 100644
index 376a0a2157..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/ssao.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:134cbfd478080236c3f5ea2ee32319e63ee21ff48f187b709ab9dc0f3688c2dd
-size 3932
diff --git a/Assets/Editor/Scripts/Shelves/icons/ssdo.png b/Assets/Editor/Scripts/Shelves/icons/ssdo.png
deleted file mode 100644
index 517658c1f5..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/ssdo.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:c200aad6ad59b7d466edc44026ffca2272ca3b20944070210db1108f21f1cb60
-size 3972
diff --git a/Assets/Editor/Scripts/Shelves/icons/ssdo_toggle.png b/Assets/Editor/Scripts/Shelves/icons/ssdo_toggle.png
deleted file mode 100644
index 881b07cb2f..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/ssdo_toggle.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:c897d61016bc32c7072273a081e624880b90beb89e90f20b25e689f5198d1f63
-size 3966
diff --git a/Assets/Editor/Scripts/Shelves/icons/sun.big.png b/Assets/Editor/Scripts/Shelves/icons/sun.big.png
deleted file mode 100644
index 0a5363ddca..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/sun.big.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:c49214e755a68e48bba8b8be9183777c24c3443aa734e4969e74bc42d5979cb7
-size 539
diff --git a/Assets/Editor/Scripts/Shelves/icons/tangents.png b/Assets/Editor/Scripts/Shelves/icons/tangents.png
deleted file mode 100644
index 7a1f5c0a3a..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/tangents.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e8a5f21232c186fed9bd9a0d62bd4023dca1d496e151ad0fee5b593fc67645bf
-size 1115
diff --git a/Assets/Editor/Scripts/Shelves/icons/terrain.png b/Assets/Editor/Scripts/Shelves/icons/terrain.png
deleted file mode 100644
index b32c4cde98..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/terrain.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:821ef3daa0cdf246985c0bc1bd988edeceadb672dd81f4813320e8d50ca0e41c
-size 461
diff --git a/Assets/Editor/Scripts/Shelves/icons/time_scale_double.png b/Assets/Editor/Scripts/Shelves/icons/time_scale_double.png
deleted file mode 100644
index 03ae1a21ea..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/time_scale_double.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:86ebd1c792b9024662a179995ba65d181157a9887112f12571fbfe05a3dc8a79
-size 3145
diff --git a/Assets/Editor/Scripts/Shelves/icons/time_scale_frozen.png b/Assets/Editor/Scripts/Shelves/icons/time_scale_frozen.png
deleted file mode 100644
index a1756ce9fa..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/time_scale_frozen.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:4fbe9783be75404b2364726b09f9013360522d2e71f479476a715b6577def003
-size 3386
diff --git a/Assets/Editor/Scripts/Shelves/icons/time_scale_half.png b/Assets/Editor/Scripts/Shelves/icons/time_scale_half.png
deleted file mode 100644
index c3f9f03d98..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/time_scale_half.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:1a6740a0e38ea99c83c1460a33f62c3dead3ab85f05bf446426fb39a75aa76f8
-size 3137
diff --git a/Assets/Editor/Scripts/Shelves/icons/time_scale_quarter.png b/Assets/Editor/Scripts/Shelves/icons/time_scale_quarter.png
deleted file mode 100644
index a8a9b8cdd8..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/time_scale_quarter.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:4b0baf9f76bcc0bcd38fea907b79edde3bcb66e78b221094473a8abd0b222734
-size 3175
diff --git a/Assets/Editor/Scripts/Shelves/icons/time_scale_tenth.png b/Assets/Editor/Scripts/Shelves/icons/time_scale_tenth.png
deleted file mode 100644
index 0aba084827..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/time_scale_tenth.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f71d44c06aa67ab94b190bd74516ce73c534a7d6421415437db262659b2ff32a
-size 3124
diff --git a/Assets/Editor/Scripts/Shelves/icons/tod.png b/Assets/Editor/Scripts/Shelves/icons/tod.png
deleted file mode 100644
index 0d5c4682c2..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/tod.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:6028cef57651c79f5eb83c52eb0ab63eb42dbf4014dcb0f60c4c15ab8fe3cafd
-size 977
diff --git a/Assets/Editor/Scripts/Shelves/icons/translucency.png b/Assets/Editor/Scripts/Shelves/icons/translucency.png
deleted file mode 100644
index 8487c5916f..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/translucency.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:07457d1315f4cf1bd931187d849a1e842c931640edb53abb2a4f5b2d8d65716b
-size 3110
diff --git a/Assets/Editor/Scripts/Shelves/icons/transparency.png b/Assets/Editor/Scripts/Shelves/icons/transparency.png
deleted file mode 100644
index 4f41c6491b..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/transparency.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e59571a1490d7dd4696bc118bd4ccc8e08a663afac1ce3f2d88bb5d7d6fdb196
-size 558
diff --git a/Assets/Editor/Scripts/Shelves/icons/valid_albedo.png b/Assets/Editor/Scripts/Shelves/icons/valid_albedo.png
deleted file mode 100644
index c3a76d6dfa..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/valid_albedo.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ce233f32949099694d4294b95252068c4486edba163a466ebdb20a54a2338f0f
-size 3120
diff --git a/Assets/Editor/Scripts/Shelves/icons/valid_spec_lum.png b/Assets/Editor/Scripts/Shelves/icons/valid_spec_lum.png
deleted file mode 100644
index 13f8404057..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/valid_spec_lum.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f5f365970f6f9138d6e78a2053338eb1275c562fb700670ab00e800e6a43280d
-size 3199
diff --git a/Assets/Editor/Scripts/Shelves/icons/vegetation.png b/Assets/Editor/Scripts/Shelves/icons/vegetation.png
deleted file mode 100644
index 4492e38ce8..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/vegetation.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:48a435a0632d7d0a8bdfee418423d8c411c4eab9b1da0fac257f32451a233d8f
-size 747
diff --git a/Assets/Editor/Scripts/Shelves/icons/vertex_normals.png b/Assets/Editor/Scripts/Shelves/icons/vertex_normals.png
deleted file mode 100644
index 80c51660c0..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/vertex_normals.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:101e61f7e5b40aaa48bed685f854fc01c58aec66ca8becc5386f6f0c22c020ad
-size 1114
diff --git a/Assets/Editor/Scripts/Shelves/icons/vis_area.png b/Assets/Editor/Scripts/Shelves/icons/vis_area.png
deleted file mode 100644
index 0d16d4a477..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/vis_area.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ae9997b5b999a6b66e56d6024617f718ea06fd389a98a97465a5d76780a1da75
-size 3915
diff --git a/Assets/Editor/Scripts/Shelves/icons/water_volume.png b/Assets/Editor/Scripts/Shelves/icons/water_volume.png
deleted file mode 100644
index 2be9a96264..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/water_volume.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e88a2a6e4d14bced3d3e48c25d4bfe075d8587898cd61fbd0e3ab99e4391e663
-size 602
diff --git a/Assets/Editor/Scripts/Shelves/icons/wind.png b/Assets/Editor/Scripts/Shelves/icons/wind.png
deleted file mode 100644
index 54ed666138..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/wind.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:caa003d65336c2e2a8987122ace98e0300e5d8afe1864dffef0d1651b136ccc1
-size 720
diff --git a/Assets/Editor/Scripts/Shelves/icons/wireframe.png b/Assets/Editor/Scripts/Shelves/icons/wireframe.png
deleted file mode 100644
index 85a71daccc..0000000000
--- a/Assets/Editor/Scripts/Shelves/icons/wireframe.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:fd5356c97575c12fa7038443c0216a316c234e4e50e2e439ff8dde4504e56243
-size 2848
diff --git a/Assets/Editor/Translation/scriptcanvas_en_us.ts b/Assets/Editor/Translation/scriptcanvas_en_us.ts
index f057ba2f30..937f6a4d96 100644
--- a/Assets/Editor/Translation/scriptcanvas_en_us.ts
+++ b/Assets/Editor/Translation/scriptcanvas_en_us.ts
@@ -2771,6 +2771,80 @@
VECTOR2_CREATEONE_OUTPUT0_TOOLTIP
+
+ VECTOR2_DIRECTIONTO_NAME
+ Class/Bus: Vector2 Event/Method: DirectionTo
+ Get Direction Vector
+
+
+ VECTOR2_DIRECTIONTO_TOOLTIP
+ Returns a direction vector between two points and the distance between them, by default the direction will be normalized, it may be optionally scaled using the Scale parameter if different from 1.0
+
+
+ VECTOR2_DIRECTIONTO_CATEGORY
+
+
+
+ VECTOR2_DIRECTIONTO_OUT_NAME
+
+
+
+ VECTOR2_DIRECTIONTO_OUT_TOOLTIP
+
+
+
+ VECTOR2_DIRECTIONTOL_IN_NAME
+
+
+
+ VECTOR2_DIRECTIONTO_IN_TOOLTIP
+
+
+
+ VECTOR2_DIRECTIONTO_OUTPUT0_NAME
+ C++ Type: const Vector2
+ Direction
+
+
+ VECTOR2_DIRECTIONTO_OUTPUT0_TOOLTIP
+ The direction between To and From normalized and optionally scaled
+
+
+ VECTOR2_DIRECTIONTO_OUTPUT1_NAME
+ C++ Type: float
+ Distance
+
+
+ VECTOR2_DIRECTIONTO_OUTPUT1_TOOLTIP
+ The distance between To and From
+
+
+ VECTOR2_DIRECTIONTO_PARAM0_NAME
+ Simple Type: Vector2 C++ Type: Vector2*
+ From
+
+
+ VECTOR2_DIRECTIONTO_PARAM0_TOOLTIP
+
+
+
+ VECTOR2_DIRECTIONTO_PARAM1_NAME
+ Simple Type: Vector2 C++ Type: Vector2*
+ To
+
+
+ VECTOR2_DIRECTIONTO_PARAM1_TOOLTIP
+
+
+
+ VECTOR2_DIRECTIONTO_PARAM2_NAME
+ Simple Type: Vector2 C++ Type: Vector2*
+ Scale
+
+
+ VECTOR2_DIRECTIONTO_PARAM2_TOOLTIP
+
+
VECTOR2_GETPROJECTED_NAME
Class/Bus: Vector2 Event/Method: GetProjected
@@ -32262,6 +32336,80 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro
VECTOR4_GETRECIPROCAL_PARAM0_TOOLTIP
+
+ VECTOR4_DIRECTIONTO_NAME
+ Class/Bus: Vector4 Event/Method: DirectionTo
+ Get Direction Vector
+
+
+ VECTOR4_DIRECTIONTO_TOOLTIP
+ Returns a direction vector between two points and the distance between them, by default the direction will be normalized, it may be optionally scaled using the Scale parameter if different from 1.0
+
+
+ VECTOR4_DIRECTIONTO_CATEGORY
+
+
+
+ VECTOR4_DIRECTIONTO_OUT_NAME
+
+
+
+ VECTOR4_DIRECTIONTO_OUT_TOOLTIP
+
+
+
+ VECTOR4_DIRECTIONTOL_IN_NAME
+
+
+
+ VECTOR4_DIRECTIONTO_IN_TOOLTIP
+
+
+
+ VECTOR4_DIRECTIONTO_OUTPUT0_NAME
+ C++ Type: const Vector4
+ Direction
+
+
+ VECTOR4_DIRECTIONTO_OUTPUT0_TOOLTIP
+ The direction between To and From normalized and optionally scaled
+
+
+ VECTOR4_DIRECTIONTO_OUTPUT1_NAME
+ C++ Type: float
+ Distance
+
+
+ VECTOR4_DIRECTIONTO_OUTPUT1_TOOLTIP
+ The distance between To and From
+
+
+ VECTOR4_DIRECTIONTO_PARAM0_NAME
+ Simple Type: Vector4 C++ Type: Vector4*
+ From
+
+
+ VECTOR4_DIRECTIONTO_PARAM0_TOOLTIP
+
+
+
+ VECTOR4_DIRECTIONTO_PARAM1_NAME
+ Simple Type: Vector4 C++ Type: Vector4*
+ To
+
+
+ VECTOR4_DIRECTIONTO_PARAM1_TOOLTIP
+
+
+
+ VECTOR4_DIRECTIONTO_PARAM2_NAME
+ Simple Type: Vector4 C++ Type: Vector4*
+ Scale
+
+
+ VECTOR4_DIRECTIONTO_PARAM2_TOOLTIP
+
+
VECTOR4_AXISX_NAME
Class/Bus: Vector4 Event/Method: CreateAxisX
@@ -37469,6 +37617,80 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro
VECTOR3_GETRECIPROCAL_PARAM0_TOOLTIP
+
+ VECTOR3_DIRECTIONTO_NAME
+ Class/Bus: Vector3 Event/Method: DirectionTo
+ Get Direction Vector
+
+
+ VECTOR3_DIRECTIONTO_TOOLTIP
+ Returns a direction vector between two points and the distance between them, by default the direction will be normalized, it may be optionally scaled using the Scale parameter if different from 1.0
+
+
+ VECTOR3_DIRECTIONTO_CATEGORY
+
+
+
+ VECTOR3_DIRECTIONTO_OUT_NAME
+
+
+
+ VECTOR3_DIRECTIONTO_OUT_TOOLTIP
+
+
+
+ VECTOR3_DIRECTIONTOL_IN_NAME
+
+
+
+ VECTOR3_DIRECTIONTO_IN_TOOLTIP
+
+
+
+ VECTOR3_DIRECTIONTO_OUTPUT0_NAME
+ C++ Type: const Vector3
+ Direction
+
+
+ VECTOR3_DIRECTIONTO_OUTPUT0_TOOLTIP
+ The direction between To and From normalized and optionally scaled
+
+
+ VECTOR3_DIRECTIONTO_OUTPUT1_NAME
+ C++ Type: float
+ Distance
+
+
+ VECTOR3_DIRECTIONTO_OUTPUT1_TOOLTIP
+ The distance between To and From
+
+
+ VECTOR3_DIRECTIONTO_PARAM0_NAME
+ Simple Type: Vector3 C++ Type: Vector3*
+ From
+
+
+ VECTOR3_DIRECTIONTO_PARAM0_TOOLTIP
+
+
+
+ VECTOR3_DIRECTIONTO_PARAM1_NAME
+ Simple Type: Vector3 C++ Type: Vector3*
+ To
+
+
+ VECTOR3_DIRECTIONTO_PARAM1_TOOLTIP
+
+
+
+ VECTOR3_DIRECTIONTO_PARAM2_NAME
+ Simple Type: Vector3 C++ Type: Vector3*
+ Scale
+
+
+ VECTOR3_DIRECTIONTO_PARAM2_TOOLTIP
+
+
VECTOR3_PROJECT_NAME
Class/Bus: Vector3 Event/Method: Project
diff --git a/AutomatedTesting/surfacetypemateriallibrary.physmaterial b/AutomatedTesting/Assets/Physics/SurfaceTypeMaterialLibrary.physmaterial
similarity index 100%
rename from AutomatedTesting/surfacetypemateriallibrary.physmaterial
rename to AutomatedTesting/Assets/Physics/SurfaceTypeMaterialLibrary.physmaterial
diff --git a/AutomatedTesting/Gem/PythonTests/AWS/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/AWS/CMakeLists.txt
index 1c555c1e17..a589a395c1 100644
--- a/AutomatedTesting/Gem/PythonTests/AWS/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/AWS/CMakeLists.txt
@@ -12,6 +12,11 @@
################################################################################
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
+ # Only enable AWS automated tests on Windows
+ if(NOT "${PAL_PLATFORM_NAME}" STREQUAL "Windows")
+ return()
+ endif()
+
# Enable after installing NodeJS and CDK on jenkins Windows AMI.
ly_add_pytest(
NAME AutomatedTesting::AWSTests
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/assetpipeline/CMakeLists.txt
index 1b42d0d871..29b30a12b4 100644
--- a/AutomatedTesting/Gem/PythonTests/assetpipeline/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/CMakeLists.txt
@@ -7,6 +7,7 @@
#
add_subdirectory(asset_processor_tests)
+add_subdirectory(fbx_tests)
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
## AP Python Tests ##
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt
index 8b9de91906..0170d73af0 100644
--- a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt
@@ -97,7 +97,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
PATH ${CMAKE_CURRENT_LIST_DIR}/asset_bundler_batch_tests.py
EXCLUDE_TEST_RUN_TARGET_FROM_IDE
TEST_SERIAL
- TIMEOUT 1500
+ TIMEOUT 2400
TEST_SUITE periodic
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_builder_tests.py b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_builder_tests.py
index 13b899dfdd..2c805f0291 100755
--- a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_builder_tests.py
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_builder_tests.py
@@ -113,7 +113,7 @@ class TestsAssetBuilder_WindowsAndMac(object):
if listening_port:
corrupted_slice_command.append(f'-port={listening_port}')
if workspace.project:
- corrupted_slice_command.append(f'-gamename={workspace.project}')
+ corrupted_slice_command.append(f'--project-path={workspace.project}')
corrupted_slice_output = utils.safe_subprocess(corrupted_slice_command)
# Verify corrupted slice produced error
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_bundler_batch_tests.py b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_bundler_batch_tests.py
index 768dd985fd..7f85e5e317 100755
--- a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_bundler_batch_tests.py
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/asset_bundler_batch_tests.py
@@ -902,7 +902,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
second_input_arg = asset_lists_to_string(second_asset_list) # --secondAssetList
output_arg = asset_lists_to_string(output_file) # --output
- def generate_compare_command(platform_arg: str) -> object:
+ def generate_compare_command(platform_arg: str, project_name : str) -> object:
"""Creates a string containing a full Compare command. This string can be executed as-is."""
cmd = [helper["bundler_batch"], "compare", f"--firstassetFile={first_input_arg}", f"--output={output_arg}"]
if platform_arg is not None:
@@ -918,6 +918,8 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
if comp_type == "4":
# Extra arguments for pattern comparison
cmd.extend([f"--filePatternType={pattern_type}", f"--filePattern={pattern}"])
+ if workspace.project:
+ cmd.append(f'--project-path={project_name}')
return cmd
# End generate_compare_command()
@@ -936,6 +938,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
# End verify_asset_list_contents()
def run_compare_command_and_verify(platform_arg: str, expect_pc_output: bool, expect_mac_output: bool) -> None:
+
# Expected asset list to equal result of comparison
expected_pc_asset_list = None
expected_mac_asset_list = None
@@ -957,7 +960,7 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
output_mac_asset_list = helper.platform_file_name(last_output_arg, platform)
# Build execution command
- cmd = generate_compare_command(platform_arg)
+ cmd = generate_compare_command(platform_arg, workspace.project)
# Execute command
subprocess.check_call(cmd)
@@ -992,10 +995,12 @@ class TestsAssetBundlerBatch_WindowsAndMac(object):
f"--comparisonRulesFile={rule_file}",
f"--comparisonType={args[1]}",
r"--addComparison",
+ f"--project-path={workspace.project}",
]
if args[1] == "4":
# If pattern comparison, append a few extra arguments
cmd.extend(["--filePatternType=0", "--filePattern=*.dat"])
+
subprocess.check_call(cmd)
assert os.path.exists(rule_file), f"Rule file {args[0]} was not created at location: {rule_file}"
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/CMakeLists.txt
new file mode 100644
index 0000000000..4a26500ee2
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/CMakeLists.txt
@@ -0,0 +1,21 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
+ ly_add_pytest(
+ NAME SceneProcessingTests.PythonAssetBuilderTests
+ TEST_SUITE main
+ PATH ${CMAKE_CURRENT_LIST_DIR}/pythonassetbuildertests.py
+ PYTEST_MARKS "not SUITE_sandbox" # don't run sandbox tests in this file
+ EXCLUDE_TEST_RUN_TARGET_FROM_IDE
+ RUNTIME_DEPENDENCIES
+ AZ::AssetProcessorBatch
+ AZ::AssetProcessor
+ )
+
+endif()
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/assets/TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/a_simple_box_with_script.fbx b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/assets/TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/a_simple_box_with_script.fbx
new file mode 100644
index 0000000000..e31b4a96f2
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/assets/TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/a_simple_box_with_script.fbx
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f82aecb36faf5cf9f2730e5ad264db38a3a469f8f48aff9b74682d1a32b098f0
+size 11644
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/assets/TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/a_simple_box_with_script.fbx.assetinfo b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/assets/TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/a_simple_box_with_script.fbx.assetinfo
new file mode 100644
index 0000000000..07018ab521
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/assets/TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/a_simple_box_with_script.fbx.assetinfo
@@ -0,0 +1,9 @@
+{
+ "values":
+ [
+ {
+ "$type": "ScriptProcessorRule",
+ "scriptFilename": "TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/python_builder.py"
+ }
+ ]
+}
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/assets/TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/b_simple_box_no_script.fbx b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/assets/TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/b_simple_box_no_script.fbx
new file mode 100644
index 0000000000..e31b4a96f2
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/assets/TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/b_simple_box_no_script.fbx
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f82aecb36faf5cf9f2730e5ad264db38a3a469f8f48aff9b74682d1a32b098f0
+size 11644
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/assets/TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/b_simple_box_no_script.fbx.assetinfo b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/assets/TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/b_simple_box_no_script.fbx.assetinfo
new file mode 100644
index 0000000000..72d756d655
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/assets/TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/b_simple_box_no_script.fbx.assetinfo
@@ -0,0 +1,15 @@
+{
+ "values": [
+ {
+ "$type": "{07B356B7-3635-40B5-878A-FAC4EFD5AD86} MeshGroup",
+ "name": "b_simple_box_no_script",
+ "nodeSelectionList": {
+ "selectedNodes": [
+ {},
+ "RootNode",
+ "RootNode.Cube"
+ ]
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/assets/TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/python_builder.py b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/assets/TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/python_builder.py
new file mode 100644
index 0000000000..7ad5894a86
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/assets/TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene/python_builder.py
@@ -0,0 +1,45 @@
+"""
+Copyright (c) Contributors to the Open 3D Engine Project.
+For complete copyright and license terms please see the LICENSE at the root of this distribution.
+
+SPDX-License-Identifier: Apache-2.0 OR MIT
+"""
+import datetime, uuid, os
+import azlmbr.scene as sceneApi
+import azlmbr.scene.graph
+
+def output_test_data(scene):
+ source_filename = os.path.basename(scene.sourceFilename)
+ source_filename = source_filename.replace('.','_')
+
+ log_output_file_name = f"{source_filename}.log"
+
+ log_output_folder = os.path.dirname(scene.sourceFilename)
+ log_output_location = os.path.join(log_output_folder, log_output_file_name)
+
+ # Saving a file to the temp folder is the easiest way to have this test communicate
+ # with the outer python test.
+ with open(log_output_location, "w") as f:
+ # Just write something to the file, but the filename is the main information
+ # used for the test.
+ f.write(f"scene.sourceFilename: {scene.sourceFilename}\n")
+ return True
+
+mySceneJobHandler = None
+
+def on_update_manifest(args):
+ scene = args[0]
+ result = output_test_data(scene)
+ global mySceneJobHandler
+ mySceneJobHandler.disconnect()
+ mySceneJobHandler = None
+ return result
+
+def main():
+ global mySceneJobHandler
+ mySceneJobHandler = sceneApi.ScriptBuildingNotificationBusHandler()
+ mySceneJobHandler.connect()
+ mySceneJobHandler.add_callback('OnUpdateManifest', on_update_manifest)
+
+if __name__ == "__main__":
+ main()
\ No newline at end of file
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/pythonassetbuildertests.py b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/pythonassetbuildertests.py
new file mode 100644
index 0000000000..6a568349d2
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/pythonassetbuildertests.py
@@ -0,0 +1,94 @@
+"""
+Copyright (c) Contributors to the Open 3D Engine Project.
+For complete copyright and license terms please see the LICENSE at the root of this distribution.
+
+SPDX-License-Identifier: Apache-2.0 OR MIT
+"""
+
+# Import builtin libraries
+import pytest
+import logging
+import os
+import stat
+
+# Import LyTestTools
+from ly_test_tools.o3de.asset_processor import AssetProcessor
+from ly_test_tools.o3de import asset_processor as asset_processor_utils
+import ly_test_tools.environment.file_system as fs
+
+# Import fixtures
+from ..ap_fixtures.asset_processor_fixture import asset_processor as asset_processor
+from ..ap_fixtures.ap_setup_fixture import ap_setup_fixture as ap_setup_fixture
+
+# Import LyShared
+from ly_test_tools.o3de.ap_log_parser import APLogParser, APOutputParser
+import ly_test_tools.o3de.pipeline_utils as utils
+
+# Use the following logging pattern to hook all test logging together:
+logger = logging.getLogger(__name__)
+# Configuring the logging is done in ly_test_tools at the following location:
+# ~/dev/Tools/LyTestTools/ly_test_tools/log/py_logging_util.py
+
+# Helper: variables we will use for parameter values in the test:
+targetProjects = ["AutomatedTesting"]
+
+@pytest.fixture
+def local_resources(request, workspace, ap_setup_fixture):
+ ap_setup_fixture["tests_dir"] = os.path.dirname(os.path.realpath(__file__))
+
+
+@pytest.mark.usefixtures("asset_processor")
+@pytest.mark.usefixtures("ap_setup_fixture")
+@pytest.mark.usefixtures("local_resources")
+@pytest.mark.parametrize("project", targetProjects)
+@pytest.mark.assetpipeline
+@pytest.mark.SUITE_main
+class TestsPythonAssetProcessing_APBatch(object):
+
+ @pytest.mark.BAT
+ @pytest.mark.assetpipeline
+ def test_ProcessAssetWithoutScriptAfterAssetWithScript_ScriptOnlyRunsOnExpectedAsset(self, workspace, ap_setup_fixture, asset_processor):
+ # This is a regression test. The situation it's testing is, the Python script to run
+ # defined in scene manifest files was persisting in a single builder. So if
+ # that builder processed file a.fbx, then b.fbx, and a.fbx has a Python script to run,
+ # it was also running that Python script on b.fbx.
+
+ asset_processor.prepare_test_environment(ap_setup_fixture["tests_dir"], "TwoSceneFiles_OneWithPythonOneWithout_PythonOnlyRunsOnFirstScene")
+
+ asset_processor_extra_params = [
+ # Disabling Atom assets disables most products, using the debugOutput flag ensures one product is output.
+ "--debugOutput",
+ # By default, if job priorities are equal, jobs run in an arbitrary order. This makes sure
+ # jobs are run by sorting on the database source name, so they run in the same order each time
+ # when this test is run.
+ "--sortJobsByDBSourceName",
+ # Disabling Atom products means this asset won't need a lot of source dependencies to be processed,
+ # keeping the scope of this test down.
+ "--regset=\"/O3DE/SceneAPI/AssetImporter/SkipAtomOutput=true\"",
+ # The bug this regression test happened when the same builder processed FBX files with and without Python.
+ # This flag ensures that only one builder is launched, so that situation can be replicated.
+ "--regset=\"/Amazon/AssetProcessor/Settings/Jobs/maxJobs=1\""]
+
+ result, _ = asset_processor.batch_process(extra_params=asset_processor_extra_params)
+ assert result, "AP Batch failed"
+
+ expected_product_list = [
+ "a_simple_box_with_script.dbgsg",
+ "b_simple_box_no_script.dbgsg"
+ ]
+
+ missing_assets, _ = utils.compare_assets_with_cache(expected_product_list,
+ asset_processor.project_test_cache_folder())
+ assert not missing_assets, f'The following assets were expected to be in, but not found in cache: {str(missing_assets)}'
+
+ # The Python script loaded in the scene manifest will write a log file with the source file's name
+ # to the temp folder. This is the easiest way to have the internal Python there communicate with this test.
+ expected_path = os.path.join(asset_processor.project_test_source_folder(), "a_simple_box_with_script_fbx.log")
+ unexpected_path = os.path.join(asset_processor.project_test_source_folder(), "b_simple_box_no_script_fbx.log")
+
+ # Simple check to make sure the Python script in the scene manifest ran on the file it should have ran on.
+ assert os.path.exists(expected_path), f"Did not find expected output test asset {expected_path}"
+ # If this test fails here, it means the Python script from the first processed FBX file is being run
+ # on the second FBX file, when it should not be.
+ assert not os.path.exists(unexpected_path), f"Found unexpected output test asset {unexpected_path}"
+
diff --git a/AutomatedTesting/Gem/PythonTests/atom_renderer/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/atom_renderer/CMakeLists.txt
index a342d95d98..d4f036faeb 100644
--- a/AutomatedTesting/Gem/PythonTests/atom_renderer/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/atom_renderer/CMakeLists.txt
@@ -17,7 +17,7 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_BUILD_TESTS_SUPPORTED AND AutomatedT
TEST_SUITE main
PATH ${CMAKE_CURRENT_LIST_DIR}/test_Atom_MainSuite.py
TEST_SERIAL
- TIMEOUT 400
+ TIMEOUT 600
RUNTIME_DEPENDENCIES
AssetProcessor
AutomatedTesting.Assets
diff --git a/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_hydra_scripts/hydra_AtomEditorComponents_LightComponent.py b/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_hydra_scripts/hydra_AtomEditorComponents_LightComponent.py
new file mode 100644
index 0000000000..ec8dc199ae
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_hydra_scripts/hydra_AtomEditorComponents_LightComponent.py
@@ -0,0 +1,217 @@
+"""
+Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
+
+SPDX-License-Identifier: Apache-2.0 OR MIT
+
+Hydra script that creates an entity, attaches the Light component to it for test verifications.
+The test verifies that each light type option is available and can be selected without errors.
+"""
+
+import os
+import sys
+
+import azlmbr.bus as bus
+import azlmbr.editor as editor
+import azlmbr.math as math
+import azlmbr.paths
+import azlmbr.legacy.general as general
+
+sys.path.append(os.path.join(azlmbr.paths.devassets, "Gem", "PythonTests"))
+
+import editor_python_test_tools.hydra_editor_utils as hydra
+from atom_renderer.atom_utils.atom_component_helper import LIGHT_TYPES
+
+LIGHT_TYPE_PROPERTY = 'Controller|Configuration|Light type'
+SPHERE_AND_SPOT_DISK_LIGHT_PROPERTIES = [
+ ("Controller|Configuration|Shadows|Enable shadow", True),
+ ("Controller|Configuration|Shadows|Shadowmap size", 0), # 256
+ ("Controller|Configuration|Shadows|Shadowmap size", 1), # 512
+ ("Controller|Configuration|Shadows|Shadowmap size", 2), # 1024
+ ("Controller|Configuration|Shadows|Shadowmap size", 3), # 2048
+ ("Controller|Configuration|Shadows|Shadow filter method", 1), # PCF
+ ("Controller|Configuration|Shadows|Filtering sample count", 4.0),
+ ("Controller|Configuration|Shadows|Filtering sample count", 64.0),
+ ("Controller|Configuration|Shadows|PCF method", 0), # Bicubic
+ ("Controller|Configuration|Shadows|PCF method", 1), # Boundary search
+ ("Controller|Configuration|Shadows|Shadow filter method", 2), # ECM
+ ("Controller|Configuration|Shadows|ESM exponent", 50),
+ ("Controller|Configuration|Shadows|ESM exponent", 5000),
+ ("Controller|Configuration|Shadows|Shadow filter method", 3), # ESM+PCF
+]
+QUAD_LIGHT_PROPERTIES = [
+ ("Controller|Configuration|Both directions", True),
+ ("Controller|Configuration|Fast approximation", True),
+]
+SIMPLE_POINT_LIGHT_PROPERTIES = [
+ ("Controller|Configuration|Attenuation radius|Mode", 0),
+ ("Controller|Configuration|Attenuation radius|Radius", 100.0),
+]
+SIMPLE_SPOT_LIGHT_PROPERTIES = [
+ ("Controller|Configuration|Shutters|Inner angle", 45.0),
+ ("Controller|Configuration|Shutters|Outer angle", 90.0),
+]
+
+
+def verify_required_component_property_value(entity_name, component, property_path, expected_property_value):
+ """
+ Compares the property value of component against the expected_property_value.
+ :param entity_name: name of the entity to use (for test verification purposes).
+ :param component: component to check on a given entity for its current property value.
+ :param property_path: the path to the property inside the component.
+ :param expected_property_value: The value expected from the value inside property_path.
+ :return: None, but prints to general.log() which the test uses to verify against.
+ """
+ property_value = editor.EditorComponentAPIBus(
+ bus.Broadcast, "GetComponentProperty", component, property_path).GetValue()
+ general.log(f"{entity_name}_test: Property value is {property_value} "
+ f"which matches {expected_property_value}")
+
+
+def run():
+ """
+ Test Case - Light Component
+ 1. Creates a "light_entity" Entity and attaches a "Light" component to it.
+ 2. Updates the Light component to each light type option from the LIGHT_TYPES constant.
+ 3. The test will check the Editor log to ensure each light type was selected.
+ 4. Prints the string "Light component test (non-GPU) completed" after completion.
+
+ Tests will fail immediately if any of these log lines are found:
+ 1. Trace::Assert
+ 2. Trace::Error
+ 3. Traceback (most recent call last):
+
+ :return: None
+ """
+ # Create a "light_entity" entity with "Light" component.
+ light_entity_name = "light_entity"
+ light_component = "Light"
+ light_entity = hydra.Entity(light_entity_name)
+ light_entity.create_entity(math.Vector3(-1.0, -2.0, 3.0), [light_component])
+ general.log(
+ f"{light_entity_name}_test: Component added to the entity: "
+ f"{hydra.has_components(light_entity.id, [light_component])}")
+
+ # Populate the light_component_id_pair value so that it can be used to select all Light component options.
+ light_component_id_pair = None
+ component_type_id_list = azlmbr.editor.EditorComponentAPIBus(
+ azlmbr.bus.Broadcast, 'FindComponentTypeIdsByEntityType', [light_component], 0)
+ if len(component_type_id_list) < 1:
+ general.log(f"ERROR: A component class with name {light_component} doesn't exist")
+ light_component_id_pair = None
+ elif len(component_type_id_list) > 1:
+ general.log(f"ERROR: Found more than one component classes with same name: {light_component}")
+ light_component_id_pair = None
+ entity_component_id_pair = azlmbr.editor.EditorComponentAPIBus(
+ azlmbr.bus.Broadcast, 'GetComponentOfType', light_entity.id, component_type_id_list[0])
+ if entity_component_id_pair.IsSuccess():
+ light_component_id_pair = entity_component_id_pair.GetValue()
+
+ # Test each Light component option can be selected and it's properties updated.
+ # Point (sphere) light type checks.
+ light_type_property_test(
+ light_type=LIGHT_TYPES['sphere'],
+ light_properties=SPHERE_AND_SPOT_DISK_LIGHT_PROPERTIES,
+ light_component_id_pair=light_component_id_pair,
+ light_entity_name=light_entity_name,
+ light_entity=light_entity
+ )
+
+ # Spot (disk) light type checks.
+ light_type_property_test(
+ light_type=LIGHT_TYPES['spot_disk'],
+ light_properties=SPHERE_AND_SPOT_DISK_LIGHT_PROPERTIES,
+ light_component_id_pair=light_component_id_pair,
+ light_entity_name=light_entity_name,
+ light_entity=light_entity
+ )
+
+ # Capsule light type checks.
+ azlmbr.editor.EditorComponentAPIBus(
+ azlmbr.bus.Broadcast,
+ 'SetComponentProperty',
+ light_component_id_pair,
+ LIGHT_TYPE_PROPERTY,
+ LIGHT_TYPES['capsule']
+ )
+ verify_required_component_property_value(
+ entity_name=light_entity_name,
+ component=light_entity.components[0],
+ property_path=LIGHT_TYPE_PROPERTY,
+ expected_property_value=LIGHT_TYPES['capsule']
+ )
+
+ # Quad light type checks.
+ light_type_property_test(
+ light_type=LIGHT_TYPES['quad'],
+ light_properties=QUAD_LIGHT_PROPERTIES,
+ light_component_id_pair=light_component_id_pair,
+ light_entity_name=light_entity_name,
+ light_entity=light_entity
+ )
+
+ # Polygon light type checks.
+ azlmbr.editor.EditorComponentAPIBus(
+ azlmbr.bus.Broadcast,
+ 'SetComponentProperty',
+ light_component_id_pair,
+ LIGHT_TYPE_PROPERTY,
+ LIGHT_TYPES['polygon']
+ )
+ verify_required_component_property_value(
+ entity_name=light_entity_name,
+ component=light_entity.components[0],
+ property_path=LIGHT_TYPE_PROPERTY,
+ expected_property_value=LIGHT_TYPES['polygon']
+ )
+
+ # Point (simple punctual) light type checks.
+ light_type_property_test(
+ light_type=LIGHT_TYPES['simple_point'],
+ light_properties=SIMPLE_POINT_LIGHT_PROPERTIES,
+ light_component_id_pair=light_component_id_pair,
+ light_entity_name=light_entity_name,
+ light_entity=light_entity
+ )
+
+ # Spot (simple punctual) light type checks.
+ light_type_property_test(
+ light_type=LIGHT_TYPES['simple_spot'],
+ light_properties=SIMPLE_SPOT_LIGHT_PROPERTIES,
+ light_component_id_pair=light_component_id_pair,
+ light_entity_name=light_entity_name,
+ light_entity=light_entity
+ )
+
+ general.log("Light component test (non-GPU) completed.")
+
+
+def light_type_property_test(light_type, light_properties, light_component_id_pair, light_entity_name, light_entity):
+ """
+ Updates the current light type and modifies its properties, then verifies they are accurate to what was set.
+ :param light_type: The type of light to update, must match a value in LIGHT_TYPES
+ :param light_properties: List of tuples detailing properties to modify with update values.
+ :param light_component_id_pair: Entity + component ID pair for updating the light component on a given entity.
+ :param light_entity_name: the name of the Entity holding the light component.
+ :param light_entity: the Entity object containing the light component.
+ :return: None
+ """
+ azlmbr.editor.EditorComponentAPIBus(
+ azlmbr.bus.Broadcast,
+ 'SetComponentProperty',
+ light_component_id_pair,
+ LIGHT_TYPE_PROPERTY,
+ light_type
+ )
+ verify_required_component_property_value(
+ entity_name=light_entity_name,
+ component=light_entity.components[0],
+ property_path=LIGHT_TYPE_PROPERTY,
+ expected_property_value=light_type
+ )
+
+ for light_property in light_properties:
+ light_entity.get_set_test(0, light_property[0], light_property[1])
+
+
+if __name__ == "__main__":
+ run()
diff --git a/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_hydra_scripts/hydra_GPUTest_AtomFeatureIntegrationBenchmark.py b/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_hydra_scripts/hydra_GPUTest_AtomFeatureIntegrationBenchmark.py
index b899d7dcde..3aa9fe660c 100644
--- a/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_hydra_scripts/hydra_GPUTest_AtomFeatureIntegrationBenchmark.py
+++ b/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_hydra_scripts/hydra_GPUTest_AtomFeatureIntegrationBenchmark.py
@@ -93,6 +93,7 @@ def run():
general.idle_wait_frames(100)
for i in range(1, 101):
benchmarker.capture_pass_timestamp(i)
+ benchmarker.capture_cpu_frame_time(i)
general.exit_game_mode()
helper.wait_for_condition(function=lambda: not general.is_in_game_mode(), timeout_in_seconds=2.0)
general.log("Capturing complete.")
diff --git a/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_utils/atom_component_helper.py b/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_utils/atom_component_helper.py
new file mode 100644
index 0000000000..de4e28bb36
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_utils/atom_component_helper.py
@@ -0,0 +1,19 @@
+"""
+Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
+
+SPDX-License-Identifier: Apache-2.0 OR MIT
+
+File to assist with common hydra component functions or constants used across various Atom tests.
+"""
+
+# Light type options for the Light component.
+LIGHT_TYPES = {
+ 'unknown': 0,
+ 'sphere': 1,
+ 'spot_disk': 2,
+ 'capsule': 3,
+ 'quad': 4,
+ 'polygon': 5,
+ 'simple_point': 6,
+ 'simple_spot': 7,
+}
diff --git a/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_utils/benchmark_utils.py b/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_utils/benchmark_utils.py
index 21c7489ed3..b4fdfcb8a0 100644
--- a/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_utils/benchmark_utils.py
+++ b/AutomatedTesting/Gem/PythonTests/atom_renderer/atom_utils/benchmark_utils.py
@@ -61,6 +61,25 @@ class BenchmarkHelper(object):
general.log('Failed to capture pass timestamps.')
return self.capturedData
+ def capture_cpu_frame_time(self, frame_number):
+ """
+ Capture CPU frame times and block further execution until it has been written to the disk.
+ """
+ self.handler = azlmbr.atom.ProfilingCaptureNotificationBusHandler()
+ self.handler.connect()
+ self.handler.add_callback('OnCaptureCpuFrameTimeFinished', self.on_data_captured)
+
+ self.done = False
+ self.capturedData = False
+ success = azlmbr.atom.ProfilingCaptureRequestBus(
+ azlmbr.bus.Broadcast, "CaptureCpuFrameTime", f'{self.output_path}/cpu_frame{frame_number}_time.json')
+ if success:
+ self.wait_until_data()
+ general.log('CPU frame time captured.')
+ else:
+ general.log('Failed to capture CPU frame time.')
+ return self.capturedData
+
def on_data_captured(self, parameters):
# the parameters come in as a tuple
if parameters[0]:
diff --git a/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_GPUTests.py b/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_GPUTests.py
index ede140c075..9165bced90 100644
--- a/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_GPUTests.py
+++ b/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_GPUTests.py
@@ -99,6 +99,7 @@ class TestPerformanceBenchmarkSuite(object):
expected_lines = [
"Benchmark metadata captured.",
"Pass timestamps captured.",
+ "CPU frame time captured.",
"Capturing complete.",
"Captured data successfully."
]
@@ -106,6 +107,7 @@ class TestPerformanceBenchmarkSuite(object):
unexpected_lines = [
"Failed to capture data.",
"Failed to capture pass timestamps.",
+ "Failed to capture CPU frame time.",
"Failed to capture benchmark metadata."
]
diff --git a/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_MainSuite.py b/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_MainSuite.py
index ed5d057626..98d2ba0632 100644
--- a/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_MainSuite.py
+++ b/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_MainSuite.py
@@ -12,9 +12,10 @@ import os
import pytest
import editor_python_test_tools.hydra_test_utils as hydra
+from atom_renderer.atom_utils.atom_component_helper import LIGHT_TYPES
logger = logging.getLogger(__name__)
-EDITOR_TIMEOUT = 300
+EDITOR_TIMEOUT = 120
TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "atom_hydra_scripts")
@@ -180,3 +181,64 @@ class TestAtomEditorComponentsMain(object):
null_renderer=True,
cfg_args=cfg_args,
)
+
+ def test_AtomEditorComponents_LightComponent(
+ self, request, editor, workspace, project, launcher_platform, level):
+ """
+ Please review the hydra script run by this test for more specific test info.
+ Tests that the Light component has the expected property options available to it.
+ """
+ cfg_args = [level]
+
+ expected_lines = [
+ "light_entity Entity successfully created",
+ "Entity has a Light component",
+ "light_entity_test: Component added to the entity: True",
+ f"light_entity_test: Property value is {LIGHT_TYPES['sphere']} which matches {LIGHT_TYPES['sphere']}",
+ "Controller|Configuration|Shadows|Enable shadow set to True",
+ "light_entity Controller|Configuration|Shadows|Shadowmap size: SUCCESS",
+ "Controller|Configuration|Shadows|Shadow filter method set to 1", # PCF
+ "Controller|Configuration|Shadows|Filtering sample count set to 4",
+ "Controller|Configuration|Shadows|Filtering sample count set to 64",
+ "Controller|Configuration|Shadows|PCF method set to 0",
+ "Controller|Configuration|Shadows|PCF method set to 1",
+ "Controller|Configuration|Shadows|Shadow filter method set to 2", # ESM
+ "Controller|Configuration|Shadows|ESM exponent set to 50.0",
+ "Controller|Configuration|Shadows|ESM exponent set to 5000.0",
+ "Controller|Configuration|Shadows|Shadow filter method set to 3", # ESM+PCF
+ f"light_entity_test: Property value is {LIGHT_TYPES['spot_disk']} which matches {LIGHT_TYPES['spot_disk']}",
+ f"light_entity_test: Property value is {LIGHT_TYPES['capsule']} which matches {LIGHT_TYPES['capsule']}",
+ f"light_entity_test: Property value is {LIGHT_TYPES['quad']} which matches {LIGHT_TYPES['quad']}",
+ "light_entity Controller|Configuration|Fast approximation: SUCCESS",
+ "light_entity Controller|Configuration|Both directions: SUCCESS",
+ f"light_entity_test: Property value is {LIGHT_TYPES['polygon']} which matches {LIGHT_TYPES['polygon']}",
+ f"light_entity_test: Property value is {LIGHT_TYPES['simple_point']} "
+ f"which matches {LIGHT_TYPES['simple_point']}",
+ "Controller|Configuration|Attenuation radius|Mode set to 0",
+ "Controller|Configuration|Attenuation radius|Radius set to 100.0",
+ f"light_entity_test: Property value is {LIGHT_TYPES['simple_spot']} "
+ f"which matches {LIGHT_TYPES['simple_spot']}",
+ "Controller|Configuration|Shutters|Outer angle set to 45.0",
+ "Controller|Configuration|Shutters|Outer angle set to 90.0",
+ "light_entity_test: Component added to the entity: True",
+ "Light component test (non-GPU) completed.",
+ ]
+
+ unexpected_lines = [
+ "Trace::Assert",
+ "Trace::Error",
+ "Traceback (most recent call last):",
+ ]
+
+ hydra.launch_and_validate_results(
+ request,
+ TEST_DIRECTORY,
+ editor,
+ "hydra_AtomEditorComponents_LightComponent.py",
+ timeout=EDITOR_TIMEOUT,
+ expected_lines=expected_lines,
+ unexpected_lines=unexpected_lines,
+ halt_on_unexpected=True,
+ null_renderer=True,
+ cfg_args=cfg_args,
+ )
diff --git a/AutomatedTesting/Gem/PythonTests/physics/C15096740_Material_LibraryUpdatedCorrectly.py b/AutomatedTesting/Gem/PythonTests/physics/C15096740_Material_LibraryUpdatedCorrectly.py
index 060779082c..341597e36a 100755
--- a/AutomatedTesting/Gem/PythonTests/physics/C15096740_Material_LibraryUpdatedCorrectly.py
+++ b/AutomatedTesting/Gem/PythonTests/physics/C15096740_Material_LibraryUpdatedCorrectly.py
@@ -64,7 +64,8 @@ def C15096740_Material_LibraryUpdatedCorrectly():
# Constants
library_property_path = "Configuration|Physics Material|Library"
- default_material_path = "surfacetypemateriallibrary.physmaterial"
+
+ default_material_path = os.path.join("assets", "physics", "surfacetypemateriallibrary.physmaterial")
new_material_path = os.path.join("physicssurfaces", "default_phys_materials.physmaterial")
helper.init_idle()
@@ -82,7 +83,7 @@ def C15096740_Material_LibraryUpdatedCorrectly():
default_asset = Asset.find_asset_by_path(default_material_path)
test_component.set_component_property_value(library_property_path, default_asset.id)
default_asset.id = test_component.get_component_property_value(library_property_path)
- Report.result(Tests.override_default_library, default_asset.get_path() == default_material_path)
+ Report.result(Tests.override_default_library, default_asset.get_path() == default_material_path.replace(os.sep, '/'))
# 4) Switch it back again to the default material library.
test_component.set_component_property_value(library_property_path, azasset.AssetId())
diff --git a/AutomatedTesting/Gem/PythonTests/physics/Physmaterial_Editor.py b/AutomatedTesting/Gem/PythonTests/physics/Physmaterial_Editor.py
index 54ea3c7f15..cff8ae8377 100755
--- a/AutomatedTesting/Gem/PythonTests/physics/Physmaterial_Editor.py
+++ b/AutomatedTesting/Gem/PythonTests/physics/Physmaterial_Editor.py
@@ -133,7 +133,7 @@ class Physmaterial_Editor:
def _set_path(self):
# type: (str) -> str
if self.document_filename == None:
- self.document_filename = os.path.join(self.project_folder, "surfacetypemateriallibrary.physmaterial")
+ self.document_filename = os.path.join(self.project_folder, "assets", "physics", "surfacetypemateriallibrary.physmaterial")
else:
for (root, directories, root_files) in os.walk(self.project_folder):
for root_file in root_files:
diff --git a/AutomatedTesting/Gem/PythonTests/scripting/ScriptCanvasComponent_OnEntityActivatedDeactivated_PrintMessage.py b/AutomatedTesting/Gem/PythonTests/scripting/ScriptCanvasComponent_OnEntityActivatedDeactivated_PrintMessage.py
index b07a34dacd..097d3fb42d 100644
--- a/AutomatedTesting/Gem/PythonTests/scripting/ScriptCanvasComponent_OnEntityActivatedDeactivated_PrintMessage.py
+++ b/AutomatedTesting/Gem/PythonTests/scripting/ScriptCanvasComponent_OnEntityActivatedDeactivated_PrintMessage.py
@@ -93,11 +93,11 @@ def ScriptCanvasComponent_OnEntityActivatedDeactivated_PrintMessage():
if entity_dict["name"] == "Controller":
sc_component.get_property_tree()
sc_component.set_component_property_value(
- "Properties|Variable Fields|Variables|[0]|Name,Value|Datum|Datum|EntityToActivate",
+ "Properties|Variables|EntityToActivate|Datum|Datum|value|EntityToActivate",
entity_to_activate.id,
)
sc_component.set_component_property_value(
- "Properties|Variable Fields|Variables|[1]|Name,Value|Datum|Datum|EntityToDeactivate",
+ "Properties|Variables|EntityToDeactivate|Datum|Datum|value|EntityToDeactivate",
entity_to_deactivate.id,
)
return entity
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/smoke/CMakeLists.txt
index 600911e9f1..2c1d03b5a2 100644
--- a/AutomatedTesting/Gem/PythonTests/smoke/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/smoke/CMakeLists.txt
@@ -11,7 +11,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
if (PAL_TRAIT_BUILD_SERIALIZECONTEXTTOOLS)
list(APPEND additional_dependencies AZ::SerializeContextTools) # test_CLITool_SerializeContextTools depends on it
endif()
- list(APPEND additional_dependencies AZ::AssetBundlerBatch) # test_CLITool_AssetBundlerBatch_Works depends on it
ly_add_pytest(
NAME AutomatedTesting::SmokeTest
@@ -26,26 +25,27 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
Legacy::Editor
AutomatedTesting.GameLauncher
AutomatedTesting.Assets
- ${aditional_dependencies}
+ AZ::AzTestRunner
+ AZ::AssetBundlerBatch
+ ${additional_dependencies}
COMPONENT
Smoke
)
ly_add_pytest(
- NAME AutomatedTesting::SandboxTest
- TEST_SUITE sandbox
+ NAME AutomatedTesting::LoadLevelGPU
+ TEST_SUITE smoke
TEST_SERIAL
- PATH ${CMAKE_CURRENT_LIST_DIR}
- PYTEST_MARKS "SUITE_sandbox"
- TIMEOUT 1500
+ TEST_REQUIRES gpu
+ PATH ${CMAKE_CURRENT_LIST_DIR}/test_RemoteConsole_GPULoadLevel_Works.py
+ TIMEOUT 100
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
AZ::PythonBindingsExample
- Legacy::Editor
AutomatedTesting.GameLauncher
AutomatedTesting.Assets
COMPONENT
- Sandbox
+ Smoke
)
ly_add_pytest(
@@ -74,4 +74,5 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
AutomatedTesting.GameLauncher
AutomatedTesting.Assets
)
+
endif()
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_RemoteConsole_CPULoadLevel_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_RemoteConsole_CPULoadLevel_Works.py
new file mode 100644
index 0000000000..6522514f2f
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_RemoteConsole_CPULoadLevel_Works.py
@@ -0,0 +1,44 @@
+"""
+Copyright (c) Contributors to the Open 3D Engine Project.
+For complete copyright and license terms please see the LICENSE at the root of this distribution.
+
+SPDX-License-Identifier: Apache-2.0 OR MIT
+
+
+UI Apps: AutomatedTesting.GameLauncher
+Launch AutomatedTesting.GameLauncher with Simple level
+Test should run in both gpu and non gpu
+"""
+
+import pytest
+import psutil
+
+import ly_test_tools.environment.waiter as waiter
+import editor_python_test_tools.hydra_test_utils as editor_test_utils
+from ly_remote_console.remote_console_commands import RemoteConsole as RemoteConsole
+from ly_remote_console.remote_console_commands import (
+ send_command_and_expect_response as send_command_and_expect_response,
+)
+
+
+@pytest.mark.parametrize("launcher_platform", ["windows"])
+@pytest.mark.parametrize("project", ["AutomatedTesting"])
+@pytest.mark.parametrize("level", ["Simple"])
+@pytest.mark.SUITE_smoke
+class TestRemoteConsoleLoadLevelWorks(object):
+ @pytest.fixture
+ def remote_console_instance(self, request):
+ console = RemoteConsole()
+
+ def teardown():
+ if console.connected:
+ console.stop()
+
+ request.addfinalizer(teardown)
+
+ return console
+
+ def test_RemoteConsole_LoadLevel_Works(self, launcher, level, remote_console_instance, launcher_platform):
+ expected_lines = ['Level system is loading "Simple"']
+
+ editor_test_utils.launch_and_validate_results_launcher(launcher, level, remote_console_instance, expected_lines, null_renderer=True)
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_RemoteConsole_GPULoadLevel_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_RemoteConsole_GPULoadLevel_Works.py
new file mode 100644
index 0000000000..7debcab938
--- /dev/null
+++ b/AutomatedTesting/Gem/PythonTests/smoke/test_RemoteConsole_GPULoadLevel_Works.py
@@ -0,0 +1,43 @@
+"""
+Copyright (c) Contributors to the Open 3D Engine Project.
+For complete copyright and license terms please see the LICENSE at the root of this distribution.
+
+SPDX-License-Identifier: Apache-2.0 OR MIT
+
+
+UI Apps: AutomatedTesting.GameLauncher
+Launch AutomatedTesting.GameLauncher with Simple level
+Test should run in both gpu and non gpu
+"""
+
+import pytest
+import psutil
+
+import ly_test_tools.environment.waiter as waiter
+import editor_python_test_tools.hydra_test_utils as editor_test_utils
+from ly_remote_console.remote_console_commands import RemoteConsole as RemoteConsole
+from ly_remote_console.remote_console_commands import (
+ send_command_and_expect_response as send_command_and_expect_response,
+)
+
+
+@pytest.mark.parametrize("launcher_platform", ["windows"])
+@pytest.mark.parametrize("project", ["AutomatedTesting"])
+@pytest.mark.parametrize("level", ["Simple"])
+class TestRemoteConsoleLoadLevelWorks(object):
+ @pytest.fixture
+ def remote_console_instance(self, request):
+ console = RemoteConsole()
+
+ def teardown():
+ if console.connected:
+ console.stop()
+
+ request.addfinalizer(teardown)
+
+ return console
+
+ def test_RemoteConsole_LoadLevel_Works(self, launcher, level, remote_console_instance, launcher_platform):
+ expected_lines = ['Level system is loading "Simple"']
+
+ editor_test_utils.launch_and_validate_results_launcher(launcher, level, remote_console_instance, expected_lines, null_renderer=False)
diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_RemoteConsole_LoadLevel_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_RemoteConsole_LoadLevel_Works.py
deleted file mode 100644
index b1606e1910..0000000000
--- a/AutomatedTesting/Gem/PythonTests/smoke/test_RemoteConsole_LoadLevel_Works.py
+++ /dev/null
@@ -1,105 +0,0 @@
-"""
-Copyright (c) Contributors to the Open 3D Engine Project.
-For complete copyright and license terms please see the LICENSE at the root of this distribution.
-
-SPDX-License-Identifier: Apache-2.0 OR MIT
-
-
-UI Apps: AutomatedTesting.GameLauncher
-Launch AutomatedTesting.GameLauncher with Simple level
-Test should run in both gpu and non gpu
-"""
-
-import pytest
-import psutil
-
-# Bail on the test if ly_test_tools doesn't exist.
-pytest.importorskip("ly_test_tools")
-import ly_test_tools.environment.waiter as waiter
-from ly_remote_console.remote_console_commands import RemoteConsole as RemoteConsole
-from ly_remote_console.remote_console_commands import (
- send_command_and_expect_response as send_command_and_expect_response,
-)
-
-
-@pytest.mark.parametrize("launcher_platform", ["windows"])
-@pytest.mark.parametrize("project", ["AutomatedTesting"])
-@pytest.mark.parametrize("level", ["Simple"])
-@pytest.mark.SUITE_sandbox
-class TestRemoteConsoleLoadLevelWorks(object):
- @pytest.fixture
- def remote_console_instance(self, request):
- console = RemoteConsole()
-
- def teardown():
- if console.connected:
- console.stop()
-
- request.addfinalizer(teardown)
-
- return console
-
- def test_RemoteConsole_LoadLevel_Works(self, launcher, level, remote_console_instance, launcher_platform):
- expected_lines = ['Level system is loading "Simple"']
-
- self.launch_and_validate_results_launcher(launcher, level, remote_console_instance, expected_lines)
-
- def launch_and_validate_results_launcher(
- self,
- launcher,
- level,
- remote_console_instance,
- expected_lines,
- null_renderer=False,
- port_listener_timeout=120,
- log_monitor_timeout=300,
- remote_console_port=4600,
- ):
- """
- Runs the launcher with the specified level, and monitors Game.log for expected lines.
- :param launcher: Configured launcher object to run test against.
- :param level: The level to load in the launcher.
- :param remote_console_instance: Configured Remote Console object.
- :param expected_lines: Expected lines to search log for.
- :oaram null_renderer: Specifies the test does not require the renderer. Defaults to True.
- :param port_listener_timeout: Timeout for verifying successful connection to Remote Console.
- :param log_monitor_timeout: Timeout for monitoring for lines in Game.log
- :param remote_console_port: The port used to communicate with the Remote Console.
- """
-
- def _check_for_listening_port(port):
- """
- Checks to see if the connection to the designated port was established.
- :param port: Port to listen to.
- :return: True if port is listening.
- """
- port_listening = False
- for conn in psutil.net_connections():
- if "port={}".format(port) in str(conn):
- port_listening = True
- return port_listening
-
- if null_renderer:
- launcher.args.extend(["-NullRenderer"])
-
- # Start the Launcher
- with launcher.start():
-
- # Ensure Remote Console can be reached
- waiter.wait_for(
- lambda: _check_for_listening_port(remote_console_port),
- port_listener_timeout,
- exc=AssertionError("Port {} not listening.".format(remote_console_port)),
- )
- remote_console_instance.start(timeout=30)
-
- # Load the specified level in the launcher
- send_command_and_expect_response(
- remote_console_instance, f"loadlevel {level}", "LEVEL_LOAD_END", timeout=30
- )
-
- # Monitor the console for expected lines
- for line in expected_lines:
- assert remote_console_instance.expect_log_line(
- line, log_monitor_timeout
- ), f"Expected line not found: {line}"
diff --git a/AutomatedTesting/Passes/MainPipeline.pass b/AutomatedTesting/Passes/MainPipeline.pass
new file mode 100644
index 0000000000..aa9f3757c4
--- /dev/null
+++ b/AutomatedTesting/Passes/MainPipeline.pass
@@ -0,0 +1,483 @@
+{
+ "Type": "JsonSerialization",
+ "Version": 1,
+ "ClassName": "PassAsset",
+ "ClassData": {
+ "PassTemplate": {
+ "Name": "MainPipeline",
+ "PassClass": "ParentPass",
+ "Slots": [
+ {
+ "Name": "SwapChainOutput",
+ "SlotType": "InputOutput",
+ "ScopeAttachmentUsage": "RenderTarget"
+ }
+ ],
+ "PassRequests": [
+ {
+ "Name": "MorphTargetPass",
+ "TemplateName": "MorphTargetPassTemplate"
+ },
+ {
+ "Name": "SkinningPass",
+ "TemplateName": "SkinningPassTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "SkinnedMeshOutputStream",
+ "AttachmentRef": {
+ "Pass": "MorphTargetPass",
+ "Attachment": "MorphTargetDeltaOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "RayTracingAccelerationStructurePass",
+ "TemplateName": "RayTracingAccelerationStructurePassTemplate"
+ },
+ {
+ "Name": "DiffuseProbeGridUpdatePass",
+ "TemplateName": "DiffuseProbeGridUpdatePassTemplate",
+ "ExecuteAfter": [
+ "RayTracingAccelerationStructurePass"
+ ]
+ },
+ {
+ "Name": "DepthPrePass",
+ "TemplateName": "DepthMSAAParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "SkinnedMeshes",
+ "AttachmentRef": {
+ "Pass": "SkinningPass",
+ "Attachment": "SkinnedMeshOutputStream"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "MotionVectorPass",
+ "TemplateName": "MotionVectorParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "SkinnedMeshes",
+ "AttachmentRef": {
+ "Pass": "SkinningPass",
+ "Attachment": "SkinnedMeshOutputStream"
+ }
+ },
+ {
+ "LocalSlot": "Depth",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "LightCullingPass",
+ "TemplateName": "LightCullingParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "SkinnedMeshes",
+ "AttachmentRef": {
+ "Pass": "SkinningPass",
+ "Attachment": "SkinnedMeshOutputStream"
+ }
+ },
+ {
+ "LocalSlot": "DepthMSAA",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "DepthMSAA"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "ShadowPass",
+ "TemplateName": "ShadowParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "SkinnedMeshes",
+ "AttachmentRef": {
+ "Pass": "SkinningPass",
+ "Attachment": "SkinnedMeshOutputStream"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "OpaquePass",
+ "TemplateName": "OpaqueParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "DirectionalShadowmap",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "DirectionalShadowmap"
+ }
+ },
+ {
+ "LocalSlot": "DirectionalESM",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "DirectionalESM"
+ }
+ },
+ {
+ "LocalSlot": "ProjectedShadowmap",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "ProjectedShadowmap"
+ }
+ },
+ {
+ "LocalSlot": "ProjectedESM",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "ProjectedESM"
+ }
+ },
+ {
+ "LocalSlot": "TileLightData",
+ "AttachmentRef": {
+ "Pass": "LightCullingPass",
+ "Attachment": "TileLightData"
+ }
+ },
+ {
+ "LocalSlot": "LightListRemapped",
+ "AttachmentRef": {
+ "Pass": "LightCullingPass",
+ "Attachment": "LightListRemapped"
+ }
+ },
+ {
+ "LocalSlot": "DepthLinear",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "DepthLinear"
+ }
+ },
+ {
+ "LocalSlot": "DepthStencil",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "DepthMSAA"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "TransparentPass",
+ "TemplateName": "TransparentParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "DirectionalShadowmap",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "DirectionalShadowmap"
+ }
+ },
+ {
+ "LocalSlot": "DirectionalESM",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "DirectionalESM"
+ }
+ },
+ {
+ "LocalSlot": "ProjectedShadowmap",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "ProjectedShadowmap"
+ }
+ },
+ {
+ "LocalSlot": "ProjectedESM",
+ "AttachmentRef": {
+ "Pass": "ShadowPass",
+ "Attachment": "ProjectedESM"
+ }
+ },
+ {
+ "LocalSlot": "TileLightData",
+ "AttachmentRef": {
+ "Pass": "LightCullingPass",
+ "Attachment": "TileLightData"
+ }
+ },
+ {
+ "LocalSlot": "LightListRemapped",
+ "AttachmentRef": {
+ "Pass": "LightCullingPass",
+ "Attachment": "LightListRemapped"
+ }
+ },
+ {
+ "LocalSlot": "InputLinearDepth",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "DepthLinear"
+ }
+ },
+ {
+ "LocalSlot": "DepthStencil",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ },
+ {
+ "LocalSlot": "InputOutput",
+ "AttachmentRef": {
+ "Pass": "OpaquePass",
+ "Attachment": "Output"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "DeferredFogPass",
+ "TemplateName": "DeferredFogPassTemplate",
+ "Enabled": false,
+ "Connections": [
+ {
+ "LocalSlot": "InputLinearDepth",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "DepthLinear"
+ }
+ },
+ {
+ "LocalSlot": "InputDepthStencil",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ },
+ {
+ "LocalSlot": "RenderTargetInputOutput",
+ "AttachmentRef": {
+ "Pass": "TransparentPass",
+ "Attachment": "InputOutput"
+ }
+ }
+ ],
+ "PassData": {
+ "$type": "FullscreenTrianglePassData",
+ "ShaderAsset": {
+ "FilePath": "Shaders/ScreenSpace/DeferredFog.shader"
+ },
+ "PipelineViewTag": "MainCamera"
+ }
+ },
+ {
+ "Name": "ReflectionCopyFrameBufferPass",
+ "TemplateName": "ReflectionCopyFrameBufferPassTemplate",
+ "Enabled": false,
+ "Connections": [
+ {
+ "LocalSlot": "Input",
+ "AttachmentRef": {
+ "Pass": "DeferredFogPass",
+ "Attachment": "RenderTargetInputOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "PostProcessPass",
+ "TemplateName": "PostProcessParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "LightingInput",
+ "AttachmentRef": {
+ "Pass": "DeferredFogPass",
+ "Attachment": "RenderTargetInputOutput"
+ }
+ },
+ {
+ "LocalSlot": "Depth",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ },
+ {
+ "LocalSlot": "MotionVectors",
+ "AttachmentRef": {
+ "Pass": "MotionVectorPass",
+ "Attachment": "MotionVectorOutput"
+ }
+ },
+ {
+ "LocalSlot": "SwapChainOutput",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "AuxGeomPass",
+ "TemplateName": "AuxGeomPassTemplate",
+ "Enabled": true,
+ "Connections": [
+ {
+ "LocalSlot": "ColorInputOutput",
+ "AttachmentRef": {
+ "Pass": "PostProcessPass",
+ "Attachment": "Output"
+ }
+ },
+ {
+ "LocalSlot": "DepthInputOutput",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ }
+ ],
+ "PassData": {
+ "$type": "RasterPassData",
+ "DrawListTag": "auxgeom",
+ "PipelineViewTag": "MainCamera"
+ }
+ },
+ {
+ "Name": "DebugOverlayPass",
+ "TemplateName": "DebugOverlayParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "TileLightData",
+ "AttachmentRef": {
+ "Pass": "LightCullingPass",
+ "Attachment": "TileLightData"
+ }
+ },
+ {
+ "LocalSlot": "RawLightingInput",
+ "AttachmentRef": {
+ "Pass": "PostProcessPass",
+ "Attachment": "RawLightingOutput"
+ }
+ },
+ {
+ "LocalSlot": "LuminanceMipChainInput",
+ "AttachmentRef": {
+ "Pass": "PostProcessPass",
+ "Attachment": "LuminanceMipChainOutput"
+ }
+ },
+ {
+ "LocalSlot": "InputOutput",
+ "AttachmentRef": {
+ "Pass": "AuxGeomPass",
+ "Attachment": "ColorInputOutput"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "LyShinePass",
+ "TemplateName": "LyShineParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "ColorInputOutput",
+ "AttachmentRef": {
+ "Pass": "DebugOverlayPass",
+ "Attachment": "InputOutput"
+ }
+ },
+ {
+ "LocalSlot": "DepthInputOutput",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "UIPass",
+ "TemplateName": "UIParentTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "InputOutput",
+ "AttachmentRef": {
+ "Pass": "LyShinePass",
+ "Attachment": "ColorInputOutput"
+ }
+ },
+ {
+ "LocalSlot": "DepthInputOutput",
+ "AttachmentRef": {
+ "Pass": "DepthPrePass",
+ "Attachment": "Depth"
+ }
+ }
+ ]
+ },
+ {
+ "Name": "CopyToSwapChain",
+ "TemplateName": "FullscreenCopyTemplate",
+ "Connections": [
+ {
+ "LocalSlot": "Input",
+ "AttachmentRef": {
+ "Pass": "UIPass",
+ "Attachment": "InputOutput"
+ }
+ },
+ {
+ "LocalSlot": "Output",
+ "AttachmentRef": {
+ "Pass": "Parent",
+ "Attachment": "SwapChainOutput"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/AutomatedTesting/Registry/C3510644_Collider_CollisionGroups.setreg_override b/AutomatedTesting/Registry/C3510644_Collider_CollisionGroups.setreg_override
index 9fa5e26768..e4ea71f652 100644
--- a/AutomatedTesting/Registry/C3510644_Collider_CollisionGroups.setreg_override
+++ b/AutomatedTesting/Registry/C3510644_Collider_CollisionGroups.setreg_override
@@ -121,9 +121,10 @@
},
"MaterialLibrary": {
"assetId": {
- "guid": "{3A055A3F-8CB7-5FEE-B437-EB365FACD0D4}"
+ "guid": "{62446378-67F8-5E49-AC31-761DD5942695}"
},
- "assetHint": "surfacetypemateriallibrary.physmaterial"
+ "loadBehavior": "QueueLoad",
+ "assetHint": "assets/physics/surfacetypemateriallibrary.physmaterial"
}
}
}
diff --git a/AutomatedTesting/Registry/C4976227_Collider_NewGroup.setreg_override b/AutomatedTesting/Registry/C4976227_Collider_NewGroup.setreg_override
index afbe6a9d38..e53d3893f8 100644
--- a/AutomatedTesting/Registry/C4976227_Collider_NewGroup.setreg_override
+++ b/AutomatedTesting/Registry/C4976227_Collider_NewGroup.setreg_override
@@ -109,9 +109,10 @@
},
"MaterialLibrary": {
"assetId": {
- "guid": "{3A055A3F-8CB7-5FEE-B437-EB365FACD0D4}"
+ "guid": "{62446378-67F8-5E49-AC31-761DD5942695}"
},
- "assetHint": "surfacetypemateriallibrary.physmaterial"
+ "loadBehavior": "QueueLoad",
+ "assetHint": "assets/physics/surfacetypemateriallibrary.physmaterial"
}
}
}
diff --git a/AutomatedTesting/Registry/C4976244_Collider_SameGroupSameLayerCollision.setreg_override b/AutomatedTesting/Registry/C4976244_Collider_SameGroupSameLayerCollision.setreg_override
index 9fa5e26768..e4ea71f652 100644
--- a/AutomatedTesting/Registry/C4976244_Collider_SameGroupSameLayerCollision.setreg_override
+++ b/AutomatedTesting/Registry/C4976244_Collider_SameGroupSameLayerCollision.setreg_override
@@ -121,9 +121,10 @@
},
"MaterialLibrary": {
"assetId": {
- "guid": "{3A055A3F-8CB7-5FEE-B437-EB365FACD0D4}"
+ "guid": "{62446378-67F8-5E49-AC31-761DD5942695}"
},
- "assetHint": "surfacetypemateriallibrary.physmaterial"
+ "loadBehavior": "QueueLoad",
+ "assetHint": "assets/physics/surfacetypemateriallibrary.physmaterial"
}
}
}
diff --git a/AutomatedTesting/Registry/C4976245_PhysXCollider_CollisionLayerTest.setreg_override b/AutomatedTesting/Registry/C4976245_PhysXCollider_CollisionLayerTest.setreg_override
index 9fa5e26768..e4ea71f652 100644
--- a/AutomatedTesting/Registry/C4976245_PhysXCollider_CollisionLayerTest.setreg_override
+++ b/AutomatedTesting/Registry/C4976245_PhysXCollider_CollisionLayerTest.setreg_override
@@ -121,9 +121,10 @@
},
"MaterialLibrary": {
"assetId": {
- "guid": "{3A055A3F-8CB7-5FEE-B437-EB365FACD0D4}"
+ "guid": "{62446378-67F8-5E49-AC31-761DD5942695}"
},
- "assetHint": "surfacetypemateriallibrary.physmaterial"
+ "loadBehavior": "QueueLoad",
+ "assetHint": "assets/physics/surfacetypemateriallibrary.physmaterial"
}
}
}
diff --git a/AutomatedTesting/Registry/C4982593_PhysXCollider_CollisionLayer.setreg_override b/AutomatedTesting/Registry/C4982593_PhysXCollider_CollisionLayer.setreg_override
index 9fa5e26768..e4ea71f652 100644
--- a/AutomatedTesting/Registry/C4982593_PhysXCollider_CollisionLayer.setreg_override
+++ b/AutomatedTesting/Registry/C4982593_PhysXCollider_CollisionLayer.setreg_override
@@ -121,9 +121,10 @@
},
"MaterialLibrary": {
"assetId": {
- "guid": "{3A055A3F-8CB7-5FEE-B437-EB365FACD0D4}"
+ "guid": "{62446378-67F8-5E49-AC31-761DD5942695}"
},
- "assetHint": "surfacetypemateriallibrary.physmaterial"
+ "loadBehavior": "QueueLoad",
+ "assetHint": "assets/physics/surfacetypemateriallibrary.physmaterial"
}
}
}
diff --git a/AutomatedTesting/Registry/physxsystemconfiguration.setreg b/AutomatedTesting/Registry/physxsystemconfiguration.setreg
index 02f65b685b..83aad307a6 100644
--- a/AutomatedTesting/Registry/physxsystemconfiguration.setreg
+++ b/AutomatedTesting/Registry/physxsystemconfiguration.setreg
@@ -103,9 +103,10 @@
},
"MaterialLibrary": {
"assetId": {
- "guid": "{3A055A3F-8CB7-5FEE-B437-EB365FACD0D4}"
+ "guid": "{62446378-67F8-5E49-AC31-761DD5942695}"
},
- "assetHint": "surfacetypemateriallibrary.physmaterial"
+ "loadBehavior": "QueueLoad",
+ "assetHint": "assets/physics/surfacetypemateriallibrary.physmaterial"
}
}
}
diff --git a/Code/Editor/2DViewport.cpp b/Code/Editor/2DViewport.cpp
index 56f2e7bdf5..838d30e0b3 100644
--- a/Code/Editor/2DViewport.cpp
+++ b/Code/Editor/2DViewport.cpp
@@ -952,7 +952,8 @@ void Q2DViewport::DrawViewerMarker(DisplayContext& dc)
dc.SetColor(QColor(0, 0, 255)); // blue
dc.DrawWireBox(-dim * noScale, dim * noScale);
- float fov = GetIEditor()->GetSystem()->GetViewCamera().GetFov();
+ constexpr float DefaultFov = 60.f;
+ float fov = DefaultFov;
Vec3 q[4];
float dist = 30;
diff --git a/Code/Editor/AboutDialog.cpp b/Code/Editor/AboutDialog.cpp
index 8429e86553..f8abe67376 100644
--- a/Code/Editor/AboutDialog.cpp
+++ b/Code/Editor/AboutDialog.cpp
@@ -25,7 +25,7 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-CAboutDialog::CAboutDialog(QString versionText, QString richTextCopyrightNotice, QWidget* pParent /*=NULL*/)
+CAboutDialog::CAboutDialog(QString versionText, QString richTextCopyrightNotice, QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_ui(new Ui::CAboutDialog)
{
diff --git a/Code/Editor/Animation/SkeletonHierarchy.cpp b/Code/Editor/Animation/SkeletonHierarchy.cpp
index 3015ff5e27..d1cc44b31d 100644
--- a/Code/Editor/Animation/SkeletonHierarchy.cpp
+++ b/Code/Editor/Animation/SkeletonHierarchy.cpp
@@ -63,7 +63,7 @@ int32 CHierarchy::FindNodeIndexByName(const char* name) const
const CHierarchy::SNode* CHierarchy::FindNode(const char* name) const
{
int32 index = FindNodeIndexByName(name);
- return index < 0 ? NULL : &m_nodes[index];
+ return index < 0 ? nullptr : &m_nodes[index];
}
void CHierarchy::CreateFrom(IDefaultSkeleton* pIDefaultSkeleton)
diff --git a/Code/Editor/Animation/SkeletonMapper.cpp b/Code/Editor/Animation/SkeletonMapper.cpp
index 3913801fc8..24f01f56ad 100644
--- a/Code/Editor/Animation/SkeletonMapper.cpp
+++ b/Code/Editor/Animation/SkeletonMapper.cpp
@@ -56,8 +56,8 @@ void CMapper::ClearLocations()
uint32 count = uint32(m_nodes.size());
for (uint32 i = 0; i < count; ++i)
{
- m_nodes[i].position = NULL;
- m_nodes[i].orientation = NULL;
+ m_nodes[i].position = nullptr;
+ m_nodes[i].orientation = nullptr;
}
m_locations.clear();
@@ -141,7 +141,7 @@ void CMapper::Map(QuatT* pResult)
}
CHierarchy::SNode* pParent = pNode->parent < 0 ?
- NULL : m_hierarchy.GetNode(pNode->parent);
+ nullptr : m_hierarchy.GetNode(pNode->parent);
if (pParent)
{
pResult[i].t =
@@ -173,7 +173,7 @@ void CMapper::Map(QuatT* pResult)
}
CHierarchy::SNode* pParent = pNode->parent < 0 ?
- NULL : m_hierarchy.GetNode(pNode->parent);
+ nullptr : m_hierarchy.GetNode(pNode->parent);
if (!pParent)
{
pResult[i].q = absolutes[i];
diff --git a/Code/Editor/Animation/SkeletonMapperOperator.cpp b/Code/Editor/Animation/SkeletonMapperOperator.cpp
index 7a69173bed..cc53957115 100644
--- a/Code/Editor/Animation/SkeletonMapperOperator.cpp
+++ b/Code/Editor/Animation/SkeletonMapperOperator.cpp
@@ -37,8 +37,8 @@ CMapperOperatorDesc::CMapperOperatorDesc(const char* name)
CMapperOperator::CMapperOperator(const char* className, uint32 positionCount, uint32 orientationCount)
{
m_className = className;
- m_position.resize(positionCount, NULL);
- m_orientation.resize(orientationCount, NULL);
+ m_position.resize(positionCount, nullptr);
+ m_orientation.resize(orientationCount, nullptr);
}
CMapperOperator::~CMapperOperator()
diff --git a/Code/Editor/AnimationContext.cpp b/Code/Editor/AnimationContext.cpp
index debe5e3b01..6e146faacb 100644
--- a/Code/Editor/AnimationContext.cpp
+++ b/Code/Editor/AnimationContext.cpp
@@ -16,7 +16,6 @@
// Editor
#include "TrackView/TrackViewDialog.h"
-#include "RenderViewport.h"
#include "ViewManager.h"
#include "Objects/SelectionGroup.h"
#include "Include/IObjectManager.h"
@@ -29,7 +28,7 @@ class CMovieCallback
: public IMovieCallback
{
protected:
- virtual void OnMovieCallback(ECallbackReason reason, [[maybe_unused]] IAnimNode* pNode)
+ void OnMovieCallback(ECallbackReason reason, [[maybe_unused]] IAnimNode* pNode) override
{
switch (reason)
{
@@ -49,7 +48,7 @@ protected:
}
}
- void OnSetCamera(const SCameraParams& Params)
+ void OnSetCamera(const SCameraParams& Params) override
{
// Only switch camera when in Play mode.
GUID camObjId = GUID_NULL;
@@ -61,15 +60,6 @@ protected:
{
camObjId = pEditorEntity->GetId();
}
-
- CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
- if (CRenderViewport* rvp = viewport_cast(pViewport))
- {
- if (!rvp->IsSequenceCamera())
- {
- return;
- }
- }
}
// Switch camera in active rendering view.
@@ -79,14 +69,14 @@ protected:
}
};
- bool IsSequenceCamUsed() const
+ bool IsSequenceCamUsed() const override
{
if (gEnv->IsEditorGameMode() == true)
{
return true;
}
- if (GetIEditor()->GetViewManager() == NULL)
+ if (GetIEditor()->GetViewManager() == nullptr)
{
return false;
}
@@ -113,7 +103,7 @@ public:
CAnimationContextPostRender(CAnimationContext* pAC)
: m_pAC(pAC){}
- void OnPostRender() const { assert(m_pAC); m_pAC->OnPostRender(); }
+ void OnPostRender() const override { assert(m_pAC); m_pAC->OnPostRender(); }
protected:
CAnimationContext* m_pAC;
@@ -231,7 +221,7 @@ void CAnimationContext::SetSequence(CTrackViewSequence* sequence, bool force, bo
m_pSequence->UnBindFromEditorObjects();
}
m_pSequence = sequence;
-
+
// Notify a new sequence was just selected.
Maestro::EditorSequenceNotificationBus::Broadcast(&Maestro::EditorSequenceNotificationBus::Events::OnSequenceSelected, m_pSequence ? m_pSequence->GetSequenceComponentEntityId() : AZ::EntityId());
@@ -347,7 +337,7 @@ void CAnimationContext::OnSequenceActivated(AZ::EntityId entityId)
{
// Hang onto this because SetSequence() will reset it.
float lastTime = m_mostRecentSequenceTime;
-
+
SetSequence(sequence, false, false);
// Restore the current time.
diff --git a/Code/Editor/AnimationContext.cpp.rej b/Code/Editor/AnimationContext.cpp.rej
deleted file mode 100644
index 3ee0913c9d..0000000000
--- a/Code/Editor/AnimationContext.cpp.rej
+++ /dev/null
@@ -1,11 +0,0 @@
---- Editor/AnimationContext.cpp
-+++ Editor/AnimationContext.cpp
-@@ -612,7 +612,7 @@ void CAnimationContext::UpdateAnimatedLights()
- return;
-
- std::vector entityObjects;
-- GetIEditor()->GetObjectManager()->FindObjectsOfType(entityObjects);
-+ GetIEditor()->GetObjectManager()->FindObjectsOfType(&CEntityObject::staticMetaObject, entityObjects);
- std::for_each(std::begin(entityObjects), std::end(entityObjects),
- [this](CBaseObject *pBaseObject)
- {
diff --git a/Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp b/Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp
index 50f8aff144..cb97632e07 100644
--- a/Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp
+++ b/Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp
@@ -260,9 +260,7 @@ void AzAssetBrowserRequestHandler::AddContextMenuActions(QWidget* caller, QMenu*
return;
}
- AZStd::string fullFileDirectory;
AZStd::string fullFilePath;
- AZStd::string fileName;
AZStd::string extension;
switch (entry->GetEntryType())
@@ -281,8 +279,6 @@ void AzAssetBrowserRequestHandler::AddContextMenuActions(QWidget* caller, QMenu*
{
AZ::Uuid sourceID = azrtti_cast(entry)->GetSourceUuid();
fullFilePath = entry->GetFullPath();
- fullFileDirectory = fullFilePath.substr(0, fullFilePath.find_last_of(AZ_CORRECT_DATABASE_SEPARATOR));
- fileName = entry->GetName();
AzFramework::StringFunc::Path::GetExtension(fullFilePath.c_str(), extension);
// Add the "Open" menu item.
@@ -369,19 +365,19 @@ void AzAssetBrowserRequestHandler::AddContextMenuActions(QWidget* caller, QMenu*
{
if (entry->GetEntryType() == AssetBrowserEntry::AssetEntryType::Source)
{
- CFileUtil::PopulateQMenu(caller, menu, fileName.c_str(), fullFileDirectory.c_str());
+ CFileUtil::PopulateQMenu(caller, menu, fullFilePath);
}
return;
}
- CFileUtil::PopulateQMenu(caller, menu, fileName.c_str(), fullFileDirectory.c_str());
+ CFileUtil::PopulateQMenu(caller, menu, fullFilePath);
}
break;
case AssetBrowserEntry::AssetEntryType::Folder:
{
- fullFileDirectory = entry->GetFullPath();
- // we are sending an empty filename to indicate that it is a folder and not a file
- CFileUtil::PopulateQMenu(caller, menu, fileName.c_str(), fullFileDirectory.c_str());
+ fullFilePath = entry->GetFullPath();
+
+ CFileUtil::PopulateQMenu(caller, menu, fullFilePath);
}
break;
default:
diff --git a/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp b/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp
index f1047ae62b..c54fe60c4d 100644
--- a/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp
+++ b/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp
@@ -42,7 +42,7 @@ public:
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
}
- ~ListenerForShowAssetEditorEvent()
+ ~ListenerForShowAssetEditorEvent() override
{
AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
}
@@ -82,6 +82,7 @@ AzAssetBrowserWindow::AzAssetBrowserWindow(QWidget* parent)
m_ui->m_assetBrowserTableViewWidget->setVisible(false);
m_ui->m_toggleDisplayViewBtn->setVisible(false);
+ m_ui->m_searchWidget->SetFilterInputInterval(AZStd::chrono::milliseconds(250));
if (ed_useNewAssetBrowserTableView)
{
m_ui->m_toggleDisplayViewBtn->setVisible(true);
diff --git a/Code/Editor/BaseLibrary.cpp b/Code/Editor/BaseLibrary.cpp
index ee1c85756d..7c920a7f04 100644
--- a/Code/Editor/BaseLibrary.cpp
+++ b/Code/Editor/BaseLibrary.cpp
@@ -24,10 +24,10 @@ class CUndoBaseLibrary
: public IUndoObject
{
public:
- CUndoBaseLibrary(CBaseLibrary* pLib, const QString& description, const QString& selectedItem = 0)
+ CUndoBaseLibrary(CBaseLibrary* pLib, const QString& description, const QString& selectedItem = QString())
: m_pLib(pLib)
, m_description(description)
- , m_redo(0)
+ , m_redo(nullptr)
, m_selectedItem(selectedItem)
{
assert(m_pLib);
@@ -36,16 +36,16 @@ public:
m_pLib->Serialize(m_undo, false);
}
- virtual QString GetEditorObjectName()
+ QString GetEditorObjectName() override
{
return m_selectedItem;
}
protected:
- virtual int GetSize() { return sizeof(CUndoBaseLibrary); }
- virtual QString GetDescription() { return m_description; };
+ int GetSize() override { return sizeof(CUndoBaseLibrary); }
+ QString GetDescription() override { return m_description; };
- virtual void Undo(bool bUndo)
+ void Undo(bool bUndo) override
{
if (bUndo)
{
@@ -57,7 +57,7 @@ protected:
GetIEditor()->Notify(eNotify_OnDataBaseUpdate);
}
- virtual void Redo()
+ void Redo() override
{
m_pLib->Serialize(m_redo, true);
m_pLib->SetModified();
@@ -107,7 +107,7 @@ void CBaseLibrary::RemoveAllItems()
// Unregister item in case it was registered. It is ok if it wasn't. This is still safe to call.
m_pManager->UnregisterItem(m_items[i]);
// Clear library item.
- m_items[i]->m_library = NULL;
+ m_items[i]->m_library = nullptr;
}
m_items.clear();
Release();
@@ -216,7 +216,7 @@ IDataBaseItem* CBaseLibrary::FindItem(const QString& name)
return m_items[i];
}
}
- return NULL;
+ return nullptr;
}
bool CBaseLibrary::AddLibraryToSourceControl(const QString& fullPathName) const
@@ -233,8 +233,8 @@ bool CBaseLibrary::AddLibraryToSourceControl(const QString& fullPathName) const
bool CBaseLibrary::SaveLibrary(const char* name, bool saveEmptyLibrary)
{
- assert(name != NULL);
- if (name == NULL)
+ assert(name != nullptr);
+ if (name == nullptr)
{
CryFatalError("The library you are attempting to save has no name specified.");
return false;
diff --git a/Code/Editor/BaseLibraryItem.cpp b/Code/Editor/BaseLibraryItem.cpp
index fd310eaf9f..252510c951 100644
--- a/Code/Editor/BaseLibraryItem.cpp
+++ b/Code/Editor/BaseLibraryItem.cpp
@@ -16,7 +16,7 @@
#include
-//undo object for multi-changes inside library item. such as set all variables to default values.
+//undo object for multi-changes inside library item. such as set all variables to default values.
//For example: change particle emitter shape will lead to multiple variable changes
class CUndoBaseLibraryItem
: public IUndoObject
@@ -54,24 +54,24 @@ public:
}
protected:
- virtual int GetSize()
- {
+ int GetSize() override
+ {
return m_size;
}
QString GetDescription() override
- {
- return m_description;
+ {
+ return m_description;
}
- virtual void Undo(bool bUndo)
+ void Undo(bool bUndo) override
{
//find the libItem
IDataBaseItem *libItem = m_libMgr->FindItemByName(m_itemPath);
if (libItem == nullptr)
{
//the undo stack is not reliable any more..
- assert(false);
+ assert(false);
return;
}
@@ -95,7 +95,7 @@ protected:
libItem->Serialize(m_undoCtx);
}
- virtual void Redo()
+ void Redo() override
{
//find the libItem
IDataBaseItem *libItem = m_libMgr->FindItemByName(m_itemPath);
@@ -124,7 +124,7 @@ private:
//////////////////////////////////////////////////////////////////////////
CBaseLibraryItem::CBaseLibraryItem()
{
- m_library = 0;
+ m_library = nullptr;
GenerateId();
m_bModified = false;
}
@@ -266,7 +266,7 @@ void CBaseLibraryItem::SetLibrary(CBaseLibrary* pLibrary)
void CBaseLibraryItem::SetModified(bool bModified)
{
m_bModified = bModified;
- if (m_bModified && m_library != NULL)
+ if (m_bModified && m_library != nullptr)
{
m_library->SetModified(bModified);
}
diff --git a/Code/Editor/BaseLibraryManager.cpp b/Code/Editor/BaseLibraryManager.cpp
index 8e555cae8c..6dd7dc58a5 100644
--- a/Code/Editor/BaseLibraryManager.cpp
+++ b/Code/Editor/BaseLibraryManager.cpp
@@ -26,7 +26,7 @@ class CUndoBaseLibraryManager
: public IUndoObject
{
public:
- CUndoBaseLibraryManager(CBaseLibraryManager* pMngr, const QString& description, const QString& modifiedManager = 0)
+ CUndoBaseLibraryManager(CBaseLibraryManager* pMngr, const QString& description, const QString& modifiedManager = nullptr)
: m_pMngr(pMngr)
, m_description(description)
, m_editorObject(modifiedManager)
@@ -35,16 +35,16 @@ public:
SerializeTo(m_undos);
}
- virtual QString GetEditorObjectName()
+ QString GetEditorObjectName() override
{
return m_editorObject;
}
protected:
- virtual int GetSize() { return sizeof(CUndoBaseLibraryManager); }
- virtual QString GetDescription() { return m_description; };
+ int GetSize() override { return sizeof(CUndoBaseLibraryManager); }
+ QString GetDescription() override { return m_description; };
- virtual void Undo(bool bUndo)
+ void Undo(bool bUndo) override
{
if (bUndo)
{
@@ -55,7 +55,7 @@ protected:
GetIEditor()->Notify(eNotify_OnDataBaseUpdate);
}
- virtual void Redo()
+ void Redo() override
{
m_pMngr->ClearAll();
UnserializeFrom(m_redos);
@@ -84,7 +84,7 @@ private:
for (int i = 0; i < m_pMngr->GetLibraryCount(); i++)
{
IDataBaseLibrary* library = m_pMngr->GetLibrary(i);
-
+
const char* tag = library->IsLevelLibrary() ? LEVEL_LIBRARY_TAG : LIBRARY_TAG;
XmlNodeRef node = GetIEditor()->GetSystem()->CreateXmlNode(tag);
QString file = library->GetFilename().isEmpty() ? library->GetFilename() : library->GetName();
@@ -203,7 +203,7 @@ int CBaseLibraryManager::FindLibraryIndex(const QString& library)
//////////////////////////////////////////////////////////////////////////
IDataBaseItem* CBaseLibraryManager::FindItem(REFGUID guid) const
{
- CBaseLibraryItem* pMtl = stl::find_in_map(m_itemsGuidMap, guid, (CBaseLibraryItem*)0);
+ CBaseLibraryItem* pMtl = stl::find_in_map(m_itemsGuidMap, guid, nullptr);
return pMtl;
}
@@ -226,7 +226,7 @@ void CBaseLibraryManager::SplitFullItemName(const QString& fullItemName, QString
IDataBaseItem* CBaseLibraryManager::FindItemByName(const QString& fullItemName)
{
AZStd::lock_guard lock(m_itemsNameMapMutex);
- return stl::find_in_map(m_itemsNameMap, fullItemName, 0);
+ return stl::find_in_map(m_itemsNameMap, fullItemName, nullptr);
}
//////////////////////////////////////////////////////////////////////////
@@ -398,7 +398,7 @@ void CBaseLibraryManager::DeleteLibrary(const QString& library, bool forceDelete
UnregisterItem((CBaseLibraryItem*)pLibrary->GetItem(j));
}
pLibrary->RemoveAllItems();
-
+
if (pLibrary->IsLevelLibrary())
{
m_pLevelLibrary = nullptr;
@@ -420,7 +420,7 @@ IDataBaseLibrary* CBaseLibraryManager::GetLibrary(int index) const
//////////////////////////////////////////////////////////////////////////
IDataBaseLibrary* CBaseLibraryManager::GetLevelLibrary() const
{
- IDataBaseLibrary* pLevelLib = NULL;
+ IDataBaseLibrary* pLevelLib = nullptr;
for (int i = 0; i < GetLibraryCount(); i++)
{
@@ -531,9 +531,9 @@ QString CBaseLibraryManager::MakeUniqueItemName(const QString& srcName, const QS
// search for strings in the database that might have a similar name (ignore case)
IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
- for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != NULL; pItem = pEnum->GetNext())
+ for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != nullptr; pItem = pEnum->GetNext())
{
- //Check if the item is in the target library first.
+ //Check if the item is in the target library first.
IDataBaseLibrary* itemLibrary = pItem->GetLibrary();
QString itemLibraryName;
if (itemLibrary)
@@ -590,7 +590,7 @@ QString CBaseLibraryManager::MakeUniqueItemName(const QString& srcName, const QS
void CBaseLibraryManager::Validate()
{
IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
- for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != NULL; pItem = pEnum->GetNext())
+ for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != nullptr; pItem = pEnum->GetNext())
{
pItem->Validate();
}
@@ -617,7 +617,7 @@ void CBaseLibraryManager::RegisterItem(CBaseLibraryItem* pItem, REFGUID newGuid)
{
return;
}
- CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, newGuid, (CBaseLibraryItem*)0);
+ CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, newGuid, nullptr);
if (!pOldItem)
{
pItem->m_guid = newGuid;
@@ -677,7 +677,7 @@ void CBaseLibraryManager::RegisterItem(CBaseLibraryItem* pItem)
{
return;
}
- CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, pItem->GetGUID(), (CBaseLibraryItem*)0);
+ CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, pItem->GetGUID(), nullptr);
if (!pOldItem)
{
m_itemsGuidMap[pItem->GetGUID()] = pItem;
@@ -789,7 +789,7 @@ QString CBaseLibraryManager::MakeFullItemName(IDataBaseLibrary* pLibrary, const
void CBaseLibraryManager::GatherUsedResources(CUsedResources& resources)
{
IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
- for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != NULL; pItem = pEnum->GetNext())
+ for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != nullptr; pItem = pEnum->GetNext())
{
pItem->GatherUsedResources(resources);
}
@@ -815,15 +815,15 @@ void CBaseLibraryManager::OnEditorNotifyEvent(EEditorNotifyEvent event)
switch (event)
{
case eNotify_OnBeginNewScene:
- SetSelectedItem(0);
+ SetSelectedItem(nullptr);
ClearAll();
break;
case eNotify_OnBeginSceneOpen:
- SetSelectedItem(0);
+ SetSelectedItem(nullptr);
ClearAll();
break;
case eNotify_OnCloseScene:
- SetSelectedItem(0);
+ SetSelectedItem(nullptr);
ClearAll();
break;
}
@@ -913,7 +913,7 @@ void CBaseLibraryManager::ChangeLibraryOrder(IDataBaseLibrary* lib, unsigned int
{
return;
}
-
+
for (int i = 0; i < m_libs.size(); i++)
{
if (lib == m_libs[i])
diff --git a/Code/Editor/CheckOutDialog.h b/Code/Editor/CheckOutDialog.h
index 7e7054ccdf..9ad64c57cf 100644
--- a/Code/Editor/CheckOutDialog.h
+++ b/Code/Editor/CheckOutDialog.h
@@ -34,7 +34,7 @@ public:
CANCEL = QDialog::Rejected
};
- CCheckOutDialog(const QString& file, QWidget* pParent = NULL); // standard constructor
+ CCheckOutDialog(const QString& file, QWidget* pParent = nullptr); // standard constructor
virtual ~CCheckOutDialog();
// Dialog Data
diff --git a/Code/Editor/Commands/CommandManager.cpp b/Code/Editor/Commands/CommandManager.cpp
index 90059ea195..0712e35e79 100644
--- a/Code/Editor/Commands/CommandManager.cpp
+++ b/Code/Editor/Commands/CommandManager.cpp
@@ -20,8 +20,8 @@
// AzToolsFramework
#include
-CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pFirst = 0;
-CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pLast = 0;
+CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pFirst = nullptr;
+CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pLast = nullptr;
CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::GetFirst()
{
@@ -31,7 +31,7 @@ CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::GetFirst()
CAutoRegisterCommandHelper::CAutoRegisterCommandHelper(void(*registerFunc)(CEditorCommandManager &))
{
m_registerFunc = registerFunc;
- m_pNext = 0;
+ m_pNext = nullptr;
if (!s_pLast)
{
diff --git a/Code/Editor/Commands/CommandManager.h b/Code/Editor/Commands/CommandManager.h
index 2ec4a137bc..761c79f79c 100644
--- a/Code/Editor/Commands/CommandManager.h
+++ b/Code/Editor/Commands/CommandManager.h
@@ -38,7 +38,7 @@ public:
void RegisterAutoCommands();
- bool AddCommand(CCommand* pCommand, TPfnDeleter deleter = NULL);
+ bool AddCommand(CCommand* pCommand, TPfnDeleter deleter = nullptr);
bool UnregisterCommand(const char* module, const char* name);
bool RegisterUICommand(
const char* module,
diff --git a/Code/Editor/ConfigGroup.cpp b/Code/Editor/ConfigGroup.cpp
index 4e61c38f4b..c1e0abbf31 100644
--- a/Code/Editor/ConfigGroup.cpp
+++ b/Code/Editor/ConfigGroup.cpp
@@ -48,7 +48,7 @@ namespace Config
}
}
- return NULL;
+ return nullptr;
}
const IConfigVar* CConfigGroup::GetVar(const char* szName) const
@@ -63,7 +63,7 @@ namespace Config
}
}
- return NULL;
+ return nullptr;
}
IConfigVar* CConfigGroup::GetVar(uint index)
@@ -73,7 +73,7 @@ namespace Config
return m_vars[index];
}
- return NULL;
+ return nullptr;
}
const IConfigVar* CConfigGroup::GetVar(uint index) const
@@ -83,7 +83,7 @@ namespace Config
return m_vars[index];
}
- return NULL;
+ return nullptr;
}
void CConfigGroup::SaveToXML(XmlNodeRef node)
@@ -127,7 +127,7 @@ namespace Config
case IConfigVar::eType_STRING:
{
- string currentValue = 0;
+ string currentValue = nullptr;
var->Get(¤tValue);
node->setAttr(szName, currentValue);
break;
@@ -186,7 +186,7 @@ namespace Config
case IConfigVar::eType_STRING:
{
- string currentValue = 0;
+ string currentValue = nullptr;
var->GetDefault(¤tValue);
QString readValue(currentValue.c_str());
if (node->getAttr(szName, readValue))
diff --git a/Code/Editor/ConfigGroup.h b/Code/Editor/ConfigGroup.h
index 35c0b8e47f..f772823ad8 100644
--- a/Code/Editor/ConfigGroup.h
+++ b/Code/Editor/ConfigGroup.h
@@ -37,11 +37,11 @@ namespace Config
, m_description(szDescription)
, m_type(varType)
, m_flags(flags)
- , m_ptr(NULL)
+ , m_ptr(nullptr)
{};
virtual ~IConfigVar() = default;
-
+
ILINE EType GetType() const
{
return m_type;
diff --git a/Code/Editor/ControlMRU.cpp b/Code/Editor/ControlMRU.cpp
index 47de13950f..a721876624 100644
--- a/Code/Editor/ControlMRU.cpp
+++ b/Code/Editor/ControlMRU.cpp
@@ -28,7 +28,7 @@ void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
CString* pArrNames = pRecentFileList->m_arrNames;
- assert(pArrNames != NULL);
+ assert(pArrNames != nullptr);
if (!pArrNames)
{
return;
@@ -52,7 +52,7 @@ void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
if (m_pParent->IsCustomizeMode())
{
m_dwHideFlags = 0;
- SetEnabled(TRUE);
+ SetEnabled(true);
return;
}
@@ -61,7 +61,7 @@ void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
SetCaption(CString(MAKEINTRESOURCE(IDS_NORECENTFILE_CAPTION)));
SetDescription("No recently opened files");
m_dwHideFlags = 0;
- SetEnabled(FALSE);
+ SetEnabled(false);
return;
}
@@ -105,7 +105,7 @@ void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
int nId = iMRU + GetFirstMruID();
- CXTPControl* pControl = m_pControls->Add(xtpControlButton, nId, _T(""), m_nIndex + iLastValidMRU + 1, TRUE);
+ CXTPControl* pControl = m_pControls->Add(xtpControlButton, nId, _T(""), m_nIndex + iLastValidMRU + 1, true);
assert(pControl);
pControl->SetCaption(CXTPControlWindowList::ConstructCaption(strName, iLastValidMRU + 1));
@@ -130,6 +130,6 @@ void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
SetCaption(CString(MAKEINTRESOURCE(IDS_NORECENTFILE_CAPTION)));
SetDescription("No recently opened files");
m_dwHideFlags = 0;
- SetEnabled(FALSE);
+ SetEnabled(false);
}
}
diff --git a/Code/Editor/Controls/BitmapToolTip.h b/Code/Editor/Controls/BitmapToolTip.h
index d4bb89c625..5b7c56cbf3 100644
--- a/Code/Editor/Controls/BitmapToolTip.h
+++ b/Code/Editor/Controls/BitmapToolTip.h
@@ -42,7 +42,7 @@ public:
CBitmapToolTip(QWidget* parent = nullptr);
virtual ~CBitmapToolTip();
- BOOL Create(const RECT& rect);
+ bool Create(const RECT& rect);
// Attributes
public:
diff --git a/Code/Editor/Controls/ColorGradientCtrl.cpp b/Code/Editor/Controls/ColorGradientCtrl.cpp
index 555d285192..3bd3b11690 100644
--- a/Code/Editor/Controls/ColorGradientCtrl.cpp
+++ b/Code/Editor/Controls/ColorGradientCtrl.cpp
@@ -29,7 +29,7 @@ CColorGradientCtrl::CColorGradientCtrl(QWidget* parent)
m_nHitKeyIndex = -1;
m_nKeyDrawRadius = 3;
m_bTracking = false;
- m_pSpline = 0;
+ m_pSpline = nullptr;
m_fMinTime = -1;
m_fMaxTime = 1;
m_fMinValue = -1;
@@ -474,7 +474,7 @@ void CColorGradientCtrl::SetActiveKey(int nIndex)
}
/////////////////////////////////////////////////////////////////////////////
-void CColorGradientCtrl::SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw)
+void CColorGradientCtrl::SetSpline(ISplineInterpolator* pSpline, bool bRedraw)
{
if (pSpline != m_pSpline)
{
@@ -501,7 +501,7 @@ ISplineInterpolator* CColorGradientCtrl::GetSpline()
/////////////////////////////////////////////////////////////////////////////
void CColorGradientCtrl::keyPressEvent(QKeyEvent* event)
{
- BOOL bProcessed = false;
+ bool bProcessed = false;
if (m_nActiveKey != -1 && m_pSpline)
{
diff --git a/Code/Editor/Controls/ColorGradientCtrl.h b/Code/Editor/Controls/ColorGradientCtrl.h
index 9533fecdfa..80d8b966f4 100644
--- a/Code/Editor/Controls/ColorGradientCtrl.h
+++ b/Code/Editor/Controls/ColorGradientCtrl.h
@@ -54,7 +54,7 @@ public:
// Lock value of first and last key to be the same.
void LockFirstAndLastKeys(bool bLock) { m_bLockFirstLastKey = bLock; }
- void SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw = FALSE);
+ void SetSpline(ISplineInterpolator* pSpline, bool bRedraw = false);
ISplineInterpolator* GetSpline();
void SetTimeMarker(float fTime);
diff --git a/Code/Editor/Controls/ConsoleSCB.cpp b/Code/Editor/Controls/ConsoleSCB.cpp
index 9f1921395c..7f018e0286 100644
--- a/Code/Editor/Controls/ConsoleSCB.cpp
+++ b/Code/Editor/Controls/ConsoleSCB.cpp
@@ -62,14 +62,14 @@ public:
}
protected:
- void highlightBlock(const QString &text)
+ void highlightBlock(const QString &text) override
{
auto pos = -1;
QTextCharFormat myClassFormat;
myClassFormat.setFontWeight(QFont::Bold);
myClassFormat.setBackground(Qt::yellow);
- while (1)
+ while (true)
{
pos = text.indexOf(m_searchTerm, pos+1, Qt::CaseInsensitive);
@@ -338,6 +338,8 @@ CConsoleSCB::CConsoleSCB(QWidget* parent)
connect(findPreviousAction, &QAction::triggered, this, &CConsoleSCB::findPrevious);
ui->findPrevButton->addAction(findPreviousAction);
+ GetIEditor()->RegisterNotifyListener(this);
+
connect(ui->button, &QPushButton::clicked, this, &CConsoleSCB::showVariableEditor);
connect(ui->findButton, &QPushButton::clicked, this, &CConsoleSCB::toggleConsoleSearch);
connect(ui->textEdit, &ConsoleTextEdit::searchBarRequested, this, [this]
@@ -376,6 +378,8 @@ CConsoleSCB::~CConsoleSCB()
{
AzToolsFramework::EditorPreferencesNotificationBus::Handler::BusDisconnect();
+ GetIEditor()->UnregisterNotifyListener(this);
+
s_consoleSCB = nullptr;
CLogFile::AttachEditBox(nullptr);
}
@@ -567,7 +571,7 @@ static CVarBlock* VarBlockFromConsoleVars()
size_t cmdCount = console->GetSortedVars(&cmds[0], cmds.size());
CVarBlock* vb = new CVarBlock;
- IVariable* pVariable = 0;
+ IVariable* pVariable = nullptr;
for (int i = 0; i < cmdCount; i++)
{
ICVar* pCVar = console->GetCVar(cmds[i]);
@@ -1352,4 +1356,19 @@ CConsoleSCB* CConsoleSCB::GetCreatedInstance()
return s_consoleSCB;
}
+void CConsoleSCB::OnEditorNotifyEvent(EEditorNotifyEvent event)
+{
+ switch (event)
+ {
+ case eNotify_OnBeginGameMode:
+ if (gSettings.clearConsoleOnGameModeStart)
+ {
+ ui->textEdit->clear();
+ }
+ break;
+ default:
+ break;
+ }
+}
+
#include
diff --git a/Code/Editor/Controls/ConsoleSCB.h b/Code/Editor/Controls/ConsoleSCB.h
index 98bf4b391d..f51786e2a5 100644
--- a/Code/Editor/Controls/ConsoleSCB.h
+++ b/Code/Editor/Controls/ConsoleSCB.h
@@ -159,6 +159,7 @@ private:
class CConsoleSCB
: public QWidget
, private AzToolsFramework::EditorPreferencesNotificationBus::Handler
+ , public IEditorNotifyListener
{
Q_OBJECT
public:
@@ -187,6 +188,8 @@ private Q_SLOTS:
void findNext();
private:
+ void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
+
QScopedPointer ui;
int m_richEditTextLength;
diff --git a/Code/Editor/Controls/HotTrackingTreeCtrl.cpp b/Code/Editor/Controls/HotTrackingTreeCtrl.cpp
index 917d02155b..54152a9fd4 100644
--- a/Code/Editor/Controls/HotTrackingTreeCtrl.cpp
+++ b/Code/Editor/Controls/HotTrackingTreeCtrl.cpp
@@ -19,22 +19,22 @@ CHotTrackingTreeCtrl::CHotTrackingTreeCtrl(QWidget* parent)
: QTreeWidget(parent)
{
setMouseTracking(true);
- m_hHoverItem = NULL;
+ m_hHoverItem = nullptr;
}
void CHotTrackingTreeCtrl::mouseMoveEvent(QMouseEvent* event)
{
QTreeWidgetItem* hItem = itemAt(event->pos());
- if (m_hHoverItem != NULL)
+ if (m_hHoverItem != nullptr)
{
QFont font = m_hHoverItem->font(0);
font.setBold(false);
m_hHoverItem->setFont(0, font);
- m_hHoverItem = NULL;
+ m_hHoverItem = nullptr;
}
- if (hItem != NULL)
+ if (hItem != nullptr)
{
QFont font = hItem->font(0);
font.setBold(true);
diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertiesPanel.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertiesPanel.cpp
index 323fe2a07a..8651db7e96 100644
--- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertiesPanel.cpp
+++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertiesPanel.cpp
@@ -27,7 +27,7 @@ void ReflectedPropertiesPanel::DeleteVars()
{
ClearVarBlock();
m_updateCallbacks.clear();
- m_varBlock = 0;
+ m_varBlock = nullptr;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp
index 89938d9735..1a7060aa8d 100644
--- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp
+++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp
@@ -198,7 +198,7 @@ void ReflectedPropertyControl::CreateItems(XmlNodeRef node)
void ReflectedPropertyControl::CreateItems(XmlNodeRef node, CVarBlockPtr& outBlockPtr, IVariable::OnSetCallback* func, bool splitCamelCaseIntoWords)
{
- SelectItem(0);
+ SelectItem(nullptr);
outBlockPtr = new CVarBlock;
for (size_t i = 0, iGroupCount(node->getChildCount()); i < iGroupCount; ++i)
@@ -505,7 +505,7 @@ void ReflectedPropertyControl::RemoveAllItems()
void ReflectedPropertyControl::ClearVarBlock()
{
RemoveAllItems();
- m_pVarBlock = 0;
+ m_pVarBlock = nullptr;
}
void ReflectedPropertyControl::RecreateAllItems()
@@ -688,11 +688,11 @@ void ReflectedPropertyControl::OnItemChange(ReflectedPropertyItem *item, bool de
// callback until after the current event queue is processed, so that we aren't changing other widgets
// as a ton of them are still being created.
Qt::ConnectionType connectionType = deferCallbacks ? Qt::QueuedConnection : Qt::DirectConnection;
- if (m_updateVarFunc != 0 && m_bEnableCallback)
+ if (m_updateVarFunc && m_bEnableCallback)
{
QMetaObject::invokeMethod(this, "DoUpdateCallback", connectionType, Q_ARG(IVariable*, item->GetVariable()));
}
- if (m_updateObjectFunc != 0 && m_bEnableCallback)
+ if (m_updateObjectFunc && m_bEnableCallback)
{
// KDAB: This callback has same signature as DoUpdateCallback. I think the only reason there are 2 is because some
// EntityObject registers callback and some derived objects want to register their own callback. the normal UpdateCallback
@@ -709,7 +709,7 @@ void ReflectedPropertyControl::DoUpdateCallback(IVariable *var)
const bool variableStillExists = FindVariable(var);
AZ_Assert(variableStillExists, "This variable and the item containing it were destroyed during a deferred callback. Change to non-deferred callback.");
- if (m_updateVarFunc == 0 || !variableStillExists)
+ if (!m_updateVarFunc || !variableStillExists)
{
return;
}
@@ -724,7 +724,7 @@ void ReflectedPropertyControl::DoUpdateObjectCallback(IVariable *var)
const bool variableStillExists = FindVariable(var);
AZ_Assert(variableStillExists, "This variable and the item containing it were destroyed during a deferred callback. Change to non-deferred callback.");
- if (m_updateVarFunc == 0 || !variableStillExists)
+ if ( !m_updateVarFunc || !variableStillExists)
{
return;
}
@@ -904,7 +904,7 @@ void ReflectedPropertyControl::SetUndoCallback(UndoCallback &callback)
void ReflectedPropertyControl::ClearUndoCallback()
{
- m_undoFunc = 0;
+ m_undoFunc = nullptr;
}
bool ReflectedPropertyControl::FindVariable(IVariable *categoryItem) const
diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.cpp
index 0bea6902c9..5a9d61be42 100644
--- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.cpp
+++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.cpp
@@ -82,7 +82,7 @@ public:
}
//helps implement ReflectedPropertyControl::ReplaceVarBlock
- void ReplaceVarBlock(CVarBlock *varBlock)
+ void ReplaceVarBlock(CVarBlock *varBlock) override
{
m_containerVar->Clear();
UpdateCommon(m_item->GetVariable(), varBlock);
@@ -207,7 +207,7 @@ void ReflectedPropertyItem::SetVariable(IVariable *var)
ReleaseVariable();
m_pVariable = pInputVar;
- assert(m_pVariable != NULL);
+ assert(m_pVariable != nullptr);
m_pVariable->AddOnSetCallback(&m_onSetCallback);
m_pVariable->AddOnSetEnumCallback(&m_onSetEnumCallback);
@@ -332,7 +332,7 @@ void ReflectedPropertyItem::RemoveAllChildren()
{
for (int i = 0; i < m_childs.size(); i++)
{
- m_childs[i]->m_parent = 0;
+ m_childs[i]->m_parent = nullptr;
}
m_childs.clear();
@@ -473,7 +473,7 @@ void ReflectedPropertyItem::ReleaseVariable()
m_pVariable->RemoveOnSetCallback(&m_onSetCallback);
m_pVariable->RemoveOnSetEnumCallback(&m_onSetEnumCallback);
}
- m_pVariable = 0;
+ m_pVariable = nullptr;
delete m_reflectedVarAdapter;
m_reflectedVarAdapter = nullptr;
}
diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.h b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.h
index 0abf7d295c..9bd34f3f7c 100644
--- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.h
+++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.h
@@ -122,7 +122,7 @@ protected:
public:
//! Get number of child nodes.
- int GetChildCount() const { return m_childs.size(); };
+ int GetChildCount() const { return static_cast(m_childs.size()); };
//! Get Child by id.
ReflectedPropertyItem* GetChild(int index) const { return m_childs[index]; }
PropertyType GetType() const { return m_type; }
diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp
index 20e86c6838..5639fa95b0 100644
--- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp
+++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp
@@ -473,7 +473,7 @@ void ReflectedVarUserAdapter::SyncReflectedVarToIVar(IVariable *pVariable)
//extract the list of custom items from the IVariable user data
IVariable::IGetCustomItems* pGetCustomItems = static_cast (pVariable->GetUserData().value());
- if (pGetCustomItems != 0)
+ if (pGetCustomItems != nullptr)
{
std::vector items;
QString dlgTitle;
diff --git a/Code/Editor/Controls/SplineCtrl.cpp b/Code/Editor/Controls/SplineCtrl.cpp
index 63481d27df..d66fc16ade 100644
--- a/Code/Editor/Controls/SplineCtrl.cpp
+++ b/Code/Editor/Controls/SplineCtrl.cpp
@@ -30,7 +30,7 @@ CSplineCtrl::CSplineCtrl(QWidget* parent)
m_nHitKeyIndex = -1;
m_nKeyDrawRadius = 3;
m_bTracking = false;
- m_pSpline = 0;
+ m_pSpline = nullptr;
m_gridX = 10;
m_gridY = 10;
m_fMinTime = -1;
@@ -40,7 +40,7 @@ CSplineCtrl::CSplineCtrl(QWidget* parent)
m_fTooltipScaleX = 1;
m_fTooltipScaleY = 1;
m_bLockFirstLastKey = false;
- m_pTimelineCtrl = 0;
+ m_pTimelineCtrl = nullptr;
m_bSelectedKeys.reserve(0);
@@ -417,7 +417,7 @@ void CSplineCtrl::SetActiveKey(int nIndex)
}
/////////////////////////////////////////////////////////////////////////////
-void CSplineCtrl::SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw)
+void CSplineCtrl::SetSpline(ISplineInterpolator* pSpline, bool bRedraw)
{
if (pSpline != m_pSpline)
{
@@ -596,7 +596,7 @@ CSplineCtrl::EHitCode CSplineCtrl::HitTest(const QPoint& point)
///////////////////////////////////////////////////////////////////////////////
void CSplineCtrl::StartTracking()
{
- m_bTracking = TRUE;
+ m_bTracking = true;
GetIEditor()->BeginUndo();
@@ -674,7 +674,7 @@ void CSplineCtrl::StopTracking()
GetIEditor()->AcceptUndo("Spline Move");
- m_bTracking = FALSE;
+ m_bTracking = false;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/Code/Editor/Controls/SplineCtrl.h b/Code/Editor/Controls/SplineCtrl.h
index e90fc1820e..ec5b3e52ce 100644
--- a/Code/Editor/Controls/SplineCtrl.h
+++ b/Code/Editor/Controls/SplineCtrl.h
@@ -59,7 +59,7 @@ public:
// Lock value of first and last key to be the same.
void LockFirstAndLastKeys(bool bLock) { m_bLockFirstLastKey = bLock; }
- void SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw = FALSE);
+ void SetSpline(ISplineInterpolator* pSpline, bool bRedraw = false);
ISplineInterpolator* GetSpline();
void SetTimeMarker(float fTime);
diff --git a/Code/Editor/Controls/SplineCtrlEx.cpp b/Code/Editor/Controls/SplineCtrlEx.cpp
index 2afc3f16aa..36a9d8afef 100644
--- a/Code/Editor/Controls/SplineCtrlEx.cpp
+++ b/Code/Editor/Controls/SplineCtrlEx.cpp
@@ -69,8 +69,8 @@ protected:
AbstractSplineWidget* pCtrl = FindControl(m_pCtrl);
m_splineEntries.resize(m_splineEntries.size() + 1);
SplineEntry& entry = m_splineEntries.back();
- ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : 0);
- entry.id = (pSplineSet ? pSplineSet->GetIDFromSpline(pSpline) : 0);
+ ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : nullptr);
+ entry.id = (pSplineSet ? pSplineSet->GetIDFromSpline(pSpline) : nullptr);
entry.pSpline = pSpline;
const int numKeys = pSpline->GetKeyCount();
@@ -81,10 +81,10 @@ protected:
}
}
- virtual int GetSize() { return sizeof(*this); }
- virtual QString GetDescription() { return "UndoSplineCtrlEx"; };
+ int GetSize() override { return sizeof(*this); }
+ QString GetDescription() override { return "UndoSplineCtrlEx"; };
- virtual void Undo(bool bUndo)
+ void Undo(bool bUndo) override
{
AbstractSplineWidget* pCtrl = FindControl(m_pCtrl);
if (pCtrl)
@@ -104,7 +104,7 @@ protected:
}
}
- virtual void Redo()
+ void Redo() override
{
AbstractSplineWidget* pCtrl = FindControl(m_pCtrl);
if (pCtrl)
@@ -134,7 +134,7 @@ private:
void SerializeSplines(_smart_ptr SplineEntry::* backup, bool bLoading)
{
AbstractSplineWidget* pCtrl = FindControl(m_pCtrl);
- ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : 0);
+ ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : nullptr);
for (auto it = m_splineEntries.begin(); it != m_splineEntries.end(); ++it)
{
SplineEntry& entry = *it;
@@ -157,19 +157,19 @@ private:
}
public:
- typedef std::list CSplineCtrls;
+ using CSplineCtrls = std::list;
static AbstractSplineWidget* FindControl(AbstractSplineWidget* pCtrl)
{
if (!pCtrl)
{
- return 0;
+ return nullptr;
}
auto iter = std::find(s_activeCtrls.begin(), s_activeCtrls.end(), pCtrl);
if (iter == s_activeCtrls.end())
{
- return 0;
+ return nullptr;
}
return *iter;
@@ -193,10 +193,10 @@ public:
static CSplineCtrls s_activeCtrls;
- virtual bool IsSelectionChanged() const
+ bool IsSelectionChanged() const override
{
AbstractSplineWidget* pCtrl = FindControl(m_pCtrl);
- ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : 0);
+ ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : nullptr);
for (auto it = m_splineEntries.begin(); it != m_splineEntries.end(); ++it)
{
@@ -256,11 +256,11 @@ SplineWidget::~SplineWidget()
AbstractSplineWidget::AbstractSplineWidget()
: m_defaultKeyTangentType(SPLINE_KEY_TANGENT_NONE)
{
- m_pTimelineCtrl = 0;
+ m_pTimelineCtrl = nullptr;
m_totalSplineCount = 0;
- m_pHitSpline = 0;
- m_pHitDetailSpline = 0;
+ m_pHitSpline = nullptr;
+ m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
m_nHitDimension = -1;
m_bHitIncomingHandle = true;
@@ -301,7 +301,7 @@ AbstractSplineWidget::AbstractSplineWidget()
m_boLeftMouseButtonDown = false;
- m_pSplineSet = 0;
+ m_pSplineSet = nullptr;
m_controlAmplitude = false;
@@ -1633,7 +1633,7 @@ void SplineWidget::wheelEvent(QWheelEvent* event)
void SplineWidget::keyPressEvent(QKeyEvent* e)
{
- BOOL bProcessed = false;
+ bool bProcessed = false;
switch (e->key())
{
@@ -1780,7 +1780,7 @@ void AbstractSplineWidget::SetHorizontalExtent([[maybe_unused]] int min, [[maybe
//si.nPage = max(0,m_rcClient.Width() - m_leftOffset*2);
//si.nPage = 1;
//si.nPage = 1;
- SetScrollInfo( SB_HORZ,&si,TRUE );
+ SetScrollInfo( SB_HORZ,&si,true );
*/
}
@@ -1792,7 +1792,7 @@ ISplineInterpolator* AbstractSplineWidget::HitSpline(const QPoint& point)
return m_pHitSpline;
}
- return NULL;
+ return nullptr;
}
//////////////////////////////////////////////////////////////////////////////
@@ -1806,8 +1806,8 @@ AbstractSplineWidget::EHitCode AbstractSplineWidget::HitTest(const QPoint& point
PointToTimeValue(point, time, val);
m_hitCode = HIT_NOTHING;
- m_pHitSpline = NULL;
- m_pHitDetailSpline = NULL;
+ m_pHitSpline = nullptr;
+ m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
m_nHitDimension = -1;
m_bHitIncomingHandle = true;
@@ -1968,8 +1968,8 @@ void AbstractSplineWidget::StopTracking()
void AbstractSplineWidget::ScaleAmplitudeKeys(float time, float startValue, float offset)
{
//TODO: Test it in the facial animation pane and fix it...
- m_pHitSpline = 0;
- m_pHitDetailSpline = 0;
+ m_pHitSpline = nullptr;
+ m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
m_nHitDimension = -1;
@@ -2071,8 +2071,8 @@ void AbstractSplineWidget::TimeScaleKeys(float time, float startTime, float endT
float timeScaleC = endTime - startTime * timeScaleM;
// Loop through all keys that are selected.
- m_pHitSpline = 0;
- m_pHitDetailSpline = 0;
+ m_pHitSpline = nullptr;
+ m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
float affectedRangeMin = FLT_MAX;
@@ -2179,8 +2179,8 @@ void AbstractSplineWidget::ValueScaleKeys(float startValue, float endValue)
}
// Loop through all keys that are selected.
- m_pHitSpline = 0;
- m_pHitDetailSpline = 0;
+ m_pHitSpline = nullptr;
+ m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
m_nHitDimension = -1;
@@ -2212,8 +2212,8 @@ void AbstractSplineWidget::ValueScaleKeys(float startValue, float endValue)
//////////////////////////////////////////////////////////////////////////
void AbstractSplineWidget::MoveSelectedKeys(Vec2 offset, bool copyKeys)
{
- m_pHitSpline = 0;
- m_pHitDetailSpline = 0;
+ m_pHitSpline = nullptr;
+ m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
m_nHitDimension = -1;
@@ -2275,8 +2275,8 @@ void AbstractSplineWidget::RemoveKey(ISplineInterpolator* pSpline, int nKey)
SendNotifyEvent(SPLN_BEFORE_CHANGE);
- m_pHitSpline = 0;
- m_pHitDetailSpline = 0;
+ m_pHitSpline = nullptr;
+ m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
if (nKey != -1)
{
@@ -2294,8 +2294,8 @@ void AbstractSplineWidget::RemoveSelectedKeys()
SendNotifyEvent(SPLN_BEFORE_CHANGE);
- m_pHitSpline = 0;
- m_pHitDetailSpline = 0;
+ m_pHitSpline = nullptr;
+ m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
@@ -2558,11 +2558,11 @@ public:
};
void AbstractSplineWidget::DuplicateSelectedKeys()
{
- m_pHitSpline = 0;
- m_pHitDetailSpline = 0;
+ m_pHitSpline = nullptr;
+ m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
- typedef std::vector KeysToAddContainer;
+ using KeysToAddContainer = std::vector;
KeysToAddContainer keysToInsert;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
@@ -2600,7 +2600,7 @@ void AbstractSplineWidget::ZeroAll()
{
GetIEditor()->BeginUndo();
- typedef std::vector SplineContainer;
+ using SplineContainer = std::vector;
SplineContainer splines;
for (int splineIndex = 0; splineIndex < int(m_splines.size()); ++splineIndex)
{
@@ -2632,7 +2632,7 @@ void AbstractSplineWidget::KeyAll()
{
GetIEditor()->BeginUndo();
- typedef std::vector SplineContainer;
+ using SplineContainer = std::vector;
SplineContainer splines;
for (int splineIndex = 0; splineIndex < int(m_splines.size()); ++splineIndex)
{
diff --git a/Code/Editor/Controls/TimelineCtrl.cpp b/Code/Editor/Controls/TimelineCtrl.cpp
index d1590c5346..a5a941fc78 100644
--- a/Code/Editor/Controls/TimelineCtrl.cpp
+++ b/Code/Editor/Controls/TimelineCtrl.cpp
@@ -58,7 +58,7 @@ TimelineWidget::TimelineWidget(QWidget* parent /* = nullptr */)
m_bIgnoreSetTime = false;
- m_pKeyTimeSet = 0;
+ m_pKeyTimeSet = nullptr;
m_markerStyle = MARKER_STYLE_SECONDS;
m_fps = 30.0f;
diff --git a/Code/Editor/Core/LevelEditorMenuHandler.cpp b/Code/Editor/Core/LevelEditorMenuHandler.cpp
index 3c27c25c9a..3724993604 100644
--- a/Code/Editor/Core/LevelEditorMenuHandler.cpp
+++ b/Code/Editor/Core/LevelEditorMenuHandler.cpp
@@ -80,12 +80,12 @@ namespace
, m_trigger(trigger)
{}
- virtual ~EditorListener()
+ ~EditorListener() override
{
GetIEditor()->UnregisterNotifyListener(this);
}
- void OnEditorNotifyEvent(EEditorNotifyEvent event)
+ void OnEditorNotifyEvent(EEditorNotifyEvent event) override
{
m_trigger(event);
}
@@ -544,12 +544,12 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe
auto snapMenu = modifyMenu.AddMenu(tr("Snap"));
- snapMenu.AddAction(ID_SNAPANGLE);
+ snapMenu.AddAction(AzToolsFramework::SnapAngle);
auto transformModeMenu = modifyMenu.AddMenu(tr("Transform Mode"));
- transformModeMenu.AddAction(ID_EDITMODE_MOVE);
- transformModeMenu.AddAction(ID_EDITMODE_ROTATE);
- transformModeMenu.AddAction(ID_EDITMODE_SCALE);
+ transformModeMenu.AddAction(AzToolsFramework::EditModeMove);
+ transformModeMenu.AddAction(AzToolsFramework::EditModeRotate);
+ transformModeMenu.AddAction(AzToolsFramework::EditModeScale);
editMenu.AddSeparator();
diff --git a/Code/Editor/Core/QtEditorApplication.cpp b/Code/Editor/Core/QtEditorApplication.cpp
index 46e789cd7c..0776a96a4d 100644
--- a/Code/Editor/Core/QtEditorApplication.cpp
+++ b/Code/Editor/Core/QtEditorApplication.cpp
@@ -415,33 +415,37 @@ namespace Editor
}
// Ensure that the Windows WM_INPUT messages get passed through to the AzFramework input system.
- // These events are now consumed both in and out of game mode.
- if (msg->message == WM_INPUT)
+ // These events are only broadcast in game mode. In Editor mode, RenderViewportWidget creates synthetic
+ // keyboard and mouse events via Qt.
+ if (GetIEditor()->IsInGameMode())
{
- UINT rawInputSize;
- const UINT rawInputHeaderSize = sizeof(RAWINPUTHEADER);
- GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, NULL, &rawInputSize, rawInputHeaderSize);
-
- AZStd::array rawInputBytesArray;
- LPBYTE rawInputBytes = rawInputBytesArray.data();
-
- const UINT bytesCopied = GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, rawInputBytes, &rawInputSize, rawInputHeaderSize);
- CRY_ASSERT(bytesCopied == rawInputSize);
-
- RAWINPUT* rawInput = (RAWINPUT*)rawInputBytes;
- CRY_ASSERT(rawInput);
-
- AzFramework::RawInputNotificationBusWindows::Broadcast(&AzFramework::RawInputNotificationsWindows::OnRawInputEvent, *rawInput);
-
- return false;
- }
- else if (msg->message == WM_DEVICECHANGE)
- {
- if (msg->wParam == 0x0007) // DBT_DEVNODES_CHANGED
+ if (msg->message == WM_INPUT)
{
- AzFramework::RawInputNotificationBusWindows::Broadcast(&AzFramework::RawInputNotificationsWindows::OnRawInputDeviceChangeEvent);
+ UINT rawInputSize;
+ const UINT rawInputHeaderSize = sizeof(RAWINPUTHEADER);
+ GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, nullptr, &rawInputSize, rawInputHeaderSize);
+
+ AZStd::array rawInputBytesArray;
+ LPBYTE rawInputBytes = rawInputBytesArray.data();
+
+ const UINT bytesCopied = GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, rawInputBytes, &rawInputSize, rawInputHeaderSize);
+ CRY_ASSERT(bytesCopied == rawInputSize);
+
+ RAWINPUT* rawInput = (RAWINPUT*)rawInputBytes;
+ CRY_ASSERT(rawInput);
+
+ AzFramework::RawInputNotificationBusWindows::Broadcast(&AzFramework::RawInputNotificationsWindows::OnRawInputEvent, *rawInput);
+
+ return false;
+ }
+ else if (msg->message == WM_DEVICECHANGE)
+ {
+ if (msg->wParam == 0x0007) // DBT_DEVNODES_CHANGED
+ {
+ AzFramework::RawInputNotificationBusWindows::Broadcast(&AzFramework::RawInputNotificationsWindows::OnRawInputDeviceChangeEvent);
+ }
+ return true;
}
- return true;
}
return false;
diff --git a/Code/Editor/Core/Tests/test_Main.cpp b/Code/Editor/Core/Tests/test_Main.cpp
index c0772753c6..6acedb6e57 100644
--- a/Code/Editor/Core/Tests/test_Main.cpp
+++ b/Code/Editor/Core/Tests/test_Main.cpp
@@ -26,7 +26,7 @@ class EditorCoreTestEnvironment
public:
AZ_TEST_CLASS_ALLOCATOR(EditorCoreTestEnvironment);
- virtual ~EditorCoreTestEnvironment()
+ ~EditorCoreTestEnvironment() override
{
}
diff --git a/Code/Editor/CrtDebug.cpp b/Code/Editor/CrtDebug.cpp
index a37b3d26e9..f9335373da 100644
--- a/Code/Editor/CrtDebug.cpp
+++ b/Code/Editor/CrtDebug.cpp
@@ -62,7 +62,7 @@ int crtAllocHook(int nAllocType, void* pvData,
{
if (nBlockUse == _CRT_BLOCK)
{
- return(TRUE);
+ return TRUE;
}
static int total_cnt = 0;
diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp
index 4bfc6a319d..8cede89f8a 100644
--- a/Code/Editor/CryEdit.cpp
+++ b/Code/Editor/CryEdit.cpp
@@ -127,7 +127,6 @@ AZ_POP_DISABLE_WARNING
#include "Util/AutoDirectoryRestoreFileDialog.h"
#include "Util/EditorAutoLevelLoadTest.h"
-#include "Util/IndexedFiles.h"
#include "AboutDialog.h"
#include
@@ -267,13 +266,13 @@ CCrySingleDocTemplate* CCryDocManager::SetDefaultTemplate(CCrySingleDocTemplate*
// Copied from MFC to get rid of the silly ugly unoverridable doc-type pick dialog
void CCryDocManager::OnFileNew()
{
- assert(m_pDefTemplate != NULL);
+ assert(m_pDefTemplate != nullptr);
- m_pDefTemplate->OpenDocumentFile(NULL);
+ m_pDefTemplate->OpenDocumentFile(nullptr);
// if returns NULL, the user has already been alerted
}
-BOOL CCryDocManager::DoPromptFileName(QString& fileName, [[maybe_unused]] UINT nIDSTitle,
- [[maybe_unused]] DWORD lFlags, BOOL bOpenFileDialog, [[maybe_unused]] CDocTemplate* pTemplate)
+bool CCryDocManager::DoPromptFileName(QString& fileName, [[maybe_unused]] UINT nIDSTitle,
+ [[maybe_unused]] DWORD lFlags, bool bOpenFileDialog, [[maybe_unused]] CDocTemplate* pTemplate)
{
CLevelFileDialog levelFileDialog(bOpenFileDialog);
levelFileDialog.show();
@@ -287,15 +286,15 @@ BOOL CCryDocManager::DoPromptFileName(QString& fileName, [[maybe_unused]] UINT n
return false;
}
-CCryEditDoc* CCryDocManager::OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToMRU)
+CCryEditDoc* CCryDocManager::OpenDocumentFile(LPCTSTR lpszFileName, bool bAddToMRU)
{
- assert(lpszFileName != NULL);
+ assert(lpszFileName != nullptr);
// find the highest confidence
auto pos = m_templateList.begin();
CCrySingleDocTemplate::Confidence bestMatch = CCrySingleDocTemplate::noAttempt;
- CCrySingleDocTemplate* pBestTemplate = NULL;
- CCryEditDoc* pOpenDocument = NULL;
+ CCrySingleDocTemplate* pBestTemplate = nullptr;
+ CCryEditDoc* pOpenDocument = nullptr;
if (lpszFileName[0] == '\"')
{
@@ -312,7 +311,7 @@ CCryEditDoc* CCryDocManager::OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToM
auto pTemplate = *(pos++);
CCrySingleDocTemplate::Confidence match;
- assert(pOpenDocument == NULL);
+ assert(pOpenDocument == nullptr);
match = pTemplate->MatchDocType(szPath.toUtf8().data(), pOpenDocument);
if (match > bestMatch)
{
@@ -325,18 +324,18 @@ CCryEditDoc* CCryDocManager::OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToM
}
}
- if (pOpenDocument != NULL)
+ if (pOpenDocument != nullptr)
{
return pOpenDocument;
}
- if (pBestTemplate == NULL)
+ if (pBestTemplate == nullptr)
{
QMessageBox::critical(AzToolsFramework::GetActiveWindow(), QString(), QObject::tr("Failed to open document."));
- return NULL;
+ return nullptr;
}
- return pBestTemplate->OpenDocumentFile(szPath.toUtf8().data(), bAddToMRU, FALSE);
+ return pBestTemplate->OpenDocumentFile(szPath.toUtf8().data(), bAddToMRU, false);
}
//////////////////////////////////////////////////////////////////////////////
@@ -375,9 +374,6 @@ void CCryEditApp::RegisterActionHandlers()
});
ON_COMMAND(ID_MOVE_OBJECT, OnMoveObject)
ON_COMMAND(ID_RENAME_OBJ, OnRenameObj)
- ON_COMMAND(ID_EDITMODE_MOVE, OnEditmodeMove)
- ON_COMMAND(ID_EDITMODE_ROTATE, OnEditmodeRotate)
- ON_COMMAND(ID_EDITMODE_SCALE, OnEditmodeScale)
ON_COMMAND(ID_UNDO, OnUndo)
ON_COMMAND(ID_TOOLBAR_WIDGET_REDO, OnUndo) // Can't use the same ID, because for the menu we can't have a QWidgetAction, while for the toolbar we want one
ON_COMMAND(ID_IMPORT_ASSET, OnOpenAssetImporter)
@@ -464,7 +460,7 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_FILE_SAVE_LEVEL, OnFileSave)
ON_COMMAND(ID_FILE_EXPORTOCCLUSIONMESH, OnFileExportOcclusionMesh)
- // Project Manager
+ // Project Manager
ON_COMMAND(ID_FILE_PROJECT_MANAGER_SETTINGS, OnOpenProjectManagerSettings)
ON_COMMAND(ID_FILE_PROJECT_MANAGER_NEW, OnOpenProjectManagerNew)
ON_COMMAND(ID_FILE_PROJECT_MANAGER_OPEN, OnOpenProjectManager)
@@ -657,7 +653,7 @@ struct SharedData
//
// This function uses a technique similar to that described in KB
// article Q141752 to locate the previous instance of the application. .
-BOOL CCryEditApp::FirstInstance(bool bForceNewInstance)
+bool CCryEditApp::FirstInstance(bool bForceNewInstance)
{
QSystemSemaphore sem(QString(O3DEApplicationName) + "_sem", 1);
sem.acquire();
@@ -805,12 +801,12 @@ void CCryEditApp::InitDirectory()
// Needed to work with custom memory manager.
//////////////////////////////////////////////////////////////////////////
-CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible /*= true*/)
+CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, bool bMakeVisible /*= true*/)
{
return OpenDocumentFile(lpszPathName, true, bMakeVisible);
}
-CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, BOOL bAddToMRU, [[maybe_unused]] BOOL bMakeVisible)
+CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, bool bAddToMRU, [[maybe_unused]] bool bMakeVisible)
{
CCryEditDoc* pCurDoc = GetIEditor()->GetDocument();
@@ -851,8 +847,8 @@ CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, BOOL
CCrySingleDocTemplate::Confidence CCrySingleDocTemplate::MatchDocType(LPCTSTR lpszPathName, CCryEditDoc*& rpDocMatch)
{
- assert(lpszPathName != NULL);
- rpDocMatch = NULL;
+ assert(lpszPathName != nullptr);
+ rpDocMatch = nullptr;
// go through all documents
CCryEditDoc* pDoc = GetIEditor()->GetDocument();
@@ -1059,7 +1055,7 @@ AZ::Outcome CCryEditApp::InitGameSystem(HWND hwndForInputSy
}
/////////////////////////////////////////////////////////////////////////////
-BOOL CCryEditApp::CheckIfAlreadyRunning()
+bool CCryEditApp::CheckIfAlreadyRunning()
{
bool bForceNewInstance = false;
@@ -1303,7 +1299,7 @@ void CCryEditApp::InitLevel(const CEditCommandLineInfo& cmdInfo)
}
/////////////////////////////////////////////////////////////////////////////
-BOOL CCryEditApp::InitConsole()
+bool CCryEditApp::InitConsole()
{
// Execute command from cmdline -exec_line if applicable
if (!m_execLineCmd.isEmpty())
@@ -1435,7 +1431,7 @@ struct CCryEditApp::PythonOutputHandler
AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusConnect();
}
- virtual ~PythonOutputHandler()
+ ~PythonOutputHandler() override
{
AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusDisconnect();
}
@@ -1467,7 +1463,7 @@ struct PythonTestOutputHandler final
: public CCryEditApp::PythonOutputHandler
{
PythonTestOutputHandler() = default;
- virtual ~PythonTestOutputHandler() = default;
+ ~PythonTestOutputHandler() override = default;
void OnTraceMessage(AZStd::string_view message) override
{
@@ -1593,7 +1589,7 @@ void CCryEditApp::RunInitPythonScript(CEditCommandLineInfo& cmdInfo)
/////////////////////////////////////////////////////////////////////////////
// CCryEditApp initialization
-BOOL CCryEditApp::InitInstance()
+bool CCryEditApp::InitInstance()
{
QElapsedTimer startupTimer;
startupTimer.start();
@@ -1620,7 +1616,7 @@ BOOL CCryEditApp::InitInstance()
{
CAboutDialog aboutDlg(FormatVersion(m_pEditor->GetFileVersion()), FormatRichTextCopyrightNotice());
aboutDlg.exec();
- return FALSE;
+ return false;
}
// Reflect property control classes to the serialize context...
@@ -1718,18 +1714,6 @@ BOOL CCryEditApp::InitInstance()
if (IsInRegularEditorMode())
{
- CIndexedFiles::Create();
-
- if (gEnv->pConsole->GetCVar("ed_indexfiles")->GetIVal())
- {
- Log("Started game resource files indexing...");
- CIndexedFiles::StartFileIndexing();
- }
- else
- {
- Log("Game resource files indexing is disabled.");
- }
-
// QuickAccessBar creation should be before m_pMainWnd->SetFocus(),
// since it receives the focus at creation time. It brakes MainFrame key accelerators.
m_pQuickAccessBar = new CQuickAccessBar;
@@ -1775,7 +1759,7 @@ BOOL CCryEditApp::InitInstance()
}
}
- SetEditorWindowTitle(0, AZ::Utils::GetProjectName().c_str(), 0);
+ SetEditorWindowTitle(nullptr, AZ::Utils::GetProjectName().c_str(), nullptr);
if (!GetIEditor()->IsInMatEditMode())
{
m_pEditor->InitFinished();
@@ -1860,8 +1844,8 @@ void CCryEditApp::RegisterEventLoopHook(IEventLoopHook* pHook)
void CCryEditApp::UnregisterEventLoopHook(IEventLoopHook* pHookToRemove)
{
- IEventLoopHook* pPrevious = 0;
- for (IEventLoopHook* pHook = m_pEventLoopHook; pHook != 0; pHook = pHook->pNextHook)
+ IEventLoopHook* pPrevious = nullptr;
+ for (IEventLoopHook* pHook = m_pEventLoopHook; pHook != nullptr; pHook = pHook->pNextHook)
{
if (pHook == pHookToRemove)
{
@@ -1874,7 +1858,7 @@ void CCryEditApp::UnregisterEventLoopHook(IEventLoopHook* pHookToRemove)
m_pEventLoopHook = pHookToRemove->pNextHook;
}
- pHookToRemove->pNextHook = 0;
+ pHookToRemove->pNextHook = nullptr;
return;
}
}
@@ -1897,7 +1881,7 @@ void CCryEditApp::LoadFile(QString fileName)
if (MainWindow::instance() || m_pConsoleDialog)
{
- SetEditorWindowTitle(0, AZ::Utils::GetProjectName().c_str(), GetIEditor()->GetGameEngine()->GetLevelName());
+ SetEditorWindowTitle(nullptr, AZ::Utils::GetProjectName().c_str(), GetIEditor()->GetGameEngine()->GetLevelName());
}
GetIEditor()->SetModifiedFlag(false);
@@ -1938,7 +1922,7 @@ void CCryEditApp::EnableAccelerator([[maybe_unused]] bool bEnable)
CMainFrame *mainFrame = (CMainFrame*)m_pMainWnd;
if (mainFrame->m_hAccelTable)
DestroyAcceleratorTable( mainFrame->m_hAccelTable );
- mainFrame->m_hAccelTable = NULL;
+ mainFrame->m_hAccelTable = nullptr;
mainFrame->LoadAccelTable( MAKEINTRESOURCE(IDR_GAMEACCELERATOR) );
CLogFile::WriteLine( "Disable Accelerators" );
}
@@ -2166,12 +2150,6 @@ int CCryEditApp::ExitInstance(int exitCode)
}
}
- if (IsInRegularEditorMode())
- {
- CIndexedFiles::AbortFileIndexing();
- CIndexedFiles::Destroy();
- }
-
if (GetIEditor() && !GetIEditor()->IsInMatEditMode())
{
//Nobody seems to know in what case that kind of exit can happen so instrumented to see if it happens at all
@@ -2281,7 +2259,7 @@ void CCryEditApp::EnableIdleProcessing()
AZ_Assert(m_disableIdleProcessingCounter >= 0, "m_disableIdleProcessingCounter must be nonnegative");
}
-BOOL CCryEditApp::OnIdle([[maybe_unused]] LONG lCount)
+bool CCryEditApp::OnIdle([[maybe_unused]] LONG lCount)
{
if (0 == m_disableIdleProcessingCounter)
{
@@ -2289,7 +2267,7 @@ BOOL CCryEditApp::OnIdle([[maybe_unused]] LONG lCount)
}
else
{
- return 0;
+ return false;
}
}
@@ -2579,75 +2557,6 @@ void CCryEditApp::OnRenameObj()
{
}
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::OnEditmodeMove()
-{
- using namespace AzToolsFramework;
- EditorTransformComponentSelectionRequestBus::Event(
- GetEntityContextId(),
- &EditorTransformComponentSelectionRequests::SetTransformMode,
- EditorTransformComponentSelectionRequests::Mode::Translation);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::OnEditmodeRotate()
-{
- using namespace AzToolsFramework;
- EditorTransformComponentSelectionRequestBus::Event(
- GetEntityContextId(),
- &EditorTransformComponentSelectionRequests::SetTransformMode,
- EditorTransformComponentSelectionRequests::Mode::Rotation);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::OnEditmodeScale()
-{
- using namespace AzToolsFramework;
- EditorTransformComponentSelectionRequestBus::Event(
- GetEntityContextId(),
- &EditorTransformComponentSelectionRequests::SetTransformMode,
- EditorTransformComponentSelectionRequests::Mode::Scale);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::OnUpdateEditmodeMove(QAction* action)
-{
- Q_ASSERT(action->isCheckable());
-
- AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
- AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
- mode, AzToolsFramework::GetEntityContextId(),
- &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
-
- action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Translation);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::OnUpdateEditmodeRotate(QAction* action)
-{
- Q_ASSERT(action->isCheckable());
-
- AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
- AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
- mode, AzToolsFramework::GetEntityContextId(),
- &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
-
- action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Rotation);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CCryEditApp::OnUpdateEditmodeScale(QAction* action)
-{
- Q_ASSERT(action->isCheckable());
-
- AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
- AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
- mode, AzToolsFramework::GetEntityContextId(),
- &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
-
- action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Scale);
-}
-
void CCryEditApp::OnViewSwitchToGame()
{
if (IsInPreviewMode())
@@ -2901,7 +2810,14 @@ void CCryEditApp::OpenProjectManager(const AZStd::string& screen)
{
// provide the current project path for in case we want to update the project
AZ::IO::FixedMaxPathString projectPath = AZ::Utils::GetProjectPath();
- const AZStd::string commandLineOptions = AZStd::string::format(" --screen %s --project-path %s", screen.c_str(), projectPath.c_str());
+#if !AZ_TRAIT_OS_PLATFORM_APPLE && !AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS
+ const char* argumentQuoteString = R"(")";
+#else
+ const char* argumentQuoteString = R"(\")";
+#endif
+ const AZStd::string commandLineOptions = AZStd::string::format(R"( --screen %s --project-path %s%s%s)",
+ screen.c_str(),
+ argumentQuoteString, projectPath.c_str(), argumentQuoteString);
bool launchSuccess = AzFramework::ProjectManager::LaunchProjectManager(commandLineOptions);
if (!launchSuccess)
{
@@ -3226,7 +3142,7 @@ void CCryEditApp::OnCreateLevel()
//////////////////////////////////////////////////////////////////////////
bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
{
- BOOL bIsDocModified = GetIEditor()->GetDocument()->IsModified();
+ bool bIsDocModified = GetIEditor()->GetDocument()->IsModified();
if (GetIEditor()->GetDocument()->IsDocumentReady() && bIsDocModified)
{
QString str = QObject::tr("Level %1 has been changed. Save Level?").arg(GetIEditor()->GetGameEngine()->GetLevelName());
@@ -3314,11 +3230,11 @@ bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
#ifdef WIN32
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
+ nullptr,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
windowsErrorMessage.data(),
- windowsErrorMessage.length(), NULL);
+ windowsErrorMessage.length(), nullptr);
_getcwd(cwd.data(), cwd.length());
#else
windowsErrorMessage = strerror(dw);
@@ -3728,24 +3644,12 @@ void CCryEditApp::OnToolsPreferences()
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnSwitchToDefaultCamera()
{
- CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
- if (CRenderViewport* rvp = viewport_cast(vp))
- {
- rvp->SetDefaultCamera();
- }
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateSwitchToDefaultCamera(QAction* action)
{
Q_ASSERT(action->isCheckable());
- CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
- if (CRenderViewport* rvp = viewport_cast(pViewport))
- {
- action->setEnabled(true);
- action->setChecked(rvp->IsDefaultCamera());
- }
- else
{
action->setEnabled(false);
}
@@ -3754,39 +3658,12 @@ void CCryEditApp::OnUpdateSwitchToDefaultCamera(QAction* action)
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnSwitchToSequenceCamera()
{
- CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
- if (CRenderViewport* rvp = viewport_cast(vp))
- {
- rvp->SetSequenceCamera();
- }
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateSwitchToSequenceCamera(QAction* action)
{
Q_ASSERT(action->isCheckable());
-
- CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
-
- if (CRenderViewport* rvp = viewport_cast(pViewport))
- {
- bool enableAction = false;
-
- // only enable if we're editing a sequence in Track View and have cameras in the level
- if (GetIEditor()->GetAnimation()->GetSequence())
- {
-
- AZ::EBusAggregateResults componentCameras;
- Camera::CameraBus::BroadcastResult(componentCameras, &Camera::CameraRequests::GetCameras);
-
- const int numCameras = componentCameras.values.size();
- enableAction = (numCameras > 0);
- }
-
- action->setEnabled(enableAction);
- action->setChecked(rvp->IsSequenceCamera());
- }
- else
{
action->setEnabled(false);
}
@@ -3795,31 +3672,12 @@ void CCryEditApp::OnUpdateSwitchToSequenceCamera(QAction* action)
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnSwitchToSelectedcamera()
{
- CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
- if (CRenderViewport* rvp = viewport_cast(vp))
- {
- rvp->SetSelectedCamera();
- }
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateSwitchToSelectedCamera(QAction* action)
{
Q_ASSERT(action->isCheckable());
- AzToolsFramework::EntityIdList selectedEntityList;
- AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
- AZ::EBusAggregateResults cameras;
- Camera::CameraBus::BroadcastResult(cameras, &Camera::CameraRequests::GetCameras);
- bool isCameraComponentSelected = selectedEntityList.size() > 0 ? AZStd::find(cameras.values.begin(), cameras.values.end(), *selectedEntityList.begin()) != cameras.values.end() : false;
-
- CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
- CRenderViewport* rvp = viewport_cast(pViewport);
- if (isCameraComponentSelected && rvp)
- {
- action->setEnabled(true);
- action->setChecked(rvp->IsSelectedCamera());
- }
- else
{
action->setEnabled(false);
}
@@ -3828,11 +3686,7 @@ void CCryEditApp::OnUpdateSwitchToSelectedCamera(QAction* action)
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnSwitchcameraNext()
{
- CViewport* vp = GetIEditor()->GetActiveView();
- if (CRenderViewport* rvp = viewport_cast(vp))
- {
- rvp->CycleCamera();
- }
+
}
//////////////////////////////////////////////////////////////////////////
@@ -3905,7 +3759,7 @@ bool CCryEditApp::IsInRegularEditorMode()
void CCryEditApp::OnOpenQuickAccessBar()
{
- if (m_pQuickAccessBar == NULL)
+ if (m_pQuickAccessBar == nullptr)
{
return;
}
@@ -4253,7 +4107,7 @@ extern "C" int AZ_DLL_EXPORT CryEditMain(int argc, char* argv[])
int exitCode = 0;
- BOOL didCryEditStart = CCryEditApp::instance()->InitInstance();
+ bool didCryEditStart = CCryEditApp::instance()->InitInstance();
AZ_Error("Editor", didCryEditStart, "O3DE Editor did not initialize correctly, and will close."
"\nThis could be because of incorrectly configured components, or missing required gems."
"\nSee other errors for more details.");
diff --git a/Code/Editor/CryEdit.h b/Code/Editor/CryEdit.h
index af0fbb0971..9e3dfc98ff 100644
--- a/Code/Editor/CryEdit.h
+++ b/Code/Editor/CryEdit.h
@@ -135,16 +135,16 @@ public:
virtual void AddToRecentFileList(const QString& lpszPathName);
ECreateLevelResult CreateLevel(const QString& levelName, QString& fullyQualifiedLevelName);
static void InitDirectory();
- BOOL FirstInstance(bool bForceNewInstance = false);
+ bool FirstInstance(bool bForceNewInstance = false);
void InitFromCommandLine(CEditCommandLineInfo& cmdInfo);
- BOOL CheckIfAlreadyRunning();
+ bool CheckIfAlreadyRunning();
//! @return successful outcome if initialization succeeded. or failed outcome with error message.
AZ::Outcome InitGameSystem(HWND hwndForInputSystem);
void CreateSplashScreen();
void InitPlugins();
bool InitGame();
- BOOL InitConsole();
+ bool InitConsole();
int IdleProcessing(bool bBackground);
bool IsWindowInForeground();
void RunInitPythonScript(CEditCommandLineInfo& cmdInfo);
@@ -171,9 +171,9 @@ public:
// Overrides
// ClassWizard generated virtual function overrides
public:
- virtual BOOL InitInstance();
+ virtual bool InitInstance();
virtual int ExitInstance(int exitCode = 0);
- virtual BOOL OnIdle(LONG lCount);
+ virtual bool OnIdle(LONG lCount);
virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszFileName);
CCryDocManager* GetDocManager() { return m_pDocManager; }
@@ -208,12 +208,6 @@ public:
void DeleteSelectedEntities(bool includeDescendants);
void OnMoveObject();
void OnRenameObj();
- void OnEditmodeMove();
- void OnEditmodeRotate();
- void OnEditmodeScale();
- void OnUpdateEditmodeMove(QAction* action);
- void OnUpdateEditmodeRotate(QAction* action);
- void OnUpdateEditmodeScale(QAction* action);
void OnUndo();
void OnOpenAssetImporter();
void OnUpdateSelected(QAction* action);
@@ -353,7 +347,7 @@ private:
// Disable warning for dll export since this member won't be used outside this class
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
AZ::IO::FileDescriptorRedirector m_stdoutRedirection = AZ::IO::FileDescriptorRedirector(1); // < 1 for STDOUT
-AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
+AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
private:
static inline constexpr const char* DefaultLevelTemplateName = "Prefabs/Default_Level.prefab";
@@ -426,7 +420,7 @@ public:
};
//////////////////////////////////////////////////////////////////////////
-class CCrySingleDocTemplate
+class CCrySingleDocTemplate
: public QObject
{
private:
@@ -454,8 +448,8 @@ public:
~CCrySingleDocTemplate() {};
// avoid creating another CMainFrame
// close other type docs before opening any things
- virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszPathName, BOOL bAddToMRU, BOOL bMakeVisible);
- virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible = TRUE);
+ virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszPathName, bool bAddToMRU, bool bMakeVisible);
+ virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszPathName, bool bMakeVisible = true);
virtual Confidence MatchDocType(LPCTSTR lpszPathName, CCryEditDoc*& rpDocMatch);
private:
@@ -471,9 +465,9 @@ public:
CCrySingleDocTemplate* SetDefaultTemplate(CCrySingleDocTemplate* pNew);
// Copied from MFC to get rid of the silly ugly unoverridable doc-type pick dialog
virtual void OnFileNew();
- virtual BOOL DoPromptFileName(QString& fileName, UINT nIDSTitle,
- DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate);
- virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToMRU);
+ virtual bool DoPromptFileName(QString& fileName, UINT nIDSTitle,
+ DWORD lFlags, bool bOpenFileDialog, CDocTemplate* pTemplate);
+ virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszFileName, bool bAddToMRU);
QVector m_templateList;
};
diff --git a/Code/Editor/CryEditDoc.cpp b/Code/Editor/CryEditDoc.cpp
index 43f599b191..e372baf365 100644
--- a/Code/Editor/CryEditDoc.cpp
+++ b/Code/Editor/CryEditDoc.cpp
@@ -19,6 +19,7 @@
#include
#include
#include
+#include
// AzFramework
#include
@@ -53,6 +54,7 @@
#include "MainWindow.h"
#include "LevelFileDialog.h"
#include "StatObjBus.h"
+#include "Undo/Undo.h"
#include
#include
@@ -95,7 +97,7 @@ namespace Internal
{
bool SaveLevel()
{
- if (!GetIEditor()->GetDocument()->DoSave(GetIEditor()->GetDocument()->GetActivePathName(), TRUE))
+ if (!GetIEditor()->GetDocument()->DoSave(GetIEditor()->GetDocument()->GetActivePathName(), true))
{
return false;
}
@@ -108,21 +110,12 @@ namespace Internal
// CCryEditDoc construction/destruction
CCryEditDoc::CCryEditDoc()
- : doc_validate_surface_types(0)
+ : doc_validate_surface_types(nullptr)
, m_modifiedModuleFlags(eModifiedNothing)
- // It assumes loaded levels have already been exported. Can be a big fat lie, though.
- // The right way would require us to save to the level folder the export status of the
- // level.
- , m_boLevelExported(true)
- , m_modified(false)
- , m_envProbeHeight(200.0f)
- , m_envProbeSliceRelativePath("EngineAssets/Slices/DefaultLevelSetup.slice")
{
////////////////////////////////////////////////////////////////////////
// Set member variables to initial values
////////////////////////////////////////////////////////////////////////
- m_bLoadFailed = false;
- m_waterColor = QColor(0, 0, 255);
m_fogTemplate = GetIEditor()->FindTemplate("Fog");
m_environmentTemplate = GetIEditor()->FindTemplate("Environment");
@@ -136,7 +129,6 @@ CCryEditDoc::CCryEditDoc()
m_environmentTemplate = XmlHelpers::CreateXmlNode("Environment");
}
- m_bDocumentReady = false;
GetIEditor()->SetDocument(this);
CLogFile::WriteLine("Document created");
RegisterConsoleVariables();
@@ -195,7 +187,7 @@ CCryEditDoc::DocumentEditingMode CCryEditDoc::GetEditMode() const
QString CCryEditDoc::GetActivePathName() const
{
- return DocumentEditingMode() == CCryEditDoc::DocumentEditingMode::SliceEdit ? GetSlicePathName() : GetLevelPathName();
+ return GetEditMode() == CCryEditDoc::DocumentEditingMode::SliceEdit ? GetSlicePathName() : GetLevelPathName();
}
QString CCryEditDoc::GetTitle() const
@@ -260,9 +252,9 @@ void CCryEditDoc::DeleteContents()
GetIEditor()->FlushUndo();
// Notify listeners.
- for (std::list::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
+ for (IDocListener* listener : m_listeners)
{
- (*it)->OnCloseDocument();
+ listener->OnCloseDocument();
}
GetIEditor()->ResetViews();
@@ -271,7 +263,7 @@ void CCryEditDoc::DeleteContents()
GetIEditor()->GetObjectManager()->DeleteAllObjects();
// Load scripts data
- SetModifiedFlag(FALSE);
+ SetModifiedFlag(false);
SetModifiedModules(eModifiedNothing);
// Clear error reports if open.
CErrorReportDialog::Clear();
@@ -313,7 +305,7 @@ void CCryEditDoc::Save(TDocMultiArchive& arrXmlAr)
{
CAutoDocNotReady autoDocNotReady;
- if (arrXmlAr[DMAS_GENERAL] != NULL)
+ if (arrXmlAr[DMAS_GENERAL] != nullptr)
{
(*arrXmlAr[DMAS_GENERAL]).root = XmlHelpers::CreateXmlNode("Level");
(*arrXmlAr[DMAS_GENERAL]).root->setAttr("WaterColor", m_waterColor);
@@ -458,7 +450,7 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
//////////////////////////////////////////////////////////////////////////
// Load water color.
//////////////////////////////////////////////////////////////////////////
- (*arrXmlAr[DMAS_GENERAL]).root->getAttr("WaterColor", m_waterColor);
+ (*arrXmlAr[DMAS_GENERAL]).root->getAttr("WaterColor", m_waterColor);
//////////////////////////////////////////////////////////////////////////
// Load View Settings
@@ -491,7 +483,7 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
if (!pObj)
{
- pObj = GetIEditor()->GetObjectManager()->NewObject("SequenceObject", 0, fullname);
+ pObj = GetIEditor()->GetObjectManager()->NewObject("SequenceObject", nullptr, fullname);
}
}
}
@@ -507,9 +499,9 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
CAutoLogTime logtime("Post Load");
// Notify listeners.
- for (std::list::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
+ for (IDocListener* listener : m_listeners)
{
- (*it)->OnLoadDocument();
+ listener->OnLoadDocument();
}
}
@@ -675,7 +667,7 @@ int CCryEditDoc::GetModifiedModule()
return m_modifiedModuleFlags;
}
-BOOL CCryEditDoc::CanCloseFrame()
+bool CCryEditDoc::CanCloseFrame()
{
// Ask the base class to ask for saving, which also includes the save
// status of the plugins. Additionaly we query if all the plugins can exit
@@ -684,21 +676,21 @@ BOOL CCryEditDoc::CanCloseFrame()
// are not serialized in the project file
if (!SaveModified())
{
- return FALSE;
+ return false;
}
if (!GetIEditor()->GetPluginManager()->CanAllPluginsExitNow())
{
- return FALSE;
+ return false;
}
// If there is an export in process, exiting will corrupt it
if (CGameExporter::GetCurrentExporter() != nullptr)
{
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
bool CCryEditDoc::SaveModified()
@@ -708,7 +700,8 @@ bool CCryEditDoc::SaveModified()
return true;
}
- auto button = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QString(), tr("Save changes to %1?").arg(GetTitle()), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
+ auto button = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QString(), tr("Save changes to %1?").arg(GetTitle()),
+ QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
switch (button)
{
case QMessageBox::Cancel:
@@ -742,7 +735,7 @@ bool CCryEditDoc::OnOpenDocument(const QString& lpszPathName)
TOpenDocContext context;
if (!BeforeOpenDocument(lpszPathName, context))
{
- return FALSE;
+ return false;
}
return DoOpenDocument(context);
}
@@ -785,7 +778,7 @@ bool CCryEditDoc::BeforeOpenDocument(const QString& lpszPathName, TOpenDocContex
context.absoluteLevelPath = absolutePath;
context.absoluteSlicePath = "";
}
- return TRUE;
+ return true;
}
bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
@@ -822,7 +815,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
if (!LoadXmlArchiveArray(arrXmlAr, levelFilePath, levelFolderAbsolutePath))
{
m_bLoadFailed = true;
- return FALSE;
+ return false;
}
}
if (!LoadLevel(arrXmlAr, context.absoluteLevelPath))
@@ -834,7 +827,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
if (m_bLoadFailed)
{
- return FALSE;
+ return false;
}
// Load AZ entities for the editor.
@@ -855,7 +848,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
if (m_bLoadFailed)
{
- return FALSE;
+ return false;
}
StartStreamingLoad();
@@ -872,7 +865,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
// level.
SetLevelExported(true);
- return TRUE;
+ return true;
}
bool CCryEditDoc::OnNewDocument()
@@ -933,8 +926,7 @@ bool CCryEditDoc::OnSaveDocument(const QString& lpszPathName)
}
TSaveDocContext context;
- if (shouldSaveLevel &&
- BeforeSaveDocument(lpszPathName, context))
+ if (shouldSaveLevel && BeforeSaveDocument(lpszPathName, context))
{
DoSaveDocument(lpszPathName, context);
saveSuccess = AfterSaveDocument(lpszPathName, context);
@@ -969,10 +961,10 @@ bool CCryEditDoc::BeforeSaveDocument(const QString& lpszPathName, TSaveDocContex
bool bSaved(true);
context.bSaved = bSaved;
- return TRUE;
+ return true;
}
-bool CCryEditDoc::HasLayerNameConflicts()
+bool CCryEditDoc::HasLayerNameConflicts() const
{
AZStd::vector editorEntities;
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
@@ -1004,43 +996,42 @@ bool CCryEditDoc::HasLayerNameConflicts()
bool CCryEditDoc::DoSaveDocument(const QString& filename, TSaveDocContext& context)
{
bool& bSaved = context.bSaved;
- if (bSaved)
+ if (!bSaved)
{
- // Paranoia - we shouldn't get this far into the save routine without a level loaded (empty levelPath)
- // If nothing is loaded, we don't need to save anything
- if (filename.isEmpty())
- {
- bSaved = false;
- }
- else
- {
- // Save Tag Point locations to file if auto save of tag points disabled
- if (!gSettings.bAutoSaveTagPoints)
- {
- CCryEditApp::instance()->SaveTagLocations();
- }
-
- QString normalizedPath = Path::ToUnixPath(filename);
- if (IsSliceFile(normalizedPath))
- {
- bSaved = SaveSlice(normalizedPath);
- }
- else
- {
- bSaved = SaveLevel(normalizedPath);
- }
-
- // Changes filename for this document.
- SetPathName(normalizedPath);
- }
+ return false;
+ }
+ // Paranoia - we shouldn't get this far into the save routine without a level loaded (empty levelPath)
+ // If nothing is loaded, we don't need to save anything
+ if (filename.isEmpty())
+ {
+ bSaved = false;
+ return false;
}
+ // Save Tag Point locations to file if auto save of tag points disabled
+ if (!gSettings.bAutoSaveTagPoints)
+ {
+ CCryEditApp::instance()->SaveTagLocations();
+ }
+
+ QString normalizedPath = Path::ToUnixPath(filename);
+ if (IsSliceFile(normalizedPath))
+ {
+ bSaved = SaveSlice(normalizedPath);
+ }
+ else
+ {
+ bSaved = SaveLevel(normalizedPath);
+ }
+
+ // Changes filename for this document.
+ SetPathName(normalizedPath);
return bSaved;
}
bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName, TSaveDocContext& context, bool bShowPrompt)
{
- bool& bSaved = context.bSaved;
+ bool bSaved = context.bSaved;
GetIEditor()->Notify(eNotify_OnEndSceneSave);
@@ -1055,7 +1046,7 @@ bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName
else
{
CLogFile::WriteLine("$3Document successfully saved");
- SetModifiedFlag(FALSE);
+ SetModifiedFlag(false);
SetModifiedModules(eModifiedNothing);
MainWindow::instance()->ResetAutoSaveTimers();
}
@@ -1067,8 +1058,7 @@ bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName
static void GetUserSettingsFile(const QString& levelFolder, QString& userSettings)
{
const char* pUserName = GetISystem()->GetUserName();
- QString fileName;
- fileName = QStringLiteral("%1_usersettings.editor_xml").arg(pUserName);
+ QString fileName = QStringLiteral("%1_usersettings.editor_xml").arg(pUserName);
userSettings = Path::Make(levelFolder, fileName);
}
@@ -1182,9 +1172,9 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
}
QString oldFilePath = QDir(oldLevelFolder).absoluteFilePath(sourceName);
- QString newFilePath = QDir(newLevelFolder).absoluteFilePath(sourceName);
+ QString newFilePath = QDir(newLevelFolder).absoluteFilePath(destName);
CFileUtil::CopyFile(oldFilePath, newFilePath);
- } while (findHandle = pIPak->FindNext(findHandle));
+ } while ((findHandle = pIPak->FindNext(findHandle)));
pIPak->FindClose(findHandle);
}
@@ -1506,7 +1496,7 @@ bool CCryEditDoc::LoadEntitiesFromLevel(const QString& levelPakFile)
{
AZStd::vector fileBuffer;
fileBuffer.resize(entitiesFile.GetLength());
- if (fileBuffer.size() > 0)
+ if (!fileBuffer.empty())
{
if (fileBuffer.size() == entitiesFile.ReadRaw(fileBuffer.begin(), fileBuffer.size()))
{
@@ -1608,7 +1598,7 @@ bool CCryEditDoc::LoadLevel(TDocMultiArchive& arrXmlAr, const QString& absoluteC
// Set level path directly *after* DeleteContents(), since that will unload the previous level and clear the level path.
GetIEditor()->GetGameEngine()->SetLevelPath(folderPath);
- SetModifiedFlag(TRUE); // dirty during de-serialize
+ SetModifiedFlag(true); // dirty during de-serialize
SetModifiedModules(eModifiedAll);
Load(arrXmlAr, absoluteCryFilePath);
@@ -1618,7 +1608,7 @@ bool CCryEditDoc::LoadLevel(TDocMultiArchive& arrXmlAr, const QString& absoluteC
{
pIPak->GetResourceList(AZ::IO::IArchive::RFOM_NextLevel)->Clear();
}
- SetModifiedFlag(FALSE); // start off with unmodified
+ SetModifiedFlag(false); // start off with unmodified
SetModifiedModules(eModifiedNothing);
SetDocumentReady(true);
GetIEditor()->Notify(eNotify_OnEndLoad);
@@ -1910,7 +1900,7 @@ void CCryEditDoc::UnregisterListener(IDocListener* listener)
m_listeners.remove(listener);
}
-void CCryEditDoc::LogLoadTime(int time)
+void CCryEditDoc::LogLoadTime(int time) const
{
QString appFilePath = QDir::toNativeSeparators(QCoreApplication::applicationFilePath());
QString exePath = Path::GetPath(appFilePath);
@@ -1922,21 +1912,18 @@ void CCryEditDoc::LogLoadTime(int time)
SetFileAttributes(filename.toUtf8().data(), FILE_ATTRIBUTE_ARCHIVE);
#endif
- FILE* file = nullptr;
- azfopen(&file, filename.toUtf8().data(), "at");
-
- if (file)
+ QFile file(filename);
+ if (!file.open(QFile::Append | QFile::Text))
{
- char version[50];
- GetIEditor()->GetFileVersion().ToShortString(version, AZ_ARRAY_SIZE(version));
-
- QString text;
-
- time = time / 1000;
- text = QStringLiteral("\n[%1] Level %2 loaded in %3 seconds").arg(version, level).arg(time);
- fwrite(text.toUtf8().data(), text.toUtf8().length(), 1, file);
- fclose(file);
+ return;
}
+
+ char version[50];
+ GetIEditor()->GetFileVersion().ToShortString(version, AZ_ARRAY_SIZE(version));
+
+ time = time / 1000;
+ QString text = QStringLiteral("\n[%1] Level %2 loaded in %3 seconds").arg(version, level).arg(time);
+ file.write(text.toUtf8());
}
void CCryEditDoc::SetDocumentReady(bool bReady)
@@ -1944,7 +1931,7 @@ void CCryEditDoc::SetDocumentReady(bool bReady)
m_bDocumentReady = bReady;
}
-void CCryEditDoc::GetMemoryUsage(ICrySizer* pSizer)
+void CCryEditDoc::GetMemoryUsage(ICrySizer* pSizer) const
{
{
SIZER_COMPONENT_NAME(pSizer, "UndoManager(estimate)");
@@ -1997,7 +1984,7 @@ void CCryEditDoc::OnStartLevelResourceList()
gEnv->pCryPak->GetResourceList(AZ::IO::IArchive::RFOM_Level)->Clear();
}
-BOOL CCryEditDoc::DoFileSave()
+bool CCryEditDoc::DoFileSave()
{
if (GetEditMode() == CCryEditDoc::DocumentEditingMode::LevelEdit)
{
@@ -2015,15 +2002,15 @@ BOOL CCryEditDoc::DoFileSave()
QString newLevelPath = filename.left(filename.lastIndexOf('/') + 1);
GetIEditor()->GetDocument()->SetPathName(filename);
GetIEditor()->GetGameEngine()->SetLevelPath(newLevelPath);
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
}
if (!IsDocumentReady())
{
- return FALSE;
+ return false;
}
return Internal::SaveLevel();
@@ -2068,12 +2055,9 @@ void CCryEditDoc::InitEmptyLevel(int /*resolution*/, int /*unitSize*/, bool /*bU
{
// Notify listeners.
std::list listeners = m_listeners;
- std::list::iterator it, next;
- for (it = listeners.begin(); it != listeners.end(); it = next)
+ for (IDocListener* listener : listeners)
{
- next = it;
- next++;
- (*it)->OnNewDocument();
+ listener->OnNewDocument();
}
}
@@ -2081,7 +2065,7 @@ void CCryEditDoc::InitEmptyLevel(int /*resolution*/, int /*unitSize*/, bool /*bU
GetISystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_LOAD_END, 0, 0);
GetIEditor()->Notify(eNotify_OnEndNewScene);
- SetModifiedFlag(FALSE);
+ SetModifiedFlag(false);
SetLevelExported(false);
SetModifiedModules(eModifiedNothing);
@@ -2095,13 +2079,13 @@ void CCryEditDoc::CreateDefaultLevelAssets([[maybe_unused]] int resolution, [[ma
void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
{
- if (pVar == NULL)
+ if (pVar == nullptr)
{
return;
}
XmlNodeRef node = GetEnvironmentTemplate();
- if (node == NULL)
+ if (node == nullptr)
{
return;
}
@@ -2119,7 +2103,7 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
XmlNodeRef groupNode = node->getChild(nGroup);
- if (groupNode == NULL)
+ if (groupNode == nullptr)
{
return;
}
@@ -2130,36 +2114,34 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
}
XmlNodeRef childNode = groupNode->getChild(nChild);
- if (childNode == NULL)
+ if (childNode == nullptr)
{
return;
}
+ QString childValue;
if (pVar->GetDataType() == IVariable::DT_COLOR)
{
Vec3 value;
pVar->Get(value);
- QString buff;
QColor gammaColor = ColorLinearToGamma(ColorF(value.x, value.y, value.z));
- buff = QStringLiteral("%1,%2,%3").arg(gammaColor.red()).arg(gammaColor.green()).arg(gammaColor.blue());
- childNode->setAttr("value", buff.toUtf8().data());
+ childValue = QStringLiteral("%1,%2,%3").arg(gammaColor.red()).arg(gammaColor.green()).arg(gammaColor.blue());
}
else
{
- QString value;
- pVar->Get(value);
- childNode->setAttr("value", value.toUtf8().data());
+ pVar->Get(childValue);
}
+ childNode->setAttr("value", childValue.toUtf8().data());
}
-QString CCryEditDoc::GetCryIndexPath(const LPCTSTR levelFilePath)
+QString CCryEditDoc::GetCryIndexPath(const LPCTSTR levelFilePath) const
{
QString levelPath = Path::GetPath(levelFilePath);
QString levelName = Path::GetFileName(levelFilePath);
return Path::AddPathSlash(levelPath + levelName + "_editor");
}
-BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath)
+bool CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath)
{
auto pIPak = GetIEditor()->GetSystem()->GetIPak();
@@ -2168,7 +2150,7 @@ BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString&
CXmlArchive* pXmlAr = new CXmlArchive();
if (!pXmlAr)
{
- return FALSE;
+ return false;
}
CXmlArchive& xmlAr = *pXmlAr;
@@ -2179,22 +2161,21 @@ BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString&
bool openLevelPakFileSuccess = pIPak->OpenPack(levelPath.toUtf8().data(), absoluteLevelPath.toUtf8().data());
if (!openLevelPakFileSuccess)
{
- return FALSE;
+ return false;
}
CPakFile pakFile;
- bool loadFromPakSuccess;
- loadFromPakSuccess = xmlAr.LoadFromPak(levelPath, pakFile);
+ bool loadFromPakSuccess = xmlAr.LoadFromPak(levelPath, pakFile);
pIPak->ClosePack(absoluteLevelPath.toUtf8().data());
if (!loadFromPakSuccess)
{
- return FALSE;
+ return false;
}
FillXmlArArray(arrXmlAr, &xmlAr);
}
- return TRUE;
+ return true;
}
void CCryEditDoc::ReleaseXmlArchiveArray(TDocMultiArchive& arrXmlAr)
diff --git a/Code/Editor/CryEditDoc.h b/Code/Editor/CryEditDoc.h
index 574f8eb7da..a5b3334818 100644
--- a/Code/Editor/CryEditDoc.h
+++ b/Code/Editor/CryEditDoc.h
@@ -26,7 +26,7 @@ struct ICVar;
// Filename of the temporary file used for the hold / fetch operation
// conform to the "$tmp[0-9]_" naming convention
-#define HOLD_FETCH_FILE "$tmp_hold"
+#define HOLD_FETCH_FILE "$tmp_hold"
class CCryEditDoc
: public QObject
@@ -36,7 +36,7 @@ class CCryEditDoc
Q_PROPERTY(bool modified READ IsModified WRITE SetModifiedFlag);
Q_PROPERTY(QString pathName READ GetLevelPathName WRITE SetPathName);
Q_PROPERTY(QString title READ GetTitle WRITE SetTitle);
-
+
public: // Create from serialization only
enum DocumentEditingMode
{
@@ -82,7 +82,7 @@ public: // Create from serialization only
bool DoSave(const QString& pathName, bool replace);
SANDBOX_API bool Save();
- virtual BOOL DoFileSave();
+ virtual bool DoFileSave();
bool SaveModified();
virtual bool BackupBeforeSave(bool bForce = false);
@@ -91,7 +91,7 @@ public: // Create from serialization only
// ClassWizard generated virtual function overrides
virtual bool OnOpenDocument(const QString& lpszPathName);
- const bool IsLevelLoadFailed() const { return m_bLoadFailed; }
+ bool IsLevelLoadFailed() const { return m_bLoadFailed; }
//! Marks this document as having errors.
void SetHasErrors() { m_hasErrors = true; }
@@ -102,7 +102,7 @@ public: // Create from serialization only
bool IsLevelExported() const;
void SetLevelExported(bool boExported = true);
- BOOL CanCloseFrame();
+ bool CanCloseFrame();
enum class FetchPolicy
{
@@ -121,7 +121,7 @@ public: // Create from serialization only
CClouds* GetClouds() { return m_pClouds; }
void SetWaterColor(const QColor& col) { m_waterColor = col; }
- QColor GetWaterColor() { return m_waterColor; }
+ QColor GetWaterColor() const { return m_waterColor; }
XmlNodeRef& GetFogTemplate() { return m_fogTemplate; }
XmlNodeRef& GetEnvironmentTemplate() { return m_environmentTemplate; }
void OnEnvironmentPropertyChanged(IVariable* pVar);
@@ -129,7 +129,7 @@ public: // Create from serialization only
void RegisterListener(IDocListener* listener);
void UnregisterListener(IDocListener* listener);
- void GetMemoryUsage(ICrySizer* pSizer);
+ void GetMemoryUsage(ICrySizer* pSizer) const;
static bool IsBackupOrTempLevelSubdirectory(const QString& folderName);
protected:
@@ -144,7 +144,7 @@ protected:
};
bool BeforeOpenDocument(const QString& lpszPathName, TOpenDocContext& context);
bool DoOpenDocument(TOpenDocContext& context);
- virtual BOOL LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath);
+ virtual bool LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath);
virtual void ReleaseXmlArchiveArray(TDocMultiArchive& arrXmlAr);
virtual void Load(TDocMultiArchive& arrXmlAr, const QString& szFilename);
@@ -161,14 +161,14 @@ protected:
void SerializeFogSettings(CXmlArchive& xmlAr);
virtual void SerializeViewSettings(CXmlArchive& xmlAr);
void SerializeNameSelection(CXmlArchive& xmlAr);
- void LogLoadTime(int time);
+ void LogLoadTime(int time) const;
struct TSaveDocContext
{
bool bSaved;
};
bool BeforeSaveDocument(const QString& lpszPathName, TSaveDocContext& context);
- bool HasLayerNameConflicts();
+ bool HasLayerNameConflicts() const;
bool DoSaveDocument(const QString& lpszPathName, TSaveDocContext& context);
bool AfterSaveDocument(const QString& lpszPathName, TSaveDocContext& context, bool bShowPrompt = true);
@@ -180,7 +180,7 @@ protected:
void OnStartLevelResourceList();
static void OnValidateSurfaceTypesChanged(ICVar*);
- QString GetCryIndexPath(const LPCTSTR levelFilePath);
+ QString GetCryIndexPath(const LPCTSTR levelFilePath) const;
//////////////////////////////////////////////////////////////////////////
// SliceEditorEntityOwnershipServiceNotificationBus::Handler
@@ -188,24 +188,26 @@ protected:
void OnSliceInstantiationFailed(const AZ::Data::AssetId& sliceAssetId, const AzFramework::SliceInstantiationTicket& /*ticket*/) override;
//////////////////////////////////////////////////////////////////////////
- bool m_bLoadFailed;
- QColor m_waterColor;
+ bool m_bLoadFailed = false;
+ QColor m_waterColor = QColor(0, 0, 255);
XmlNodeRef m_fogTemplate;
XmlNodeRef m_environmentTemplate;
CClouds* m_pClouds;
std::list m_listeners;
- bool m_bDocumentReady;
- ICVar* doc_validate_surface_types;
+ bool m_bDocumentReady = false;
+ ICVar* doc_validate_surface_types = nullptr;
int m_modifiedModuleFlags;
- bool m_boLevelExported;
- bool m_modified;
+ // On construction, it assumes loaded levels have already been exported. Can be a big fat lie, though.
+ // The right way would require us to save to the level folder the export status of the level.
+ bool m_boLevelExported = true;
+ bool m_modified = false;
QString m_pathName;
QString m_slicePathName;
QString m_title;
AZ::Data::AssetId m_envProbeSliceAssetId;
float m_terrainSize;
- const char* m_envProbeSliceRelativePath;
- const float m_envProbeHeight;
+ const char* m_envProbeSliceRelativePath = "EngineAssets/Slices/DefaultLevelSetup.slice";
+ const float m_envProbeHeight = 200.0f;
bool m_hasErrors = false; ///< This is used to warn the user that they may lose work when they go to save.
};
diff --git a/Code/Editor/CryEditPy.cpp b/Code/Editor/CryEditPy.cpp
index e65af3a19b..21d2dcced9 100644
--- a/Code/Editor/CryEditPy.cpp
+++ b/Code/Editor/CryEditPy.cpp
@@ -359,7 +359,7 @@ namespace
{
AZ::TickBus::Handler::BusConnect();
}
- ~Ticker()
+ ~Ticker() override
{
AZ::TickBus::Handler::BusDisconnect();
}
diff --git a/Code/Editor/CustomAspectRatioDlg.cpp b/Code/Editor/CustomAspectRatioDlg.cpp
index 16f50601d1..f24ff9ccdb 100644
--- a/Code/Editor/CustomAspectRatioDlg.cpp
+++ b/Code/Editor/CustomAspectRatioDlg.cpp
@@ -22,7 +22,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
#define MIN_ASPECT 1
#define MAX_ASPECT 16384
-CCustomAspectRatioDlg::CCustomAspectRatioDlg(int x, int y, QWidget* pParent /*=NULL*/)
+CCustomAspectRatioDlg::CCustomAspectRatioDlg(int x, int y, QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_xDefault(x)
, m_yDefault(y)
diff --git a/Code/Editor/CustomResolutionDlg.cpp b/Code/Editor/CustomResolutionDlg.cpp
index b970b80fe7..9e0e11e2e4 100644
--- a/Code/Editor/CustomResolutionDlg.cpp
+++ b/Code/Editor/CustomResolutionDlg.cpp
@@ -25,7 +25,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
#define MIN_RES 64
#define MAX_RES 8192
-CCustomResolutionDlg::CCustomResolutionDlg(int w, int h, QWidget* pParent /*=NULL*/)
+CCustomResolutionDlg::CCustomResolutionDlg(int w, int h, QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_wDefault(w)
, m_hDefault(h)
@@ -50,12 +50,12 @@ void CCustomResolutionDlg::OnInitDialog()
m_ui->m_height->setValue(m_hDefault);
QString maxDimensionString;
- QTextStream(&maxDimensionString)
- << "Maximum Dimension: " << MAX_RES << Qt::endl
+ QTextStream(&maxDimensionString)
+ << "Maximum Dimension: " << MAX_RES << Qt::endl
<< Qt::endl
<< "Note: Dimensions over 8K may be" << Qt::endl
<< "unstable depending on hardware.";
-
+
m_ui->m_maxDimension->setText(maxDimensionString);
}
diff --git a/Code/Editor/CustomizeKeyboardDialog.cpp b/Code/Editor/CustomizeKeyboardDialog.cpp
index d6bea6860f..ce09f8d878 100644
--- a/Code/Editor/CustomizeKeyboardDialog.cpp
+++ b/Code/Editor/CustomizeKeyboardDialog.cpp
@@ -87,7 +87,7 @@ public:
: QAbstractListModel(parent)
{
}
- virtual ~MenuActionsModel() {}
+ ~MenuActionsModel() override {}
int rowCount([[maybe_unused]] const QModelIndex& parent = QModelIndex()) const override
{
@@ -134,7 +134,7 @@ public:
, m_action(nullptr)
{
}
- virtual ~ActionShortcutsModel() {}
+ ~ActionShortcutsModel() override {}
int rowCount([[maybe_unused]] const QModelIndex& parent = QModelIndex()) const override
{
diff --git a/Code/Editor/Dialogs/ErrorsDlg.cpp b/Code/Editor/Dialogs/ErrorsDlg.cpp
index e89a3a6ded..280ffbbab6 100644
--- a/Code/Editor/Dialogs/ErrorsDlg.cpp
+++ b/Code/Editor/Dialogs/ErrorsDlg.cpp
@@ -20,7 +20,7 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-CErrorsDlg::CErrorsDlg(QWidget* pParent /*=NULL*/)
+CErrorsDlg::CErrorsDlg(QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, ui(new Ui::CErrorsDlg)
{
diff --git a/Code/Editor/Dialogs/PythonScriptsDialog.cpp b/Code/Editor/Dialogs/PythonScriptsDialog.cpp
index 98365769bb..7c6b445387 100644
--- a/Code/Editor/Dialogs/PythonScriptsDialog.cpp
+++ b/Code/Editor/Dialogs/PythonScriptsDialog.cpp
@@ -159,7 +159,7 @@ void CPythonScriptsDialog::OnExecute()
QList selectedItems = ui->treeView->GetSelectedItems();
QStandardItem* selectedItem = selectedItems.empty() ? nullptr : selectedItems.first();
- if (selectedItem == NULL)
+ if (selectedItem == nullptr)
{
return;
}
diff --git a/Code/Editor/EditorDefs.h b/Code/Editor/EditorDefs.h
index c98209befe..6614fa4d72 100644
--- a/Code/Editor/EditorDefs.h
+++ b/Code/Editor/EditorDefs.h
@@ -37,7 +37,6 @@
#pragma warning (disable : 4786) // identifier was truncated to 'number' characters in the debug information.
#pragma warning (disable : 4244) // conversion from 'long' to 'float', possible loss of data
#pragma warning (disable : 4018) // signed/unsigned mismatch
-#pragma warning (disable : 4800) // BOOL bool conversion
// Disable warning when a function returns a value inside an __asm block
#pragma warning (disable : 4035)
@@ -85,17 +84,17 @@
#endif
#ifndef SAFE_DELETE
-#define SAFE_DELETE(p) { if (p) { delete (p); (p) = NULL; } \
+#define SAFE_DELETE(p) { if (p) { delete (p); (p) = nullptr; } \
}
#endif
#ifndef SAFE_DELETE_ARRAY
-#define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p) = NULL; } \
+#define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p) = nullptr; } \
}
#endif
#ifndef SAFE_RELEASE
-#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p) = NULL; } \
+#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p) = nullptr; } \
}
#endif
diff --git a/Code/Editor/EditorFileMonitor.cpp b/Code/Editor/EditorFileMonitor.cpp
index 96dc883ab0..5e539f78a8 100644
--- a/Code/Editor/EditorFileMonitor.cpp
+++ b/Code/Editor/EditorFileMonitor.cpp
@@ -162,7 +162,7 @@ QString RemoveGameName(const QString &filename)
void CEditorFileMonitor::OnFileMonitorChange(const SFileChangeInfo& rChange)
{
CCryEditApp* app = CCryEditApp::instance();
- if (app == NULL || app->IsExiting())
+ if (app == nullptr || app->IsExiting())
{
return;
}
diff --git a/Code/Editor/EditorFileMonitor.h b/Code/Editor/EditorFileMonitor.h
index ac33fee9f4..7474d5e43a 100644
--- a/Code/Editor/EditorFileMonitor.h
+++ b/Code/Editor/EditorFileMonitor.h
@@ -42,7 +42,7 @@ private:
QString extension;
SFileChangeCallback()
- : pListener(NULL)
+ : pListener(nullptr)
{}
SFileChangeCallback(IFileChangeListener* pListener, const char* item, const char* extension)
diff --git a/Code/Editor/EditorPanelUtils.cpp b/Code/Editor/EditorPanelUtils.cpp
index 9091bb4c2f..b19bde4583 100644
--- a/Code/Editor/EditorPanelUtils.cpp
+++ b/Code/Editor/EditorPanelUtils.cpp
@@ -49,7 +49,7 @@ class CEditorPanelUtils_Impl
{
#pragma region Drag & Drop
public:
- virtual void SetViewportDragOperation(void(* dropCallback)(CViewport* viewport, int dragPointX, int dragPointY, void* custom), void* custom) override
+ void SetViewportDragOperation(void(* dropCallback)(CViewport* viewport, int dragPointX, int dragPointY, void* custom), void* custom) override
{
for (int i = 0; i < GetIEditor()->GetViewManager()->GetViewCount(); i++)
{
@@ -60,13 +60,13 @@ public:
#pragma region Preview Window
public:
- virtual int PreviewWindow_GetDisplaySettingsDebugFlags(CDisplaySettings* settings)
+ int PreviewWindow_GetDisplaySettingsDebugFlags(CDisplaySettings* settings) override
{
CRY_ASSERT(settings);
return settings->GetDebugFlags();
}
- virtual void PreviewWindow_SetDisplaySettingsDebugFlags(CDisplaySettings* settings, int flags)
+ void PreviewWindow_SetDisplaySettingsDebugFlags(CDisplaySettings* settings, int flags) override
{
CRY_ASSERT(settings);
settings->SetDebugFlags(flags);
@@ -79,7 +79,7 @@ protected:
bool m_hotkeysAreEnabled;
public:
- virtual bool HotKey_Import() override
+ bool HotKey_Import() override
{
QVector > keys;
QString filepath = QFileDialog::getOpenFileName(nullptr, "Select shortcut configuration to load",
@@ -143,7 +143,7 @@ public:
return result;
}
- virtual void HotKey_Export() override
+ void HotKey_Export() override
{
auto settingDir = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Editor" / "Plugins" / "ParticleEditorPlugin" / "settings";
QString filepath = QFileDialog::getSaveFileName(nullptr, "Select shortcut configuration to load", settingDir.c_str(), "HotKey Config Files (*.hkxml)");
@@ -170,7 +170,7 @@ public:
file.close();
}
- virtual QKeySequence HotKey_GetShortcut(const char* path) override
+ QKeySequence HotKey_GetShortcut(const char* path) override
{
for (HotKey combo : hotkeys)
{
@@ -182,7 +182,7 @@ public:
return QKeySequence();
}
- virtual bool HotKey_IsPressed(const QKeyEvent* event, const char* path) override
+ bool HotKey_IsPressed(const QKeyEvent* event, const char* path) override
{
if (!m_hotkeysAreEnabled)
{
@@ -221,7 +221,7 @@ public:
return false;
}
- virtual bool HotKey_IsPressed(const QShortcutEvent* event, const char* path) override
+ bool HotKey_IsPressed(const QShortcutEvent* event, const char* path) override
{
if (!m_hotkeysAreEnabled)
{
@@ -239,7 +239,7 @@ public:
return false;
}
- virtual bool HotKey_LoadExisting() override
+ bool HotKey_LoadExisting() override
{
QSettings settings("O3DE", "O3DE");
QString group = "Hotkeys/";
@@ -275,7 +275,7 @@ public:
return true;
}
- virtual void HotKey_SaveCurrent() override
+ void HotKey_SaveCurrent() override
{
QSettings settings("O3DE", "O3DE");
QString group = "Hotkeys/";
@@ -296,7 +296,7 @@ public:
settings.sync();
}
- virtual void HotKey_BuildDefaults() override
+ void HotKey_BuildDefaults() override
{
m_hotkeysAreEnabled = true;
QVector > keys;
@@ -356,17 +356,17 @@ public:
}
}
- virtual void HotKey_SetKeys(QVector keys) override
+ void HotKey_SetKeys(QVector keys) override
{
hotkeys = keys;
}
- virtual QVector HotKey_GetKeys() override
+ QVector HotKey_GetKeys() override
{
return hotkeys;
}
- virtual QString HotKey_GetPressedHotkey(const QKeyEvent* event) override
+ QString HotKey_GetPressedHotkey(const QKeyEvent* event) override
{
if (!m_hotkeysAreEnabled)
{
@@ -381,7 +381,7 @@ public:
}
return "";
}
- virtual QString HotKey_GetPressedHotkey(const QShortcutEvent* event) override
+ QString HotKey_GetPressedHotkey(const QShortcutEvent* event) override
{
if (!m_hotkeysAreEnabled)
{
@@ -398,12 +398,12 @@ public:
}
//building the default hotkey list re-enables hotkeys
//do not use this when rebuilding the default list is a possibility.
- virtual void HotKey_SetEnabled(bool val) override
+ void HotKey_SetEnabled(bool val) override
{
m_hotkeysAreEnabled = val;
}
- virtual bool HotKey_IsEnabled() const override
+ bool HotKey_IsEnabled() const override
{
return m_hotkeysAreEnabled;
}
@@ -457,13 +457,13 @@ protected:
}
public:
- virtual void ToolTip_LoadConfigXML(QString filepath) override
+ void ToolTip_LoadConfigXML(QString filepath) override
{
XmlNodeRef node = GetIEditor()->GetSystem()->LoadXmlFromFile(filepath.toStdString().c_str());
ToolTip_ParseNode(node);
}
- virtual void ToolTip_BuildFromConfig(IQToolTip* tooltip, QString path, QString option, QString optionalData = "", bool isEnabled = true)
+ void ToolTip_BuildFromConfig(IQToolTip* tooltip, QString path, QString option, QString optionalData = "", bool isEnabled = true) override
{
AZ_Assert(tooltip, "tooltip cannot be null");
@@ -488,7 +488,7 @@ public:
}
}
- virtual QString ToolTip_GetTitle(QString path, QString option) override
+ QString ToolTip_GetTitle(QString path, QString option) override
{
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
{
@@ -501,7 +501,7 @@ public:
return GetToolTip(path).title;
}
- virtual QString ToolTip_GetContent(QString path, QString option) override
+ QString ToolTip_GetContent(QString path, QString option) override
{
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
{
@@ -514,7 +514,7 @@ public:
return GetToolTip(path).content;
}
- virtual QString ToolTip_GetSpecialContentType(QString path, QString option) override
+ QString ToolTip_GetSpecialContentType(QString path, QString option) override
{
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
{
@@ -527,7 +527,7 @@ public:
return GetToolTip(path).specialContent;
}
- virtual QString ToolTip_GetDisabledContent(QString path, QString option) override
+ QString ToolTip_GetDisabledContent(QString path, QString option) override
{
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
{
diff --git a/Code/Editor/EditorPreferencesDialog.cpp b/Code/Editor/EditorPreferencesDialog.cpp
index 893b36b40c..c3fc4139f6 100644
--- a/Code/Editor/EditorPreferencesDialog.cpp
+++ b/Code/Editor/EditorPreferencesDialog.cpp
@@ -282,7 +282,7 @@ void EditorPreferencesDialog::CreatePages()
{
auto pUnknown = classes[i];
- IPreferencesPageCreator* pPageCreator = 0;
+ IPreferencesPageCreator* pPageCreator = nullptr;
if (FAILED(pUnknown->QueryInterface(&pPageCreator)))
{
continue;
diff --git a/Code/Editor/EditorPreferencesPageFiles.cpp b/Code/Editor/EditorPreferencesPageFiles.cpp
index aa84c7075c..4be3269d42 100644
--- a/Code/Editor/EditorPreferencesPageFiles.cpp
+++ b/Code/Editor/EditorPreferencesPageFiles.cpp
@@ -43,11 +43,16 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
->Field("MaxCount", &AutoBackup::m_maxCount)
->Field("RemindTime", &AutoBackup::m_remindTime);
+ serialize.Class()
+ ->Version(1)
+ ->Field("Max number of items displayed", &AssetBrowserSearch::m_maxNumberOfItemsShownInSearch);
+
serialize.Class()
->Version(1)
->Field("Files", &CEditorPreferencesPage_Files::m_files)
->Field("Editors", &CEditorPreferencesPage_Files::m_editors)
- ->Field("AutoBackup", &CEditorPreferencesPage_Files::m_autoBackup);
+ ->Field("AutoBackup", &CEditorPreferencesPage_Files::m_autoBackup)
+ ->Field("AssetBrowserSearch", &CEditorPreferencesPage_Files::m_assetBrowserSearch);
AZ::EditContext* editContext = serialize.GetEditContext();
@@ -80,12 +85,19 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
->Attribute(AZ::Edit::Attributes::Max, 100)
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AutoBackup::m_remindTime, "Remind Time", "Auto Remind Every (Minutes)");
+ editContext->Class("Asset Browser Search View", "Asset Browser Search View")
+ ->DataElement(AZ::Edit::UIHandlers::SpinBox, &AssetBrowserSearch::m_maxNumberOfItemsShownInSearch, "Maximum number of displayed items",
+ "Maximum number of displayed items displayed in the Search View")
+ ->Attribute(AZ::Edit::Attributes::Min, 50)
+ ->Attribute(AZ::Edit::Attributes::Max, 5000);
+
editContext->Class("File Preferences", "Class for handling File Preferences")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20))
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_files, "Files", "File Preferences")
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_editors, "External Editors", "External Editors")
- ->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_autoBackup, "Auto Backup", "Auto Backup");
+ ->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_autoBackup, "Auto Backup", "Auto Backup")
+ ->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_assetBrowserSearch, "Asset Browser Search", "Asset Browser Search");
}
}
@@ -124,6 +136,8 @@ void CEditorPreferencesPage_Files::OnApply()
gSettings.autoBackupTime = m_autoBackup.m_timeInterval;
gSettings.autoBackupMaxCount = m_autoBackup.m_maxCount;
gSettings.autoRemindTime = m_autoBackup.m_remindTime;
+
+ gSettings.maxNumberOfItemsShownInSearch = m_assetBrowserSearch.m_maxNumberOfItemsShownInSearch;
}
void CEditorPreferencesPage_Files::InitializeSettings()
@@ -148,4 +162,6 @@ void CEditorPreferencesPage_Files::InitializeSettings()
m_autoBackup.m_timeInterval = gSettings.autoBackupTime;
m_autoBackup.m_maxCount = gSettings.autoBackupMaxCount;
m_autoBackup.m_remindTime = gSettings.autoRemindTime;
+
+ m_assetBrowserSearch.m_maxNumberOfItemsShownInSearch = gSettings.maxNumberOfItemsShownInSearch;
}
diff --git a/Code/Editor/EditorPreferencesPageFiles.h b/Code/Editor/EditorPreferencesPageFiles.h
index 2bb806a73e..368cd91fc3 100644
--- a/Code/Editor/EditorPreferencesPageFiles.h
+++ b/Code/Editor/EditorPreferencesPageFiles.h
@@ -69,10 +69,17 @@ private:
int m_remindTime;
};
+ struct AssetBrowserSearch
+ {
+ AZ_TYPE_INFO(AssetBrowserSearch, "{9FBFCD24-9452-49DF-99F4-2711443CEAAE}")
+
+ int m_maxNumberOfItemsShownInSearch;
+ };
Files m_files;
ExternalEditors m_editors;
AutoBackup m_autoBackup;
+ AssetBrowserSearch m_assetBrowserSearch;
QIcon m_icon;
};
diff --git a/Code/Editor/EditorPreferencesPageGeneral.cpp b/Code/Editor/EditorPreferencesPageGeneral.cpp
index 70ac0fd46f..79ecfbdfc7 100644
--- a/Code/Editor/EditorPreferencesPageGeneral.cpp
+++ b/Code/Editor/EditorPreferencesPageGeneral.cpp
@@ -32,6 +32,7 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
->Field("PreviewPanel", &GeneralSettings::m_previewPanel)
->Field("ApplyConfigSpec", &GeneralSettings::m_applyConfigSpec)
->Field("EnableSourceControl", &GeneralSettings::m_enableSourceControl)
+ ->Field("ClearConsole", &GeneralSettings::m_clearConsoleOnGameModeStart)
->Field("ConsoleBackgroundColorTheme", &GeneralSettings::m_consoleBackgroundColorTheme)
->Field("AutoloadLastLevel", &GeneralSettings::m_autoLoadLastLevel)
->Field("ShowTimeInConsole", &GeneralSettings::m_bShowTimeInConsole)
@@ -77,6 +78,8 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_previewPanel, "Show Geometry Preview Panel", "Show Geometry Preview Panel")
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_applyConfigSpec, "Hide objects by config spec", "Hide objects by config spec")
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_enableSourceControl, "Enable Source Control", "Enable Source Control")
+ ->DataElement(
+ AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_clearConsoleOnGameModeStart, "Clear Console at game startup", "Clear Console when game mode starts")
->DataElement(AZ::Edit::UIHandlers::ComboBox, &GeneralSettings::m_consoleBackgroundColorTheme, "Console Background", "Console Background")
->EnumAttribute(AzToolsFramework::ConsoleColorTheme::Light, "Light")
->EnumAttribute(AzToolsFramework::ConsoleColorTheme::Dark, "Dark")
@@ -142,6 +145,7 @@ void CEditorPreferencesPage_General::OnApply()
gSettings.bPreviewGeometryWindow = m_generalSettings.m_previewPanel;
gSettings.bApplyConfigSpecInEditor = m_generalSettings.m_applyConfigSpec;
gSettings.enableSourceControl = m_generalSettings.m_enableSourceControl;
+ gSettings.clearConsoleOnGameModeStart = m_generalSettings.m_clearConsoleOnGameModeStart;
gSettings.consoleBackgroundColorTheme = m_generalSettings.m_consoleBackgroundColorTheme;
gSettings.bShowTimeInConsole = m_generalSettings.m_bShowTimeInConsole;
gSettings.bShowDashboardAtStartup = m_messaging.m_showDashboard;
@@ -176,6 +180,7 @@ void CEditorPreferencesPage_General::InitializeSettings()
m_generalSettings.m_previewPanel = gSettings.bPreviewGeometryWindow;
m_generalSettings.m_applyConfigSpec = gSettings.bApplyConfigSpecInEditor;
m_generalSettings.m_enableSourceControl = gSettings.enableSourceControl;
+ m_generalSettings.m_clearConsoleOnGameModeStart = gSettings.clearConsoleOnGameModeStart;
m_generalSettings.m_consoleBackgroundColorTheme = gSettings.consoleBackgroundColorTheme;
m_generalSettings.m_bShowTimeInConsole = gSettings.bShowTimeInConsole;
m_generalSettings.m_autoLoadLastLevel = gSettings.bAutoloadLastLevelAtStartup;
diff --git a/Code/Editor/EditorPreferencesPageGeneral.h b/Code/Editor/EditorPreferencesPageGeneral.h
index f22cfdd424..9a3a0f21e8 100644
--- a/Code/Editor/EditorPreferencesPageGeneral.h
+++ b/Code/Editor/EditorPreferencesPageGeneral.h
@@ -46,6 +46,7 @@ private:
bool m_previewPanel;
bool m_applyConfigSpec;
bool m_enableSourceControl;
+ bool m_clearConsoleOnGameModeStart;
AzToolsFramework::ConsoleColorTheme m_consoleBackgroundColorTheme;
bool m_autoLoadLastLevel;
bool m_bShowTimeInConsole;
diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp
index 357c27fd72..dd89d96dc3 100644
--- a/Code/Editor/EditorViewportWidget.cpp
+++ b/Code/Editor/EditorViewportWidget.cpp
@@ -46,7 +46,7 @@
#include
#include
#include
-#include
+#include
// AtomToolsFramework
#include
@@ -73,6 +73,7 @@
#include "EditorPreferencesPageGeneral.h"
#include "ViewportManipulatorController.h"
#include "LegacyViewportCameraController.h"
+#include "EditorViewportSettings.h"
#include "ViewPane.h"
#include "CustomResolutionDlg.h"
@@ -91,6 +92,8 @@
// Atom
#include
#include
+#include
+
#include
#include
@@ -163,6 +166,10 @@ namespace AZ::ViewportHelpers
{
m_renderViewport.OnStopPlayInEditor();
}
+ void OnStartPlayInEditorBegin() override
+ {
+ m_renderViewport.OnStartPlayInEditorBegin();
+ }
private:
EditorViewportWidget& m_renderViewport;
@@ -175,16 +182,12 @@ namespace AZ::ViewportHelpers
EditorViewportWidget::EditorViewportWidget(const QString& name, QWidget* parent)
: QtViewport(parent)
- , m_Camera(GetIEditor()->GetSystem()->GetViewCamera())
- , m_camFOV(gSettings.viewports.fDefaultFov)
, m_defaultViewName(name)
, m_renderViewport(nullptr) //m_renderViewport is initialized later, in SetViewportId
{
// need this to be set in order to allow for language switching on Windows
setAttribute(Qt::WA_InputMethodEnabled);
- LockCameraMovement(true);
- EditorViewportWidget::SetViewTM(m_Camera.GetMatrix());
m_defaultViewTM.SetIdentity();
if (GetIEditor()->GetViewManager()->GetSelectedViewport() == nullptr)
@@ -197,8 +200,6 @@ EditorViewportWidget::EditorViewportWidget(const QString& name, QWidget* parent)
m_displayContext.pIconManager = GetIEditor()->GetIconManager();
GetIEditor()->GetUndoManager()->AddListener(this);
- m_PhysicalLocation.SetIdentity();
-
// The renderer requires something, so don't allow us to shrink to absolutely nothing
// This won't in fact stop the viewport from being shrunk, when it's the centralWidget for
// the MainWindow, but it will stop the viewport from getting resize events
@@ -206,22 +207,14 @@ EditorViewportWidget::EditorViewportWidget(const QString& name, QWidget* parent)
// to be the same thing.
setMinimumSize(50, 50);
- OnCreate();
-
setMouseTracking(true);
Camera::EditorCameraRequestBus::Handler::BusConnect();
+ Camera::CameraNotificationBus::Handler::BusConnect();
+
m_editorEntityNotifications = AZStd::make_unique(*this);
AzFramework::AssetCatalogEventBus::Handler::BusConnect();
- auto handleCameraChange = [this](const AZ::Matrix4x4&)
- {
- UpdateCameraFromViewportContext();
- };
-
- m_cameraViewMatrixChangeHandler = AZ::RPI::ViewportContext::MatrixChangedEvent::Handler(handleCameraChange);
- m_cameraProjectionMatrixChangeHandler = AZ::RPI::ViewportContext::MatrixChangedEvent::Handler(handleCameraChange);
-
m_manipulatorManager = GetIEditor()->GetViewManager()->GetManipulatorManager();
if (!m_pPrimaryViewport)
{
@@ -240,28 +233,20 @@ EditorViewportWidget::~EditorViewportWidget()
DisconnectViewportInteractionRequestBus();
m_editorEntityNotifications.reset();
Camera::EditorCameraRequestBus::Handler::BusDisconnect();
- OnDestroy();
+ Camera::CameraNotificationBus::Handler::BusDisconnect();
GetIEditor()->GetUndoManager()->RemoveListener(this);
GetIEditor()->UnregisterNotifyListener(this);
}
-//////////////////////////////////////////////////////////////////////////
-// EditorViewportWidget message handlers
-//////////////////////////////////////////////////////////////////////////
-int EditorViewportWidget::OnCreate()
-{
- CreateRenderContext();
-
- return 0;
-}
-
//////////////////////////////////////////////////////////////////////////
void EditorViewportWidget::resizeEvent(QResizeEvent* event)
{
+ // Call base class resize event while not rendering
PushDisableRendering();
QtViewport::resizeEvent(event);
PopDisableRendering();
+ // Emit Legacy system events about the viewport size change
const QRect rcWindow = rect().translated(mapToGlobal(QPoint()));
gEnv->pSystem->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_MOVE, rcWindow.left(), rcWindow.top());
@@ -271,10 +256,12 @@ void EditorViewportWidget::resizeEvent(QResizeEvent* event)
gEnv->pSystem->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_RESIZE, width(), height());
- // We queue the window resize event because the render overlay may be hidden.
- // If the render overlay is not visible, the native window that is backing it will
- // also be hidden, and it will not resize until it becomes visible.
- m_windowResizedEvent = true;
+ // In the case of the default viewport camera, we must re-set the FOV, which also updates the aspect ratio
+ // Component cameras hand this themselves
+ if (m_viewSourceType == ViewSourceType::None)
+ {
+ SetFOV(GetFOV());
+ }
}
//////////////////////////////////////////////////////////////////////////
@@ -383,15 +370,6 @@ AzToolsFramework::ViewportInteraction::MouseInteraction EditorViewportWidget::Bu
BuildMousePick(WidgetToViewport(point)));
}
-void EditorViewportWidget::InjectFakeMouseMove(int deltaX, int deltaY, Qt::MouseButtons buttons)
-{
- // this is required, otherwise the user will see the context menu
- OnMouseMove(Qt::NoModifier, buttons, QCursor::pos() + QPoint(deltaX, deltaY));
- // we simply move the prev mouse position, so the change will be picked up
- // by the next ProcessMouse call
- m_prevMousePos -= QPoint(deltaX, deltaY);
-}
-
//////////////////////////////////////////////////////////////////////////
bool EditorViewportWidget::event(QEvent* event)
{
@@ -403,19 +381,6 @@ bool EditorViewportWidget::event(QEvent* event)
m_keyDown.clear();
break;
- case QEvent::ShortcutOverride:
- {
- // Ensure we exit game mode on escape, even if something else would eat our escape key event.
- if (static_cast(event)->key() == Qt::Key_Escape && GetIEditor()->IsInGameMode())
- {
- GetIEditor()->SetInGameMode(false);
- event->accept();
- return true;
- }
- break;
- }
-
-
case QEvent::Shortcut:
// a shortcut should immediately clear us, otherwise the release event never gets sent
m_keyDown.clear();
@@ -425,12 +390,6 @@ bool EditorViewportWidget::event(QEvent* event)
return QtViewport::event(event);
}
-//////////////////////////////////////////////////////////////////////////
-void EditorViewportWidget::ResetContent()
-{
- QtViewport::ResetContent();
-}
-
//////////////////////////////////////////////////////////////////////////
void EditorViewportWidget::UpdateContent(int flags)
{
@@ -461,20 +420,6 @@ void EditorViewportWidget::Update()
return;
}
- if (m_updateCameraPositionNextTick)
- {
- auto cameraState = GetCameraState();
- AZ::Matrix3x4 matrix;
- matrix.SetBasisAndTranslation(cameraState.m_side, cameraState.m_forward, cameraState.m_up, cameraState.m_position);
- auto m = AZMatrix3x4ToLYMatrix3x4(matrix);
-
- SetViewTM(m);
- m_Camera.SetZRange(cameraState.m_nearClip, cameraState.m_farClip);
- }
-
- // Reset the camera update flag now that we're finished updating our viewport context
- m_updateCameraPositionNextTick = false;
-
// Don't wait for changes to update the focused viewport.
if (CheckRespondToInput())
{
@@ -552,25 +497,13 @@ void EditorViewportWidget::Update()
PushDisableRendering();
- m_viewTM = m_Camera.GetMatrix(); // synchronize.
-
// Render
{
// TODO: Move out this logic to a controller and refactor to work with Atom
-
- OnRender();
-
ProcessRenderLisneters(m_displayContext);
m_displayContext.Flush2D();
- // m_renderer->SwitchToNativeResolutionBackbuffer();
-
- // 3D engine stats
-
- CCamera CurCamera = gEnv->pSystem->GetViewCamera();
- gEnv->pSystem->SetViewCamera(m_Camera);
-
// Post Render Callback
{
PostRenderers::iterator itr = m_postRenderers.begin();
@@ -580,8 +513,6 @@ void EditorViewportWidget::Update()
(*itr)->OnPostRender();
}
}
-
- gEnv->pSystem->SetViewCamera(CurCamera);
}
{
@@ -603,35 +534,7 @@ void EditorViewportWidget::Update()
m_bUpdateViewport = false;
}
-//////////////////////////////////////////////////////////////////////////
-void EditorViewportWidget::SetViewEntity(const AZ::EntityId& viewEntityId, bool lockCameraMovement)
-{
- // if they've picked the same camera, then that means they want to toggle
- if (viewEntityId.IsValid() && viewEntityId != m_viewEntityId)
- {
- LockCameraMovement(lockCameraMovement);
- m_viewEntityId = viewEntityId;
- AZStd::string entityName;
- AZ::ComponentApplicationBus::BroadcastResult(entityName, &AZ::ComponentApplicationRequests::GetEntityName, viewEntityId);
- SetName(QString("Camera entity: %1").arg(entityName.c_str()));
- }
- else
- {
- SetDefaultCamera();
- }
- PostCameraSet();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void EditorViewportWidget::ResetToViewSourceType(const ViewSourceType& viewSourceType)
-{
- LockCameraMovement(true);
- m_viewEntityId.SetInvalid();
- m_cameraObjectId = GUID_NULL;
- m_viewSourceType = viewSourceType;
- SetViewTM(GetViewTM());
-}
//////////////////////////////////////////////////////////////////////////
void EditorViewportWidget::PostCameraSet()
@@ -641,10 +544,28 @@ void EditorViewportWidget::PostCameraSet()
m_viewPane->OnFOVChanged(GetFOV());
}
+ // CryLegacy notify
GetIEditor()->Notify(eNotify_CameraChanged);
- QScopedValueRollback rb(m_ignoreSetViewFromEntityPerspective, true);
+
+ // Special case in the editor; if the camera is the default editor camera,
+ // notify that the active view changed. In game mode, it is a hard error to not have
+ // any cameras on the view stack!
+ if (m_viewSourceType == ViewSourceType::None)
+ {
+ m_sendingOnActiveChanged = true;
+ Camera::CameraNotificationBus::Broadcast(
+ &Camera::CameraNotificationBus::Events::OnActiveViewChanged, AZ::EntityId());
+ m_sendingOnActiveChanged = false;
+ }
+
+ // Notify about editor camera change
Camera::EditorCameraNotificationBus::Broadcast(
&Camera::EditorCameraNotificationBus::Events::OnViewportViewEntityChanged, m_viewEntityId);
+
+ // The editor view entity ID has changed, and the editor camera component "Be This Camera" text needs to be updated
+ AzToolsFramework::PropertyEditorGUIMessages::Bus::Broadcast(
+ &AzToolsFramework::PropertyEditorGUIMessages::RequestRefresh,
+ AzToolsFramework::PropertyModificationRefreshLevel::Refresh_AttributesAndValues);
}
//////////////////////////////////////////////////////////////////////////
@@ -652,16 +573,7 @@ CBaseObject* EditorViewportWidget::GetCameraObject() const
{
CBaseObject* pCameraObject = nullptr;
- if (m_viewSourceType == ViewSourceType::SequenceCamera)
- {
- m_cameraObjectId = GetViewManager()->GetCameraObjectId();
- }
- if (m_cameraObjectId != GUID_NULL)
- {
- // Find camera object from id.
- pCameraObject = GetIEditor()->GetObjectManager()->FindObject(m_cameraObjectId);
- }
- else if (m_viewSourceType == ViewSourceType::CameraComponent || m_viewSourceType == ViewSourceType::AZ_Entity)
+ if (m_viewSourceType == ViewSourceType::CameraComponent)
{
AzToolsFramework::ComponentEntityEditorRequestBus::EventResult(
pCameraObject, m_viewEntityId, &AzToolsFramework::ComponentEntityEditorRequests::GetSandboxObject);
@@ -717,10 +629,6 @@ void EditorViewportWidget::OnEditorNotifyEvent(EEditorNotifyEvent event)
if (GetIEditor()->GetViewManager()->GetGameViewport() == this)
{
SetCurrentCursor(STD_CURSOR_DEFAULT);
- m_bInRotateMode = false;
- m_bInMoveMode = false;
- m_bInOrbitMode = false;
- m_bInZoomMode = false;
if (m_inFullscreenPreview)
{
@@ -732,7 +640,7 @@ void EditorViewportWidget::OnEditorNotifyEvent(EEditorNotifyEvent event)
if (m_renderViewport)
{
- m_renderViewport->SetInputProcessingEnabled(true);
+ m_renderViewport->GetControllerList()->SetEnabled(true);
}
break;
@@ -812,21 +720,6 @@ void EditorViewportWidget::OnEditorNotifyEvent(EEditorNotifyEvent event)
}
}
-//////////////////////////////////////////////////////////////////////////
-void EditorViewportWidget::OnRender()
-{
- if (m_rcClient.isEmpty())
- {
- // Even in null rendering, update the view camera.
- // This is necessary so that automated editor tests using the null renderer to test systems like dynamic vegetation
- // are still able to manipulate the current logical camera position, even if nothing is rendered.
- GetIEditor()->GetSystem()->SetViewCamera(m_Camera);
- return;
- }
-
- FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-}
-
void EditorViewportWidget::OnBeginPrepareRender()
{
if (!m_debugDisplay)
@@ -847,82 +740,6 @@ void EditorViewportWidget::OnBeginPrepareRender()
Update();
m_isOnPaint = false;
- float fNearZ = GetIEditor()->GetConsoleVar("cl_DefaultNearPlane");
- float fFarZ = m_Camera.GetFarPlane();
-
- CBaseObject* cameraObject = GetCameraObject();
- if (cameraObject)
- {
- AZ::Matrix3x3 lookThroughEntityCorrection = AZ::Matrix3x3::CreateIdentity();
- if (m_viewEntityId.IsValid())
- {
- Camera::CameraRequestBus::EventResult(fNearZ, m_viewEntityId, &Camera::CameraComponentRequests::GetNearClipDistance);
- Camera::CameraRequestBus::EventResult(fFarZ, m_viewEntityId, &Camera::CameraComponentRequests::GetFarClipDistance);
- LmbrCentral::EditorCameraCorrectionRequestBus::EventResult(
- lookThroughEntityCorrection, m_viewEntityId, &LmbrCentral::EditorCameraCorrectionRequests::GetTransformCorrection);
- }
-
- m_viewTM = cameraObject->GetWorldTM() * AZMatrix3x3ToLYMatrix3x3(lookThroughEntityCorrection);
- m_viewTM.OrthonormalizeFast();
-
- m_Camera.SetMatrix(m_viewTM);
-
- int w = m_rcClient.width();
- int h = m_rcClient.height();
-
- m_Camera.SetFrustum(w, h, GetFOV(), fNearZ, fFarZ);
- }
- else if (m_viewEntityId.IsValid())
- {
- Camera::CameraRequestBus::EventResult(fNearZ, m_viewEntityId, &Camera::CameraComponentRequests::GetNearClipDistance);
- Camera::CameraRequestBus::EventResult(fFarZ, m_viewEntityId, &Camera::CameraComponentRequests::GetFarClipDistance);
- int w = m_rcClient.width();
- int h = m_rcClient.height();
-
- m_Camera.SetFrustum(w, h, GetFOV(), fNearZ, fFarZ);
- }
- else
- {
- // Normal camera.
- m_cameraObjectId = GUID_NULL;
- int w = m_rcClient.width();
- int h = m_rcClient.height();
-
- // Don't bother doing an FOV calculation if we don't have a valid viewport
- // This prevents frustum calculation bugs with a null viewport
- if (w <= 1 || h <= 1)
- {
- return;
- }
-
- float fov = gSettings.viewports.fDefaultFov;
-
- // match viewport fov to default / selected title menu fov
- if (GetFOV() != fov)
- {
- if (m_viewPane)
- {
- m_viewPane->OnFOVChanged(fov);
- SetFOV(fov);
- }
- }
-
- // Just for editor: Aspect ratio fix when changing the viewport
- if (!GetIEditor()->IsInGameMode())
- {
- float viewportAspectRatio = float( w ) / h;
- float targetAspectRatio = GetAspectRatio();
- if (targetAspectRatio > viewportAspectRatio)
- {
- // Correct for vertical FOV change.
- float maxTargetHeight = float( w ) / targetAspectRatio;
- fov = 2 * atanf((h * tan(fov / 2)) / maxTargetHeight);
- }
- }
- m_Camera.SetFrustum(w, h, fov, fNearZ);
- }
-
- GetIEditor()->GetSystem()->SetViewCamera(m_Camera);
if (GetIEditor()->IsInGameMode())
{
@@ -1138,17 +955,6 @@ void EditorViewportWidget::OnMenuSelectCurrentCamera()
AzFramework::CameraState EditorViewportWidget::GetCameraState()
{
- if (m_viewEntityId.IsValid())
- {
- bool cameraStateAcquired = false;
- AzFramework::CameraState cameraState;
- Camera::EditorCameraViewRequestBus::BroadcastResult(cameraStateAcquired,
- &Camera::EditorCameraViewRequestBus::Events::GetCameraState, cameraState);
- if (cameraStateAcquired)
- {
- return cameraState;
- }
- }
return m_renderViewport->GetCameraState();
}
@@ -1234,6 +1040,13 @@ AZStd::shared_ptr CreateMod
AzFramework::ViewportId viewportId)
{
auto controller = AZStd::make_shared();
+
+ controller->SetCameraPriorityBuilderCallback(
+ [](AtomToolsFramework::CameraControllerPriorityFn& cameraControllerPriorityFn)
+ {
+ cameraControllerPriorityFn = AtomToolsFramework::DefaultCameraControllerPriority;
+ });
+
controller->SetCameraPropsBuilderCallback(
[](AzFramework::CameraProps& cameraProps)
{
@@ -1454,13 +1267,11 @@ void EditorViewportWidget::SetViewportId(int id)
}
auto viewportContext = m_renderViewport->GetViewportContext();
m_defaultViewportContextName = viewportContext->GetName();
+ m_defaultView = viewportContext->GetDefaultView();
QBoxLayout* layout = new QBoxLayout(QBoxLayout::Direction::TopToBottom, this);
layout->setContentsMargins(QMargins());
layout->addWidget(m_renderViewport);
- viewportContext->ConnectViewMatrixChangedHandler(m_cameraViewMatrixChangeHandler);
- viewportContext->ConnectProjectionMatrixChangedHandler(m_cameraProjectionMatrixChangeHandler);
-
m_renderViewport->GetControllerList()->Add(AZStd::make_shared());
if (ed_useNewCameraSystem)
@@ -1669,7 +1480,6 @@ bool EditorViewportWidget::AddCameraMenuItems(QMenu* menu)
menu->addSeparator();
}
- AZ::ViewportHelpers::AddCheckbox(menu, "Lock Camera Movement", &m_bLockCameraMovement);
menu->addSeparator();
// Camera Sub menu
@@ -1683,17 +1493,6 @@ bool EditorViewportWidget::AddCameraMenuItems(QMenu* menu)
AZ::EBusAggregateResults getCameraResults;
Camera::CameraBus::BroadcastResult(getCameraResults, &Camera::CameraRequests::GetCameras);
- const int numCameras = getCameraResults.values.size();
-
- // only enable if we're editing a sequence in Track View and have cameras in the level
- bool enableSequenceCameraMenu = (GetIEditor()->GetAnimation()->GetSequence() && numCameras);
-
- action = customCameraMenu->addAction(tr("Sequence Camera"));
- action->setCheckable(true);
- action->setChecked(m_viewSourceType == ViewSourceType::SequenceCamera);
- action->setEnabled(enableSequenceCameraMenu);
- connect(action, &QAction::triggered, this, &EditorViewportWidget::SetSequenceCamera);
-
QVector additionalCameras;
additionalCameras.reserve(getCameraResults.values.size());
@@ -1727,28 +1526,6 @@ bool EditorViewportWidget::AddCameraMenuItems(QMenu* menu)
customCameraMenu->addAction(cameraAction);
}
- action = customCameraMenu->addAction(tr("Look through entity"));
- bool areAnyEntitiesSelected = false;
- AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(areAnyEntitiesSelected, &AzToolsFramework::ToolsApplicationRequests::AreAnyEntitiesSelected);
- action->setCheckable(areAnyEntitiesSelected || m_viewSourceType == ViewSourceType::AZ_Entity);
- action->setEnabled(areAnyEntitiesSelected || m_viewSourceType == ViewSourceType::AZ_Entity);
- action->setChecked(m_viewSourceType == ViewSourceType::AZ_Entity);
- connect(action, &QAction::triggered, this, [this](bool isChecked)
- {
- if (isChecked)
- {
- AzToolsFramework::EntityIdList selectedEntityList;
- AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
- if (selectedEntityList.size())
- {
- SetEntityAsCamera(*selectedEntityList.begin());
- }
- }
- else
- {
- SetDefaultCamera();
- }
- });
return true;
}
@@ -1777,28 +1554,6 @@ void EditorViewportWidget::ResizeView(int width, int height)
}
}
-//////////////////////////////////////////////////////////////////////////
-void EditorViewportWidget::ToggleCameraObject()
-{
- if (m_viewSourceType == ViewSourceType::SequenceCamera)
- {
- ResetToViewSourceType(ViewSourceType::LegacyCamera);
- }
- else
- {
- ResetToViewSourceType(ViewSourceType::SequenceCamera);
- }
- PostCameraSet();
- GetIEditor()->GetAnimation()->ForceAnimation();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void EditorViewportWidget::SetCamera(const CCamera& camera)
-{
- m_Camera = camera;
- SetViewTM(m_Camera.GetMatrix());
-}
-
//////////////////////////////////////////////////////////////////////////
EditorViewportWidget* EditorViewportWidget::GetPrimaryViewport()
{
@@ -1852,64 +1607,64 @@ void EditorViewportWidget::keyPressEvent(QKeyEvent* event)
#endif // defined(AZ_PLATFORM_WINDOWS)
}
-void EditorViewportWidget::SetViewTM(const Matrix34& viewTM, bool bMoveOnly)
+void EditorViewportWidget::SetViewTM(const Matrix34& tm)
{
- Matrix34 camMatrix = viewTM;
-
- // If no collision flag set do not check for terrain elevation.
- if (GetType() == ET_ViewportCamera)
+ if (m_viewSourceType == ViewSourceType::None)
{
- if ((GetIEditor()->GetDisplaySettings()->GetSettings() & SETTINGS_NOCOLLISION) == 0)
- {
- Vec3 p = camMatrix.GetTranslation();
- bool adjustCameraElevation = true;
- auto terrain = AzFramework::Terrain::TerrainDataRequestBus::FindFirstHandler();
- if (terrain)
- {
- AZ::Aabb terrainAabb(terrain->GetTerrainAabb());
-
- // Adjust the AABB to include all Z values. Since the goal here is to snap the camera to the terrain height if
- // it's below the terrain, we only want to verify the camera is within the XY bounds of the terrain to adjust the elevation.
- terrainAabb.SetMin(AZ::Vector3(terrainAabb.GetMin().GetX(), terrainAabb.GetMin().GetY(), -AZ::Constants::FloatMax));
- terrainAabb.SetMax(AZ::Vector3(terrainAabb.GetMax().GetX(), terrainAabb.GetMax().GetY(), AZ::Constants::FloatMax));
-
- if (!terrainAabb.Contains(LYVec3ToAZVec3(p)))
- {
- adjustCameraElevation = false;
- }
- else if (terrain->GetIsHoleFromFloats(p.x, p.y))
- {
- adjustCameraElevation = false;
- }
- }
-
- if (adjustCameraElevation)
- {
- float z = GetIEditor()->GetTerrainElevation(p.x, p.y);
- if (p.z < z + 0.25)
- {
- p.z = z + 0.25;
- camMatrix.SetTranslation(p);
- }
- }
- }
-
- // Also force this position on game.
- if (GetIEditor()->GetGameEngine())
- {
- GetIEditor()->GetGameEngine()->SetPlayerViewMatrix(viewTM);
- }
+ m_defaultViewTM = tm;
}
+ SetViewTM(tm, false);
+}
+void EditorViewportWidget::SetViewTM(const Matrix34& camMatrix, bool bMoveOnly)
+{
+ AZ_Warning("EditorViewportWidget", !bMoveOnly, "'Move Only' mode is deprecated");
CBaseObject* cameraObject = GetCameraObject();
- if (cameraObject)
+
+ // Check if the active view entity is the same as the entity having the current view
+ // Sometimes this isn't the case because the active view is in the process of changing
+ // If it isn't, then we're doing the wrong thing below: we end up copying data from one (seemingly random)
+ // camera to another (seemingly random) camera
+ enum class ShouldUpdateObject
{
- // Ignore camera movement if locked.
- if (IsCameraMovementLocked() || (!GetIEditor()->GetAnimation()->IsRecordMode() && !IsCameraObjectMove()))
+ Yes, No, YesButViewsOutOfSync
+ };
+
+ const ShouldUpdateObject shouldUpdateObject = [&]() {
+ if (!cameraObject)
{
- return;
+ return ShouldUpdateObject::No;
}
+ if (m_viewSourceType == ViewSourceType::CameraComponent)
+ {
+ if (!m_viewEntityId.IsValid())
+ {
+ // Should be impossible anyways
+ AZ_Assert(false, "Internal logic error - view entity Id and view source type out of sync. Please report this as a bug");
+ return ShouldUpdateObject::No;
+ }
+
+ // Check that the current view is the same view as the view entity view
+ AZ::RPI::ViewPtr viewEntityView;
+ AZ::RPI::ViewProviderBus::EventResult(
+ viewEntityView, m_viewEntityId,
+ &AZ::RPI::ViewProviderBus::Events::GetView
+ );
+
+ return viewEntityView == GetCurrentAtomView() ? ShouldUpdateObject::Yes : ShouldUpdateObject::YesButViewsOutOfSync;
+ }
+ else
+ {
+ AZ_Assert(false, "Internal logic error - view source type is the default camera, but there is somehow a camera object. Please report this as a bug.");
+
+ // For non-component cameras, can't do any complicated view-based checks
+ return ShouldUpdateObject::No;
+ }
+ }();
+
+ if (shouldUpdateObject == ShouldUpdateObject::Yes)
+ {
AZ::Matrix3x3 lookThroughEntityCorrection = AZ::Matrix3x3::CreateIdentity();
if (m_viewEntityId.IsValid())
{
@@ -1918,89 +1673,77 @@ void EditorViewportWidget::SetViewTM(const Matrix34& viewTM, bool bMoveOnly)
&LmbrCentral::EditorCameraCorrectionRequests::GetInverseTransformCorrection);
}
- if (m_pressedKeyState != KeyPressedState::PressedInPreviousFrame)
+ int flags = 0;
{
- AzToolsFramework::ScopedUndoBatch undo("Move Camera");
+ // It isn't clear what this logic is supposed to do (it's legacy code)...
+ // For now, instead of removing it, just assert if the m_pressedKeyState isn't as expected
+ // Do not touch unless you really know what you're doing!
+ AZ_Assert(m_pressedKeyState == KeyPressedState::AllUp, "Internal logic error - key pressed state got changed. Please report this as a bug");
+
+ AZStd::optional undo;
+ if (m_pressedKeyState != KeyPressedState::PressedInPreviousFrame)
+ {
+ flags = eObjectUpdateFlags_UserInput;
+ undo.emplace("Move Camera");
+ }
+
if (bMoveOnly)
{
- // specify eObjectUpdateFlags_UserInput so that an undo command gets logged
- cameraObject->SetWorldPos(camMatrix.GetTranslation(), eObjectUpdateFlags_UserInput);
+ cameraObject->SetWorldPos(camMatrix.GetTranslation(), flags);
}
else
{
- // specify eObjectUpdateFlags_UserInput so that an undo command gets logged
- cameraObject->SetWorldTM(camMatrix * AZMatrix3x3ToLYMatrix3x3(lookThroughEntityCorrection), eObjectUpdateFlags_UserInput);
- }
- }
- else
- {
- if (bMoveOnly)
- {
- // Do not specify eObjectUpdateFlags_UserInput, so that an undo command does not get logged; we covered it already when m_pressedKeyState was PressedThisFrame
- cameraObject->SetWorldPos(camMatrix.GetTranslation());
- }
- else
- {
- // Do not specify eObjectUpdateFlags_UserInput, so that an undo command does not get logged; we covered it already when m_pressedKeyState was PressedThisFrame
- cameraObject->SetWorldTM(camMatrix * AZMatrix3x3ToLYMatrix3x3(lookThroughEntityCorrection));
+ cameraObject->SetWorldTM(camMatrix * AZMatrix3x3ToLYMatrix3x3(lookThroughEntityCorrection), flags);
}
}
}
- else if (m_viewEntityId.IsValid())
+ else if (shouldUpdateObject == ShouldUpdateObject::YesButViewsOutOfSync)
{
- // Ignore camera movement if locked.
- if (IsCameraMovementLocked() || (!GetIEditor()->GetAnimation()->IsRecordMode() && !IsCameraObjectMove()))
- {
- return;
- }
-
- if (m_pressedKeyState != KeyPressedState::PressedInPreviousFrame)
- {
- AzToolsFramework::ScopedUndoBatch undo("Move Camera");
- if (bMoveOnly)
- {
- AZ::TransformBus::Event(
- m_viewEntityId, &AZ::TransformInterface::SetWorldTranslation,
- LYVec3ToAZVec3(camMatrix.GetTranslation()));
- }
- else
- {
- AZ::TransformBus::Event(
- m_viewEntityId, &AZ::TransformInterface::SetWorldTM,
- LYTransformToAZTransform(camMatrix));
- }
-
- AzToolsFramework::ToolsApplicationRequestBus::Broadcast(&AzToolsFramework::ToolsApplicationRequests::AddDirtyEntity, m_viewEntityId);
- }
- else
- {
- if (bMoveOnly)
- {
- AZ::TransformBus::Event(
- m_viewEntityId, &AZ::TransformInterface::SetWorldTranslation,
- LYVec3ToAZVec3(camMatrix.GetTranslation()));
- }
- else
- {
- AZ::TransformBus::Event(
- m_viewEntityId, &AZ::TransformInterface::SetWorldTM,
- LYTransformToAZTransform(camMatrix));
- }
- }
-
- AzToolsFramework::PropertyEditorGUIMessages::Bus::Broadcast(
- &AzToolsFramework::PropertyEditorGUIMessages::RequestRefresh,
- AzToolsFramework::PropertyModificationRefreshLevel::Refresh_AttributesAndValues);
+ // Technically this should not cause anything to go wrong, but may indicate some underlying bug by a caller
+ // of SetViewTm, for example, trying to set the view TM in the middle of a camera change.
+ // If this is an important case, it can potentially be supported by caching the requested view TM
+ // until the entity and view ptr become synchronized.
+ AZ_Error("EditorViewportWidget",
+ m_playInEditorState == PlayInEditorState::Editor,
+ "Viewport camera entity ID and view out of sync; request view transform will be ignored. "
+ "Please report this as a bug."
+ );
}
if (m_pressedKeyState == KeyPressedState::PressedThisFrame)
{
m_pressedKeyState = KeyPressedState::PressedInPreviousFrame;
}
+}
- QtViewport::SetViewTM(camMatrix);
+const Matrix34& EditorViewportWidget::GetViewTM() const
+{
+ // `m_viewTmStorage' is only required because we must return a reference
+ m_viewTmStorage = AZTransformToLYTransform(GetCurrentAtomView()->GetCameraTransform());
+ return m_viewTmStorage;
+};
- m_Camera.SetMatrix(camMatrix);
+AZ::EntityId EditorViewportWidget::GetCurrentViewEntityId()
+{
+ // Sanity check that this camera entity ID is actually the camera entity which owns the current active render view
+ if (m_viewSourceType == ViewSourceType::CameraComponent)
+ {
+ // Check that the current view is the same view as the view entity view
+ AZ::RPI::ViewPtr viewEntityView;
+ AZ::RPI::ViewProviderBus::EventResult(
+ viewEntityView, m_viewEntityId,
+ &AZ::RPI::ViewProviderBus::Events::GetView
+ );
+
+ const bool isViewEntityCorrect = viewEntityView == GetCurrentAtomView();
+ AZ_Error("EditorViewportWidget", isViewEntityCorrect,
+ "GetCurrentViewEntityId called while the current view is being changed. "
+ "You may get inconsistent results if you make use of the returned entity ID. "
+ "This is an internal error, please report it as a bug."
+ );
+ }
+
+ return m_viewEntityId;
}
//////////////////////////////////////////////////////////////////////////
@@ -2406,14 +2149,10 @@ void EditorViewportWidget::ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3&
}
//////////////////////////////////////////////////////////////////////////
-float EditorViewportWidget::GetScreenScaleFactor(const Vec3& worldPoint) const
+float EditorViewportWidget::GetScreenScaleFactor([[maybe_unused]] const Vec3& worldPoint) const
{
- float dist = m_Camera.GetPosition().GetDistance(worldPoint);
- if (dist < m_Camera.GetNearPlane())
- {
- dist = m_Camera.GetNearPlane();
- }
- return dist;
+ AZ_Error("CryLegacy", false, "EditorViewportWidget::GetScreenScaleFactor not implemented");
+ return 1.f;
}
//////////////////////////////////////////////////////////////////////////
float EditorViewportWidget::GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position)
@@ -2423,12 +2162,6 @@ float EditorViewportWidget::GetScreenScaleFactor(const CCamera& camera, const Ve
return dist;
}
-//////////////////////////////////////////////////////////////////////////
-void EditorViewportWidget::OnDestroy()
-{
- DestroyRenderContext();
-}
-
//////////////////////////////////////////////////////////////////////////
bool EditorViewportWidget::CheckRespondToInput() const
{
@@ -2448,16 +2181,16 @@ bool EditorViewportWidget::CheckRespondToInput() const
//////////////////////////////////////////////////////////////////////////
bool EditorViewportWidget::HitTest(const QPoint& point, HitContext& hitInfo)
{
- hitInfo.camera = &m_Camera;
+ hitInfo.camera = nullptr;
hitInfo.pExcludedObject = GetCameraObject();
return QtViewport::HitTest(point, hitInfo);
}
//////////////////////////////////////////////////////////////////////////
-bool EditorViewportWidget::IsBoundsVisible(const AABB& box) const
+bool EditorViewportWidget::IsBoundsVisible(const AABB&) const
{
- // If at least part of bbox is visible then its visible.
- return m_Camera.IsAABBVisible_F(AABB(box.min, box.max));
+ AZ_Assert(false, "Not supported");
+ return false;
}
//////////////////////////////////////////////////////////////////////////
@@ -2502,11 +2235,11 @@ void EditorViewportWidget::CenterOnAABB(const AABB& aabb)
Matrix34 newTM = Matrix34(rotationMatrix, newPosition);
// Set new orbit distance
- m_orbitDistance = distanceToTarget;
- m_orbitDistance = fabs(m_orbitDistance);
+ float orbitDistance = distanceToTarget;
+ orbitDistance = fabs(orbitDistance);
SetViewTM(newTM);
- SandboxEditor::OrbitCameraControlsBus::Event(GetViewportId(), &SandboxEditor::OrbitCameraControlsBus::Events::SetOrbitDistance, m_orbitDistance);
+ SandboxEditor::OrbitCameraControlsBus::Event(GetViewportId(), &SandboxEditor::OrbitCameraControlsBus::Events::SetOrbitDistance, orbitDistance);
}
void EditorViewportWidget::CenterOnSliceInstance()
@@ -2556,132 +2289,121 @@ void EditorViewportWidget::SetFOV(float fov)
{
if (m_viewEntityId.IsValid())
{
- Camera::CameraRequestBus::Event(m_viewEntityId, &Camera::CameraComponentRequests::SetFov, AZ::RadToDeg(fov));
+ Camera::CameraRequestBus::Event(m_viewEntityId, &Camera::CameraComponentRequests::SetFovRadians, fov);
}
else
{
- m_camFOV = fov;
- // Set the active camera's FOV
- {
- AZ::Matrix4x4 clipMatrix;
- AZ::MakePerspectiveFovMatrixRH(
- clipMatrix,
- GetFOV(),
- aznumeric_cast(width()) / aznumeric_cast(height()),
- m_Camera.GetNearPlane(),
- m_Camera.GetFarPlane(),
- true
- );
- m_renderViewport->GetViewportContext()->SetCameraProjectionMatrix(clipMatrix);
- }
- }
-
- if (m_viewPane)
- {
- m_viewPane->OnFOVChanged(fov);
+ auto m = m_defaultView->GetViewToClipMatrix();
+ AZ::SetPerspectiveMatrixFOV(m, fov, aznumeric_cast(width()) / aznumeric_cast(height()));
+ m_defaultView->SetViewToClipMatrix(m);
}
}
//////////////////////////////////////////////////////////////////////////
float EditorViewportWidget::GetFOV() const
{
- if (m_viewSourceType == ViewSourceType::SequenceCamera)
- {
- CBaseObject* cameraObject = GetCameraObject();
-
- AZ::EntityId cameraEntityId;
- AzToolsFramework::ComponentEntityObjectRequestBus::EventResult(cameraEntityId, cameraObject, &AzToolsFramework::ComponentEntityObjectRequestBus::Events::GetAssociatedEntityId);
- if (cameraEntityId.IsValid())
- {
- // component Camera
- float fov = DEFAULT_FOV;
- Camera::CameraRequestBus::EventResult(fov, cameraEntityId, &Camera::CameraComponentRequests::GetFov);
- return AZ::DegToRad(fov);
- }
- }
-
if (m_viewEntityId.IsValid())
{
- float fov = AZ::RadToDeg(m_camFOV);
- Camera::CameraRequestBus::EventResult(fov, m_viewEntityId, &Camera::CameraComponentRequests::GetFov);
- return AZ::DegToRad(fov);
+ float fov = 0.f;
+ Camera::CameraRequestBus::EventResult(fov, m_viewEntityId, &Camera::CameraComponentRequests::GetFovRadians);
+ return fov;
+ }
+ else
+ {
+ return AZ::GetPerspectiveMatrixFOV(m_defaultView->GetViewToClipMatrix());
+ }
+}
+
+void EditorViewportWidget::OnActiveViewChanged(const AZ::EntityId& viewEntityId)
+{
+ // Avoid re-entry
+ if (m_sendingOnActiveChanged)
+ {
+ return;
}
- return m_camFOV;
-}
+ // Ignore any changes in simulation mode
+ if (m_playInEditorState != PlayInEditorState::Editor)
+ {
+ return;
+ }
-//////////////////////////////////////////////////////////////////////////
-bool EditorViewportWidget::CreateRenderContext()
-{
- return true;
-}
+ // if they've picked the same camera, then that means they want to toggle
+ if (viewEntityId.IsValid())
+ {
+ // Any such events for game entities should be filtered out by the check above
+ AZ_Error(
+ "EditorViewportWidget",
+ Camera::EditorCameraViewRequestBus::FindFirstHandler(viewEntityId) != nullptr,
+ "Internal logic error - active view changed to an entity which is not an editor camera. "
+ "Please report this as a bug."
+ );
-//////////////////////////////////////////////////////////////////////////
-void EditorViewportWidget::DestroyRenderContext()
-{
+ m_viewEntityId = viewEntityId;
+ m_viewSourceType = ViewSourceType::CameraComponent;
+ AZStd::string entityName;
+ AZ::ComponentApplicationBus::BroadcastResult(entityName, &AZ::ComponentApplicationRequests::GetEntityName, viewEntityId);
+ SetName(QString("Camera entity: %1").arg(entityName.c_str()));
+
+ PostCameraSet();
+ }
+ else
+ {
+ SetDefaultCamera();
+ }
}
//////////////////////////////////////////////////////////////////////////
void EditorViewportWidget::SetDefaultCamera()
{
- // Ensure the FOV matches our internally stored setting
- SetFOV(GetFOV());
- if (IsDefaultCamera())
- {
- return;
- }
- ResetToViewSourceType(ViewSourceType::None);
- GetViewManager()->SetCameraObjectId(m_cameraObjectId);
+ m_viewEntityId.SetInvalid();
+ m_viewSourceType = ViewSourceType::None;
+ GetViewManager()->SetCameraObjectId(GUID_NULL);
SetName(m_defaultViewName);
SetViewTM(m_defaultViewTM);
+
+ // Synchronize the configured editor viewport FOV to the default camera
+ if (m_viewPane)
+ {
+ const float fov = gSettings.viewports.fDefaultFov;
+ m_viewPane->OnFOVChanged(fov);
+ SetFOV(fov);
+ }
+
+ // Push the default view as the active view
+ auto atomViewportRequests = AZ::Interface::Get();
+ if (atomViewportRequests)
+ {
+ const AZ::Name contextName = atomViewportRequests->GetDefaultViewportContextName();
+ atomViewportRequests->PushView(contextName, m_defaultView);
+ }
+
PostCameraSet();
}
//////////////////////////////////////////////////////////////////////////
-bool EditorViewportWidget::IsDefaultCamera() const
+AZ::RPI::ViewPtr EditorViewportWidget::GetCurrentAtomView() const
{
- return m_viewSourceType == ViewSourceType::None;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void EditorViewportWidget::SetSequenceCamera()
-{
- if (m_viewSourceType == ViewSourceType::SequenceCamera)
+ if (m_renderViewport && m_renderViewport->GetViewportContext())
{
- // Reset if we were checked before
- SetDefaultCamera();
+ return m_renderViewport->GetViewportContext()->GetDefaultView();
}
else
{
- ResetToViewSourceType(ViewSourceType::SequenceCamera);
-
- SetName(tr("Sequence Camera"));
- SetViewTM(GetViewTM());
-
- GetViewManager()->SetCameraObjectId(m_cameraObjectId);
- PostCameraSet();
-
- // ForceAnimation() so Track View will set the Camera params
- // if a camera is animated in the sequences.
- if (GetIEditor() && GetIEditor()->GetAnimation())
- {
- GetIEditor()->GetAnimation()->ForceAnimation();
- }
+ return nullptr;
}
}
//////////////////////////////////////////////////////////////////////////
void EditorViewportWidget::SetComponentCamera(const AZ::EntityId& entityId)
{
- ResetToViewSourceType(ViewSourceType::CameraComponent);
- SetViewEntity(entityId);
+ SetViewFromEntityPerspective(entityId);
}
//////////////////////////////////////////////////////////////////////////
void EditorViewportWidget::SetEntityAsCamera(const AZ::EntityId& entityId, bool lockCameraMovement)
{
- ResetToViewSourceType(ViewSourceType::AZ_Entity);
- SetViewEntity(entityId, lockCameraMovement);
+ SetViewAndMovementLockFromEntityPerspective(entityId, lockCameraMovement);
}
void EditorViewportWidget::SetFirstComponentCamera()
@@ -2729,7 +2451,7 @@ bool EditorViewportWidget::IsSelectedCamera() const
AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(
selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
- if ((m_viewSourceType == ViewSourceType::CameraComponent || m_viewSourceType == ViewSourceType::AZ_Entity)
+ if ((m_viewSourceType == ViewSourceType::CameraComponent)
&& !selectedEntityList.empty()
&& AZStd::find(selectedEntityList.begin(), selectedEntityList.end(), m_viewEntityId) != selectedEntityList.end())
{
@@ -2751,17 +2473,6 @@ void EditorViewportWidget::CycleCamera()
SetFirstComponentCamera();
break;
}
- case EditorViewportWidget::ViewSourceType::SequenceCamera:
- {
- AZ_Error("EditorViewportWidget", false, "Legacy cameras no longer exist, unable to set sequence camera.");
- break;
- }
- case EditorViewportWidget::ViewSourceType::LegacyCamera:
- {
- AZ_Warning("EditorViewportWidget", false, "Legacy cameras no longer exist, using first found component camera instead.");
- SetFirstComponentCamera();
- break;
- }
case EditorViewportWidget::ViewSourceType::CameraComponent:
{
AZ::EBusAggregateResults results;
@@ -2780,12 +2491,6 @@ void EditorViewportWidget::CycleCamera()
SetDefaultCamera();
break;
}
- case EditorViewportWidget::ViewSourceType::AZ_Entity:
- {
- // we may decide to have this iterate over just selected entities
- SetDefaultCamera();
- break;
- }
default:
{
SetDefaultCamera();
@@ -2799,11 +2504,28 @@ void EditorViewportWidget::SetViewFromEntityPerspective(const AZ::EntityId& enti
SetViewAndMovementLockFromEntityPerspective(entityId, false);
}
-void EditorViewportWidget::SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement)
+void EditorViewportWidget::SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, [[maybe_unused]] bool lockCameraMovement)
{
- if (!m_ignoreSetViewFromEntityPerspective)
+ // This is an editor event, so is only serviced during edit mode, not play game mode
+ //
+ if (m_playInEditorState != PlayInEditorState::Editor)
{
- SetEntityAsCamera(entityId, lockCameraMovement);
+ AZ_Warning("EditorViewportWidget", false,
+ "Tried to change the editor camera during play game in editor; this is currently unsupported"
+ );
+ return;
+ }
+
+ AZ_Assert(lockCameraMovement == false, "SetViewAndMovementLockFromEntityPerspective with lockCameraMovement == true not supported");
+
+ if (entityId.IsValid())
+ {
+ Camera::CameraRequestBus::Event(entityId, &Camera::CameraRequestBus::Events::MakeActiveView);
+ }
+ else
+ {
+ // The default camera
+ SetDefaultCamera();
}
}
@@ -2818,7 +2540,7 @@ bool EditorViewportWidget::GetActiveCameraPosition(AZ::Vector3& cameraPos)
else
{
// Use viewTM, which is synced with the camera and guaranteed to be up-to-date
- cameraPos = LYVec3ToAZVec3(m_viewTM.GetTranslation());
+ cameraPos = LYVec3ToAZVec3(GetViewTM().GetTranslation());
}
return true;
@@ -2832,17 +2554,26 @@ bool EditorViewportWidget::GetActiveCameraState(AzFramework::CameraState& camera
if (m_pPrimaryViewport == this)
{
cameraState = GetCameraState();
-
return true;
}
return false;
}
+void EditorViewportWidget::OnStartPlayInEditorBegin()
+{
+ m_playInEditorState = PlayInEditorState::Starting;
+}
+
void EditorViewportWidget::OnStartPlayInEditor()
{
+ m_playInEditorState = PlayInEditorState::Started;
+
if (m_viewEntityId.IsValid())
{
+ // Note that this is assuming that the Atom camera components will share the same view ptr
+ // in editor as in game mode
+
m_viewEntityIdCachedForEditMode = m_viewEntityId;
AZ::EntityId runtimeEntityId;
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
@@ -2855,20 +2586,14 @@ void EditorViewportWidget::OnStartPlayInEditor()
void EditorViewportWidget::OnStopPlayInEditor()
{
- if (m_viewEntityIdCachedForEditMode.IsValid())
- {
- m_viewEntityId = m_viewEntityIdCachedForEditMode;
- m_viewEntityIdCachedForEditMode.SetInvalid();
- }
-}
+ m_playInEditorState = PlayInEditorState::Editor;
-//////////////////////////////////////////////////////////////////////////
-void EditorViewportWidget::OnCameraFOVVariableChanged([[maybe_unused]] IVariable* var)
-{
- if (m_viewPane)
- {
- m_viewPane->OnFOVChanged(GetFOV());
- }
+ // Note that:
+ // - this is assuming that the Atom camera components will share the same view ptr in editor as in game mode.
+ // - if `m_viewEntityIdCachedForEditMode' is invalid, the camera before game mode was the default editor camera
+ // - we MUST set the camera again when exiting game mode, because when rendering with trackview, the editor camera gets set somehow
+ SetViewFromEntityPerspective(m_viewEntityIdCachedForEditMode);
+ m_viewEntityIdCachedForEditMode.SetInvalid();
}
//////////////////////////////////////////////////////////////////////////
@@ -2901,11 +2626,6 @@ void EditorViewportWidget::ShowCursor()
m_bCursorHidden = false;
}
-bool EditorViewportWidget::IsKeyDown(Qt::Key key) const
-{
- return m_keyDown.contains(key);
-}
-
//////////////////////////////////////////////////////////////////////////
void EditorViewportWidget::PushDisableRendering()
{
@@ -2943,6 +2663,17 @@ QSize EditorViewportWidget::WidgetToViewport(const QSize& size) const
return size * WidgetToViewportFactor();
}
+//////////////////////////////////////////////////////////////////////////
+double EditorViewportWidget::WidgetToViewportFactor() const
+{
+#if defined(AZ_PLATFORM_WINDOWS)
+ // Needed for high DPI mode on windows
+ return devicePixelRatioF();
+#else
+ return 1.0;
+#endif
+}
+
//////////////////////////////////////////////////////////////////////////
void EditorViewportWidget::BeginUndoTransaction()
{
@@ -2956,12 +2687,6 @@ void EditorViewportWidget::EndUndoTransaction()
Update();
}
-void EditorViewportWidget::UpdateCurrentMousePos(const QPoint& newPosition)
-{
- m_prevMousePos = m_mousePos;
- m_mousePos = newPosition;
-}
-
void* EditorViewportWidget::GetSystemCursorConstraintWindow() const
{
AzFramework::SystemCursorState systemCursorState = AzFramework::SystemCursorState::Unknown;
@@ -3037,7 +2762,8 @@ void EditorViewportWidget::RestoreViewportAfterGameMode()
}
else
{
- SetViewTM(m_gameTM);
+ AZ_Error("CryLegacy", false, "Not restoring the editor viewport camera is currently unsupported");
+ SetViewTM(preGameModeViewTM);
}
}
@@ -3056,12 +2782,6 @@ void EditorViewportWidget::UpdateScene()
}
}
-void EditorViewportWidget::UpdateCameraFromViewportContext()
-{
- // Queue a sync for the next tick, to ensure the latest version of the viewport context transform is used
- m_updateCameraPositionNextTick = true;
-}
-
void EditorViewportWidget::SetAsActiveViewport()
{
auto viewportContextManager = AZ::Interface::Get();
diff --git a/Code/Editor/EditorViewportWidget.h b/Code/Editor/EditorViewportWidget.h
index 1829995d02..33ed001735 100644
--- a/Code/Editor/EditorViewportWidget.h
+++ b/Code/Editor/EditorViewportWidget.h
@@ -8,8 +8,6 @@
#pragma once
-// RenderViewport.h : header file
-//
#if !defined(Q_MOC_RUN)
#include
@@ -34,6 +32,7 @@
#include
#include
#include
+#include
#endif
#include
@@ -65,130 +64,120 @@ namespace AzToolsFramework
// EditorViewportWidget window
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-class SANDBOX_API EditorViewportWidget
+class SANDBOX_API EditorViewportWidget final
: public QtViewport
- , public IEditorNotifyListener
- , public IUndoManagerListener
- , public Camera::EditorCameraRequestBus::Handler
- , public AzFramework::InputSystemCursorConstraintRequestBus::Handler
- , public AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler
- , public AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler
- , public AzFramework::AssetCatalogEventBus::Handler
- , public AZ::RPI::SceneNotificationBus::Handler
+ , private IEditorNotifyListener
+ , private IUndoManagerListener
+ , private Camera::EditorCameraRequestBus::Handler
+ , private Camera::CameraNotificationBus::Handler
+ , private AzFramework::InputSystemCursorConstraintRequestBus::Handler
+ , private AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler
+ , private AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler
+ , private AzFramework::AssetCatalogEventBus::Handler
+ , private AZ::RPI::SceneNotificationBus::Handler
{
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
Q_OBJECT
-public:
- struct SResolution
- {
- SResolution()
- : width(0)
- , height(0)
- {
- }
-
- SResolution(int w, int h)
- : width(w)
- , height(h)
- {
- }
-
- int width;
- int height;
- };
public:
EditorViewportWidget(const QString& name, QWidget* parent = nullptr);
+ ~EditorViewportWidget() override;
static const GUID& GetClassID()
{
return QtViewport::GetClassID();
}
- /** Get type of this viewport.
- */
- virtual EViewportType GetType() const { return ET_ViewportCamera; }
- virtual void SetType([[maybe_unused]] EViewportType type) { assert(type == ET_ViewportCamera); };
+ static EditorViewportWidget* GetPrimaryViewport();
- virtual ~EditorViewportWidget();
+ // Used by ViewPan in some circumstances
+ void ConnectViewportInteractionRequestBus();
+ void DisconnectViewportInteractionRequestBus();
- Q_INVOKABLE void InjectFakeMouseMove(int deltaX, int deltaY, Qt::MouseButtons buttons);
+ // QtViewport/IDisplayViewport/CViewport
+ // These methods are made public in the derived class because they are called with an object whose static type is known to be this class type.
+ void SetFOV(float fov) override;
+ float GetFOV() const override;
- // Replacement for still used CRenderer methods
- void UnProjectFromScreen(float sx, float sy, float sz, float* px, float* py, float* pz) const;
- void ProjectToScreen(float ptx, float pty, float ptz, float* sx, float* sy, float* sz) const;
+private:
+ ////////////////////////////////////////////////////////////////////////
+ // Private types ...
-public:
- virtual void Update();
-
- virtual void ResetContent();
- virtual void UpdateContent(int flags);
-
- void OnTitleMenu(QMenu* menu) override;
-
- void SetCamera(const CCamera& camera);
- const CCamera& GetCamera() const { return m_Camera; };
- virtual void SetViewTM(const Matrix34& tm)
+ enum class ViewSourceType
{
- if (m_viewSourceType == ViewSourceType::None)
- {
- m_defaultViewTM = tm;
- }
- SetViewTM(tm, false);
- }
+ None,
+ CameraComponent,
+ ViewSourceTypesCount,
+ };
+ enum class PlayInEditorState
+ {
+ Editor, Starting, Started
+ };
+ enum class KeyPressedState
+ {
+ AllUp,
+ PressedThisFrame,
+ PressedInPreviousFrame,
+ };
- //! Map world space position to viewport position.
- virtual QPoint WorldToView(const Vec3& wp) const;
- virtual QPoint WorldToViewParticleEditor(const Vec3& wp, int width, int height) const;
- virtual Vec3 WorldToView3D(const Vec3& wp, int nFlags = 0) const;
-
- //! Map viewport position to world space position.
- virtual Vec3 ViewToWorld(const QPoint& vp, bool* collideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
- virtual void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const override;
- virtual Vec3 ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh = false) override;
- virtual float GetScreenScaleFactor(const Vec3& worldPoint) const;
- virtual float GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position);
- virtual float GetAspectRatio() const;
- virtual bool HitTest(const QPoint& point, HitContext& hitInfo);
- virtual bool IsBoundsVisible(const AABB& box) const;
- virtual void CenterOnSelection();
- virtual void CenterOnAABB(const AABB& aabb);
- void CenterOnSliceInstance() override;
+ ////////////////////////////////////////////////////////////////////////
+ // Method overrides ...
+ // QWidget
void focusOutEvent(QFocusEvent* event) override;
void keyPressEvent(QKeyEvent* event) override;
+ bool event(QEvent* event) override;
+ void resizeEvent(QResizeEvent* event) override;
+ void paintEvent(QPaintEvent* event) override;
+ void mousePressEvent(QMouseEvent* event) override;
- void SetFOV(float fov);
- float GetFOV() const;
+ // QtViewport/IDisplayViewport/CViewport
+ EViewportType GetType() const override { return ET_ViewportCamera; }
+ void SetType([[maybe_unused]] EViewportType type) override { assert(type == ET_ViewportCamera); };
+ AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point) override;
+ void SetViewportId(int id) override;
+ QPoint WorldToView(const Vec3& wp) const override;
+ QPoint WorldToViewParticleEditor(const Vec3& wp, int width, int height) const override;
+ Vec3 WorldToView3D(const Vec3& wp, int nFlags = 0) const override;
+ Vec3 ViewToWorld(const QPoint& vp, bool* collideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
+ void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const override;
+ Vec3 ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh = false) override;
+ float GetScreenScaleFactor(const Vec3& worldPoint) const override;
+ float GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position) override;
+ float GetAspectRatio() const override;
+ bool HitTest(const QPoint& point, HitContext& hitInfo) override;
+ bool IsBoundsVisible(const AABB& box) const override;
+ void CenterOnSelection() override;
+ void CenterOnAABB(const AABB& aabb) override;
+ void CenterOnSliceInstance() override;
+ void OnTitleMenu(QMenu* menu) override;
+ void SetViewTM(const Matrix34& tm) override;
+ const Matrix34& GetViewTM() const override;
+ void Update() override;
+ void UpdateContent(int flags) override;
- void SetDefaultCamera();
- bool IsDefaultCamera() const;
- void SetSequenceCamera();
- bool IsSequenceCamera() const { return m_viewSourceType == ViewSourceType::SequenceCamera; }
- void SetSelectedCamera();
- bool IsSelectedCamera() const;
- void SetComponentCamera(const AZ::EntityId& entityId);
- void SetEntityAsCamera(const AZ::EntityId& entityId, bool lockCameraMovement = false);
- void SetFirstComponentCamera();
- void SetViewEntity(const AZ::EntityId& cameraEntityId, bool lockCameraMovement = false);
- void PostCameraSet();
- // This switches the active camera to the next one in the list of (default, all custom cams).
- void CycleCamera();
+ // SceneNotificationBus
+ void OnBeginPrepareRender() override;
- // Camera::EditorCameraRequestBus
- void SetViewFromEntityPerspective(const AZ::EntityId& entityId) override;
- void SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement) override;
- AZ::EntityId GetCurrentViewEntityId() override { return m_viewEntityId; }
- bool GetActiveCameraPosition(AZ::Vector3& cameraPos) override;
- bool GetActiveCameraState(AzFramework::CameraState& cameraState) override;
+ // Camera::CameraNotificationBus
+ void OnActiveViewChanged(const AZ::EntityId&) override;
+
+ // IEditorEventListener
+ void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
// AzToolsFramework::EditorEntityContextNotificationBus (handler moved to cpp to resolve link issues in unity builds)
- virtual void OnStartPlayInEditor();
- virtual void OnStopPlayInEditor();
+ void OnStartPlayInEditor();
+ void OnStopPlayInEditor();
+ void OnStartPlayInEditorBegin();
- AzFramework::CameraState GetCameraState();
- AzFramework::ScreenPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition);
+ // IUndoManagerListener
+ void BeginUndoTransaction() override;
+ void EndUndoTransaction() override;
+
+ // AzFramework::InputSystemCursorConstraintRequestBus
+ void* GetSystemCursorConstraintWindow() const override;
// AzToolsFramework::ViewportFreezeRequestBus
bool IsViewportInputFrozen() override;
@@ -204,142 +193,19 @@ public:
void BeginWidgetContext() override;
void EndWidgetContext() override;
- // CViewport...
- void SetViewportId(int id) override;
-
- void ConnectViewportInteractionRequestBus();
- void DisconnectViewportInteractionRequestBus();
-
- void LockCameraMovement(bool bLock) { m_bLockCameraMovement = bLock; }
- bool IsCameraMovementLocked() const { return m_bLockCameraMovement; }
-
- void EnableCameraObjectMove(bool bMove) { m_bMoveCameraObject = bMove; }
- bool IsCameraObjectMove() const { return m_bMoveCameraObject; }
-
- void SetPlayerControl(uint32 i) { m_PlayerControl = i; };
- uint32 GetPlayerControl() { return m_PlayerControl; };
-
- const DisplayContext& GetDisplayContext() const { return m_displayContext; }
- CBaseObject* GetCameraObject() const;
-
- QPoint WidgetToViewport(const QPoint& point) const;
- QPoint ViewportToWidget(const QPoint& point) const;
- QSize WidgetToViewport(const QSize& size) const;
-
- AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point) override;
-
- void SetPlayerPos()
- {
- Matrix34 m = GetViewTM();
- m.SetTranslation(m.GetTranslation() - m_PhysicalLocation.t);
- SetViewTM(m);
-
- m_AverageFrameTime = 0.14f;
-
- m_PhysicalLocation.SetIdentity();
-
- m_LocalEntityMat.SetIdentity();
- m_PrevLocalEntityMat.SetIdentity();
-
- m_absCameraHigh = 2.0f;
- m_absCameraPos = Vec3(0, 3, 2);
- m_absCameraPosVP = Vec3(0, -3, 1.5);
-
- m_absCurrentSlope = 0.0f;
-
- m_absLookDirectionXY = Vec2(0, 1);
-
- m_LookAt = Vec3(ZERO);
- m_LookAtRate = Vec3(ZERO);
- m_vCamPos = Vec3(ZERO);
- m_vCamPosRate = Vec3(ZERO);
-
- m_relCameraRotX = 0;
- m_relCameraRotZ = 0;
-
- uint32 numSample6 = m_arrAnimatedCharacterPath.size();
- for (uint32 i = 0; i < numSample6; i++)
- {
- m_arrAnimatedCharacterPath[i] = Vec3(ZERO);
- }
-
- numSample6 = m_arrSmoothEntityPath.size();
- for (uint32 i = 0; i < numSample6; i++)
- {
- m_arrSmoothEntityPath[i] = Vec3(ZERO);
- }
-
- uint32 numSample7 = m_arrRunStrafeSmoothing.size();
- for (uint32 i = 0; i < numSample7; i++)
- {
- m_arrRunStrafeSmoothing[i] = 0;
- }
-
- m_vWorldDesiredBodyDirection = Vec2(0, 1);
- m_vWorldDesiredBodyDirectionSmooth = Vec2(0, 1);
- m_vWorldDesiredBodyDirectionSmoothRate = Vec2(0, 1);
-
- m_vWorldDesiredBodyDirection2 = Vec2(0, 1);
-
- m_vWorldDesiredMoveDirection = Vec2(0, 1);
- m_vWorldDesiredMoveDirectionSmooth = Vec2(0, 1);
- m_vWorldDesiredMoveDirectionSmoothRate = Vec2(0, 1);
- m_vLocalDesiredMoveDirection = Vec2(0, 1);
- m_vLocalDesiredMoveDirectionSmooth = Vec2(0, 1);
- m_vLocalDesiredMoveDirectionSmoothRate = Vec2(0, 1);
-
- m_vWorldAimBodyDirection = Vec2(0, 1);
-
- m_MoveSpeedMSec = 5.0f;
- m_key_W = 0;
- m_keyrcr_W = 0;
- m_key_S = 0;
- m_keyrcr_S = 0;
- m_key_A = 0;
- m_keyrcr_A = 0;
- m_key_D = 0;
- m_keyrcr_D = 0;
- m_key_SPACE = 0;
- m_keyrcr_SPACE = 0;
- m_ControllMode = 0;
-
- m_State = -1;
- m_Stance = 1; //combat
-
- m_udGround = 0.0f;
- m_lrGround = 0.0f;
- AABB aabb = AABB(Vec3(-40.0f, -40.0f, -0.25f), Vec3(+40.0f, +40.0f, +0.0f));
- m_GroundOBB = OBB::CreateOBBfromAABB(Matrix33(IDENTITY), aabb);
- m_GroundOBBPos = Vec3(0, 0, -0.01f);
- };
-
- static EditorViewportWidget* GetPrimaryViewport();
-
- AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
- CCamera m_Camera;
- AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-
-protected:
- struct SScopedCurrentContext;
+ // Camera::EditorCameraRequestBus
+ void SetViewFromEntityPerspective(const AZ::EntityId& entityId) override;
+ void SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement) override;
+ AZ::EntityId GetCurrentViewEntityId() override;
+ bool GetActiveCameraPosition(AZ::Vector3& cameraPos) override;
+ bool GetActiveCameraState(AzFramework::CameraState& cameraState) override;
+ ////////////////////////////////////////////////////////////////////////
+ // Private helpers...
void SetViewTM(const Matrix34& tm, bool bMoveOnly);
-
- // Called to render stuff.
- virtual void OnRender();
-
- virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
-
- //! Get currently active camera object.
- void ToggleCameraObject();
-
- void RenderConstructionPlane();
void RenderSnapMarker();
-
void RenderAll();
- void OnBeginPrepareRender() override;
-
// Update the safe frame, safe action, safe title, and borders rectangles based on
// viewport size and target aspect ratio.
void UpdateSafeFrame();
@@ -353,193 +219,41 @@ protected:
// Draw a selected region if it has been selected
void RenderSelectedRegion();
- virtual bool CreateRenderContext();
- virtual void DestroyRenderContext();
-
- void OnMenuCommandChangeAspectRatio(unsigned int commandId);
-
bool AdjustObjectPosition(const ray_hit& hit, Vec3& outNormal, Vec3& outPos) const;
bool RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const;
bool AddCameraMenuItems(QMenu* menu);
void ResizeView(int width, int height);
- void OnCameraFOVVariableChanged(IVariable* var);
-
void HideCursor();
void ShowCursor();
- bool IsKeyDown(Qt::Key key) const;
-
- enum class ViewSourceType
- {
- None,
- SequenceCamera,
- LegacyCamera,
- CameraComponent,
- AZ_Entity,
- ViewSourceTypesCount,
- };
- void ResetToViewSourceType(const ViewSourceType& viewSourType);
+ double WidgetToViewportFactor() const;
bool ShouldPreviewFullscreen() const;
void StartFullscreenPreview();
void StopFullscreenPreview();
- bool m_inFullscreenPreview = false;
- bool m_bRenderContextCreated = false;
- bool m_bInRotateMode = false;
- bool m_bInMoveMode = false;
- bool m_bInOrbitMode = false;
- bool m_bInZoomMode = false;
-
- QPoint m_mousePos = QPoint(0, 0);
- QPoint m_prevMousePos = QPoint(0, 0); // for tablets, you can't use SetCursorPos and need to remember the prior point and delta with that.
-
-
- float m_moveSpeed = 1;
-
- float m_orbitDistance = 10.0f;
- AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
- Vec3 m_orbitTarget;
-
- //-------------------------------------------
- //--- player-control in CharEdit ---
- //-------------------------------------------
- f32 m_MoveSpeedMSec;
-
- uint32 m_key_W, m_keyrcr_W;
- uint32 m_key_S, m_keyrcr_S;
- uint32 m_key_A, m_keyrcr_A;
- uint32 m_key_D, m_keyrcr_D;
-
- uint32 m_key_SPACE, m_keyrcr_SPACE;
- uint32 m_ControllMode;
-
- int32 m_Stance;
- int32 m_State;
- f32 m_AverageFrameTime;
-
- uint32 m_PlayerControl = 0;
-
- f32 m_absCameraHigh;
- Vec3 m_absCameraPos;
- Vec3 m_absCameraPosVP;
-
- f32 m_absCurrentSlope; //in radiants
-
- Vec2 m_absLookDirectionXY;
-
- Vec3 m_LookAt;
- Vec3 m_LookAtRate;
- Vec3 m_vCamPos;
- Vec3 m_vCamPosRate;
- float m_camFOV;
-
- f32 m_relCameraRotX;
- f32 m_relCameraRotZ;
-
- QuatTS m_PhysicalLocation;
-
- Matrix34 m_AnimatedCharacterMat;
-
- Matrix34 m_LocalEntityMat; //this is used for data-driven animations where the character is running on the spot
- Matrix34 m_PrevLocalEntityMat;
-
- std::vector m_arrVerticesHF;
- std::vector m_arrIndicesHF;
-
- std::vector m_arrAnimatedCharacterPath;
- std::vector m_arrSmoothEntityPath;
- std::vector m_arrRunStrafeSmoothing;
-
- Vec2 m_vWorldDesiredBodyDirection;
- Vec2 m_vWorldDesiredBodyDirectionSmooth;
- Vec2 m_vWorldDesiredBodyDirectionSmoothRate;
-
- Vec2 m_vWorldDesiredBodyDirection2;
-
-
- Vec2 m_vWorldDesiredMoveDirection;
- Vec2 m_vWorldDesiredMoveDirectionSmooth;
- Vec2 m_vWorldDesiredMoveDirectionSmoothRate;
- Vec2 m_vLocalDesiredMoveDirection;
- Vec2 m_vLocalDesiredMoveDirectionSmooth;
- Vec2 m_vLocalDesiredMoveDirectionSmoothRate;
- Vec2 m_vWorldAimBodyDirection;
-
- f32 m_udGround;
- f32 m_lrGround;
- OBB m_GroundOBB;
- Vec3 m_GroundOBBPos;
-
- // Index of camera objects.
- mutable GUID m_cameraObjectId;
- mutable AZ::EntityId m_viewEntityId;
- mutable ViewSourceType m_viewSourceType = ViewSourceType::None;
- AZ::EntityId m_viewEntityIdCachedForEditMode;
- Matrix34 m_preGameModeViewTM;
- uint m_disableRenderingCount = 0;
- bool m_bLockCameraMovement;
- bool m_bUpdateViewport = false;
- bool m_bMoveCameraObject = true;
-
- enum class KeyPressedState
- {
- AllUp,
- PressedThisFrame,
- PressedInPreviousFrame,
- };
- KeyPressedState m_pressedKeyState = KeyPressedState::AllUp;
-
- Matrix34 m_defaultViewTM;
- const QString m_defaultViewName;
-
- DisplayContext m_displayContext;
-
-
- bool m_isOnPaint = false;
- static EditorViewportWidget* m_pPrimaryViewport;
-
- QRect m_safeFrame;
- QRect m_safeAction;
- QRect m_safeTitle;
-
- CPredefinedAspectRatios m_predefinedAspectRatios;
-
- bool m_bCursorHidden = false;
-
void OnMenuResolutionCustom();
void OnMenuCreateCameraEntityFromCurrentView();
void OnMenuSelectCurrentCamera();
- int OnCreate();
- void resizeEvent(QResizeEvent* event) override;
- void paintEvent(QPaintEvent* event) override;
- void mousePressEvent(QMouseEvent* event) override;
-
// From a series of input primitives, compose a complete mouse interaction.
AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteractionInternal(
AzToolsFramework::ViewportInteraction::MouseButtons buttons,
AzToolsFramework::ViewportInteraction::KeyboardModifiers modifiers,
const AzToolsFramework::ViewportInteraction::MousePick& mousePick) const;
+
// Given a point in the viewport, return the pick ray into the scene.
// note: The argument passed to parameter **point**, originating
// from a Qt event, must first be passed to WidgetToViewport before being
// passed to BuildMousePick.
AzToolsFramework::ViewportInteraction::MousePick BuildMousePick(const QPoint& point);
- bool event(QEvent* event) override;
- void OnDestroy();
-
bool CheckRespondToInput() const;
- // AzFramework::InputSystemCursorConstraintRequestBus
- void* GetSystemCursorConstraintWindow() const override;
-
void BuildDragDropContext(AzQtComponents::ViewportDragContext& context, const QPoint& pt) override;
-private:
void SetAsActiveViewport();
void PushDisableRendering();
void PopDisableRendering();
@@ -547,48 +261,131 @@ private:
AzToolsFramework::ViewportInteraction::MousePick BuildMousePickInternal(const QPoint& point) const;
void RestoreViewportAfterGameMode();
- void UpdateCameraFromViewportContext();
- double WidgetToViewportFactor() const
- {
-#if defined(AZ_PLATFORM_WINDOWS)
- // Needed for high DPI mode on windows
- return devicePixelRatioF();
-#else
- return 1.0f;
-#endif
- }
-
- void BeginUndoTransaction() override;
- void EndUndoTransaction() override;
-
- void UpdateCurrentMousePos(const QPoint& newPosition);
void UpdateScene();
+ void SetDefaultCamera();
+ void SetSelectedCamera();
+ bool IsSelectedCamera() const;
+ void SetComponentCamera(const AZ::EntityId& entityId);
+ void SetEntityAsCamera(const AZ::EntityId& entityId, bool lockCameraMovement = false);
+ void SetFirstComponentCamera();
+ void PostCameraSet();
+ // This switches the active camera to the next one in the list of (default, all custom cams).
+ void CycleCamera();
+
+ AzFramework::CameraState GetCameraState();
+ AzFramework::ScreenPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition);
+
+ QPoint WidgetToViewport(const QPoint& point) const;
+ QPoint ViewportToWidget(const QPoint& point) const;
+ QSize WidgetToViewport(const QSize& size) const;
+
+ const DisplayContext& GetDisplayContext() const { return m_displayContext; }
+ CBaseObject* GetCameraObject() const;
+
+ void UnProjectFromScreen(float sx, float sy, float sz, float* px, float* py, float* pz) const;
+ void ProjectToScreen(float ptx, float pty, float ptz, float* sx, float* sy, float* sz) const;
+
+ AZ::RPI::ViewPtr GetCurrentAtomView() const;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Members ...
+ friend class AZ::ViewportHelpers::EditorEntityNotifications;
+
+ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
+
+ // Singleton for the primary viewport
+ static EditorViewportWidget* m_pPrimaryViewport;
+
+ // The simulation (play-game in editor) state
+ PlayInEditorState m_playInEditorState = PlayInEditorState::Editor;
+
+ // Whether we are doing a full screen game preview (play-game in editor) or a regular one
+ bool m_inFullscreenPreview = false;
+
+ // The entity ID of the current camera for this viewport, or invalid if the default editor camera
+ AZ::EntityId m_viewEntityId;
+
+ // Determines also if the current camera for this viewport is default editor camera
+ ViewSourceType m_viewSourceType = ViewSourceType::None;
+
+ // During play game in editor, holds the editor entity ID of the last
+ AZ::EntityId m_viewEntityIdCachedForEditMode;
+
+ // The editor camera TM before switching to game mode
+ Matrix34 m_preGameModeViewTM;
+
+ // Disables rendering during some periods of time, e.g. undo/redo, resize events
+ uint m_disableRenderingCount = 0;
+
+ // Determines if the viewport needs updating (false when out of focus for example)
+ bool m_bUpdateViewport = false;
+
+ // Avoid re-entering PostCameraSet->OnActiveViewChanged->PostCameraSet
+ bool m_sendingOnActiveChanged = false;
+
+ // Legacy...
+ KeyPressedState m_pressedKeyState = KeyPressedState::AllUp;
+
+ // The last camera matrix of the default editor camera, used when switching back to editor camera to restore the right TM
+ Matrix34 m_defaultViewTM;
+
+ // The name to use for the default editor camera
+ const QString m_defaultViewName;
+
+ // Note that any attempts to draw anything with this object will crash. Exists here for legacy "reasons"
+ DisplayContext m_displayContext;
+
+ // Re-entrency guard for on paint events
+ bool m_isOnPaint = false;
+
+ // Shapes of various safe frame helpers which can be displayed in the editor
+ QRect m_safeFrame;
+ QRect m_safeAction;
+ QRect m_safeTitle;
+
+ // Aspect ratios available in the title bar
+ CPredefinedAspectRatios m_predefinedAspectRatios;
+
+ // Is the cursor hidden or displayed?
+ bool m_bCursorHidden = false;
+
+ // Shim for QtViewport, which used to be responsible for visibility queries in the editor,
+ // these are now forwarded to EntityVisibilityQuery
AzFramework::EntityVisibilityQuery m_entityVisibilityQuery;
+ // Handlers for grid snapping/editor event callbacks
SandboxEditor::GridSnappingChangedEvent::Handler m_gridSnappingHandler;
AZStd::unique_ptr m_editorViewportSettingsCallbacks;
+ // Used for some legacy logic which lets the widget release a grabbed keyboard at the right times
+ // Unclear if it's still necessary.
QSet m_keyDown;
+ // State for ViewportFreezeRequestBus, currently does nothing
bool m_freezeViewportInput = false;
+ // This widget holds a reference to the manipulator manage because its responsible for drawing manipulators
AZStd::shared_ptr m_manipulatorManager;
- // Used to prevent circular set camera events
- bool m_ignoreSetViewFromEntityPerspective = false;
- bool m_windowResizedEvent = false;
-
+ // Helper for getting EditorEntityNotificationBus events
AZStd::unique_ptr m_editorEntityNotifications;
+
+ // The widget to which Atom will actually render
AtomToolsFramework::RenderViewportWidget* m_renderViewport = nullptr;
- bool m_updateCameraPositionNextTick = false;
- AZ::RPI::ViewportContext::MatrixChangedEvent::Handler m_cameraViewMatrixChangeHandler;
- AZ::RPI::ViewportContext::MatrixChangedEvent::Handler m_cameraProjectionMatrixChangeHandler;
+ // Atom debug display
AzFramework::DebugDisplayRequests* m_debugDisplay = nullptr;
+ // The default view created for the viewport context, which is used as the "Editor Camera"
+ AZ::RPI::ViewPtr m_defaultView;
+
+ // The name to set on the viewport context when this viewport widget is set as the active one
AZ::Name m_defaultViewportContextName;
+ // DO NOT USE THIS! It exists only to satisfy the signature of the base class method GetViewTm
+ mutable Matrix34 m_viewTmStorage;
+
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
};
diff --git a/Code/Editor/ErrorReport.cpp b/Code/Editor/ErrorReport.cpp
index e1b2b8b6e4..7914511fbe 100644
--- a/Code/Editor/ErrorReport.cpp
+++ b/Code/Editor/ErrorReport.cpp
@@ -136,11 +136,11 @@ void CErrorReport::ReportError(CErrorRecord& err)
}
else
{
- if (err.pObject == NULL && m_pObject != NULL)
+ if (err.pObject == nullptr && m_pObject != nullptr)
{
err.pObject = m_pObject;
}
- else if (err.pItem == NULL && m_pItem != NULL)
+ else if (err.pItem == nullptr && m_pItem != nullptr)
{
err.pItem = m_pItem;
}
diff --git a/Code/Editor/ErrorReport.h b/Code/Editor/ErrorReport.h
index dec5cd4fb8..2bef4105f8 100644
--- a/Code/Editor/ErrorReport.h
+++ b/Code/Editor/ErrorReport.h
@@ -105,7 +105,7 @@ public:
bool IsEmpty() const;
//! Get number of contained error records.
- int GetErrorCount() const { return m_errors.size(); };
+ int GetErrorCount() const { return static_cast(m_errors.size()); };
//! Get access to indexed error record.
CErrorRecord& GetError(int i);
//! Clear all error records.
diff --git a/Code/Editor/ErrorReportDialog.cpp b/Code/Editor/ErrorReportDialog.cpp
index 8b007207d6..2d551d6c8b 100644
--- a/Code/Editor/ErrorReportDialog.cpp
+++ b/Code/Editor/ErrorReportDialog.cpp
@@ -39,7 +39,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
//////////////////////////////////////////////////////////////////////////
-CErrorReportDialog* CErrorReportDialog::m_instance = 0;
+CErrorReportDialog* CErrorReportDialog::m_instance = nullptr;
// CErrorReportDialog dialog
@@ -88,12 +88,12 @@ CErrorReportDialog::CErrorReportDialog(QWidget* parent)
m_instance = this;
//CErrorReport *report,
//m_pErrorReport = report;
- m_pErrorReport = 0;
+ m_pErrorReport = nullptr;
}
CErrorReportDialog::~CErrorReportDialog()
{
- m_instance = 0;
+ m_instance = nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -141,7 +141,7 @@ void CErrorReportDialog::Clear()
{
if (m_instance)
{
- m_instance->SetReport(0);
+ m_instance->SetReport(nullptr);
m_instance->UpdateErrors();
}
}
@@ -500,7 +500,7 @@ void CErrorReportDialog::OnReportItemDblClick(const QModelIndex& index)
{
bool bDone = false;
const CErrorRecord* pError = index.data(Qt::UserRole).value();
- if (pError && pError->pObject != NULL)
+ if (pError && pError->pObject != nullptr)
{
CUndo undo("Select Object(s)");
// Clear other selection.
@@ -563,7 +563,7 @@ void CErrorReportDialog::OnReportHyperlink(const QModelIndex& index)
{
const CErrorRecord* pError = index.data(Qt::UserRole).value();
bool bDone = false;
- if (pError && pError->pObject != NULL)
+ if (pError && pError->pObject != nullptr)
{
CUndo undo("Select Object(s)");
// Clear other selection.
@@ -593,8 +593,8 @@ void CErrorReportDialog::OnShowFieldChooser()
CMainFrm* pMainFrm = (CMainFrame*)AfxGetMainWnd();
if (pMainFrm)
{
- BOOL bShow = !pMainFrm->m_wndFieldChooser.IsVisible();
- pMainFrm->ShowControlBar(&pMainFrm->m_wndFieldChooser, bShow, FALSE);
+ bool bShow = !pMainFrm->m_wndFieldChooser.IsVisible();
+ pMainFrm->ShowControlBar(&pMainFrm->m_wndFieldChooser, bShow, false);
}
}
*/
diff --git a/Code/Editor/ErrorReportTableModel.cpp b/Code/Editor/ErrorReportTableModel.cpp
index e7a1048a09..c0c24bb7ce 100644
--- a/Code/Editor/ErrorReportTableModel.cpp
+++ b/Code/Editor/ErrorReportTableModel.cpp
@@ -105,7 +105,7 @@ void CErrorReportTableModel::setErrorReport(CErrorReport* report)
{
m_errorRecords.clear();
}
- if (report != 0)
+ if (report != nullptr)
{
const int count = report->GetErrorCount();
m_errorRecords.reserve(count);
diff --git a/Code/Editor/Export/ExportManager.cpp b/Code/Editor/Export/ExportManager.cpp
index 682dcf3980..764cc7b6b3 100644
--- a/Code/Editor/Export/ExportManager.cpp
+++ b/Code/Editor/Export/ExportManager.cpp
@@ -22,7 +22,6 @@
#include "OBJExporter.h"
#include "OCMExporter.h"
#include "FBXExporterDialog.h"
-#include "RenderViewport.h"
#include "TrackViewExportKeyTimeDlg.h"
#include "AnimationContext.h"
#include "TrackView/DirectorNodeAnimator.h"
@@ -96,7 +95,7 @@ Export::CObject::CObject(const char* pName)
cameraTargetNodeName[0] = '\0';
- m_pLastObject = 0;
+ m_pLastObject = nullptr;
}
@@ -116,14 +115,14 @@ void Export::CData::Clear()
// CExportManager
CExportManager::CExportManager()
: m_isPrecaching(false)
- , m_pBaseObj(0)
+ , m_pBaseObj(nullptr)
, m_FBXBakedExportFPS(0.0f)
, m_fScale(100.0f)
, // this scale is used by CryEngine RC
m_bAnimationExport(false)
, m_bExportLocalCoords(false)
, m_numberOfExportFrames(0)
- , m_pivotEntityObject(0)
+ , m_pivotEntityObject(nullptr)
, m_bBakedKeysSequenceExport(true)
, m_animTimeExportPrimarySequenceCurrentTime(0.0f)
, m_animKeyTimeExport(true)
@@ -290,7 +289,7 @@ void CExportManager::ProcessEntityAnimationTrack(
const AZ::EntityId entityId, Export::CObject* pObj, AnimParamType entityTrackParamType)
{
CTrackViewAnimNode* pEntityNode = GetIEditor()->GetSequenceManager()->GetActiveAnimNode(entityId);
- CTrackViewTrack* pEntityTrack = (pEntityNode ? pEntityNode->GetTrackForParameter(entityTrackParamType) : 0);
+ CTrackViewTrack* pEntityTrack = (pEntityNode ? pEntityNode->GetTrackForParameter(entityTrackParamType) : nullptr);
if (!pEntityTrack)
{
@@ -397,7 +396,7 @@ void CExportManager::AddMesh(Export::CObject* pObj, const IIndexedMesh* pIndMesh
else
{
Export::CMesh* pMesh = new Export::CMesh();
- if (meshDesc.m_nFaceCount == 0 && meshDesc.m_nIndexCount != 0 && meshDesc.m_pIndices != 0)
+ if (meshDesc.m_nFaceCount == 0 && meshDesc.m_nIndexCount != 0 && meshDesc.m_pIndices != nullptr)
{
const vtx_idx* pIndices = &meshDesc.m_pIndices[0];
int nTris = meshDesc.m_nIndexCount / 3;
@@ -431,7 +430,7 @@ void CExportManager::AddMesh(Export::CObject* pObj, const IIndexedMesh* pIndMesh
bool CExportManager::AddStatObj(Export::CObject* pObj, IStatObj* pStatObj, Matrix34A* pTm)
{
- IIndexedMesh* pIndMesh = 0;
+ IIndexedMesh* pIndMesh = nullptr;
if (pStatObj->GetSubObjectCount())
{
@@ -440,7 +439,7 @@ bool CExportManager::AddStatObj(Export::CObject* pObj, IStatObj* pStatObj, Matri
IStatObj::SSubObject* pSubObj = pStatObj->GetSubObject(i);
if (pSubObj && pSubObj->nType == STATIC_SUB_OBJECT_MESH && pSubObj->pStatObj)
{
- pIndMesh = 0;
+ pIndMesh = nullptr;
if (m_isOccluder)
{
if (pSubObj->pStatObj->GetLodObject(2))
@@ -542,7 +541,7 @@ bool CExportManager::AddObject(CBaseObject* pBaseObj)
if (m_isPrecaching)
{
- AddMeshes(0);
+ AddMeshes(nullptr);
return true;
}
@@ -554,7 +553,7 @@ bool CExportManager::AddObject(CBaseObject* pBaseObj)
m_objectMap[pBaseObj] = int(m_data.m_objects.size() - 1);
AddMeshes(pObj);
- m_pBaseObj = 0;
+ m_pBaseObj = nullptr;
return true;
}
@@ -662,12 +661,6 @@ bool CExportManager::ProcessObjectsForExport()
GetIEditor()->GetAnimation()->SetRecording(false);
GetIEditor()->GetAnimation()->SetPlaying(false);
- CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
- if (CRenderViewport* rvp = viewport_cast(vp))
- {
- rvp->SetSequenceCamera();
- }
-
int startFrame = 0;
timeValue = startFrame * fpsTimeInterval;
@@ -678,7 +671,7 @@ bool CExportManager::ProcessObjectsForExport()
for (size_t objectID = 0; objectID < m_data.m_objects.size(); ++objectID)
{
Export::CObject* pObj2 = m_data.m_objects[objectID];
- CBaseObject* pObject = 0;
+ CBaseObject* pObject = nullptr;
if (QString::compare(pObj2->name, kPrimaryCameraName) == 0)
{
@@ -983,7 +976,7 @@ bool CExportManager::AddObjectsFromSequence(CTrackViewSequence* pSequence, XmlNo
{
if (pSubSequence && !pSubSequence->IsDisabled())
{
- XmlNodeRef subSeqNode = 0;
+ XmlNodeRef subSeqNode = nullptr;
if (!seqNode)
{
diff --git a/Code/Editor/Export/OBJExporter.cpp b/Code/Editor/Export/OBJExporter.cpp
index 893512e236..bd2696090e 100644
--- a/Code/Editor/Export/OBJExporter.cpp
+++ b/Code/Editor/Export/OBJExporter.cpp
@@ -67,7 +67,7 @@ bool COBJExporter::ExportToFile(const char* filename, const Export::IData* pExpo
while (nParent >= 0 && nParent < pExportData->GetObjectCount())
{
const Export::Object* pParentObj = pExportData->GetObject(nParent);
- assert(NULL != pParentObj);
+ assert(nullptr != pParentObj);
Vec3 pos2(pParentObj->pos.x, pParentObj->pos.y, pParentObj->pos.z);
Quat rot2(pParentObj->rot.w, pParentObj->rot.v.x, pParentObj->rot.v.y, pParentObj->rot.v.z);
diff --git a/Code/Editor/GameEngine.cpp b/Code/Editor/GameEngine.cpp
index dff6476ff9..137d14c844 100644
--- a/Code/Editor/GameEngine.cpp
+++ b/Code/Editor/GameEngine.cpp
@@ -57,12 +57,12 @@ struct SSystemUserCallback
: public ISystemUserCallback
{
SSystemUserCallback(IInitializeUIInfo* logo) : m_threadErrorHandler(this) { m_pLogo = logo; };
- virtual void OnSystemConnect(ISystem* pSystem)
+ void OnSystemConnect(ISystem* pSystem) override
{
ModuleInitISystem(pSystem, "Editor");
}
- virtual bool OnError(const char* szErrorString)
+ bool OnError(const char* szErrorString) override
{
// since we show a message box, we have to use the GUI thread
if (QThread::currentThread() != qApp->thread())
@@ -95,7 +95,7 @@ struct SSystemUserCallback
int res = IDNO;
- ICVar* pCVar = gEnv->pConsole ? gEnv->pConsole->GetCVar("sys_no_crash_dialog") : NULL;
+ ICVar* pCVar = gEnv->pConsole ? gEnv->pConsole->GetCVar("sys_no_crash_dialog") : nullptr;
if (!pCVar || pCVar->GetIVal() == 0)
{
@@ -116,7 +116,7 @@ struct SSystemUserCallback
return true;
}
- virtual bool OnSaveDocument()
+ bool OnSaveDocument() override
{
bool success = false;
@@ -133,7 +133,7 @@ struct SSystemUserCallback
return success;
}
- virtual bool OnBackupDocument()
+ bool OnBackupDocument() override
{
CCryEditDoc* level = GetIEditor() ? GetIEditor()->GetDocument() : nullptr;
if (level)
@@ -144,7 +144,7 @@ struct SSystemUserCallback
return false;
}
- virtual void OnProcessSwitch()
+ void OnProcessSwitch() override
{
if (GetIEditor()->IsInGameMode())
{
@@ -152,7 +152,7 @@ struct SSystemUserCallback
}
}
- virtual void OnInitProgress(const char* sProgressMsg)
+ void OnInitProgress(const char* sProgressMsg) override
{
if (m_pLogo)
{
@@ -160,7 +160,7 @@ struct SSystemUserCallback
}
}
- virtual int ShowMessage(const char* text, const char* caption, unsigned int uType)
+ int ShowMessage(const char* text, const char* caption, unsigned int uType) override
{
if (CCryEditApp::instance()->IsInAutotestMode())
{
@@ -176,7 +176,7 @@ struct SSystemUserCallback
return CryMessageBox(text, caption, uType);
}
- virtual void GetMemoryUsage(ICrySizer* pSizer)
+ void GetMemoryUsage(ICrySizer* pSizer) override
{
GetIEditor()->GetMemoryUsage(pSizer);
}
@@ -215,7 +215,7 @@ public:
{
AzFramework::AssetSystemConnectionNotificationsBus::Handler::BusConnect();
};
- ~AssetProcessConnectionStatus()
+ ~AssetProcessConnectionStatus() override
{
AzFramework::AssetSystemConnectionNotificationsBus::Handler::BusDisconnect();
}
@@ -247,18 +247,18 @@ private:
AZ_PUSH_DISABLE_WARNING(4273, "-Wunknown-warning-option")
CGameEngine::CGameEngine()
- : m_gameDll(0)
+ : m_gameDll(nullptr)
, m_bIgnoreUpdates(false)
, m_ePendingGameMode(ePGM_NotPending)
, m_modalWindowDismisser(nullptr)
AZ_POP_DISABLE_WARNING
{
- m_pISystem = NULL;
+ m_pISystem = nullptr;
m_bLevelLoaded = false;
m_bInGameMode = false;
m_bSimulationMode = false;
m_bSyncPlayerPosition = true;
- m_hSystemHandle = 0;
+ m_hSystemHandle = nullptr;
m_bJustCreated = false;
m_levelName = "Untitled";
m_levelExtension = EditorUtils::LevelFile::GetDefaultFileExtension();
@@ -271,7 +271,7 @@ CGameEngine::~CGameEngine()
{
AZ_POP_DISABLE_WARNING
GetIEditor()->UnregisterNotifyListener(this);
- m_pISystem->GetIMovieSystem()->SetCallback(NULL);
+ m_pISystem->GetIMovieSystem()->SetCallback(nullptr);
if (m_gameDll)
{
@@ -279,7 +279,7 @@ AZ_POP_DISABLE_WARNING
}
delete m_pISystem;
- m_pISystem = NULL;
+ m_pISystem = nullptr;
if (m_hSystemHandle)
{
@@ -566,14 +566,12 @@ void CGameEngine::SwitchToInGame()
streamer->QueueRequest(flush);
wait.acquire();
}
-
+
GetIEditor()->Notify(eNotify_OnBeginGameMode);
m_pISystem->GetIMovieSystem()->EnablePhysicsEvents(true);
m_bInGameMode = true;
- gEnv->pSystem->GetViewCamera().SetMatrix(m_playerViewTM);
-
// Disable accelerators.
GetIEditor()->EnableAcceleratos(false);
//! Send event to switch into game.
@@ -627,13 +625,6 @@ void CGameEngine::SwitchToInEditor()
m_bInGameMode = false;
- // save the current gameView matrix for editor
- if (pGameViewport)
- {
- Matrix34 gameView = gEnv->pSystem->GetViewCamera().GetMatrix();
- pGameViewport->SetGameTM(gameView);
- }
-
// Out of game in Editor mode.
if (pGameViewport)
{
@@ -875,7 +866,7 @@ void CGameEngine::OnEditorNotifyEvent(EEditorNotifyEvent event)
{
case eNotify_OnSplashScreenDestroyed:
{
- if (m_pSystemUserCallback != NULL)
+ if (m_pSystemUserCallback != nullptr)
{
m_pSystemUserCallback->OnSplashScreenDone();
}
diff --git a/Code/Editor/GameExporter.cpp b/Code/Editor/GameExporter.cpp
index 006eb9189c..feea94b34b 100644
--- a/Code/Editor/GameExporter.cpp
+++ b/Code/Editor/GameExporter.cpp
@@ -63,7 +63,7 @@ void SGameExporterSettings::SetHiQuality()
nApplySS = 1;
}
-CGameExporter* CGameExporter::m_pCurrentExporter = NULL;
+CGameExporter* CGameExporter::m_pCurrentExporter = nullptr;
//////////////////////////////////////////////////////////////////////////
// CGameExporter
@@ -76,7 +76,7 @@ CGameExporter::CGameExporter()
CGameExporter::~CGameExporter()
{
- m_pCurrentExporter = NULL;
+ m_pCurrentExporter = nullptr;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/Code/Editor/GenericSelectItemDialog.cpp b/Code/Editor/GenericSelectItemDialog.cpp
index ef109336ef..3c51b38d0a 100644
--- a/Code/Editor/GenericSelectItemDialog.cpp
+++ b/Code/Editor/GenericSelectItemDialog.cpp
@@ -17,7 +17,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
// CGenericSelectItemDialog dialog
-CGenericSelectItemDialog::CGenericSelectItemDialog(QWidget* pParent /*=NULL*/)
+CGenericSelectItemDialog::CGenericSelectItemDialog(QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, ui(new Ui::CGenericSelectItemDialog)
, m_initialized(false)
diff --git a/Code/Editor/Geometry/TriMesh.cpp b/Code/Editor/Geometry/TriMesh.cpp
index fe755ca6c3..737886cabc 100644
--- a/Code/Editor/Geometry/TriMesh.cpp
+++ b/Code/Editor/Geometry/TriMesh.cpp
@@ -19,13 +19,13 @@
//////////////////////////////////////////////////////////////////////////
CTriMesh::CTriMesh()
{
- pFaces = NULL;
- pVertices = NULL;
- pWSVertices = NULL;
- pUV = NULL;
- pColors = NULL;
- pEdges = NULL;
- pWeights = NULL;
+ pFaces = nullptr;
+ pVertices = nullptr;
+ pWSVertices = nullptr;
+ pUV = nullptr;
+ pColors = nullptr;
+ pEdges = nullptr;
+ pWeights = nullptr;
nFacesCount = 0;
nVertCount = 0;
@@ -67,7 +67,7 @@ void CTriMesh::ReallocStream(int stream, int nNewCount)
{
return; // Stream already have required size.
}
- void* pStream = 0;
+ void* pStream = nullptr;
int nElementSize = 0;
GetStreamInfo(stream, pStream, nElementSize);
pStream = ReAllocElements(pStream, nNewCount, nElementSize);
@@ -256,7 +256,7 @@ void CTriMesh::SharePositions()
std::vector arrHashTable[256];
CTriVertex* pNewVerts = new CTriVertex[GetVertexCount()];
- SMeshColor* pNewColors = 0;
+ SMeshColor* pNewColors = nullptr;
if (pColors)
{
pNewColors = new SMeshColor[GetVertexCount()];
@@ -433,8 +433,8 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const
//////////////////////////////////////////////////////////////////////////
void CTriMesh::CopyStream(CTriMesh& fromMesh, int stream)
{
- void* pTrgStream = 0;
- void* pSrcStream = 0;
+ void* pTrgStream = nullptr;
+ void* pSrcStream = nullptr;
int nElemSize = 0;
fromMesh.GetStreamInfo(stream, pSrcStream, nElemSize);
if (pSrcStream)
diff --git a/Code/Editor/IEditor.h b/Code/Editor/IEditor.h
index a56c8e81e9..f66dca412e 100644
--- a/Code/Editor/IEditor.h
+++ b/Code/Editor/IEditor.h
@@ -570,7 +570,7 @@ struct IEditor
//////////////////////////////////////////////////////////////////////////
virtual class CLevelIndependentFileMan* GetLevelIndependentFileMan() = 0;
//! Notify all views that data is changed.
- virtual void UpdateViews(int flags = 0xFFFFFFFF, const AABB* updateRegion = NULL) = 0;
+ virtual void UpdateViews(int flags = 0xFFFFFFFF, const AABB* updateRegion = nullptr) = 0;
virtual void ResetViews() = 0;
//! Update information in track view dialog.
virtual void ReloadTrackView() = 0;
@@ -589,7 +589,7 @@ struct IEditor
//! if bShow is true also returns a valid ITransformManipulator pointer.
virtual ITransformManipulator* ShowTransformManipulator(bool bShow) = 0;
//! Return a pointer to a ITransformManipulator pointer if shown.
- //! NULL is manipulator is not shown.
+ //! nullptr if manipulator is not shown.
virtual ITransformManipulator* GetTransformManipulator() = 0;
//! Set constrain on specified axis for objects construction and modifications.
//! @param axis one of AxisConstrains enumerations.
diff --git a/Code/Editor/IEditorImpl.cpp b/Code/Editor/IEditorImpl.cpp
index c09c0a8e62..d9c3af64b0 100644
--- a/Code/Editor/IEditorImpl.cpp
+++ b/Code/Editor/IEditorImpl.cpp
@@ -415,7 +415,7 @@ void CEditorImpl::Update()
}
if (IsInPreviewMode())
{
- SetModifiedFlag(FALSE);
+ SetModifiedFlag(false);
SetModifiedModule(eModifiedNothing);
}
@@ -550,7 +550,7 @@ QString CEditorImpl::GetResolvedUserFolder()
void CEditorImpl::SetDataModified()
{
- GetDocument()->SetModifiedFlag(TRUE);
+ GetDocument()->SetModifiedFlag(true);
}
void CEditorImpl::SetStatusText(const QString& pszString)
@@ -597,9 +597,9 @@ ITransformManipulator* CEditorImpl::ShowTransformManipulator(bool bShow)
GetObjectManager()->GetGizmoManager()->RemoveGizmo(m_pAxisGizmo);
m_pAxisGizmo->Release();
}
- m_pAxisGizmo = 0;
+ m_pAxisGizmo = nullptr;
}
- return 0;
+ return nullptr;
}
ITransformManipulator* CEditorImpl::GetTransformManipulator()
@@ -614,7 +614,7 @@ void CEditorImpl::SetAxisConstraints(AxisConstrains axisFlags)
SetTerrainAxisIgnoreObjects(false);
// Update all views.
- UpdateViews(eUpdateObjects, NULL);
+ UpdateViews(eUpdateObjects, nullptr);
}
AxisConstrains CEditorImpl::GetAxisConstrains()
@@ -637,15 +637,15 @@ void CEditorImpl::SetReferenceCoordSys(RefCoordSys refCoords)
m_refCoordsSys = refCoords;
// Update all views.
- UpdateViews(eUpdateObjects, NULL);
+ UpdateViews(eUpdateObjects, nullptr);
// Update the construction plane infos.
CViewport* pViewport = GetActiveView();
if (pViewport)
{
//Pre and Post widget rendering calls are made here to make sure that the proper camera state is set.
- //MakeConstructionPlane will make a call to ViewToWorldRay which needs the correct camera state
- //in the CRenderViewport to be set.
+ //MakeConstructionPlane will make a call to ViewToWorldRay which needs the correct camera state
+ //in the CRenderViewport to be set.
pViewport->PreWidgetRendering();
pViewport->MakeConstructionPlane(GetIEditor()->GetAxisConstrains());
@@ -671,7 +671,7 @@ CBaseObject* CEditorImpl::NewObject(const char* typeName, const char* fileName,
editor->SetModifiedFlag();
editor->SetModifiedModule(eModifiedBrushes);
}
- CBaseObject* object = editor->GetObjectManager()->NewObject(typeName, 0, fileName, name);
+ CBaseObject* object = editor->GetObjectManager()->NewObject(typeName, nullptr, fileName, name);
if (!object)
{
return nullptr;
@@ -932,7 +932,7 @@ void CEditorImpl::CloseView(const GUID& classId)
IDataBaseManager* CEditorImpl::GetDBItemManager([[maybe_unused]] EDataBaseItemType itemType)
{
- return 0;
+ return nullptr;
}
bool CEditorImpl::SelectColor(QColor& color, QWidget* parent)
@@ -1109,7 +1109,7 @@ void CEditorImpl::DetectVersion()
char ver[1024 * 8];
- GetModuleFileName(NULL, exe, _MAX_PATH);
+ GetModuleFileName(nullptr, exe, _MAX_PATH);
int verSize = GetFileVersionInfoSize(exe, &dwHandle);
if (verSize > 0)
@@ -1431,7 +1431,7 @@ void CEditorImpl::NotifyExcept(EEditorNotifyEvent event, IEditorNotifyListener*
{
m_pAxisGizmo->Release();
}
- m_pAxisGizmo = 0;
+ m_pAxisGizmo = nullptr;
}
if (event == eNotify_OnInit)
@@ -1472,7 +1472,7 @@ ISourceControl* CEditorImpl::GetSourceControl()
for (int i = 0; i < classes.size(); i++)
{
IClassDesc* pClass = classes[i];
- ISourceControl* pSCM = NULL;
+ ISourceControl* pSCM = nullptr;
HRESULT hRes = pClass->QueryInterface(__uuidof(ISourceControl), (void**)&pSCM);
if (!FAILED(hRes) && pSCM)
{
@@ -1482,7 +1482,7 @@ ISourceControl* CEditorImpl::GetSourceControl()
}
}
- return 0;
+ return nullptr;
}
bool CEditorImpl::IsSourceControlAvailable()
diff --git a/Code/Editor/IEditorImpl.h b/Code/Editor/IEditorImpl.h
index 65389a212e..db963e83f1 100644
--- a/Code/Editor/IEditorImpl.h
+++ b/Code/Editor/IEditorImpl.h
@@ -22,7 +22,7 @@
#include
#include
-#include "Commands/CommandManager.h"
+#include "Commands/CommandManager.h"
#include "Include/IErrorReport.h"
#include "ErrorReport.h"
@@ -63,7 +63,7 @@ namespace AssetDatabase
class AssetDatabaseLocationListener;
}
-class CEditorImpl
+class CEditorImpl
: public IEditor
{
Q_DECLARE_TR_FUNCTIONS(CEditorImpl)
@@ -176,7 +176,7 @@ public:
{
return m_pSystem->GetIMovieSystem();
}
- return NULL;
+ return nullptr;
};
CPluginManager* GetPluginManager() { return m_pPluginManager; }
@@ -210,7 +210,7 @@ public:
RefCoordSys GetReferenceCoordSys();
XmlNodeRef FindTemplate(const QString& templateName);
void AddTemplate(const QString& templateName, XmlNodeRef& tmpl);
-
+
const QtViewPane* OpenView(QString sViewClassName, bool reuseOpened = true) override;
/**
diff --git a/Code/Editor/IconManager.cpp b/Code/Editor/IconManager.cpp
index 7f6f7cd0ab..dc9eb56b88 100644
--- a/Code/Editor/IconManager.cpp
+++ b/Code/Editor/IconManager.cpp
@@ -81,7 +81,7 @@ void CIconManager::Reset()
{
m_objects[i]->Release();
}
- m_objects[i] = 0;
+ m_objects[i] = nullptr;
}
for (i = 0; i < eIcon_COUNT; i++)
{
@@ -135,7 +135,7 @@ IStatObj* CIconManager::GetObject(EStatObject)
//////////////////////////////////////////////////////////////////////////
QImage* CIconManager::GetIconBitmap(const char* filename, bool& bHaveAlpha, uint32 effects /*=0*/)
{
- QImage* pBitmap = 0;
+ QImage* pBitmap = nullptr;
QString iconFilename = filename;
@@ -160,11 +160,11 @@ QImage* CIconManager::GetIconBitmap(const char* filename, bool& bHaveAlpha, uint
return pBitmap;
}
- BOOL bAlphaBitmap = FALSE;
+ bool bAlphaBitmap = false;
QPixmap pm(iconFilename);
bAlphaBitmap = pm.hasAlpha();
- bHaveAlpha = (bAlphaBitmap == TRUE);
+ bHaveAlpha = (bAlphaBitmap == true);
if (!pm.isNull())
{
pBitmap = new QImage;
@@ -252,5 +252,5 @@ QImage* CIconManager::GetIconBitmap(const char* filename, bool& bHaveAlpha, uint
return pBitmap;
}
- return NULL;
+ return nullptr;
}
diff --git a/Code/Editor/Include/IAssetItem.h b/Code/Editor/Include/IAssetItem.h
index 892d347431..ff80331af5 100644
--- a/Code/Editor/Include/IAssetItem.h
+++ b/Code/Editor/Include/IAssetItem.h
@@ -334,12 +334,12 @@ struct IAssetItem
virtual void OnEndPreview() = 0;
// Description:
// If the asset has a special preview panel with utility controls, to be placed at the top of the Preview window, it can return an child dialog window
- // otherwise it can return NULL, if no panel is available
+ // otherwise it can return nullptr, if no panel is available
// Arguments:
- // pParentWnd - a valid CDialog*, or NULL
+ // pParentWnd - a valid CDialog*, or nullptr
// Return Value:
// A valid child dialog window handle, if this asset wants to have a custom panel in the top side of the Asset Preview window,
- // otherwise it can return NULL, if no panel is available
+ // otherwise it can return nullptr, if no panel is available
// See Also:
// OnBeginPreview(), OnEndPreview()
virtual QWidget* GetCustomPreviewPanelHeader(QWidget* pParentWnd) = 0;
diff --git a/Code/Editor/Include/IFileUtil.h b/Code/Editor/Include/IFileUtil.h
index f402786e67..f83c7e0d59 100644
--- a/Code/Editor/Include/IFileUtil.h
+++ b/Code/Editor/Include/IFileUtil.h
@@ -186,8 +186,15 @@ struct IFileUtil
virtual ECopyTreeResult CopyTree(const QString& strSourceDirectory, const QString& strTargetDirectory, bool boRecurse = true, bool boConfirmOverwrite = false) = 0;
//////////////////////////////////////////////////////////////////////////
- // @param LPPROGRESS_ROUTINE pfnProgress - called by the system to notify of file copy progress
- // @param LPBOOL pbCancel - when the contents of this BOOL are set to TRUE, the system cancels the copy operation
+ /**
+ * @brief CopyFile
+ * @param strSourceFile
+ * @param strTargetFile
+ * @param boConfirmOverwrite
+ * @param pfnProgress - called by the system to notify of file copy progress
+ * @param pbCancel - when the contents of this bool are set to true, the system cancels the copy operation
+ * @return
+ */
virtual ECopyTreeResult CopyFile(const QString& strSourceFile, const QString& strTargetFile, bool boConfirmOverwrite = false, ProgressRoutine pfnProgress = nullptr, bool* pbCancel = nullptr) = 0;
// As we don't have a FileUtil interface here, we have to duplicate some code :-( in order to keep
diff --git a/Code/Editor/LayoutConfigDialog.cpp b/Code/Editor/LayoutConfigDialog.cpp
index 6722a7d9d7..1074ebc23e 100644
--- a/Code/Editor/LayoutConfigDialog.cpp
+++ b/Code/Editor/LayoutConfigDialog.cpp
@@ -68,7 +68,7 @@ QVariant LayoutConfigModel::data(const QModelIndex& index, int role) const
// CLayoutConfigDialog dialog
-CLayoutConfigDialog::CLayoutConfigDialog(QWidget* pParent /*=NULL*/)
+CLayoutConfigDialog::CLayoutConfigDialog(QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_model(new LayoutConfigModel(this))
, ui(new Ui::CLayoutConfigDialog)
diff --git a/Code/Editor/LayoutWnd.cpp b/Code/Editor/LayoutWnd.cpp
index a3550b39ba..7f73c313d9 100644
--- a/Code/Editor/LayoutWnd.cpp
+++ b/Code/Editor/LayoutWnd.cpp
@@ -98,7 +98,7 @@ CLayoutWnd::CLayoutWnd(QSettings* settings, QWidget* parent)
, m_settings(settings)
{
m_bMaximized = false;
- m_maximizedView = 0;
+ m_maximizedView = nullptr;
m_layout = (EViewLayout) - 1;
m_maximizedViewId = 0;
@@ -729,7 +729,7 @@ void CLayoutWnd::OnDestroy()
if (m_maximizedView)
{
delete m_maximizedView;
- m_maximizedView = 0;
+ m_maximizedView = nullptr;
}
}
diff --git a/Code/Editor/LayoutWnd.h b/Code/Editor/LayoutWnd.h
index 106c32d0a0..918734ebb9 100644
--- a/Code/Editor/LayoutWnd.h
+++ b/Code/Editor/LayoutWnd.h
@@ -103,7 +103,7 @@ public:
static const char* GetConfigGroupName();
CLayoutViewPane* FindViewByClass(const QString& viewClassName);
- void BindViewport(CLayoutViewPane* vp, const QString& viewClassName, QWidget* pViewport = NULL);
+ void BindViewport(CLayoutViewPane* vp, const QString& viewClassName, QWidget* pViewport = nullptr);
QString ViewportTypeToClassName(EViewportType viewType);
//! Switch 2D viewports.
diff --git a/Code/Editor/LevelInfo.cpp b/Code/Editor/LevelInfo.cpp
index 5821f9c933..5ad7a6593d 100644
--- a/Code/Editor/LevelInfo.cpp
+++ b/Code/Editor/LevelInfo.cpp
@@ -93,7 +93,7 @@ void CLevelInfo::ValidateObjects()
pObject->Validate(m_pReport);
- m_pReport->SetCurrentValidatorObject(NULL);
+ m_pReport->SetCurrentValidatorObject(nullptr);
}
CLogFile::WriteLine("Validating Duplicate Objects...");
diff --git a/Code/Editor/Lib/Tests/test_EditorUtils.cpp b/Code/Editor/Lib/Tests/test_EditorUtils.cpp
index 59deb178a9..3556757ae3 100644
--- a/Code/Editor/Lib/Tests/test_EditorUtils.cpp
+++ b/Code/Editor/Lib/Tests/test_EditorUtils.cpp
@@ -23,12 +23,12 @@ namespace EditorUtilsTest
BusConnect();
}
- ~WarningDetector()
+ ~WarningDetector() override
{
BusDisconnect();
}
- virtual bool OnWarning(const char* /*window*/, const char* /*message*/) override
+ bool OnWarning(const char* /*window*/, const char* /*message*/) override
{
m_gotWarning = true;
return true;
diff --git a/Code/Editor/Lib/Tests/test_Main.cpp b/Code/Editor/Lib/Tests/test_Main.cpp
index a30afb0b7c..6250c540db 100644
--- a/Code/Editor/Lib/Tests/test_Main.cpp
+++ b/Code/Editor/Lib/Tests/test_Main.cpp
@@ -17,7 +17,7 @@ class EditorLibTestEnvironment
: public AZ::Test::ITestEnvironment
{
public:
- virtual ~EditorLibTestEnvironment() {}
+ ~EditorLibTestEnvironment() override = default;
protected:
void SetupEnvironment() override
diff --git a/Code/Editor/LogFile.cpp b/Code/Editor/LogFile.cpp
index 8c04eab58c..c768f5013b 100644
--- a/Code/Editor/LogFile.cpp
+++ b/Code/Editor/LogFile.cpp
@@ -380,7 +380,7 @@ AZ_POP_DISABLE_WARNING
//////////////////////////////////////////////////////////////////////
#if defined(AZ_PLATFORM_WINDOWS)
- EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &DisplayConfig);
+ EnumDisplaySettings(nullptr, ENUM_CURRENT_SETTINGS, &DisplayConfig);
GetPrivateProfileString("boot.description", "display.drv",
"(Unknown graphics card)", szProfileBuffer, sizeof(szProfileBuffer),
"system.ini");
diff --git a/Code/Editor/MainWindow.cpp b/Code/Editor/MainWindow.cpp
index ff322b79ac..cd023f3b42 100644
--- a/Code/Editor/MainWindow.cpp
+++ b/Code/Editor/MainWindow.cpp
@@ -46,6 +46,7 @@ AZ_POP_DISABLE_WARNING
#include
#include
#include
+#include
// AzQtComponents
#include
@@ -160,45 +161,45 @@ public:
}
}
- ~EngineConnectionListener()
+ ~EngineConnectionListener() override
{
AzFramework::AssetSystemInfoBus::Handler::BusDisconnect();
AzFramework::EngineConnectionEvents::Bus::Handler::BusDisconnect();
}
public:
- virtual void Connected([[maybe_unused]] AzFramework::SocketConnection* connection)
+ void Connected([[maybe_unused]] AzFramework::SocketConnection* connection) override
{
m_state = EConnectionState::Connected;
}
- virtual void Connecting([[maybe_unused]] AzFramework::SocketConnection* connection)
+ void Connecting([[maybe_unused]] AzFramework::SocketConnection* connection) override
{
m_state = EConnectionState::Connecting;
}
- virtual void Listening([[maybe_unused]] AzFramework::SocketConnection* connection)
+ void Listening([[maybe_unused]] AzFramework::SocketConnection* connection) override
{
m_state = EConnectionState::Listening;
}
- virtual void Disconnecting([[maybe_unused]] AzFramework::SocketConnection* connection)
+ void Disconnecting([[maybe_unused]] AzFramework::SocketConnection* connection) override
{
m_state = EConnectionState::Disconnecting;
}
- virtual void Disconnected([[maybe_unused]] AzFramework::SocketConnection* connection)
+ void Disconnected([[maybe_unused]] AzFramework::SocketConnection* connection) override
{
m_state = EConnectionState::Disconnected;
}
- virtual void AssetCompilationSuccess(const AZStd::string& assetPath) override
+ void AssetCompilationSuccess(const AZStd::string& assetPath) override
{
m_lastAssetProcessorTask = assetPath;
}
- virtual void AssetCompilationFailed(const AZStd::string& assetPath) override
+ void AssetCompilationFailed(const AZStd::string& assetPath) override
{
m_failedJobs.insert(assetPath);
}
- virtual void CountOfAssetsInQueue(const int& count) override
+ void CountOfAssetsInQueue(const int& count) override
{
m_pendingJobsCount = count;
}
@@ -298,7 +299,7 @@ MainWindow::MainWindow(QWidget* parent)
, m_undoStateAdapter(new UndoStackStateAdapter(this))
, m_keyboardCustomization(nullptr)
, m_activeView(nullptr)
- , m_settings("O3DE", "O3DE")
+ , m_settings("O3DE", "O3DE")
, m_toolbarManager(new ToolbarManager(m_actionManager, this))
, m_assetImporterManager(new AssetImporterManager(this))
, m_levelEditorMenuHandler(new LevelEditorMenuHandler(this, m_viewPaneManager, m_settings))
@@ -573,7 +574,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
if (GetIEditor()->GetDocument())
{
- GetIEditor()->GetDocument()->SetModifiedFlag(FALSE);
+ GetIEditor()->GetDocument()->SetModifiedFlag(false);
GetIEditor()->GetDocument()->SetModifiedModules(eModifiedNothing);
}
// Close all edit panels.
@@ -581,7 +582,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
GetIEditor()->GetObjectManager()->EndEditParams();
// force clean up of all deferred deletes, so that we don't have any issues with windows from plugins not being deleted yet
- qApp->sendPostedEvents(0, QEvent::DeferredDelete);
+ qApp->sendPostedEvents(nullptr, QEvent::DeferredDelete);
QMainWindow::closeEvent(event);
}
@@ -731,32 +732,84 @@ void MainWindow::InitActions()
.SetStatusTip(tr("Restore saved state (Fetch)"));
// Modify actions
- am->AddAction(ID_EDITMODE_MOVE, tr("Move"))
+ am->AddAction(AzToolsFramework::EditModeMove, tr("Move"))
.SetIcon(Style::icon("Move"))
.SetApplyHoverEffect()
.SetShortcut(tr("1"))
.SetToolTip(tr("Move (1)"))
.SetCheckable(true)
.SetStatusTip(tr("Select and move selected object(s)"))
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeMove);
- am->AddAction(ID_EDITMODE_ROTATE, tr("Rotate"))
+ .RegisterUpdateCallback([](QAction* action)
+ {
+ Q_ASSERT(action->isCheckable());
+
+ AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
+ AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
+ mode, AzToolsFramework::GetEntityContextId(),
+ &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
+
+ action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Translation);
+ })
+ .Connect(
+ &QAction::triggered,
+ []()
+ {
+ EditorTransformComponentSelectionRequestBus::Event(
+ GetEntityContextId(), &EditorTransformComponentSelectionRequests::SetTransformMode,
+ EditorTransformComponentSelectionRequests::Mode::Translation);
+ });
+ am->AddAction(AzToolsFramework::EditModeRotate, tr("Rotate"))
.SetIcon(Style::icon("Translate"))
.SetApplyHoverEffect()
.SetShortcut(tr("2"))
.SetToolTip(tr("Rotate (2)"))
.SetCheckable(true)
.SetStatusTip(tr("Select and rotate selected object(s)"))
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeRotate);
- am->AddAction(ID_EDITMODE_SCALE, tr("Scale"))
+ .RegisterUpdateCallback([](QAction* action)
+ {
+ Q_ASSERT(action->isCheckable());
+
+ AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
+ AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
+ mode, AzToolsFramework::GetEntityContextId(),
+ &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
+
+ action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Rotation);
+ })
+ .Connect(
+ &QAction::triggered,
+ []()
+ {
+ EditorTransformComponentSelectionRequestBus::Event(
+ GetEntityContextId(), &EditorTransformComponentSelectionRequests::SetTransformMode,
+ EditorTransformComponentSelectionRequests::Mode::Rotation);
+ });
+ am->AddAction(AzToolsFramework::EditModeScale, tr("Scale"))
.SetIcon(Style::icon("Scale"))
.SetApplyHoverEffect()
.SetShortcut(tr("3"))
.SetToolTip(tr("Scale (3)"))
.SetCheckable(true)
.SetStatusTip(tr("Select and scale selected object(s)"))
- .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeScale);
+ .RegisterUpdateCallback([](QAction* action)
+ {
+ Q_ASSERT(action->isCheckable());
- am->AddAction(ID_SNAP_TO_GRID, tr("Snap to grid"))
+ AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
+ AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
+ mode, AzToolsFramework::GetEntityContextId(),
+ &AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
+
+ action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Scale);
+ })
+ .Connect( &QAction::triggered,[]()
+ {
+ EditorTransformComponentSelectionRequestBus::Event(
+ GetEntityContextId(), &EditorTransformComponentSelectionRequests::SetTransformMode,
+ EditorTransformComponentSelectionRequests::Mode::Scale);
+ });
+
+ am->AddAction(AzToolsFramework::SnapToGrid, tr("Snap to grid"))
.SetIcon(Style::icon("Grid"))
.SetApplyHoverEffect()
.SetShortcut(tr("G"))
@@ -769,7 +822,7 @@ void MainWindow::InitActions()
})
.Connect(&QAction::triggered, []() { SandboxEditor::SetGridSnapping(!SandboxEditor::GridSnappingEnabled()); });
- am->AddAction(ID_SNAPANGLE, tr("Snap angle"))
+ am->AddAction(AzToolsFramework::SnapAngle, tr("Snap angle"))
.SetIcon(Style::icon("Angle"))
.SetApplyHoverEffect()
.SetStatusTip(tr("Snap angle"))
@@ -1243,7 +1296,7 @@ void MainWindow::OnEditorNotifyEvent(EEditorNotifyEvent ev)
auto cryEdit = CCryEditApp::instance();
if (cryEdit)
{
- cryEdit->SetEditorWindowTitle(0, AZ::Utils::GetProjectName().c_str(), GetIEditor()->GetGameEngine()->GetLevelName());
+ cryEdit->SetEditorWindowTitle(nullptr, AZ::Utils::GetProjectName().c_str(), GetIEditor()->GetGameEngine()->GetLevelName());
}
}
break;
@@ -1252,7 +1305,7 @@ void MainWindow::OnEditorNotifyEvent(EEditorNotifyEvent ev)
auto cryEdit = CCryEditApp::instance();
if (cryEdit)
{
- cryEdit->SetEditorWindowTitle(0, AZ::Utils::GetProjectName().c_str(), 0);
+ cryEdit->SetEditorWindowTitle(nullptr, AZ::Utils::GetProjectName().c_str(), nullptr);
}
}
break;
@@ -1351,8 +1404,8 @@ void MainWindow::ResetAutoSaveTimers(bool bForceInit)
{
delete m_autoRemindTimer;
}
- m_autoSaveTimer = 0;
- m_autoRemindTimer = 0;
+ m_autoSaveTimer = nullptr;
+ m_autoRemindTimer = nullptr;
if (bForceInit)
{
@@ -1389,7 +1442,7 @@ void MainWindow::ResetBackgroundUpdateTimer()
if (m_backgroundUpdateTimer)
{
delete m_backgroundUpdateTimer;
- m_backgroundUpdateTimer = 0;
+ m_backgroundUpdateTimer = nullptr;
}
ICVar* pBackgroundUpdatePeriod = gEnv->pConsole->GetCVar("ed_backgroundUpdatePeriod");
@@ -1435,7 +1488,7 @@ void MainWindow::OnRefreshAudioSystem()
if (QString::compare(sLevelName, "Untitled", Qt::CaseInsensitive) == 0)
{
- // Rather pass NULL to indicate that no level is loaded!
+ // Rather pass nullptr to indicate that no level is loaded!
sLevelName = QString();
}
@@ -1868,7 +1921,7 @@ QWidget* MainWindow::CreateToolbarWidget(int actionId)
break;
case ID_TOOLBAR_WIDGET_SPACER_RIGHT:
w = CreateSpacerRightWidget();
- break;
+ break;
default:
qWarning() << Q_FUNC_INFO << "Unknown id " << actionId;
return nullptr;
diff --git a/Code/Editor/MainWindow.h b/Code/Editor/MainWindow.h
index e70355827c..1e375b08f2 100644
--- a/Code/Editor/MainWindow.h
+++ b/Code/Editor/MainWindow.h
@@ -59,11 +59,17 @@ namespace AzQtComponents
namespace AzToolsFramework
{
class Ticker;
-}
-
-namespace AzToolsFramework
-{
class QtSourceControlNotificationHandler;
+
+ //! @name Reverse URLs.
+ //! Used to identify common actions and override them when necessary.
+ //@{
+ constexpr inline AZ::Crc32 EditModeMove = AZ_CRC_CE("com.o3de.action.editor.editmode.move");
+ constexpr inline AZ::Crc32 EditModeRotate = AZ_CRC_CE("com.o3de.action.editor.editmode.rotate");
+ constexpr inline AZ::Crc32 EditModeScale = AZ_CRC_CE("com.o3de.action.editor.editmode.scale");
+ constexpr inline AZ::Crc32 SnapToGrid = AZ_CRC_CE("com.o3de.action.editor.snaptogrid");
+ constexpr inline AZ::Crc32 SnapAngle = AZ_CRC_CE("com.o3de.action.editor.snapangle");
+ //@}
}
#define MAINFRM_LAYOUT_NORMAL "NormalLayout"
diff --git a/Code/Editor/NewLevelDialog.cpp b/Code/Editor/NewLevelDialog.cpp
index 7db795333b..29445cef2b 100644
--- a/Code/Editor/NewLevelDialog.cpp
+++ b/Code/Editor/NewLevelDialog.cpp
@@ -19,7 +19,7 @@
#include
// Editor
-#include "NewTerrainDialog.h"
+#include "NewTerrainDialog.h"
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include
@@ -54,7 +54,7 @@ private:
// CNewLevelDialog dialog
-CNewLevelDialog::CNewLevelDialog(QWidget* pParent /*=NULL*/)
+CNewLevelDialog::CNewLevelDialog(QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_bUpdate(false)
, ui(new Ui::CNewLevelDialog)
@@ -69,7 +69,7 @@ CNewLevelDialog::CNewLevelDialog(QWidget* pParent /*=NULL*/)
m_bIsResize = false;
-
+
ui->TITLE->setText(tr("Assign a name and location to the new level."));
ui->STATIC1->setText(tr("Location:"));
ui->STATIC2->setText(tr("Name:"));
@@ -98,7 +98,7 @@ CNewLevelDialog::CNewLevelDialog(QWidget* pParent /*=NULL*/)
m_levelFolders = GetLevelsFolder();
m_level = "";
- // First of all, keyboard focus is related to widget tab order, and the default tab order is based on the order in which
+ // First of all, keyboard focus is related to widget tab order, and the default tab order is based on the order in which
// widgets are constructed. Therefore, creating more widgets changes the keyboard focus. That is why setFocus() is called last.
// Secondly, using singleShot() allows setFocus() slot of the QLineEdit instance to be invoked right after the event system
// is ready to do so. Therefore, it is better to use singleShot() than directly call setFocus().
diff --git a/Code/Editor/NewTerrainDialog.cpp b/Code/Editor/NewTerrainDialog.cpp
index 16641ee275..0e66482eb4 100644
--- a/Code/Editor/NewTerrainDialog.cpp
+++ b/Code/Editor/NewTerrainDialog.cpp
@@ -19,7 +19,7 @@ AZ_POP_DISABLE_WARNING
-CNewTerrainDialog::CNewTerrainDialog(QWidget* pParent /*=NULL*/)
+CNewTerrainDialog::CNewTerrainDialog(QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_terrainResolutionIndex(0)
, m_terrainUnitsIndex(0)
diff --git a/Code/Editor/Objects/BaseObject.cpp b/Code/Editor/Objects/BaseObject.cpp
index c13c5932b0..482055d7ed 100644
--- a/Code/Editor/Objects/BaseObject.cpp
+++ b/Code/Editor/Objects/BaseObject.cpp
@@ -57,12 +57,12 @@ public:
CUndoBaseObject(CBaseObject* pObj, const char* undoDescription);
protected:
- virtual int GetSize() { return sizeof(*this); }
- virtual QString GetDescription() { return m_undoDescription; };
- virtual QString GetObjectName();
+ int GetSize() override { return sizeof(*this); }
+ QString GetDescription() override { return m_undoDescription; };
+ QString GetObjectName() override;
- virtual void Undo(bool bUndo);
- virtual void Redo();
+ void Undo(bool bUndo) override;
+ void Redo() override;
protected:
QString m_undoDescription;
@@ -81,12 +81,12 @@ public:
CUndoBaseObjectMinimal(CBaseObject* obj, const char* undoDescription, int flags);
protected:
- virtual int GetSize() { return sizeof(*this); }
- virtual QString GetDescription() { return m_undoDescription; };
- virtual QString GetObjectName();
+ int GetSize() override { return sizeof(*this); }
+ QString GetDescription() override { return m_undoDescription; };
+ QString GetObjectName() override;
- virtual void Undo(bool bUndo);
- virtual void Redo();
+ void Undo(bool bUndo) override;
+ void Redo() override;
private:
struct StateStruct
@@ -119,7 +119,7 @@ public:
, m_bKeepPos(bKeepPos)
, m_bAttach(bAttach) {}
- virtual void Undo([[maybe_unused]] bool bUndo) override
+ void Undo([[maybe_unused]] bool bUndo) override
{
if (m_bAttach)
{
@@ -131,7 +131,7 @@ public:
}
}
- virtual void Redo() override
+ void Redo() override
{
if (m_bAttach)
{
@@ -167,8 +167,8 @@ private:
}
}
- virtual int GetSize() { return sizeof(CUndoAttachBaseObject); }
- virtual QString GetDescription() { return "Attachment Changed"; }
+ int GetSize() override { return sizeof(CUndoAttachBaseObject); }
+ QString GetDescription() override { return "Attachment Changed"; }
GUID m_attachedObjectGUID;
GUID m_parentObjectGUID;
@@ -184,7 +184,7 @@ CUndoBaseObject::CUndoBaseObject(CBaseObject* obj, const char* undoDescription)
m_undoDescription = undoDescription;
m_guid = obj->GetId();
- m_redo = 0;
+ m_redo = nullptr;
m_undo = XmlHelpers::CreateXmlNode("Undo");
CObjectArchive ar(GetIEditor()->GetObjectManager(), m_undo, false);
ar.bUndo = true;
@@ -355,7 +355,7 @@ void CObjectCloneContext::AddClone(CBaseObject* pFromObject, CBaseObject* pToObj
//////////////////////////////////////////////////////////////////////////
CBaseObject* CObjectCloneContext::FindClone(CBaseObject* pFromObject)
{
- CBaseObject* pTarget = stl::find_in_map(m_objectsMap, pFromObject, (CBaseObject*) NULL);
+ CBaseObject* pTarget = stl::find_in_map(m_objectsMap, pFromObject, (CBaseObject*) nullptr);
return pTarget;
}
@@ -426,7 +426,7 @@ bool CBaseObject::Init([[maybe_unused]] IEditor* ie, CBaseObject* prev, [[maybe_
{
SetFlags(m_flags & (~OBJFLAG_DELETED));
- if (prev != 0)
+ if (prev != nullptr)
{
SetUniqueName(prev->GetName());
SetLocalTM(prev->GetPos(), prev->GetRotation(), prev->GetScale());
@@ -457,7 +457,7 @@ CBaseObject::~CBaseObject()
for (Childs::iterator c = m_childs.begin(); c != m_childs.end(); c++)
{
CBaseObject* child = *c;
- child->m_parent = 0;
+ child->m_parent = nullptr;
}
m_childs.clear();
}
@@ -470,10 +470,10 @@ void CBaseObject::Done()
// From children
DetachAll();
- SetLookAt(0);
+ SetLookAt(nullptr);
if (m_lookatSource)
{
- m_lookatSource->SetLookAt(0);
+ m_lookatSource->SetLookAt(nullptr);
}
SetFlags(m_flags | OBJFLAG_DELETED);
@@ -1730,7 +1730,7 @@ bool CBaseObject::IntersectRayBounds(const Ray& ray)
//////////////////////////////////////////////////////////////////////////
namespace
{
- typedef std::pair Edge2D;
+ using Edge2D = std::pair;
}
bool IsIncludePointsInConvexHull(Edge2D* pEdgeArray0, int nEdgeArray0Size, Edge2D* pEdgeArray1, int nEdgeArray1Size)
{
@@ -2065,7 +2065,7 @@ void CBaseObject::GetAllChildren(TBaseObjects& outAllChildren, CBaseObject* pObj
for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
{
CBaseObject* pChild = pBaseObj->GetChild(i);
- if (pChild == NULL)
+ if (pChild == nullptr)
{
continue;
}
@@ -2081,7 +2081,7 @@ void CBaseObject::GetAllChildren(DynArray< _smart_ptr >& outAllChil
for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
{
CBaseObject* pChild = pBaseObj->GetChild(i);
- if (pChild == NULL)
+ if (pChild == nullptr)
{
continue;
}
@@ -2097,7 +2097,7 @@ void CBaseObject::GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* p
for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
{
CBaseObject* pChild = pBaseObj->GetChild(i);
- if (pChild == NULL)
+ if (pChild == nullptr)
{
continue;
}
@@ -2109,7 +2109,7 @@ void CBaseObject::GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* p
//////////////////////////////////////////////////////////////////////////
void CBaseObject::CloneChildren(CBaseObject* pFromObject)
{
- if (pFromObject == NULL)
+ if (pFromObject == nullptr)
{
return;
}
@@ -2119,7 +2119,7 @@ void CBaseObject::CloneChildren(CBaseObject* pFromObject)
CBaseObject* pFromChildObject = pFromObject->GetChild(i);
CBaseObject* pChildClone = GetObjectManager()->CloneObject(pFromChildObject);
- if (pChildClone == NULL)
+ if (pChildClone == nullptr)
{
continue;
}
@@ -2248,7 +2248,7 @@ void CBaseObject::DetachThis(bool bKeepPos)
// Copy parent to temp var, erasing child from parent may delete this node if child referenced only from parent.
CBaseObject* parent = m_parent;
- m_parent = 0;
+ m_parent = nullptr;
parent->RemoveChild(this);
if (bKeepPos)
@@ -2389,7 +2389,7 @@ void CBaseObject::InvalidateTM([[maybe_unused]] int flags)
// Invalidate matrices off all child objects.
for (int i = 0; i < m_childs.size(); i++)
{
- if (m_childs[i] != 0 && m_childs[i]->m_bMatrixValid)
+ if (m_childs[i] != nullptr && m_childs[i]->m_bMatrixValid)
{
m_childs[i]->InvalidateTM(eObjectUpdateFlags_ParentChanged);
}
@@ -2538,7 +2538,7 @@ void CBaseObject::SetLookAt(CBaseObject* target)
//////////////////////////////////////////////////////////////////////////
bool CBaseObject::IsLookAtTarget() const
{
- return m_lookatSource != 0;
+ return m_lookatSource != nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -2806,7 +2806,7 @@ bool CBaseObject::IntersectRayMesh(const Vec3& raySrc, const Vec3& rayDir, SRayH
outHitInfo.bInFirstHit = false;
outHitInfo.bUseCache = false;
- return pStatObj->RayIntersection(outHitInfo, 0);
+ return pStatObj->RayIntersection(outHitInfo, nullptr);
}
//////////////////////////////////////////////////////////////////////////
diff --git a/Code/Editor/Objects/BaseObject.h b/Code/Editor/Objects/BaseObject.h
index a05bbb61af..47dba99ab7 100644
--- a/Code/Editor/Objects/BaseObject.h
+++ b/Code/Editor/Objects/BaseObject.h
@@ -321,7 +321,7 @@ public:
//! Set object selected status.
virtual void SetSelected(bool bSelect);
//! Return associated 3DEngine render node
- virtual IRenderNode* GetEngineNode() const { return NULL; };
+ virtual IRenderNode* GetEngineNode() const { return nullptr; };
//! Set object highlighted (Note: not selected)
virtual void SetHighlight(bool bHighlight);
//! Check if object is highlighted.
@@ -410,9 +410,9 @@ public:
//! Scans hierarchy up to determine if we child of specified node.
virtual bool IsChildOf(CBaseObject* node);
//! Get all child objects
- void GetAllChildren(TBaseObjects& outAllChildren, CBaseObject* pObj = NULL) const;
- void GetAllChildren(DynArray< _smart_ptr >& outAllChildren, CBaseObject* pObj = NULL) const;
- void GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* pObj = NULL) const;
+ void GetAllChildren(TBaseObjects& outAllChildren, CBaseObject* pObj = nullptr) const;
+ void GetAllChildren(DynArray< _smart_ptr >& outAllChildren, CBaseObject* pObj = nullptr) const;
+ void GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* pObj = nullptr) const;
//! Clone Children
void CloneChildren(CBaseObject* pFromObject);
//! Attach new child node.
@@ -468,8 +468,8 @@ public:
//! Called when object is being created (use GetMouseCreateCallback for more advanced mouse creation callback).
virtual int MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags);
// Return pointer to the callback object used when creating object by the mouse.
- // If this function return NULL MouseCreateCallback method will be used instead.
- virtual IMouseCreateCallback* GetMouseCreateCallback() { return 0; };
+ // If this function return nullptr MouseCreateCallback method will be used instead.
+ virtual IMouseCreateCallback* GetMouseCreateCallback() { return nullptr; };
//! Draw object to specified viewport.
virtual void Display([[maybe_unused]] DisplayContext& disp) {}
@@ -598,7 +598,7 @@ public:
bool CanBeHightlighted() const;
bool IsSkipSelectionHelper() const;
- virtual IStatObj* GetIStatObj() { return NULL; }
+ virtual IStatObj* GetIStatObj() { return nullptr; }
// Invalidates cached transformation matrix.
// nWhyFlags - Flags that indicate the reason for matrix invalidation.
@@ -672,7 +672,7 @@ protected:
//! Draw warning icons
virtual void DrawWarningIcons(DisplayContext& dc, const Vec3& pos);
//! Check if dimension's figures can be displayed before draw them.
- virtual void DrawDimensions(DisplayContext& dc, AABB* pMergedBoundBox = NULL);
+ virtual void DrawDimensions(DisplayContext& dc, AABB* pMergedBoundBox = nullptr);
//! Draw highlight.
virtual void DrawHighlight(DisplayContext& dc);
diff --git a/Code/Editor/Objects/DisplayContextShared.inl b/Code/Editor/Objects/DisplayContextShared.inl
index 1791c22443..a602d8eca9 100644
--- a/Code/Editor/Objects/DisplayContextShared.inl
+++ b/Code/Editor/Objects/DisplayContextShared.inl
@@ -74,12 +74,12 @@ void DisplayContext::DrawTri(const Vec3& p1, const Vec3& p2, const Vec3& p3)
void DisplayContext::DrawTriangles(const AZStd::vector& vertices, const ColorB& color)
{
- pRenderAuxGeom->DrawTriangles(vertices.begin(), vertices.size(), color);
+ pRenderAuxGeom->DrawTriangles(vertices.begin(), static_cast(vertices.size()), color);
}
void DisplayContext::DrawTrianglesIndexed(const AZStd::vector& vertices, const AZStd::vector& indices, const ColorB& color)
{
- pRenderAuxGeom->DrawTriangles(vertices.begin(), vertices.size(), indices.begin(), indices.size(), color);
+ pRenderAuxGeom->DrawTriangles(vertices.begin(), static_cast(vertices.size()), indices.begin(), static_cast(indices.size()), color);
}
//////////////////////////////////////////////////////////////////////////
@@ -862,7 +862,7 @@ void DisplayContext::DrawLine(const Vec3& p1, const Vec3& p2, const QColor& rgb1
//////////////////////////////////////////////////////////////////////////
void DisplayContext::DrawLines(const AZStd::vector& points, const ColorF& color)
{
- pRenderAuxGeom->DrawLines(points.begin(), points.size(), color, m_thickness);
+ pRenderAuxGeom->DrawLines(points.begin(), static_cast(points.size()), color, m_thickness);
}
//////////////////////////////////////////////////////////////////////////
@@ -1287,8 +1287,8 @@ void DisplayContext::Flush2D()
uvs[3] = 0;
uvt[3] = 0;
- int nLabels = m_textureLabels.size();
- for (int i = 0; i < nLabels; i++)
+ const size_t nLabels = m_textureLabels.size();
+ for (size_t i = 0; i < nLabels; i++)
{
STextureLabel& t = m_textureLabels[i];
float w2 = t.w * 0.5f;
diff --git a/Code/Editor/Objects/EntityObject.cpp b/Code/Editor/Objects/EntityObject.cpp
index 3b23894aac..0f4a17f3ba 100644
--- a/Code/Editor/Objects/EntityObject.cpp
+++ b/Code/Editor/Objects/EntityObject.cpp
@@ -56,18 +56,18 @@ public:
}
protected:
- virtual void Release() { delete this; };
- virtual int GetSize() { return sizeof(*this); }; // Return size of xml state.
- virtual QString GetDescription() { return "Entity Link"; };
- virtual QString GetObjectName(){ return ""; };
+ void Release() override { delete this; };
+ int GetSize() override { return sizeof(*this); }; // Return size of xml state.
+ QString GetDescription() override { return "Entity Link"; };
+ QString GetObjectName() override{ return ""; };
- virtual void Undo([[maybe_unused]] bool bUndo)
+ void Undo([[maybe_unused]] bool bUndo) override
{
for (int i = 0, iLinkSize(m_Links.size()); i < iLinkSize; ++i)
{
SLink& link = m_Links[i];
CBaseObject* pObj = GetIEditor()->GetObjectManager()->FindObject(link.entityID);
- if (pObj == NULL)
+ if (pObj == nullptr)
{
continue;
}
@@ -83,7 +83,7 @@ protected:
pEntity->LoadLink(link.linkXmlNode->getChild(0));
}
}
- virtual void Redo(){}
+ void Redo() override{}
private:
@@ -109,7 +109,7 @@ public:
, m_bAttach(bAttach)
{}
- virtual void Undo([[maybe_unused]] bool bUndo) override
+ void Undo([[maybe_unused]] bool bUndo) override
{
if (!m_bAttach)
{
@@ -117,7 +117,7 @@ public:
}
}
- virtual void Redo() override
+ void Redo() override
{
if (m_bAttach)
{
@@ -138,8 +138,8 @@ private:
}
}
- virtual int GetSize() { return sizeof(CUndoAttachEntity); }
- virtual QString GetDescription() { return "Attachment Changed"; }
+ int GetSize() override { return sizeof(CUndoAttachEntity); }
+ QString GetDescription() override { return "Attachment Changed"; }
GUID m_attachedEntityGUID;
CEntityObject::EAttachmentType m_attachmentType;
@@ -167,7 +167,7 @@ CEntityObject::CEntityObject()
{
m_bLoadFailed = false;
- m_visualObject = 0;
+ m_visualObject = nullptr;
m_box.min.Set(0, 0, 0);
m_box.max.Set(0, 0, 0);
@@ -225,7 +225,7 @@ CEntityObject::CEntityObject()
mv_ratioLOD.SetLimits(0, 255);
mv_viewDistanceMultiplier.SetLimits(0.0f, IRenderNode::VIEW_DISTANCE_MULTIPLIER_MAX);
- m_physicsState = 0;
+ m_physicsState = nullptr;
m_attachmentType = eAT_Pivot;
@@ -540,7 +540,7 @@ IVariable* CEntityObject::FindVariableInSubBlock(CVarBlockPtr& properties, IVari
//////////////////////////////////////////////////////////////////////////
void CEntityObject::AdjustLightProperties(CVarBlockPtr& properties, const char* pSubBlock)
{
- IVariable* pSubBlockVar = pSubBlock ? properties->FindVariable(pSubBlock) : NULL;
+ IVariable* pSubBlockVar = pSubBlock ? properties->FindVariable(pSubBlock) : nullptr;
if (IVariable* pRadius = FindVariableInSubBlock(properties, pSubBlockVar, "Radius"))
{
@@ -933,7 +933,7 @@ void CEntityObject::Serialize(CObjectArchive& ar)
{
XmlNodeRef eventTarget = eventTargets->getChild(i);
CEntityEventTarget et;
- et.target = 0;
+ et.target = nullptr;
GUID targetId = GUID_NULL;
eventTarget->getAttr("TargetId", targetId);
eventTarget->getAttr("Event", et.event);
@@ -1029,7 +1029,7 @@ void CEntityObject::Serialize(CObjectArchive& ar)
{
CEntityEventTarget& et = m_eventTargets[i];
GUID targetId = GUID_NULL;
- if (et.target != 0)
+ if (et.target != nullptr)
{
targetId = et.target->GetId();
}
@@ -1060,7 +1060,7 @@ XmlNodeRef CEntityObject::Export([[maybe_unused]] const QString& levelPath, XmlN
{
if (m_bLoadFailed)
{
- return 0;
+ return nullptr;
}
// Do not export entity with bad id.
@@ -1268,7 +1268,7 @@ void CEntityObject::OnEvent(ObjectEvent event)
IObjectManager* objMan = GetIEditor()->GetObjectManager();
if (objMan && objMan->IsLightClass(this))
{
- OnPropertyChange(NULL);
+ OnPropertyChange(nullptr);
}
break;
}
@@ -1314,7 +1314,7 @@ IVariable* CEntityObject::GetLightVariable(const char* name0) const
{
IVariable* pChild = pLightProperties->GetVariable(i);
- if (pChild == NULL)
+ if (pChild == nullptr)
{
continue;
}
@@ -1341,7 +1341,7 @@ QString CEntityObject::GetLightAnimation() const
{
IVariable* pChild = pStyleGroup->GetVariable(i);
- if (pChild == NULL)
+ if (pChild == nullptr)
{
continue;
}
@@ -1617,7 +1617,7 @@ void CEntityObject::RemoveEventTarget(int index, [[maybe_unused]] bool bUpdateSc
//////////////////////////////////////////////////////////////////////////
int CEntityObject::AddEntityLink(const QString& name, GUID targetEntityId)
{
- CEntityObject* target = 0;
+ CEntityObject* target = nullptr;
if (targetEntityId != GUID_NULL)
{
CBaseObject* pObject = FindObject(targetEntityId);
@@ -1635,7 +1635,7 @@ int CEntityObject::AddEntityLink(const QString& name, GUID targetEntityId)
StoreUndo("Add EntityLink");
- CLineGizmo* pLineGizmo = 0;
+ CLineGizmo* pLineGizmo = nullptr;
// Assign event target.
if (target)
@@ -1968,7 +1968,7 @@ void CEntityObject::ResetCallbacks()
//@FIXME Hack to display radii of properties.
// wires properties from param block, to this entity internal variables.
- IVariable* var = 0;
+ IVariable* var = nullptr;
var = pProperties->FindVariable("Radius", false);
if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
{
@@ -2194,7 +2194,7 @@ template
T CEntityObject::GetEntityProperty(const char* pName, T defaultvalue) const
{
CVarBlock* pProperties = GetProperties2();
- IVariable* pVariable = NULL;
+ IVariable* pVariable = nullptr;
if (pProperties)
{
pVariable = pProperties->FindVariable(pName);
@@ -2228,7 +2228,7 @@ template
void CEntityObject::SetEntityProperty(const char* pName, T value)
{
CVarBlock* pProperties = GetProperties2();
- IVariable* pVariable = NULL;
+ IVariable* pVariable = nullptr;
if (pProperties)
{
pVariable = pProperties->FindVariable(pName);
diff --git a/Code/Editor/Objects/EntityObject.h b/Code/Editor/Objects/EntityObject.h
index 76bd71a1f1..d5600d15b7 100644
--- a/Code/Editor/Objects/EntityObject.h
+++ b/Code/Editor/Objects/EntityObject.h
@@ -163,7 +163,7 @@ public:
//////////////////////////////////////////////////////////////////////////
//! Return number of event targets of Script.
- int GetEventTargetCount() const { return m_eventTargets.size(); };
+ int GetEventTargetCount() const { return static_cast(m_eventTargets.size()); };
CEntityEventTarget& GetEventTarget(int index) { return m_eventTargets[index]; };
//! Add new event target, returns index of created event target.
//! Event targets are Always entities.
@@ -176,7 +176,7 @@ public:
// Entity Links.
//////////////////////////////////////////////////////////////////////////
//! Return number of event targets of Script.
- int GetEntityLinkCount() const { return m_links.size(); };
+ int GetEntityLinkCount() const { return static_cast(m_links.size()); };
CEntityLink& GetEntityLink(int index) { return m_links[index]; };
virtual int AddEntityLink(const QString& name, GUID targetEntityId);
virtual bool EntityLinkExists(const QString& name, GUID targetEntityId);
@@ -185,7 +185,7 @@ public:
void RemoveAllEntityLinks();
virtual void EntityLinked([[maybe_unused]] const QString& name, [[maybe_unused]] GUID targetEntityId){}
virtual void EntityUnlinked([[maybe_unused]] const QString& name, [[maybe_unused]] GUID targetEntityId) {}
- void LoadLink(XmlNodeRef xmlNode, CObjectArchive* pArchive = NULL);
+ void LoadLink(XmlNodeRef xmlNode, CObjectArchive* pArchive = nullptr);
void SaveLink(XmlNodeRef xmlNode);
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
diff --git a/Code/Editor/Objects/Gizmo.h b/Code/Editor/Objects/Gizmo.h
index 1e5b07abff..0dba75ae9c 100644
--- a/Code/Editor/Objects/Gizmo.h
+++ b/Code/Editor/Objects/Gizmo.h
@@ -67,7 +67,7 @@ public:
//! Set this gizmo to be deleted.
void DeleteThis();
- virtual CBaseObjectPtr GetBaseObject() const { return NULL; }
+ virtual CBaseObjectPtr GetBaseObject() const { return nullptr; }
protected:
diff --git a/Code/Editor/Objects/GizmoManager.cpp b/Code/Editor/Objects/GizmoManager.cpp
index 697ca3e93c..e0fdd69c8e 100644
--- a/Code/Editor/Objects/GizmoManager.cpp
+++ b/Code/Editor/Objects/GizmoManager.cpp
@@ -79,7 +79,7 @@ CGizmo* CGizmoManager::GetGizmoByIndex(int nIndex) const
return *ii;
}
}
- return NULL;
+ return nullptr;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/Code/Editor/Objects/LineGizmo.cpp b/Code/Editor/Objects/LineGizmo.cpp
index 46026be614..31ea341f5b 100644
--- a/Code/Editor/Objects/LineGizmo.cpp
+++ b/Code/Editor/Objects/LineGizmo.cpp
@@ -37,8 +37,8 @@ CLineGizmo::~CLineGizmo()
{
m_object[1]->RemoveEventListener(this);
}
- m_object[0] = 0;
- m_object[1] = 0;
+ m_object[0] = nullptr;
+ m_object[1] = nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -164,7 +164,7 @@ void CLineGizmo::SetName(const char* sName)
//////////////////////////////////////////////////////////////////////////
bool CLineGizmo::HitTest([[maybe_unused]] HitContext& hc)
{
- return 0;
+ return false;
/*
if (hc.distanceTollerance != 0)
return 0;
diff --git a/Code/Editor/Objects/ObjectLoader.cpp b/Code/Editor/Objects/ObjectLoader.cpp
index 98f771dc76..2583eb6230 100644
--- a/Code/Editor/Objects/ObjectLoader.cpp
+++ b/Code/Editor/Objects/ObjectLoader.cpp
@@ -28,8 +28,8 @@ CObjectArchive::CObjectArchive(IObjectManager* objMan, XmlNodeRef xmlRoot, bool
m_nFlags = 0;
node = xmlRoot;
m_pCurrentErrorReport = GetIEditor()->GetErrorReport();
- m_pGeometryPak = NULL;
- m_pCurrentObject = NULL;
+ m_pGeometryPak = nullptr;
+ m_pCurrentObject = nullptr;
m_bNeedResolveObjects = false;
m_bProgressBarEnabled = true;
}
@@ -145,7 +145,7 @@ void CObjectArchive::ResolveObjects()
// Objects can be added to the list here (from Groups).
numObj = m_loadedObjects.size();
}
- m_pCurrentErrorReport->SetCurrentValidatorObject(NULL);
+ m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
//////////////////////////////////////////////////////////////////////////
GetIEditor()->ResumeUndo();
}
@@ -238,7 +238,7 @@ void CObjectArchive::ResolveObjects()
// might generate unrelated errors
m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
}
- m_pCurrentErrorReport->SetCurrentValidatorObject(NULL);
+ m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
//////////////////////////////////////////////////////////////////////////
}
@@ -257,7 +257,7 @@ void CObjectArchive::ResolveObjects()
}
m_bNeedResolveObjects = false;
- m_pCurrentErrorReport->SetCurrentValidatorObject(NULL);
+ m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
m_sequenceIdRemap.clear();
m_pendingIds.clear();
}
@@ -314,7 +314,7 @@ void CObjectArchive::LoadObjects(XmlNodeRef& rootObjectsNode)
for (int i = 0; i < numObjects; i++)
{
XmlNodeRef objNode = rootObjectsNode->getChild(i);
- LoadObject(objNode, NULL);
+ LoadObject(objNode, nullptr);
}
}
@@ -401,7 +401,7 @@ void CObjectArchive::AddSequenceIdMapping(uint32 oldId, uint32 newId)
{
assert(oldId != newId);
assert(GetIEditor()->GetMovieSystem()->FindSequenceById(oldId) || stl::find(m_pendingIds, oldId));
- assert(GetIEditor()->GetMovieSystem()->FindSequenceById(newId) == NULL);
+ assert(GetIEditor()->GetMovieSystem()->FindSequenceById(newId) == nullptr);
assert(stl::find(m_pendingIds, newId) == false);
m_sequenceIdRemap[oldId] = newId;
m_pendingIds.push_back(newId);
diff --git a/Code/Editor/Objects/ObjectLoader.h b/Code/Editor/Objects/ObjectLoader.h
index 350ffa10a9..9410a4845a 100644
--- a/Code/Editor/Objects/ObjectLoader.h
+++ b/Code/Editor/Objects/ObjectLoader.h
@@ -67,10 +67,10 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
void LoadObjects(XmlNodeRef& rootObjectsNode);
//! Load one object from archive.
- CBaseObject* LoadObject(const XmlNodeRef& objNode, CBaseObject* pPrevObject = NULL);
+ CBaseObject* LoadObject(const XmlNodeRef& objNode, CBaseObject* pPrevObject = nullptr);
//////////////////////////////////////////////////////////////////////////
- int GetLoadedObjectsCount() { return m_loadedObjects.size(); }
+ int GetLoadedObjectsCount() { return static_cast(m_loadedObjects.size()); }
CBaseObject* GetLoadedObject(int nIndex) const { return m_loadedObjects[nIndex].pObject; }
//! If true new loaded objects will be assigned new GUIDs.
diff --git a/Code/Editor/Objects/ObjectManager.cpp b/Code/Editor/Objects/ObjectManager.cpp
index 58cd016e22..fbdd56f080 100644
--- a/Code/Editor/Objects/ObjectManager.cpp
+++ b/Code/Editor/Objects/ObjectManager.cpp
@@ -32,7 +32,11 @@
#include
AZ_CVAR_EXTERNED(bool, ed_visibility_logTiming);
-AZ_CVAR_EXTERNED(bool, ed_visibility_use);
+
+AZ_CVAR(
+ bool, ed_visibility_use, true, nullptr, AZ::ConsoleFunctorFlags::Null,
+ "Enable/disable using the new IVisibilitySystem for Entity visibility determination");
+
/*!
* Class Description used for object templates.
@@ -49,16 +53,16 @@ public:
GUID guid;
public:
- REFGUID ClassID()
+ REFGUID ClassID() override
{
return guid;
}
- ObjectType GetObjectType() { return superType->GetObjectType(); };
- QString ClassName() { return type; };
- QString Category() { return category; };
+ ObjectType GetObjectType() override { return superType->GetObjectType(); };
+ QString ClassName() override { return type; };
+ QString Category() override { return category; };
QObject* CreateQObject() const override { return superType->CreateQObject(); }
- QString GetTextureIcon() { return superType->GetTextureIcon(); };
- QString GetFileSpec()
+ QString GetTextureIcon() override { return superType->GetTextureIcon(); };
+ QString GetFileSpec() override
{
if (!fileSpec.isEmpty())
{
@@ -69,7 +73,7 @@ public:
return superType->GetFileSpec();
}
};
- virtual int GameCreationOrder() { return superType->GameCreationOrder(); };
+ int GameCreationOrder() override { return superType->GameCreationOrder(); };
};
void CBaseObjectsCache::AddObject(CBaseObject* object)
@@ -86,7 +90,7 @@ void CBaseObjectsCache::AddObject(CBaseObject* object)
//////////////////////////////////////////////////////////////////////////
// CObjectManager implementation.
//////////////////////////////////////////////////////////////////////////
-CObjectManager* g_pObjectManager = 0;
+CObjectManager* g_pObjectManager = nullptr;
//////////////////////////////////////////////////////////////////////////
CObjectManager::CObjectManager()
@@ -182,19 +186,19 @@ CBaseObject* CObjectManager::NewObject(CObjectClassDesc* cls, CBaseObject* prev,
if (!AddObject(obj))
{
- obj = 0;
+ obj = nullptr;
}
}
else
{
- obj = 0;
+ obj = nullptr;
}
- GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(NULL);
+ GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
}
GetIEditor()->ResumeUndo();
- if (obj != 0 && GetIEditor()->IsUndoRecording())
+ if (obj != nullptr && GetIEditor()->IsUndoRecording())
{
// AZ entity creations are handled through the AZ undo system.
if (obj->GetType() != OBJTYPE_AZENTITY)
@@ -228,7 +232,7 @@ CBaseObject* CObjectManager::NewObject(CObjectArchive& ar, CBaseObject* pUndoObj
if (!objNode->getAttr("Type", typeName))
{
- return 0;
+ return nullptr;
}
if (!objNode->getAttr("Id", id))
@@ -268,7 +272,7 @@ CBaseObject* CObjectManager::NewObject(CObjectArchive& ar, CBaseObject* pUndoObj
if (!cls)
{
CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_ERROR, "RuntimeClass %s not registered", typeName.toUtf8().data());
- return 0;
+ return nullptr;
}
pObject = qobject_cast(cls->CreateQObject());
@@ -301,29 +305,29 @@ CBaseObject* CObjectManager::NewObject(CObjectArchive& ar, CBaseObject* pUndoObj
GetIEditor()->GetErrorReport()->ReportError(errorRecord);
}
- return 0;
+ return nullptr;
//CoCreateGuid( &pObject->m_guid ); // generate uniq GUID for this object.
}
}
GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(pObject);
- if (!pObject->Init(GetIEditor(), 0, ""))
+ if (!pObject->Init(GetIEditor(), nullptr, ""))
{
- GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(NULL);
- return 0;
+ GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
+ return nullptr;
}
if (!AddObject(pObject))
{
- GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(NULL);
- return 0;
+ GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
+ return nullptr;
}
//pObject->Serialize( ar );
- GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(NULL);
+ GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
- if (pObject != 0 && pUndoObject == 0)
+ if (pObject != nullptr && pUndoObject == nullptr)
{
// If new object with no undo, record it.
if (CUndo::IsRecording())
@@ -355,7 +359,7 @@ CBaseObject* CObjectManager::NewObject(const QString& typeName, CBaseObject* pre
if (!cls)
{
GetIEditor()->GetSystem()->GetILog()->Log("Warning: RuntimeClass %s (as well as %s) not registered", typeName.toUtf8().data(), fullName.toUtf8().data());
- return 0;
+ return nullptr;
}
CBaseObject* pObject = NewObject(cls, prev, file, newObjectName);
return pObject;
@@ -411,7 +415,7 @@ void CObjectManager::DeleteObject(CBaseObject* obj)
void CObjectManager::DeleteSelection(CSelectionGroup* pSelection)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
- if (pSelection == NULL)
+ if (pSelection == nullptr)
{
return;
}
@@ -527,7 +531,7 @@ CBaseObject* CObjectManager::CloneObject(CBaseObject* obj)
//////////////////////////////////////////////////////////////////////////
CBaseObject* CObjectManager::FindObject(REFGUID guid) const
{
- CBaseObject* result = stl::find_in_map(m_objects, guid, (CBaseObject*)0);
+ CBaseObject* result = stl::find_in_map(m_objects, guid, (CBaseObject*)nullptr);
return result;
}
@@ -603,7 +607,7 @@ void CObjectManager::FindObjectsInAABB(const AABB& aabb, std::vectorGetId(), 0);
+ CBaseObjectPtr p = stl::find_in_map(m_objects, obj->GetId(), nullptr);
if (p)
{
CErrorRecord err;
@@ -908,7 +912,7 @@ void CObjectManager::UnfreezeAll()
bool CObjectManager::SelectObject(CBaseObject* obj, bool bUseMask)
{
assert(obj);
- if (obj == NULL)
+ if (obj == nullptr)
{
return false;
}
@@ -974,7 +978,7 @@ void CObjectManager::UnselectObject(CBaseObject* obj)
CSelectionGroup* CObjectManager::GetSelection(const QString& name) const
{
- CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)0);
+ CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
return selection;
}
@@ -993,7 +997,7 @@ void CObjectManager::NameSelection(const QString& name)
return;
}
- CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)0);
+ CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
if (selection)
{
assert(selection != 0);
@@ -1020,7 +1024,7 @@ void CObjectManager::SerializeNameSelection(XmlNodeRef& rootNode, bool bLoading)
return;
}
- _smart_ptr tmpGroup(0);
+ _smart_ptr tmpGroup(nullptr);
QString selRootStr("NameSelection");
QString selNodeStr("NameSelectionNode");
@@ -1075,7 +1079,7 @@ void CObjectManager::SerializeNameSelection(XmlNodeRef& rootNode, bool bLoading)
else
{
startNode = rootNode->newChild(selRootStr.toUtf8().data());
- CSelectionGroup* objSelection = 0;
+ CSelectionGroup* objSelection = nullptr;
for (TNameSelectionMap::iterator it = m_selections.begin(); it != m_selections.end(); ++it)
{
@@ -1186,7 +1190,7 @@ int CObjectManager::InvertSelection()
void CObjectManager::SetSelection(const QString& name)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
- CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)0);
+ CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
if (selection)
{
UnselectCurrent();
@@ -1201,7 +1205,7 @@ void CObjectManager::RemoveSelection(const QString& name)
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
QString selName = name;
- CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)0);
+ CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
if (selection)
{
if (selection == m_currSelection)
@@ -1327,7 +1331,6 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]]
pDispayedViewObjects->SetSerialNumber(m_visibilitySerialNumber); // update viewport to be latest serial number
- const CCamera& camera = GetIEditor()->GetSystem()->GetViewCamera();
AABB bbox;
bbox.min.zero();
bbox.max.zero();
@@ -1359,7 +1362,7 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]]
for (int i = 0, iCount(pSelection->GetCount()); i < iCount; ++i)
{
CBaseObject* pObj(pSelection->GetObject(i));
- if (pObj == NULL)
+ if (pObj == nullptr)
{
continue;
}
@@ -1376,11 +1379,9 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]]
{
CBaseObject* obj = m_visibleObjects[i];
- if (obj && obj->IsInCameraView(camera))
+ if (obj)
{
- // Check if object is too far.
- float visRatio = obj->GetCameraVisRatio(camera);
- if (visRatio > m_maxObjectViewDistRatio || (dc.flags & DISPLAY_SELECTION_HELPERS) || obj->IsSelected())
+ if ((dc.flags & DISPLAY_SELECTION_HELPERS) || obj->IsSelected())
{
pDispayedViewObjects->AddObject(obj);
}
@@ -1443,7 +1444,7 @@ void CObjectManager::BeginEditParams(CBaseObject* obj, int flags)
void CObjectManager::EndEditParams([[maybe_unused]] int flags)
{
m_bSingleSelection = false;
- m_currEditObject = 0;
+ m_currEditObject = nullptr;
//m_bSelectionChanged = false; // don't need to clear for ungroup
}
@@ -1657,7 +1658,7 @@ bool CObjectManager::HitTest(HitContext& hitInfo)
HitContext hcOrg = hitInfo;
if (hcOrg.view)
{
- hcOrg.view->GetPerpendicularAxis(0, &hcOrg.b2DViewport);
+ hcOrg.view->GetPerpendicularAxis(nullptr, &hcOrg.b2DViewport);
}
hcOrg.rayDir = hcOrg.rayDir.GetNormalized();
@@ -1692,7 +1693,7 @@ bool CObjectManager::HitTest(HitContext& hitInfo)
const bool iconsPrioritized = true; // Force icons to always be prioritized over other things you hit. Can change to be a configurable option in the future.
- CBaseObject* selected = 0;
+ CBaseObject* selected = nullptr;
const char* name = nullptr;
bool iconHit = false;
int numVis = pDispayedViewObjects->GetObjectCount();
@@ -1993,11 +1994,11 @@ bool CObjectManager::EnableUniqObjectNames(bool bEnable)
CObjectClassDesc* CObjectManager::FindClass(const QString& className)
{
IClassDesc* cls = CClassFactory::Instance()->FindClass(className.toUtf8().data());
- if (cls != NULL && cls->SystemClassID() == ESYSTEM_CLASS_OBJECT)
+ if (cls != nullptr && cls->SystemClassID() == ESYSTEM_CLASS_OBJECT)
{
return (CObjectClassDesc*)cls;
}
- return 0;
+ return nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -2101,7 +2102,7 @@ void CObjectManager::LoadClassTemplates(const QString& path)
{
// Construct the full filepath of the current file
XmlNodeRef node = XmlHelpers::LoadXmlFromFile((dir + files[k].filename).toUtf8().data());
- if (node != 0 && node->isTag("ObjectTemplates"))
+ if (node != nullptr && node->isTag("ObjectTemplates"))
{
QString name;
for (int i = 0; i < node->getChildCount(); i++)
@@ -2449,7 +2450,7 @@ void CObjectManager::EndObjectsLoading()
{
delete m_pLoadProgress;
}
- m_pLoadProgress = 0;
+ m_pLoadProgress = nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -2481,20 +2482,20 @@ bool CObjectManager::IsLightClass(CBaseObject* pObject)
{
if (pEntity->GetEntityClass().compare(CLASS_LIGHT) == 0)
{
- return TRUE;
+ return true;
}
if (pEntity->GetEntityClass().compare(CLASS_RIGIDBODY_LIGHT) == 0)
{
- return TRUE;
+ return true;
}
if (pEntity->GetEntityClass().compare(CLASS_DESTROYABLE_LIGHT) == 0)
{
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
void CObjectManager::FindAndRenameProperty2(const char* property2Name, const QString& oldValue, const QString& newValue)
diff --git a/Code/Editor/Objects/ObjectManager.h b/Code/Editor/Objects/ObjectManager.h
index f59f6c43b8..aa9faab0e4 100644
--- a/Code/Editor/Objects/ObjectManager.h
+++ b/Code/Editor/Objects/ObjectManager.h
@@ -58,7 +58,7 @@ public:
class CBaseObjectsCache
{
public:
- int GetObjectCount() const { return m_objects.size(); }
+ int GetObjectCount() const { return static_cast(m_objects.size()); }
CBaseObject* GetObject(int nIndex) const { return m_objects[nIndex]; }
void AddObject(CBaseObject* object);
diff --git a/Code/Editor/Objects/SelectionGroup.cpp b/Code/Editor/Objects/SelectionGroup.cpp
index 5912cf050e..027c88172e 100644
--- a/Code/Editor/Objects/SelectionGroup.cpp
+++ b/Code/Editor/Objects/SelectionGroup.cpp
@@ -636,7 +636,7 @@ void CSelectionGroup::FinishChanges()
for (int i = 0; i < iObjectSize; ++i)
{
CBaseObject* pObject = selectedObjects[i];
- if (pObject == NULL)
+ if (pObject == nullptr)
{
continue;
}
diff --git a/Code/Editor/Objects/SelectionGroup.h b/Code/Editor/Objects/SelectionGroup.h
index 8f6feb32ad..600bce5f26 100644
--- a/Code/Editor/Objects/SelectionGroup.h
+++ b/Code/Editor/Objects/SelectionGroup.h
@@ -71,7 +71,7 @@ public:
//! And save resulting objects to saveTo selection.
void FilterParents();
//! Get number of child filtered objects.
- int GetFilteredCount() const { return m_filtered.size(); }
+ int GetFilteredCount() const { return static_cast(m_filtered.size()); }
CBaseObject* GetFilteredObject(int i) const { return m_filtered[i]; }
//////////////////////////////////////////////////////////////////////////
diff --git a/Code/Editor/Objects/TrackGizmo.cpp b/Code/Editor/Objects/TrackGizmo.cpp
index ed1132bd2b..8cbd7df2e5 100644
--- a/Code/Editor/Objects/TrackGizmo.cpp
+++ b/Code/Editor/Objects/TrackGizmo.cpp
@@ -34,7 +34,7 @@ namespace {
//////////////////////////////////////////////////////////////////////////
CTrackGizmo::CTrackGizmo()
{
- m_pAnimNode = 0;
+ m_pAnimNode = nullptr;
m_worldBbox.min = Vec3(-10000, -10000, -10000);
m_worldBbox.max = Vec3(10000, 10000, 10000);
diff --git a/Code/Editor/Platform/Windows/Util/Mailer_Windows.cpp b/Code/Editor/Platform/Windows/Util/Mailer_Windows.cpp
index e7cc8658f0..7ac1181cdd 100644
--- a/Code/Editor/Platform/Windows/Util/Mailer_Windows.cpp
+++ b/Code/Editor/Platform/Windows/Util/Mailer_Windows.cpp
@@ -51,8 +51,8 @@ bool CMailer::SendMail(const char* subject,
attachments[i].flFlags = 0;
attachments[i].nPosition = (ULONG)-1;
attachments[i].lpszPathName = (char*)(const char*)_attachments[k];
- attachments[i].lpszFileName = NULL;
- attachments[i].lpFileType = NULL;
+ attachments[i].lpszFileName = nullptr;
+ attachments[i].lpFileType = nullptr;
i++;
}
int numAttachments = i;
@@ -74,14 +74,14 @@ bool CMailer::SendMail(const char* subject,
recipients[i].lpszName = (char*)(const char*)_recipients[i];
recipients[i].lpszAddress = (char*)addresses[i].c_str();
recipients[i].ulEIDSize = 0;
- recipients[i].lpEntryID = NULL;
+ recipients[i].lpEntryID = nullptr;
}
MapiMessage message;
memset(&message, 0, sizeof(message));
message.lpszSubject = (char*)(const char*)subject;
message.lpszNoteText = (char*)(const char*)messageBody;
- message.lpszMessageType = NULL;
+ message.lpszMessageType = nullptr;
message.nRecipCount = numRecipients;
message.lpRecips = recipients;
diff --git a/Code/Editor/Plugin.cpp b/Code/Editor/Plugin.cpp
index 0fb37c96c7..e73b9daa2c 100644
--- a/Code/Editor/Plugin.cpp
+++ b/Code/Editor/Plugin.cpp
@@ -133,7 +133,7 @@ IClassDesc* CClassFactory::FindClass(const char* pClassName) const
if (!pSubClassName)
{
- return NULL;
+ return nullptr;
}
QString name = QString(pClassName).left(pSubClassName - pClassName);
@@ -169,7 +169,7 @@ void CClassFactory::UnregisterClass(const char* pClassName)
{
IClassDesc* pClassDesc = FindClass(pClassName);
- if (pClassDesc == NULL)
+ if (pClassDesc == nullptr)
{
return;
}
diff --git a/Code/Editor/PluginManager.cpp b/Code/Editor/PluginManager.cpp
index f03cb54fce..5efd52a97e 100644
--- a/Code/Editor/PluginManager.cpp
+++ b/Code/Editor/PluginManager.cpp
@@ -18,8 +18,8 @@
#include "Include/IPlugin.h"
-typedef IPlugin* (* TPfnCreatePluginInstance)(PLUGIN_INIT_PARAM* pInitParam);
-typedef void (* TPfnQueryPluginSettings)(SPluginSettings&);
+using TPfnCreatePluginInstance = IPlugin *(*)(PLUGIN_INIT_PARAM *pInitParam);
+using TPfnQueryPluginSettings = void (*)(SPluginSettings &);
CPluginManager::CPluginManager()
{
@@ -210,7 +210,7 @@ bool CPluginManager::LoadPlugins(const char* pPathWithMask)
continue;
}
- IPlugin* pPlugin = NULL;
+ IPlugin* pPlugin = nullptr;
PLUGIN_INIT_PARAM sInitParam =
{
GetIEditor(),
@@ -279,7 +279,7 @@ IPlugin* CPluginManager::GetPluginByGUID(const char* pGUID)
}
}
- return NULL;
+ return nullptr;
}
IPlugin* CPluginManager::GetPluginByUIID(uint8 iUserInterfaceID)
@@ -290,7 +290,7 @@ IPlugin* CPluginManager::GetPluginByUIID(uint8 iUserInterfaceID)
if (it == m_uuidPluginMap.end())
{
- return NULL;
+ return nullptr;
}
return (*it).second;
@@ -302,7 +302,7 @@ IUIEvent* CPluginManager::GetEventByIDAndPluginID(uint8 aPluginID, uint8 aEventI
// specified by its ID and the user interface ID of the plugin which
// created the UI element
- IPlugin* pPlugin = NULL;
+ IPlugin* pPlugin = nullptr;
TEventHandlerIt eventIt;
TPluginEventIt pluginIt;
@@ -310,21 +310,21 @@ IUIEvent* CPluginManager::GetEventByIDAndPluginID(uint8 aPluginID, uint8 aEventI
if (!pPlugin)
{
- return NULL;
+ return nullptr;
}
pluginIt = m_pluginEventMap.find(pPlugin);
if (pluginIt == m_pluginEventMap.end())
{
- return NULL;
+ return nullptr;
}
eventIt = (*pluginIt).second.find(aEventID);
if (eventIt == (*pluginIt).second.end())
{
- return NULL;
+ return nullptr;
}
return (*eventIt).second;
diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp
index 874868b5bc..072625936b 100644
--- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp
+++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp
@@ -84,6 +84,7 @@
#include
#include
#include "CryEdit.h"
+#include "Undo/Undo.h"
#include
#include
@@ -803,7 +804,7 @@ void SandboxIntegrationManager::SetupLayerContextMenu(QMenu* menu)
menu->addSeparator();
- const int selectedLayerCount = layersInSelection.size();
+ const int selectedLayerCount = static_cast(layersInSelection.size());
QString saveTitle = QObject::tr("Save layer");
if(selectedLayerCount > 1)
{
@@ -1815,7 +1816,7 @@ void SandboxIntegrationManager::ContextMenu_PushEntitiesToSlice(AzToolsFramework
(void)targetAncestorId;
(void)affectEntireHierarchy;
- AZ::SerializeContext* serializeContext = NULL;
+ AZ::SerializeContext* serializeContext = nullptr;
EBUS_EVENT_RESULT(serializeContext, AZ::ComponentApplicationBus, GetSerializeContext);
AZ_Assert(serializeContext, "No serialize context");
diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentPaletteWindow.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentPaletteWindow.cpp
index 78d3e51e4d..1791301654 100644
--- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentPaletteWindow.cpp
+++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentPaletteWindow.cpp
@@ -42,7 +42,7 @@ void ComponentPaletteWindow::Init()
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
- QHBoxLayout* gridLayout = new QHBoxLayout(NULL);
+ QHBoxLayout* gridLayout = new QHBoxLayout(nullptr);
gridLayout->setSizeConstraint(QLayout::SetMaximumSize);
gridLayout->setContentsMargins(0, 0, 0, 0);
gridLayout->setSpacing(0);
diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp
index 50d111d9b3..02d2174fb8 100644
--- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp
+++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp
@@ -259,7 +259,7 @@ QVariant OutlinerListModel::dataForName(const QModelIndex& index, int role) cons
if (highlightTextIndex >= 0)
{
const QString BACKGROUND_COLOR{ "#707070" };
- label.insert(highlightTextIndex + m_filterString.length(), "");
+ label.insert(static_cast(highlightTextIndex + m_filterString.length()), "");
label.insert(highlightTextIndex, "");
}
} while(highlightTextIndex > 0);
diff --git a/Code/Editor/Plugins/EditorCommon/DockTitleBarWidget.cpp b/Code/Editor/Plugins/EditorCommon/DockTitleBarWidget.cpp
index adb8ef0bc5..0569adf069 100644
--- a/Code/Editor/Plugins/EditorCommon/DockTitleBarWidget.cpp
+++ b/Code/Editor/Plugins/EditorCommon/DockTitleBarWidget.cpp
@@ -30,13 +30,13 @@ class CDockWidgetTitleButton
public:
CDockWidgetTitleButton(QWidget* parent);
- QSize sizeHint() const;
- QSize minimumSizeHint() const { return sizeHint(); }
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override { return sizeHint(); }
protected:
- void enterEvent(QEvent* ev);
- void leaveEvent(QEvent* ev);
- void paintEvent(QPaintEvent* ev);
+ void enterEvent(QEvent* ev) override;
+ void leaveEvent(QEvent* ev) override;
+ void paintEvent(QPaintEvent* ev) override;
};
class CTitleBarText
@@ -85,10 +85,10 @@ QSize CDockWidgetTitleButton::sizeHint() const
{
ensurePolished();
- int size = 2 * style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, 0, this);
+ int size = 2 * style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, nullptr, this);
if (!icon().isNull())
{
- int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
+ int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
QSize sz = icon().actualSize(QSize(iconSize, iconSize));
size += qMax(sz.width(), sz.height());
}
@@ -145,7 +145,7 @@ void CDockWidgetTitleButton::paintEvent([[maybe_unused]] QPaintEvent* ev)
opt.activeSubControls = QStyle::SubControls();
opt.features = QStyleOptionToolButton::None;
opt.arrowType = Qt::NoArrow;
- int size = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
+ int size = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
opt.iconSize = QSize(size, size);
style()->drawComplexControl(QStyle::CC_ToolButton, &opt, &painter, this);
}
diff --git a/Code/Editor/Plugins/FFMPEGPlugin/main.cpp b/Code/Editor/Plugins/FFMPEGPlugin/main.cpp
index 3432a9975e..ce0e91942b 100644
--- a/Code/Editor/Plugins/FFMPEGPlugin/main.cpp
+++ b/Code/Editor/Plugins/FFMPEGPlugin/main.cpp
@@ -15,7 +15,7 @@ PLUGIN_API IPlugin* CreatePluginInstance(PLUGIN_INIT_PARAM* pInitParam)
if (pInitParam->pluginVersion != SANDBOX_PLUGIN_SYSTEM_VERSION)
{
pInitParam->outErrorCode = IPlugin::eError_VersionMismatch;
- return 0;
+ return nullptr;
}
ModuleInitISystem(GetIEditor()->GetSystem(), "FFMPEGPlugin");
diff --git a/Code/Editor/Plugins/PerforcePlugin/PasswordDlg.cpp b/Code/Editor/Plugins/PerforcePlugin/PasswordDlg.cpp
index f1f742949c..6e9c0a42b0 100644
--- a/Code/Editor/Plugins/PerforcePlugin/PasswordDlg.cpp
+++ b/Code/Editor/Plugins/PerforcePlugin/PasswordDlg.cpp
@@ -53,7 +53,7 @@ namespace PerforceConnection
setEnabled(false);
- int numSettingsToGet = m_retrievedSettings.size();
+ int numSettingsToGet = static_cast(m_retrievedSettings.size());
auto applySettingResultFunction = [this, &numSettingsToGet](AZStd::string setting, const SourceControlSettingInfo& info) -> void
{
diff --git a/Code/Editor/Plugins/PerforcePlugin/PerforceSourceControl.cpp b/Code/Editor/Plugins/PerforcePlugin/PerforceSourceControl.cpp
index aec613b8df..581f9a576d 100644
--- a/Code/Editor/Plugins/PerforcePlugin/PerforceSourceControl.cpp
+++ b/Code/Editor/Plugins/PerforcePlugin/PerforceSourceControl.cpp
@@ -56,7 +56,7 @@ void CPerforceSourceControl::ShowSettings()
void CPerforceSourceControl::SetSourceControlState(SourceControlState state)
{
- AUTO_LOCK(g_cPerforceValues);
+ CryAutoLock lock(g_cPerforceValues);
switch (state)
{
diff --git a/Code/Editor/Plugins/ProjectSettingsTool/PlatformSettings_Android.cpp b/Code/Editor/Plugins/ProjectSettingsTool/PlatformSettings_Android.cpp
index d11cc04ba0..ea65cf3e59 100644
--- a/Code/Editor/Plugins/ProjectSettingsTool/PlatformSettings_Android.cpp
+++ b/Code/Editor/Plugins/ProjectSettingsTool/PlatformSettings_Android.cpp
@@ -165,8 +165,8 @@ namespace ProjectSettingsTool
if (editContext)
{
editContext->Class("Splashscreens", "All splashscreen overrides for Android.")
- ->DataElement(0, &AndroidSplashscreens::m_landscapeSplashscreens)
- ->DataElement(0, &AndroidSplashscreens::m_portraitSplashscreens)
+ ->DataElement(AZ::Edit::UIHandlers::Default, &AndroidSplashscreens::m_landscapeSplashscreens)
+ ->DataElement(AZ::Edit::UIHandlers::Default, &AndroidSplashscreens::m_portraitSplashscreens)
;
}
}
diff --git a/Code/Editor/Plugins/ProjectSettingsTool/Validators.cpp b/Code/Editor/Plugins/ProjectSettingsTool/Validators.cpp
index e8bb900be9..4dfc4ee25a 100644
--- a/Code/Editor/Plugins/ProjectSettingsTool/Validators.cpp
+++ b/Code/Editor/Plugins/ProjectSettingsTool/Validators.cpp
@@ -16,7 +16,7 @@
namespace
{
- typedef ProjectSettingsTool::FunctorValidator::ReturnType RetType;
+ using RetType = ProjectSettingsTool::FunctorValidator::ReturnType;
static const int noMaxLength = -1;
static const int maxIosVersionLength = 18;
diff --git a/Code/Editor/PythonEditorFuncs.cpp b/Code/Editor/PythonEditorFuncs.cpp
index 93f5f8f10f..2b7bca3b0b 100644
--- a/Code/Editor/PythonEditorFuncs.cpp
+++ b/Code/Editor/PythonEditorFuncs.cpp
@@ -323,7 +323,7 @@ namespace
//////////////////////////////////////////////////////////////////////////
void GetPythonArgumentsVector(const char* pArguments, QStringList& inputArguments)
{
- if (pArguments == NULL)
+ if (pArguments == nullptr)
{
return;
}
diff --git a/Code/Editor/QtUI/QCollapsibleGroupBox.cpp b/Code/Editor/QtUI/QCollapsibleGroupBox.cpp
index e1d3f59510..7fe56285e6 100644
--- a/Code/Editor/QtUI/QCollapsibleGroupBox.cpp
+++ b/Code/Editor/QtUI/QCollapsibleGroupBox.cpp
@@ -13,7 +13,7 @@
QCollapsibleGroupBox::QCollapsibleGroupBox(QWidget* parent)
: QGroupBox(parent)
, m_collapsed(false)
- , m_toggleButton(0)
+ , m_toggleButton(nullptr)
{
m_toggleButton = new QToolButton(this);
m_toggleButton->setFixedSize(16, 16);
diff --git a/Code/Editor/RenderHelpers/AxisHelper.h b/Code/Editor/RenderHelpers/AxisHelper.h
index b7d246d48c..70dcd2dae2 100644
--- a/Code/Editor/RenderHelpers/AxisHelper.h
+++ b/Code/Editor/RenderHelpers/AxisHelper.h
@@ -60,7 +60,7 @@ public:
void DrawDome(const Matrix34& worldTM, const SGizmoParameters& setup, DisplayContext& dc, AABB& objectBox);
bool HitTest(const Matrix34& worldTM, const SGizmoParameters& setup, HitContext& hc);
- bool HitTestForRotationCircle(const Matrix34& worldTM, IDisplayViewport* view, const QPoint& pos, float fHitWidth, Vec3* pOutHitPos = NULL, Vec3* pOutHitNormal = NULL);
+ bool HitTestForRotationCircle(const Matrix34& worldTM, IDisplayViewport* view, const QPoint& pos, float fHitWidth, Vec3* pOutHitPos = nullptr, Vec3* pOutHitNormal = nullptr);
void SetHighlightAxis(int axis) { m_highlightAxis = axis; };
int GetHighlightAxis() const { return m_highlightAxis; };
diff --git a/Code/Editor/RenderHelpers/AxisHelperShared.inl b/Code/Editor/RenderHelpers/AxisHelperShared.inl
index 9db4c82e84..2ceac98eae 100644
--- a/Code/Editor/RenderHelpers/AxisHelperShared.inl
+++ b/Code/Editor/RenderHelpers/AxisHelperShared.inl
@@ -546,7 +546,7 @@ bool CAxisHelper::HitTestForRotationCircle(const Matrix34& worldTM, IDisplayView
Vec3 vShortestHitPos;
float shortestDist = 3e11f;
- for (int i = 0, iCount(vList.size()); i < iCount; ++i)
+ for (int i = 0, iCount(static_cast(vList.size())); i < iCount; ++i)
{
const Vec3& v0 = vList[i];
const Vec3& v1 = vList[(i + 1) % iCount];
diff --git a/Code/Editor/RenderViewport.cpp b/Code/Editor/RenderViewport.cpp
deleted file mode 100644
index d268a57684..0000000000
--- a/Code/Editor/RenderViewport.cpp
+++ /dev/null
@@ -1,4142 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-// Description : implementation filefov
-
-
-#include "EditorDefs.h"
-
-#include "RenderViewport.h"
-
-// Qt
-#include
-#include
-#include
-#include
-#include
-
-// AzCore
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-// AzFramework
-#include
-#include
-#include
-#if defined(AZ_PLATFORM_WINDOWS)
-# include
-#endif // defined(AZ_PLATFORM_WINDOWS)
-#include // for AzFramework::InputDeviceMouse
-
-// AzQtComponents
-#include
-
-// AzToolsFramework
-#include
-#include
-#include
-#include
-#include
-#include
-
-
-// CryCommon
-#include
-
-// AzFramework
-#include
-
-// Editor
-#include "Util/fastlib.h"
-#include "CryEditDoc.h"
-#include "GameEngine.h"
-#include "ViewManager.h"
-#include "Objects/DisplayContext.h"
-#include "DisplaySettings.h"
-#include "Include/IObjectManager.h"
-#include "Include/IDisplayViewport.h"
-#include "Objects/ObjectManager.h"
-#include "ProcessInfo.h"
-#include "IPostEffectGroup.h"
-#include "EditorPreferencesPageGeneral.h"
-
-#include "ViewPane.h"
-#include "CustomResolutionDlg.h"
-#include "AnimationContext.h"
-#include "Objects/SelectionGroup.h"
-#include "Core/QtEditorApplication.h"
-
-// ComponentEntityEditorPlugin
-#include
-
-// LmbrCentral
-#include
-
-#include
-
-#include
-#include
-#include
-
-AZ_CVAR(
- bool, ed_visibility_use, true, nullptr, AZ::ConsoleFunctorFlags::Null,
- "Enable/disable using the new IVisibilitySystem for Entity visibility determination");
-
-CRenderViewport* CRenderViewport::m_pPrimaryViewport = nullptr;
-
-#if AZ_TRAIT_OS_PLATFORM_APPLE
-void StopFixedCursorMode();
-void StartFixedCursorMode(QObject *viewport);
-#endif
-
-#define MAX_ORBIT_DISTANCE (2000.0f)
-#define RENDER_MESH_TEST_DISTANCE (0.2f)
-#define CURSOR_FONT_HEIGHT 8.0f
-#define FORWARD_DIRECTION Vec3(0, 1, 0)
-
-static const char TextCantCreateCameraNoLevel[] = "Cannot create camera when no level is loaded.";
-
-class EditorEntityNotifications
- : public AzToolsFramework::EditorEntityContextNotificationBus::Handler
- , public AzToolsFramework::EditorContextMenuBus::Handler
-{
-public:
- EditorEntityNotifications(CRenderViewport& renderViewport)
- : m_renderViewport(renderViewport)
- {
- AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
- AzToolsFramework::EditorContextMenuBus::Handler::BusConnect();
- }
-
- ~EditorEntityNotifications() override
- {
- AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
- AzToolsFramework::EditorContextMenuBus::Handler::BusDisconnect();
- }
-
- // AzToolsFramework::EditorEntityContextNotificationBus
- void OnStartPlayInEditor() override
- {
- m_renderViewport.OnStartPlayInEditor();
- }
- void OnStopPlayInEditor() override
- {
- m_renderViewport.OnStopPlayInEditor();
- }
-
- // AzToolsFramework::EditorContextMenu::Bus
- void PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2& point, int flags) override
- {
- m_renderViewport.PopulateEditorGlobalContextMenu(menu, point, flags);
- }
-private:
- CRenderViewport& m_renderViewport;
-};
-
-struct CRenderViewport::SScopedCurrentContext
-{
- const CRenderViewport* m_viewport;
- CRenderViewport::SPreviousContext m_previousContext;
-
- explicit SScopedCurrentContext(const CRenderViewport* viewport)
- : m_viewport(viewport)
- {
- m_previousContext = viewport->SetCurrentContext();
-
- // During normal updates of RenderViewport the value of m_cameraSetForWidgetRenderingCount is expected to be 0.
- // This is to guarantee no loss in performance by tracking unnecessary calls to SetCurrentContext/RestorePreviousContext.
- // If some code makes additional calls to Pre/PostWidgetRendering then the assert will be triggered because
- // m_cameraSetForWidgetRenderingCount will be greater than 0.
- // There is a legitimate case where the counter can be greater than 0. This is when QtViewport is processing mouse callbacks.
- // QtViewport::MouseCallback() is surrounded by Pre/PostWidgetRendering and the m_processingMouseCallbacksCounter
- // tracks this specific case. If an update of a RenderViewport happens while processing the mouse callback,
- // for example when showing a QMessageBox, then both counters must match.
- AZ_Assert(viewport->m_cameraSetForWidgetRenderingCount == viewport->m_processingMouseCallbacksCounter,
- "SScopedCurrentContext constructor was called while viewport widget context is active "
- "- this is unnecessary");
- }
-
- ~SScopedCurrentContext()
- {
- m_viewport->RestorePreviousContext(m_previousContext);
- }
-};
-
-//////////////////////////////////////////////////////////////////////////
-// CRenderViewport
-//////////////////////////////////////////////////////////////////////////
-
-CRenderViewport::CRenderViewport(const QString& name, QWidget* parent)
- : QtViewport(parent)
- , m_Camera(GetIEditor()->GetSystem()->GetViewCamera())
- , m_camFOV(gSettings.viewports.fDefaultFov)
- , m_defaultViewName(name)
-{
- // need this to be set in order to allow for language switching on Windows
- setAttribute(Qt::WA_InputMethodEnabled);
- LockCameraMovement(true);
-
- CRenderViewport::SetViewTM(m_Camera.GetMatrix());
- m_defaultViewTM.SetIdentity();
-
- if (GetIEditor()->GetViewManager()->GetSelectedViewport() == nullptr)
- {
- GetIEditor()->GetViewManager()->SelectViewport(this);
- }
-
- GetIEditor()->RegisterNotifyListener(this);
-
- m_displayContext.pIconManager = GetIEditor()->GetIconManager();
- GetIEditor()->GetUndoManager()->AddListener(this);
-
- m_PhysicalLocation.SetIdentity();
-
- // The renderer requires something, so don't allow us to shrink to absolutely nothing
- // This won't in fact stop the viewport from being shrunk, when it's the centralWidget for
- // the MainWindow, but it will stop the viewport from getting resize events
- // once it's smaller than that, which from the renderer's perspective works out
- // to be the same thing.
- setMinimumSize(50, 50);
-
- OnCreate();
-
- setFocusPolicy(Qt::StrongFocus);
-
- Camera::EditorCameraRequestBus::Handler::BusConnect();
- m_editorEntityNotifications = AZStd::make_unique(*this);
-
- m_manipulatorManager = GetIEditor()->GetViewManager()->GetManipulatorManager();
- if (!m_pPrimaryViewport)
- {
- m_pPrimaryViewport = this;
- }
-
- m_hwnd = renderOverlayHWND();
-}
-
-//////////////////////////////////////////////////////////////////////////
-CRenderViewport::~CRenderViewport()
-{
- AzFramework::WindowNotificationBus::Event(m_hwnd, &AzFramework::WindowNotificationBus::Handler::OnWindowClosed);
-
- if (m_pPrimaryViewport == this)
- {
- m_pPrimaryViewport = nullptr;
- }
-
- AzFramework::WindowRequestBus::Handler::BusDisconnect();
- DisconnectViewportInteractionRequestBus();
- m_editorEntityNotifications.reset();
- Camera::EditorCameraRequestBus::Handler::BusDisconnect();
- OnDestroy();
- GetIEditor()->GetUndoManager()->RemoveListener(this);
- GetIEditor()->UnregisterNotifyListener(this);
-}
-
-//////////////////////////////////////////////////////////////////////////
-// CRenderViewport message handlers
-//////////////////////////////////////////////////////////////////////////
-int CRenderViewport::OnCreate()
-{
- CreateRenderContext();
-
- return 0;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::resizeEvent(QResizeEvent* event)
-{
- PushDisableRendering();
- QtViewport::resizeEvent(event);
- PopDisableRendering();
-
- const QRect rcWindow = rect().translated(mapToGlobal(QPoint()));
-
- gEnv->pSystem->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_MOVE, rcWindow.left(), rcWindow.top());
-
- m_rcClient = rect();
- m_rcClient.setBottomRight(WidgetToViewport(m_rcClient.bottomRight()));
-
- gEnv->pSystem->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_RESIZE, width(), height());
-
- // We queue the window resize event because the render overlay may be hidden.
- // If the render overlay is not visible, the native window that is backing it will
- // also be hidden, and it will not resize until it becomes visible.
- m_windowResizedEvent = true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::paintEvent([[maybe_unused]] QPaintEvent* event)
-{
- // Do not call CViewport::OnPaint() for painting messages
- // FIXME: paintEvent() isn't the best place for such logic. Should listen to proper eNotify events and to the stuff there instead. (Repeats for other view port classes too).
- CGameEngine* ge = GetIEditor()->GetGameEngine();
- if ((ge && ge->IsLevelLoaded()) || (GetType() != ET_ViewportCamera))
- {
- setRenderOverlayVisible(true);
- m_isOnPaint = true;
- Update();
- m_isOnPaint = false;
- }
- else
- {
- setRenderOverlayVisible(false);
- QPainter painter(this); // device context for painting
-
- // draw gradient background
- const QRect rc = rect();
- QLinearGradient gradient(rc.topLeft(), rc.bottomLeft());
- gradient.setColorAt(0, QColor(80, 80, 80));
- gradient.setColorAt(1, QColor(200, 200, 200));
- painter.fillRect(rc, gradient);
-
- // if we have some level loaded/loading/new
- // we draw a text
- if (!GetIEditor()->GetLevelFolder().isEmpty())
- {
- const int kFontSize = 200;
- const char* kFontName = "Arial";
- const QColor kTextColor(255, 255, 255);
- const QColor kTextShadowColor(0, 0, 0);
- const QFont font(kFontName, kFontSize / 10.0);
- painter.setFont(font);
-
- QString friendlyName = QFileInfo(GetIEditor()->GetLevelName()).fileName();
- const QString strMsg = tr("Preparing level %1...").arg(friendlyName);
-
- // draw text shadow
- painter.setPen(kTextShadowColor);
- painter.drawText(rc, Qt::AlignCenter, strMsg);
- painter.setPen(kTextColor);
- // offset rect for normal text
- painter.drawText(rc.translated(-1, -1), Qt::AlignCenter, strMsg);
- }
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::mousePressEvent(QMouseEvent* event)
-{
- // There's a bug caused by having a mix of MFC and Qt where if the render viewport
- // had focus and then an MFC widget gets focus, Qt internally still thinks
- // that the widget that had focus before (the render viewport) has it now.
- // Because of this, Qt won't set the window that the viewport is in as the
- // focused widget, and the render viewport won't get keyboard input.
- // Forcing the window to activate should allow the window to take focus
- // and then the call to setFocus() will give it focus.
- // All so that the ::keyPressEvent() gets called.
- ActivateWindowAndSetFocus();
-
- GetIEditor()->GetViewManager()->SelectViewport(this);
-
- QtViewport::mousePressEvent(event);
-}
-
-AzToolsFramework::ViewportInteraction::MousePick CRenderViewport::BuildMousePickInternal(const QPoint& point) const
-{
- using namespace AzToolsFramework::ViewportInteraction;
-
- MousePick mousePick;
- Vec3 from, dir;
- ViewToWorldRay(point, from, dir);
- mousePick.m_rayOrigin = LYVec3ToAZVec3(from);
- mousePick.m_rayDirection = LYVec3ToAZVec3(dir);
- mousePick.m_screenCoordinates = AzFramework::ScreenPoint(point.x(), point.y());
- return mousePick;
-}
-
-AzToolsFramework::ViewportInteraction::MousePick CRenderViewport::BuildMousePick(const QPoint& point)
-{
- using namespace AzToolsFramework::ViewportInteraction;
-
- PreWidgetRendering();
- const MousePick mousePick = BuildMousePickInternal(point);
- PostWidgetRendering();
- return mousePick;
-}
-
-AzToolsFramework::ViewportInteraction::MouseInteraction CRenderViewport::BuildMouseInteractionInternal(
- const AzToolsFramework::ViewportInteraction::MouseButtons buttons,
- const AzToolsFramework::ViewportInteraction::KeyboardModifiers modifiers,
- const AzToolsFramework::ViewportInteraction::MousePick& mousePick) const
-{
- using namespace AzToolsFramework::ViewportInteraction;
-
- MouseInteraction mouse;
- mouse.m_interactionId.m_cameraId = m_viewEntityId;
- mouse.m_interactionId.m_viewportId = GetViewportId();
- mouse.m_mouseButtons = buttons;
- mouse.m_mousePick = mousePick;
- mouse.m_keyboardModifiers = modifiers;
- return mouse;
-}
-
-AzToolsFramework::ViewportInteraction::MouseInteraction CRenderViewport::BuildMouseInteraction(
- const Qt::MouseButtons buttons, const Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
- using namespace AzToolsFramework::ViewportInteraction;
-
- return BuildMouseInteractionInternal(
- BuildMouseButtons(buttons),
- BuildKeyboardModifiers(modifiers),
- BuildMousePick(WidgetToViewport(point)));
-}
-
-namespace RenderViewportUtil
-{
- static bool JustAltHeld(const Qt::KeyboardModifiers modifiers)
- {
- return (modifiers & Qt::ShiftModifier) == 0
- && (modifiers & Qt::ControlModifier) == 0
- && (modifiers & Qt::AltModifier) != 0;
- }
-
- static bool NoModifiersHeld(const Qt::KeyboardModifiers modifiers)
- {
- return (modifiers & Qt::ShiftModifier) == 0
- && (modifiers & Qt::ControlModifier) == 0
- && (modifiers & Qt::AltModifier) == 0;
- }
-
- static bool AllowDolly(const Qt::KeyboardModifiers modifiers)
- {
- return JustAltHeld(modifiers);
- }
-
- static bool AllowOrbit(const Qt::KeyboardModifiers modifiers)
- {
- return JustAltHeld(modifiers);
- }
-
- static bool AllowPan(const Qt::KeyboardModifiers modifiers)
- {
- // begin pan with alt (inverted movement) or no modifiers
- return JustAltHeld(modifiers) || NoModifiersHeld(modifiers);
- }
-
- static bool InvertPan(const Qt::KeyboardModifiers modifiers)
- {
- return JustAltHeld(modifiers);
- }
-} // namespace RenderViewportUtil
-
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnLButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
- using namespace AzToolsFramework::ViewportInteraction;
- using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
- if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
- {
- return;
- }
-
- if (!m_renderer)
- {
- return;
- }
-
- // Force the visible object cache to be updated - this is to ensure that
- // selection will work properly even if helpers are not being displayed,
- // in which case the cache is not updated every frame.
- if (m_displayContext.settings && !m_displayContext.settings->IsDisplayHelpers())
- {
- GetIEditor()->GetObjectManager()->ForceUpdateVisibleObjectCache(m_displayContext);
- }
-
- const auto scaledPoint = WidgetToViewport(point);
- const auto mouseInteraction = BuildMouseInteractionInternal(
- MouseButtonsFromButton(MouseButton::Left),
- BuildKeyboardModifiers(modifiers),
- BuildMousePick(scaledPoint));
-
- bool manipulatorInteraction = false;
- EditorInteractionSystemViewportSelectionRequestBus::EventResult(
- manipulatorInteraction, AzToolsFramework::GetEntityContextId(),
- &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseManipulatorInteraction,
- MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
-
- if (!manipulatorInteraction)
- {
- if (RenderViewportUtil::AllowOrbit(modifiers))
- {
- m_bInOrbitMode = true;
- m_orbitTarget =
- GetViewTM().GetTranslation() + GetViewTM().TransformVector(FORWARD_DIRECTION) * m_orbitDistance;
-
- // mouse buttons are treated as keys as well
- if (m_pressedKeyState == KeyPressedState::AllUp)
- {
- m_pressedKeyState = KeyPressedState::PressedThisFrame;
- }
-
- m_mousePos = scaledPoint;
- m_prevMousePos = scaledPoint;
-
- HideCursor();
- CaptureMouse();
-
- // no further handling of left mouse button down
- return;
- }
-
- EditorInteractionSystemViewportSelectionRequestBus::Event(
- AzToolsFramework::GetEntityContextId(),
- &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseViewportInteraction,
- MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnLButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
- using namespace AzToolsFramework::ViewportInteraction;
- using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
- if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
- {
- return;
- }
-
- // Convert point to position on terrain.
- if (!m_renderer)
- {
- return;
- }
-
- // Update viewports after done with actions.
- GetIEditor()->UpdateViews(eUpdateObjects);
-
- const auto scaledPoint = WidgetToViewport(point);
-
- const auto mouseInteraction = BuildMouseInteractionInternal(
- MouseButtonsFromButton(MouseButton::Left),
- BuildKeyboardModifiers(modifiers),
- BuildMousePick(scaledPoint));
-
- if (m_bInOrbitMode)
- {
- m_bInOrbitMode = false;
-
- ReleaseMouse();
- ShowCursor();
- }
-
- AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
- AzToolsFramework::GetEntityContextId(),
- &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
- MouseInteractionEvent(mouseInteraction, MouseEvent::Up));
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnLButtonDblClk(Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
- using namespace AzToolsFramework::ViewportInteraction;
- using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
- if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
- {
- return;
- }
-
- const auto scaledPoint = WidgetToViewport(point);
- const auto mouseInteraction = BuildMouseInteractionInternal(
- MouseButtonsFromButton(MouseButton::Left),
- BuildKeyboardModifiers(modifiers),
- BuildMousePick(scaledPoint));
-
- AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
- AzToolsFramework::GetEntityContextId(),
- &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
- MouseInteractionEvent(mouseInteraction, MouseEvent::DoubleClick));
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnRButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
- using namespace AzToolsFramework::ViewportInteraction;
- using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
- if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
- {
- return;
- }
-
- SetFocus();
-
- const auto scaledPoint = WidgetToViewport(point);
- const auto mouseInteraction = BuildMouseInteractionInternal(
- MouseButtonsFromButton(MouseButton::Right),
- BuildKeyboardModifiers(modifiers),
- BuildMousePick(scaledPoint));
-
- AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
- AzToolsFramework::GetEntityContextId(),
- &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
- MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
-
- if (RenderViewportUtil::AllowDolly(modifiers))
- {
- m_bInZoomMode = true;
- }
- else
- {
- m_bInRotateMode = true;
- }
-
- // mouse buttons are treated as keys as well
- if (m_pressedKeyState == KeyPressedState::AllUp)
- {
- m_pressedKeyState = KeyPressedState::PressedThisFrame;
- }
-
- m_mousePos = scaledPoint;
- m_prevMousePos = m_mousePos;
-
- HideCursor();
-
- // we can't capture the mouse here, or it will stop the popup menu
- // when the mouse is released.
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnRButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
- using namespace AzToolsFramework::ViewportInteraction;
- using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
- if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
- {
- return;
- }
-
- const auto scaledPoint = WidgetToViewport(point);
- const auto mouseInteraction = BuildMouseInteractionInternal(
- MouseButtonsFromButton(MouseButton::Right),
- BuildKeyboardModifiers(modifiers),
- BuildMousePick(scaledPoint));
-
- AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
- AzToolsFramework::GetEntityContextId(),
- &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
- MouseInteractionEvent(mouseInteraction, MouseEvent::Up));
-
- m_bInRotateMode = false;
- m_bInZoomMode = false;
-
- ReleaseMouse();
-
- if (!m_bInMoveMode)
- {
- ShowCursor();
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnMButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
- using namespace AzToolsFramework::ViewportInteraction;
- using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
- if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
- {
- return;
- }
-
- const auto scaledPoint = WidgetToViewport(point);
- const auto mouseInteraction = BuildMouseInteractionInternal(
- MouseButtonsFromButton(MouseButton::Middle),
- BuildKeyboardModifiers(modifiers),
- BuildMousePick(scaledPoint));
-
- if (RenderViewportUtil::AllowPan(modifiers))
- {
- m_bInMoveMode = true;
-
- // mouse buttons are treated as keys as well
- if (m_pressedKeyState == KeyPressedState::AllUp)
- {
- m_pressedKeyState = KeyPressedState::PressedThisFrame;
- }
-
- m_mousePos = scaledPoint;
- m_prevMousePos = scaledPoint;
-
- HideCursor();
- CaptureMouse();
- }
-
- AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
- AzToolsFramework::GetEntityContextId(),
- &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
- MouseInteractionEvent(mouseInteraction, MouseEvent::Down));
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnMButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point)
-{
- using namespace AzToolsFramework::ViewportInteraction;
- using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
- if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
- {
- return;
- }
-
- const auto scaledPoint = WidgetToViewport(point);
- UpdateCurrentMousePos(scaledPoint);
-
- const auto tryRestoreMouse = [this]
- {
- // if we are currently looking (rotateMode) or dollying (zoomMode)
- // do not show the cursor on mouse up as rmb is still held
- if (!m_bInZoomMode && !m_bInRotateMode)
- {
- ReleaseMouse();
- ShowCursor();
- }
- };
-
- if (m_bInMoveMode)
- {
- m_bInMoveMode = false;
- tryRestoreMouse();
- }
-
- const auto mouseInteraction = BuildMouseInteractionInternal(
- MouseButtonsFromButton(MouseButton::Middle),
- BuildKeyboardModifiers(modifiers),
- BuildMousePick(scaledPoint));
-
- AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
- AzToolsFramework::GetEntityContextId(),
- &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
- MouseInteractionEvent(mouseInteraction, MouseEvent::Up));
-}
-
-void CRenderViewport::OnMouseMove(Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, const QPoint& point)
-{
- using namespace AzToolsFramework::ViewportInteraction;
- using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
- if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
- {
- return;
- }
-
- const auto scaledPoint = WidgetToViewport(point);
-
- const auto mouseInteraction = BuildMouseInteractionInternal(
- BuildMouseButtons(buttons),
- BuildKeyboardModifiers(modifiers),
- BuildMousePick(scaledPoint));
-
- AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Event(
- AzToolsFramework::GetEntityContextId(),
- &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
- MouseInteractionEvent(mouseInteraction, MouseEvent::Move));
-}
-
-void CRenderViewport::InjectFakeMouseMove(int deltaX, int deltaY, Qt::MouseButtons buttons)
-{
- // this is required, otherwise the user will see the context menu
- OnMouseMove(Qt::NoModifier, buttons, QCursor::pos() + QPoint(deltaX, deltaY));
- // we simply move the prev mouse position, so the change will be picked up
- // by the next ProcessMouse call
- m_prevMousePos -= QPoint(deltaX, deltaY);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ProcessMouse()
-{
- if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
- {
- return;
- }
-
- const auto point = WidgetToViewport(mapFromGlobal(QCursor::pos()));
-
- if (point == m_prevMousePos)
- {
- return;
- }
-
- // specifically for the right mouse button click, which triggers rotate or zoom,
- // we can't capture the mouse until the user has moved the mouse, otherwise the
- // right click context menu won't popup
- if (!m_mouseCaptured && (m_bInZoomMode || m_bInRotateMode))
- {
- if ((point - m_mousePos).manhattanLength() > QApplication::startDragDistance())
- {
- CaptureMouse();
- }
- }
-
- float speedScale = GetCameraMoveSpeed();
-
- if (CheckVirtualKey(Qt::Key_Control))
- {
- speedScale *= gSettings.cameraFastMoveSpeed;
- }
-
- if (m_PlayerControl)
- {
- if (m_bInRotateMode)
- {
- f32 MousedeltaX = (m_mousePos.x() - point.x());
- f32 MousedeltaY = (m_mousePos.y() - point.y());
- m_relCameraRotZ += MousedeltaX;
-
- if (GetCameraInvertYRotation())
- {
- MousedeltaY = -MousedeltaY;
- }
- m_relCameraRotZ += MousedeltaX;
- m_relCameraRotX += MousedeltaY;
-
- ResetCursor();
- }
- }
- else if ((m_bInRotateMode && m_bInMoveMode) || m_bInZoomMode)
- {
- // Zoom.
- Matrix34 m = GetViewTM();
-
- Vec3 ydir = m.GetColumn1().GetNormalized();
- Vec3 pos = m.GetTranslation();
-
- const float posDelta = 0.2f * (m_prevMousePos.y() - point.y()) * speedScale;
- pos = pos - ydir * posDelta;
- m_orbitDistance = m_orbitDistance + posDelta;
- m_orbitDistance = fabs(m_orbitDistance);
-
- m.SetTranslation(pos);
- SetViewTM(m);
-
- ResetCursor();
- }
- else if (m_bInRotateMode)
- {
- Ang3 angles(-point.y() + m_prevMousePos.y(), 0, -point.x() + m_prevMousePos.x());
- angles = angles * 0.002f * GetCameraRotateSpeed();
- if (GetCameraInvertYRotation())
- {
- angles.x = -angles.x;
- }
- Matrix34 camtm = GetViewTM();
- Ang3 ypr = CCamera::CreateAnglesYPR(Matrix33(camtm));
- ypr.x += angles.z;
- ypr.y += angles.x;
-
- ypr.y = CLAMP(ypr.y, -1.5f, 1.5f); // to keep rotation in reasonable range
- // In the recording mode of a custom camera, the z rotation is allowed.
- if (GetCameraObject() == nullptr || (!GetIEditor()->GetAnimation()->IsRecordMode() && !IsCameraObjectMove()))
- {
- ypr.z = 0; // to have camera always upward
- }
-
- camtm = Matrix34(CCamera::CreateOrientationYPR(ypr), camtm.GetTranslation());
- SetViewTM(camtm);
-
- ResetCursor();
- }
- else if (m_bInMoveMode)
- {
- // Slide.
- Matrix34 m = GetViewTM();
- Vec3 xdir = m.GetColumn0().GetNormalized();
- Vec3 zdir = m.GetColumn2().GetNormalized();
-
- const auto modifiers = QGuiApplication::queryKeyboardModifiers();
- if (RenderViewportUtil::InvertPan(modifiers))
- {
- xdir = -xdir;
- zdir = -zdir;
- }
-
- Vec3 pos = m.GetTranslation();
- pos += 0.1f * xdir * (point.x() - m_prevMousePos.x()) * speedScale + 0.1f * zdir * (m_prevMousePos.y() - point.y()) * speedScale;
- m.SetTranslation(pos);
- SetViewTM(m, true);
-
- ResetCursor();
- }
- else if (m_bInOrbitMode)
- {
- Ang3 angles(-point.y() + m_prevMousePos.y(), 0, -point.x() + m_prevMousePos.x());
- angles = angles * 0.002f * GetCameraRotateSpeed();
-
- if (GetCameraInvertPan())
- {
- angles.z = -angles.z;
- }
-
- Ang3 ypr = CCamera::CreateAnglesYPR(Matrix33(GetViewTM()));
- ypr.x += angles.z;
- ypr.y = CLAMP(ypr.y, -1.5f, 1.5f); // to keep rotation in reasonable range
- ypr.y += angles.x;
-
- Matrix33 rotateTM = CCamera::CreateOrientationYPR(ypr);
-
- Vec3 src = GetViewTM().GetTranslation();
- Vec3 trg = m_orbitTarget;
- float fCameraRadius = (trg - src).GetLength();
-
- // Calc new source.
- src = trg - rotateTM * Vec3(0, 1, 0) * fCameraRadius;
- Matrix34 camTM = rotateTM;
- camTM.SetTranslation(src);
-
- SetViewTM(camTM);
-
- ResetCursor();
- }
-}
-
-void CRenderViewport::ResetCursor()
-{
-#ifdef AZ_PLATFORM_WINDOWS
- if (!gSettings.stylusMode)
- {
- const QPoint point = mapToGlobal(ViewportToWidget(m_prevMousePos));
- AzQtComponents::SetCursorPos(point);
- }
-#endif
-
- // Recalculate the prev mouse pos even if we just reset to it to avoid compounding floating point math issues with DPI scaling
- m_prevMousePos = WidgetToViewport(mapFromGlobal(QCursor::pos()));
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::event(QEvent* event)
-{
- switch (event->type())
- {
- case QEvent::WindowActivate:
- GetIEditor()->GetViewManager()->SelectViewport(this);
- // also kill the keys; if we alt-tab back to the viewport, or come back from the debugger, it's done (and there's no guarantee we'll get the keyrelease event anyways)
- m_keyDown.clear();
- break;
-
- case QEvent::Shortcut:
- // a shortcut should immediately clear us, otherwise the release event never gets sent
- m_keyDown.clear();
- break;
-
- case QEvent::ShortcutOverride:
- {
- // since we respond to the following things, let Qt know so that shortcuts don't override us
- bool respondsToEvent = false;
-
- auto keyEvent = static_cast(event);
- bool manipulatorInteracting = false;
- AzToolsFramework::ManipulatorManagerRequestBus::EventResult(
- manipulatorInteracting,
- AzToolsFramework::g_mainManipulatorManagerId,
- &AzToolsFramework::ManipulatorManagerRequestBus::Events::Interacting);
-
- // If a manipulator is active, stop all shortcuts from working, except for the escape key, which cancels in some cases
- if ((keyEvent->key() != Qt::Key_Escape) && manipulatorInteracting)
- {
- respondsToEvent = true;
- }
- else
- {
- // In game mode we never want to be overridden by shortcuts
- if (GetIEditor()->IsInGameMode() && GetType() == ET_ViewportCamera)
- {
- respondsToEvent = true;
- }
- else
- {
- if (!(keyEvent->modifiers() & Qt::ControlModifier))
- {
- switch (keyEvent->key())
- {
- case Qt::Key_Up:
- case Qt::Key_W:
- case Qt::Key_Down:
- case Qt::Key_S:
- case Qt::Key_Left:
- case Qt::Key_A:
- case Qt::Key_Right:
- case Qt::Key_D:
- respondsToEvent = true;
- break;
-
- default:
- break;
- }
- }
- }
- }
-
- if (respondsToEvent)
- {
- event->accept();
- return true;
- }
-
- // because we're doing keyboard grabs, we need to detect
- // when a shortcut matched so that we can track the buttons involved
- // in the shortcut, since the key released event won't be generated in that case
- ProcessKeyRelease(keyEvent);
- }
- break;
- default:
- // do nothing
- break;
- }
-
- return QtViewport::event(event);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ResetContent()
-{
- QtViewport::ResetContent();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::UpdateContent(int flags)
-{
- QtViewport::UpdateContent(flags);
- if (flags & eUpdateObjects)
- {
- m_bUpdateViewport = true;
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::Update()
-{
- FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
- if (Editor::EditorQtApplication::instance()->isMovingOrResizing())
- {
- return;
- }
-
- if (!m_renderer || m_rcClient.isEmpty() || GetIEditor()->IsInMatEditMode())
- {
- return;
- }
-
- if (!isVisible())
- {
- return;
- }
-
- // Only send the resize event if the render overlay is visible. This is to make sure
- // the native window has resized.
- if (m_windowResizedEvent && isRenderOverlayVisible())
- {
- AzFramework::WindowNotificationBus::Event(renderOverlayHWND(), &AzFramework::WindowNotificationBus::Handler::OnWindowResized, m_rcClient.width(), m_rcClient.height());
- m_windowResizedEvent = false;
- }
-
- // Don't wait for changes to update the focused viewport.
- if (CheckRespondToInput())
- {
- m_bUpdateViewport = true;
- }
-
- // While Renderer doesn't support fast rendering of the scene to more then 1 viewport
- // render only focused viewport if more then 1 are opened and always update is off.
- if (!m_isOnPaint && m_viewManager->GetNumberOfGameViewports() > 1 && GetType() == ET_ViewportCamera)
- {
- if (m_pPrimaryViewport != this)
- {
- if (CheckRespondToInput()) // If this is the focused window, set primary viewport.
- {
- m_pPrimaryViewport = this;
- }
- else if (!m_bUpdateViewport) // Skip this viewport.
- {
- return;
- }
- }
- }
-
- if (CheckRespondToInput())
- {
- ProcessMouse();
- ProcessKeys();
- }
-
- const bool isGameMode = GetIEditor()->IsInGameMode();
- const bool isSimulationMode = GetIEditor()->GetGameEngine()->GetSimulationMode();
-
- // Allow debug visualization in both 'game' (Ctrl-G) and 'simulation' (Ctrl-P) modes
- if (isGameMode || isSimulationMode)
- {
- if (!IsRenderingDisabled())
- {
- // Disable rendering to avoid recursion into Update()
- PushDisableRendering();
-
- // draw debug visualizations
- {
- const AzFramework::DisplayContextRequestGuard displayContextGuard(m_displayContext);
-
- const AZ::u32 prevState = m_displayContext.GetState();
- m_displayContext.SetState(
- e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeBack | e_DepthWriteOn | e_DepthTestOn);
-
- AzFramework::DebugDisplayRequestBus::BusPtr debugDisplayBus;
- AzFramework::DebugDisplayRequestBus::Bind(
- debugDisplayBus, AzFramework::g_defaultSceneEntityDebugDisplayId);
- AZ_Assert(debugDisplayBus, "Invalid DebugDisplayRequestBus.");
-
- AzFramework::DebugDisplayRequests* debugDisplay =
- AzFramework::DebugDisplayRequestBus::FindFirstHandler(debugDisplayBus);
-
- AzFramework::EntityDebugDisplayEventBus::Broadcast(
- &AzFramework::EntityDebugDisplayEvents::DisplayEntityViewport,
- AzFramework::ViewportInfo{ GetViewportId() }, *debugDisplay);
-
- m_displayContext.SetState(prevState);
- }
-
- QtViewport::Update();
- PopDisableRendering();
- }
-
- // Game mode rendering is handled by CryAction
- if (isGameMode)
- {
- return;
- }
- }
-
- // Prevents rendering recursion due to recursive Paint messages.
- if (IsRenderingDisabled())
- {
- return;
- }
-
- PushDisableRendering();
-
- m_viewTM = m_Camera.GetMatrix(); // synchronize.
-
- // Render
- if (!m_bRenderContextCreated)
- {
- if (!CreateRenderContext())
- {
- return;
- }
- }
-
- if (ed_visibility_use)
- {
- auto start = std::chrono::steady_clock::now();
-
- m_entityVisibilityQuery.UpdateVisibility(GetCameraState());
- }
-
- {
- SScopedCurrentContext context(this);
-
- m_renderer->SetClearColor(Vec3(0.4f, 0.4f, 0.4f));
-
- InitDisplayContext();
-
- OnRender();
-
- ProcessRenderLisneters(m_displayContext);
-
- m_displayContext.Flush2D();
-
- m_renderer->SwitchToNativeResolutionBackbuffer();
-
- // 3D engine stats
-
- CCamera CurCamera = gEnv->pSystem->GetViewCamera();
- gEnv->pSystem->SetViewCamera(m_Camera);
-
- // Post Render Callback
- {
- PostRenderers::iterator itr = m_postRenderers.begin();
- PostRenderers::iterator end = m_postRenderers.end();
- for (; itr != end; ++itr)
- {
- (*itr)->OnPostRender();
- }
- }
-
- gEnv->pSystem->SetViewCamera(CurCamera);
- }
-
- QtViewport::Update();
-
- PopDisableRendering();
- m_bUpdateViewport = false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::SetViewEntity(const AZ::EntityId& viewEntityId, bool lockCameraMovement)
-{
- // if they've picked the same camera, then that means they want to toggle
- if (viewEntityId.IsValid() && viewEntityId != m_viewEntityId)
- {
- LockCameraMovement(lockCameraMovement);
- m_viewEntityId = viewEntityId;
- AZStd::string entityName;
- AZ::ComponentApplicationBus::BroadcastResult(entityName, &AZ::ComponentApplicationRequests::GetEntityName, viewEntityId);
- SetName(QString("Camera entity: %1").arg(entityName.c_str()));
- }
- else
- {
- SetDefaultCamera();
- }
-
- PostCameraSet();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ResetToViewSourceType(const ViewSourceType& viewSourceType)
-{
- LockCameraMovement(true);
- m_pCameraFOVVariable = nullptr;
- m_viewEntityId.SetInvalid();
- m_cameraObjectId = GUID_NULL;
- m_viewSourceType = viewSourceType;
- SetViewTM(GetViewTM());
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::PostCameraSet()
-{
- if (m_viewPane)
- {
- m_viewPane->OnFOVChanged(GetFOV());
- }
-
- GetIEditor()->Notify(eNotify_CameraChanged);
- QScopedValueRollback rb(m_ignoreSetViewFromEntityPerspective, true);
- Camera::EditorCameraNotificationBus::Broadcast(
- &Camera::EditorCameraNotificationBus::Events::OnViewportViewEntityChanged, m_viewEntityId);
-}
-
-//////////////////////////////////////////////////////////////////////////
-CBaseObject* CRenderViewport::GetCameraObject() const
-{
- CBaseObject* pCameraObject = nullptr;
-
- if (m_viewSourceType == ViewSourceType::SequenceCamera)
- {
- m_cameraObjectId = GetViewManager()->GetCameraObjectId();
- }
- if (m_cameraObjectId != GUID_NULL)
- {
- // Find camera object from id.
- pCameraObject = GetIEditor()->GetObjectManager()->FindObject(m_cameraObjectId);
- }
- else if (m_viewSourceType == ViewSourceType::CameraComponent || m_viewSourceType == ViewSourceType::AZ_Entity)
- {
- AzToolsFramework::ComponentEntityEditorRequestBus::EventResult(
- pCameraObject, m_viewEntityId, &AzToolsFramework::ComponentEntityEditorRequests::GetSandboxObject);
- }
- return pCameraObject;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnEditorNotifyEvent(EEditorNotifyEvent event)
-{
- switch (event)
- {
- case eNotify_OnBeginGameMode:
- {
- if (GetIEditor()->GetViewManager()->GetGameViewport() == this)
- {
- m_preGameModeViewTM = GetViewTM();
- // this should only occur for the main viewport and no others.
- ShowCursor();
-
- // If the user has selected game mode, enable outputting to any attached HMD and properly size the context
- // to the resolution specified by the VR device.
- if (gSettings.bEnableGameModeVR)
- {
- const AZ::VR::HMDDeviceInfo* deviceInfo = nullptr;
- EBUS_EVENT_RESULT(deviceInfo, AZ::VR::HMDDeviceRequestBus, GetDeviceInfo);
- AZ_Warning("Render Viewport", deviceInfo, "No VR device detected");
-
- if (deviceInfo)
- {
- m_previousContext = SetCurrentContext(deviceInfo->renderWidth, deviceInfo->renderHeight);
- if (m_renderer->GetIStereoRenderer())
- {
- m_renderer->GetIStereoRenderer()->OnResolutionChanged();
- }
- SetActiveWindow();
- SetFocus();
- SetSelected(true);
- }
- }
- else
- {
- m_previousContext = SetCurrentContext();
- }
- SetCurrentCursor(STD_CURSOR_GAME);
- }
- }
- break;
-
- case eNotify_OnEndGameMode:
- if (GetIEditor()->GetViewManager()->GetGameViewport() == this)
- {
- SetCurrentCursor(STD_CURSOR_DEFAULT);
- if (m_renderer->GetCurrentContextHWND() != renderOverlayHWND())
- {
- // if this warning triggers it means that someone else (ie, some other part of the code)
- // called SetCurrentContext(...) on the renderer, probably did some rendering, but then either
- // failed to set the context back when done, or set it back to the wrong one.
- CryWarning(VALIDATOR_MODULE_3DENGINE, VALIDATOR_WARNING, "RenderViewport render context was not correctly restored by someone else.");
- }
- RestorePreviousContext(m_previousContext);
- m_bInRotateMode = false;
- m_bInMoveMode = false;
- m_bInOrbitMode = false;
- m_bInZoomMode = false;
-
- RestoreViewportAfterGameMode();
- }
- break;
-
- case eNotify_OnCloseScene:
- SetDefaultCamera();
- break;
-
- case eNotify_OnBeginNewScene:
- PushDisableRendering();
- break;
-
- case eNotify_OnEndNewScene:
- PopDisableRendering();
-
- {
- // Default this to the size of default terrain in case there is no listener on the buss
- AZ::Aabb terrainAabb = AZ::Aabb::CreateFromMinMaxValues(0, 0, 32, 1024, 1024, 32);
- AzFramework::Terrain::TerrainDataRequestBus::BroadcastResult(terrainAabb, &AzFramework::Terrain::TerrainDataRequests::GetTerrainAabb);
- float sx = terrainAabb.GetXExtent();
- float sy = terrainAabb.GetYExtent();
-
- Matrix34 viewTM;
- viewTM.SetIdentity();
- // Initial camera will be at middle of the map at the height of 2
- // meters above the terrain (default terrain height is 32)
- viewTM.SetTranslation(Vec3(sx * 0.5f, sy * 0.5f, 34.0f));
- SetViewTM(viewTM);
- }
- break;
-
- case eNotify_OnBeginTerrainCreate:
- PushDisableRendering();
- break;
-
- case eNotify_OnEndTerrainCreate:
- PopDisableRendering();
-
- {
- // Default this to the size of default terrain in case there is no listener on the buss
- AZ::Aabb terrainAabb = AZ::Aabb::CreateFromMinMaxValues(0, 0, 32, 1024, 1024, 32);
- AzFramework::Terrain::TerrainDataRequestBus::BroadcastResult(terrainAabb, &AzFramework::Terrain::TerrainDataRequests::GetTerrainAabb);
- float sx = terrainAabb.GetXExtent();
- float sy = terrainAabb.GetYExtent();
-
- Matrix34 viewTM;
- viewTM.SetIdentity();
- // Initial camera will be at middle of the map at the height of 2
- // meters above the terrain (default terrain height is 32)
- viewTM.SetTranslation(Vec3(sx * 0.5f, sy * 0.5f, 34.0f));
- SetViewTM(viewTM);
- }
- break;
-
- case eNotify_OnBeginLayerExport:
- case eNotify_OnBeginSceneSave:
- PushDisableRendering();
- break;
- case eNotify_OnEndLayerExport:
- case eNotify_OnEndSceneSave:
- PopDisableRendering();
- break;
-
- case eNotify_OnBeginLoad: // disables viewport input when starting to load an existing level
- case eNotify_OnBeginCreate: // disables viewport input when starting to create a new level
- m_freezeViewportInput = true;
- break;
-
- case eNotify_OnEndLoad: // enables viewport input when finished loading an existing level
- case eNotify_OnEndCreate: // enables viewport input when finished creating a new level
- m_freezeViewportInput = false;
- break;
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-namespace {
- inline Vec3 NegY(const Vec3& v, float y)
- {
- return Vec3(v.x, y - v.y, v.z);
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnRender()
-{
- if (m_rcClient.isEmpty() || m_renderer->GetRenderType() == eRT_Null) // Null is crashing in CryEngine on macOS
- {
- // Even in null rendering, update the view camera.
- // This is necessary so that automated editor tests using the null renderer to test systems like dynamic vegetation
- // are still able to manipulate the current logical camera position, even if nothing is rendered.
- GetIEditor()->GetSystem()->SetViewCamera(m_Camera);
- return;
- }
-
- FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
- float fNearZ = GetIEditor()->GetConsoleVar("cl_DefaultNearPlane");
- float fFarZ = m_Camera.GetFarPlane();
-
- CBaseObject* cameraObject = GetCameraObject();
- if (cameraObject)
- {
- AZ::Matrix3x3 lookThroughEntityCorrection = AZ::Matrix3x3::CreateIdentity();
- if (m_viewEntityId.IsValid())
- {
- Camera::CameraRequestBus::EventResult(fNearZ, m_viewEntityId, &Camera::CameraComponentRequests::GetNearClipDistance);
- Camera::CameraRequestBus::EventResult(fFarZ, m_viewEntityId, &Camera::CameraComponentRequests::GetFarClipDistance);
- LmbrCentral::EditorCameraCorrectionRequestBus::EventResult(
- lookThroughEntityCorrection, m_viewEntityId,
- &LmbrCentral::EditorCameraCorrectionRequests::GetTransformCorrection);
- }
-
- m_viewTM = cameraObject->GetWorldTM() * AZMatrix3x3ToLYMatrix3x3(lookThroughEntityCorrection);
- m_viewTM.OrthonormalizeFast();
-
- m_Camera.SetMatrix(m_viewTM);
-
- int w = m_rcClient.width();
- int h = m_rcClient.height();
-
- m_Camera.SetFrustum(w, h, GetFOV(), fNearZ, fFarZ);
- }
- else if (m_viewEntityId.IsValid())
- {
- Camera::CameraRequestBus::EventResult(fNearZ, m_viewEntityId, &Camera::CameraComponentRequests::GetNearClipDistance);
- Camera::CameraRequestBus::EventResult(fFarZ, m_viewEntityId, &Camera::CameraComponentRequests::GetFarClipDistance);
- int w = m_rcClient.width();
- int h = m_rcClient.height();
-
- m_Camera.SetFrustum(w, h, GetFOV(), fNearZ, fFarZ);
- }
- else
- {
- // Normal camera.
- m_cameraObjectId = GUID_NULL;
- int w = m_rcClient.width();
- int h = m_rcClient.height();
-
- float fov = gSettings.viewports.fDefaultFov;
-
- // match viewport fov to default / selected title menu fov
- if (GetFOV() != fov)
- {
- if (m_viewPane)
- {
- m_viewPane->OnFOVChanged(fov);
- SetFOV(fov);
- }
- }
-
- // Just for editor: Aspect ratio fix when changing the viewport
- if (!GetIEditor()->IsInGameMode())
- {
- float viewportAspectRatio = float( w ) / h;
- float targetAspectRatio = GetAspectRatio();
- if (targetAspectRatio > viewportAspectRatio)
- {
- // Correct for vertical FOV change.
- float maxTargetHeight = float( w ) / targetAspectRatio;
- fov = 2 * atanf((h * tan(fov / 2)) / maxTargetHeight);
- }
- }
-
- m_Camera.SetFrustum(w, h, fov, fNearZ);
- }
-
- GetIEditor()->GetSystem()->SetViewCamera(m_Camera);
-
- CGameEngine* ge = GetIEditor()->GetGameEngine();
-
- bool levelIsDisplayable = (ge && ge->IsLevelLoaded() && GetIEditor()->GetDocument() && GetIEditor()->GetDocument()->IsDocumentReady());
-
- //Handle scene render tasks such as gizmos and handles but only when not in VR
- if (!m_renderer->IsStereoEnabled())
- {
- DisplayContext& displayContext = m_displayContext;
-
- PreWidgetRendering();
-
- RenderAll();
-
- // Draw 2D helpers.
- TransformationMatrices backupSceneMatrices;
- m_renderer->Set2DMode(m_rcClient.right(), m_rcClient.bottom(), backupSceneMatrices);
- displayContext.SetState(e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeBack | e_DepthWriteOn | e_DepthTestOn);
-
- // Display cursor string.
- RenderCursorString();
-
- if (gSettings.viewports.bShowSafeFrame)
- {
- UpdateSafeFrame();
- RenderSafeFrame();
- }
-
- const AzFramework::DisplayContextRequestGuard displayContextGuard(displayContext);
-
- AzFramework::DebugDisplayRequestBus::BusPtr debugDisplayBus;
- AzFramework::DebugDisplayRequestBus::Bind(
- debugDisplayBus, AzFramework::g_defaultSceneEntityDebugDisplayId);
- AZ_Assert(debugDisplayBus, "Invalid DebugDisplayRequestBus.");
-
- AzFramework::DebugDisplayRequests* debugDisplay =
- AzFramework::DebugDisplayRequestBus::FindFirstHandler(debugDisplayBus);
-
- AzFramework::ViewportDebugDisplayEventBus::Event(
- AzToolsFramework::GetEntityContextId(), &AzFramework::ViewportDebugDisplayEvents::DisplayViewport2d,
- AzFramework::ViewportInfo{ GetViewportId() }, *debugDisplay);
-
- m_renderer->Unset2DMode(backupSceneMatrices);
-
- PostWidgetRendering();
- }
-
- if (levelIsDisplayable)
- {
- m_renderer->SetViewport(0, 0, m_renderer->GetWidth(), m_renderer->GetHeight(), m_nCurViewportID);
- }
- else
- {
- ColorF viewportBackgroundColor(pow(71.0f / 255.0f, 2.2f), pow(71.0f / 255.0f, 2.2f), pow(71.0f / 255.0f, 2.2f));
- m_renderer->ClearTargetsLater(FRT_CLEAR_COLOR, viewportBackgroundColor);
- DrawBackground();
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderSelectionRectangle()
-{
- if (m_selectedRect.isEmpty())
- {
- return;
- }
-
- Vec3 topLeft(m_selectedRect.left(), m_selectedRect.top(), 1);
- Vec3 bottomRight(m_selectedRect.right() +1, m_selectedRect.bottom() + 1, 1);
-
- m_displayContext.DepthTestOff();
- m_displayContext.SetColor(1, 1, 1, 0.4f);
- m_displayContext.DrawWireBox(topLeft, bottomRight);
- m_displayContext.DepthTestOn();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::InitDisplayContext()
-{
- FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
- // Draw all objects.
- DisplayContext& displayContext = m_displayContext;
- displayContext.settings = GetIEditor()->GetDisplaySettings();
- displayContext.view = this;
- displayContext.renderer = m_renderer;
- displayContext.box.min = Vec3(-100000.0f, -100000.0f, -100000.0f);
- displayContext.box.max = Vec3(100000.0f, 100000.0f, 100000.0f);
- displayContext.camera = &m_Camera;
- displayContext.flags = 0;
-
- if (!displayContext.settings->IsDisplayLabels() || !displayContext.settings->IsDisplayHelpers())
- {
- displayContext.flags |= DISPLAY_HIDENAMES;
- }
-
- if (displayContext.settings->IsDisplayLinks() && displayContext.settings->IsDisplayHelpers())
- {
- displayContext.flags |= DISPLAY_LINKS;
- }
-
- if (m_bDegradateQuality)
- {
- displayContext.flags |= DISPLAY_DEGRADATED;
- }
-
- if (displayContext.settings->GetRenderFlags() & RENDER_FLAG_BBOX)
- {
- displayContext.flags |= DISPLAY_BBOX;
- }
-
- if (displayContext.settings->IsDisplayTracks() && displayContext.settings->IsDisplayHelpers())
- {
- displayContext.flags |= DISPLAY_TRACKS;
- displayContext.flags |= DISPLAY_TRACKTICKS;
- }
-
- if (GetIEditor()->GetReferenceCoordSys() == COORDS_WORLD)
- {
- displayContext.flags |= DISPLAY_WORLDSPACEAXIS;
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::PopulateEditorGlobalContextMenu(QMenu* /*menu*/, const AZ::Vector2& /*point*/, int /*flags*/)
-{
- m_bInMoveMode = false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderAll()
-{
- // Draw all objects.
- DisplayContext& displayContext = m_displayContext;
-
- m_renderer->ResetToDefault();
-
- displayContext.SetState(e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeBack | e_DepthWriteOn | e_DepthTestOn);
- GetIEditor()->GetObjectManager()->Display(displayContext);
-
- RenderSelectedRegion();
-
- RenderSnapMarker();
-
- if (gSettings.viewports.bShowGridGuide
- && GetIEditor()->GetDisplaySettings()->IsDisplayHelpers())
- {
- RenderSnappingGrid();
- }
-
- if (displayContext.settings->GetDebugFlags() & DBG_MEMINFO)
- {
- ProcessMemInfo mi;
- CProcessInfo::QueryMemInfo(mi);
- int MB = 1024 * 1024;
- QString str = QStringLiteral("WorkingSet=%1Mb, PageFile=%2Mb, PageFaults=%3").arg(mi.WorkingSet / MB).arg(mi.PagefileUsage / MB).arg(mi.PageFaultCount);
- m_renderer->TextToScreenColor(1, 1, 1, 0, 0, 1, str.toUtf8().data());
- }
-
- {
- const AzFramework::DisplayContextRequestGuard displayContextGuard(displayContext);
-
- AzFramework::DebugDisplayRequestBus::BusPtr debugDisplayBus;
- AzFramework::DebugDisplayRequestBus::Bind(
- debugDisplayBus, AzFramework::g_defaultSceneEntityDebugDisplayId);
- AZ_Assert(debugDisplayBus, "Invalid DebugDisplayRequestBus.");
-
- AzFramework::DebugDisplayRequests* debugDisplay =
- AzFramework::DebugDisplayRequestBus::FindFirstHandler(debugDisplayBus);
-
- // allow the override of in-editor visualization
- AzFramework::ViewportDebugDisplayEventBus::Event(
- AzToolsFramework::GetEntityContextId(), &AzFramework::ViewportDebugDisplayEvents::DisplayViewport,
- AzFramework::ViewportInfo{ GetViewportId() }, *debugDisplay);
-
- m_entityVisibilityQuery.DisplayVisibility(*debugDisplay);
-
- if (m_manipulatorManager != nullptr)
- {
- using namespace AzToolsFramework::ViewportInteraction;
-
- debugDisplay->DepthTestOff();
- m_manipulatorManager->DrawManipulators(
- *debugDisplay, GetCameraState(),
- BuildMouseInteractionInternal(
- MouseButtons(TranslateMouseButtons(QGuiApplication::mouseButtons())),
- BuildKeyboardModifiers(QGuiApplication::queryKeyboardModifiers()),
- BuildMousePickInternal(WidgetToViewport(mapFromGlobal(QCursor::pos())))));
- debugDisplay->DepthTestOn();
- }
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::DrawAxis()
-{
- AZ_Assert(m_cameraSetForWidgetRenderingCount > 0,
- "DrawAxis was called but viewport widget rendering was not set. PreWidgetRendering must be called before.");
-
- DisplayContext& dc = m_displayContext;
-
- // show axis only if draw helpers is activated
- if (!dc.settings->IsDisplayHelpers())
- {
- return;
- }
-
- Vec3 colX(1, 0, 0), colY(0, 1, 0), colZ(0, 0, 1), colW(1, 1, 1);
- Vec3 pos(50, 50, 0.1f); // Bottom-left corner
-
- float wx, wy, wz;
- m_renderer->UnProjectFromScreen(pos.x, pos.y, pos.z, &wx, &wy, &wz);
- Vec3 posInWorld(wx, wy, wz);
- float screenScale = GetScreenScaleFactor(posInWorld);
- float length = 0.03f * screenScale;
- float arrowSize = 0.02f * screenScale;
- float textSize = 1.1f;
-
- Vec3 x(length, 0, 0);
- Vec3 y(0, length, 0);
- Vec3 z(0, 0, length);
-
- int prevRState = dc.GetState();
- dc.DepthWriteOff();
- dc.DepthTestOff();
- dc.CullOff();
- dc.SetLineWidth(1);
-
- dc.SetColor(colX);
- dc.DrawLine(posInWorld, posInWorld + x);
- dc.DrawArrow(posInWorld + x * 0.9f, posInWorld + x, arrowSize);
- dc.SetColor(colY);
- dc.DrawLine(posInWorld, posInWorld + y);
- dc.DrawArrow(posInWorld + y * 0.9f, posInWorld + y, arrowSize);
- dc.SetColor(colZ);
- dc.DrawLine(posInWorld, posInWorld + z);
- dc.DrawArrow(posInWorld + z * 0.9f, posInWorld + z, arrowSize);
-
- dc.SetColor(colW);
- dc.DrawTextLabel(posInWorld + x, textSize, "x");
- dc.DrawTextLabel(posInWorld + y, textSize, "y");
- dc.DrawTextLabel(posInWorld + z, textSize, "z");
-
- dc.DepthWriteOn();
- dc.DepthTestOn();
- dc.CullOn();
- dc.SetState(prevRState);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::DrawBackground()
-{
- DisplayContext& dc = m_displayContext;
-
- if (!dc.settings->IsDisplayHelpers()) // show gradient bg only if draw helpers are activated
- {
- return;
- }
-
- int heightVP = m_renderer->GetHeight() - 1;
- int widthVP = m_renderer->GetWidth() - 1;
- Vec3 pos(0, 0, 0);
-
- Vec3 x(widthVP, 0, 0);
- Vec3 y(0, heightVP, 0);
-
- float height = m_rcClient.height();
-
- Vec3 src = NegY(pos, height);
- Vec3 trgx = NegY(pos + x, height);
- Vec3 trgy = NegY(pos + y, height);
-
- QColor topColor = palette().color(QPalette::Window);
- QColor bottomColor = palette().color(QPalette::Disabled, QPalette::WindowText);
-
- ColorB firstC(topColor.red(), topColor.green(), topColor.blue(), 255.0f);
- ColorB secondC(bottomColor.red(), bottomColor.green(), bottomColor.blue(), 255.0f);
-
- TransformationMatrices backupSceneMatrices;
-
- m_renderer->Set2DMode(m_rcClient.right(), m_rcClient.bottom(), backupSceneMatrices);
- m_displayContext.SetState(e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeBack | e_DepthWriteOn | e_DepthTestOn);
- dc.DrawQuadGradient(src, trgx, pos + x, pos, secondC, firstC);
- m_renderer->Unset2DMode(backupSceneMatrices);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderCursorString()
-{
- if (m_cursorStr.isEmpty())
- {
- return;
- }
-
- const auto point = WidgetToViewport(mapFromGlobal(QCursor::pos()));
-
- // Display hit object name.
- float col[4] = { 1, 1, 1, 1 };
- m_renderer->Draw2dLabel(point.x() + 12, point.y() + 4, 1.2f, col, false, "%s", m_cursorStr.toUtf8().data());
-
- if (!m_cursorSupplementaryStr.isEmpty())
- {
- float col2[4] = { 1, 1, 0, 1 };
- m_renderer->Draw2dLabel(point.x() + 12, point.y() + 4 + CURSOR_FONT_HEIGHT * 1.2f, 1.2f, col2, false, "%s", m_cursorSupplementaryStr.toUtf8().data());
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::UpdateSafeFrame()
-{
- m_safeFrame = m_rcClient;
-
- if (m_safeFrame.height() == 0)
- {
- return;
- }
-
- const bool allowSafeFrameBiggerThanViewport = false;
-
- float safeFrameAspectRatio = float( m_safeFrame.width()) / m_safeFrame.height();
- float targetAspectRatio = GetAspectRatio();
- bool viewportIsWiderThanSafeFrame = (targetAspectRatio <= safeFrameAspectRatio);
- if (viewportIsWiderThanSafeFrame || allowSafeFrameBiggerThanViewport)
- {
- float maxSafeFrameWidth = m_safeFrame.height() * targetAspectRatio;
- float widthDifference = m_safeFrame.width() - maxSafeFrameWidth;
-
- m_safeFrame.setLeft(m_safeFrame.left() + widthDifference * 0.5);
- m_safeFrame.setRight(m_safeFrame.right() - widthDifference * 0.5);
- }
- else
- {
- float maxSafeFrameHeight = m_safeFrame.width() / targetAspectRatio;
- float heightDifference = m_safeFrame.height() - maxSafeFrameHeight;
-
- m_safeFrame.setTop(m_safeFrame.top() + heightDifference * 0.5);
- m_safeFrame.setBottom(m_safeFrame.bottom() - heightDifference * 0.5);
- }
-
- m_safeFrame.adjust(0, 0, -1, -1); // <-- aesthetic improvement.
-
- const float SAFE_ACTION_SCALE_FACTOR = 0.05f;
- m_safeAction = m_safeFrame;
- m_safeAction.adjust(m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR, m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR,
- -m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR, -m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR);
-
- const float SAFE_TITLE_SCALE_FACTOR = 0.1f;
- m_safeTitle = m_safeFrame;
- m_safeTitle.adjust(m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR, m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR,
- -m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR, -m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderSafeFrame()
-{
- RenderSafeFrame(m_safeFrame, 0.75f, 0.75f, 0, 0.8f);
- RenderSafeFrame(m_safeAction, 0, 0.85f, 0.80f, 0.8f);
- RenderSafeFrame(m_safeTitle, 0.80f, 0.60f, 0, 0.8f);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderSafeFrame(const QRect& frame, float r, float g, float b, float a)
-{
- m_displayContext.SetColor(r, g, b, a);
-
- const int LINE_WIDTH = 2;
- for (int i = 0; i < LINE_WIDTH; i++)
- {
- Vec3 topLeft(frame.left() + i, frame.top() + i, 0);
- Vec3 bottomRight(frame.right() - i, frame.bottom() - i, 0);
- m_displayContext.DrawWireBox(topLeft, bottomRight);
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-float CRenderViewport::GetAspectRatio() const
-{
- return gSettings.viewports.fDefaultAspectRatio;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderSnapMarker()
-{
- if (!gSettings.snap.markerDisplay)
- {
- return;
- }
-
- QPoint point = QCursor::pos();
- ScreenToClient(point);
- Vec3 p = MapViewToCP(point);
-
- DisplayContext& dc = m_displayContext;
-
- float fScreenScaleFactor = GetScreenScaleFactor(p);
-
- Vec3 x(1, 0, 0);
- Vec3 y(0, 1, 0);
- Vec3 z(0, 0, 1);
- x = x * gSettings.snap.markerSize * fScreenScaleFactor * 0.1f;
- y = y * gSettings.snap.markerSize * fScreenScaleFactor * 0.1f;
- z = z * gSettings.snap.markerSize * fScreenScaleFactor * 0.1f;
-
- dc.SetColor(gSettings.snap.markerColor);
- dc.DrawLine(p - x, p + x);
- dc.DrawLine(p - y, p + y);
- dc.DrawLine(p - z, p + z);
-
- point = WorldToView(p);
-
- int s = 8;
- dc.DrawLine2d(point + QPoint(-s, -s), point + QPoint(s, -s), 0);
- dc.DrawLine2d(point + QPoint(-s, s), point + QPoint(s, s), 0);
- dc.DrawLine2d(point + QPoint(-s, -s), point + QPoint(-s, s), 0);
- dc.DrawLine2d(point + QPoint(s, -s), point + QPoint(s, s), 0);
-}
-
-//////////////////////////////////////////////////////////////////////////
-static void OnMenuDisplayWireframe()
-{
- ICVar* piVar(gEnv->pConsole->GetCVar("r_wireframe"));
- int nRenderMode = piVar->GetIVal();
- if (nRenderMode != R_WIREFRAME_MODE)
- {
- piVar->Set(R_WIREFRAME_MODE);
- }
- else
- {
- piVar->Set(R_SOLID_MODE);
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-static void OnMenuTargetAspectRatio(float aspect)
-{
- gSettings.viewports.fDefaultAspectRatio = aspect;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnMenuResolutionCustom()
-{
- CCustomResolutionDlg resDlg(width(), height(), parentWidget());
- if (resDlg.exec() == QDialog::Accepted)
- {
- ResizeView(resDlg.GetWidth(), resDlg.GetHeight());
-
- const QString text = QString::fromLatin1("%1 x %2").arg(resDlg.GetWidth()).arg(resDlg.GetHeight());
-
- QStringList customResPresets;
- CViewportTitleDlg::LoadCustomPresets("ResPresets", "ResPresetFor2ndView", customResPresets);
- CViewportTitleDlg::UpdateCustomPresets(text, customResPresets);
- CViewportTitleDlg::SaveCustomPresets("ResPresets", "ResPresetFor2ndView", customResPresets);
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnMenuCreateCameraEntityFromCurrentView()
-{
- Camera::EditorCameraSystemRequestBus::Broadcast(&Camera::EditorCameraSystemRequests::CreateCameraEntityFromViewport);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnMenuSelectCurrentCamera()
-{
- CBaseObject* pCameraObject = GetCameraObject();
-
- if (pCameraObject && !pCameraObject->IsSelected())
- {
- GetIEditor()->BeginUndo();
- IObjectManager* pObjectManager = GetIEditor()->GetObjectManager();
- pObjectManager->ClearSelection();
- pObjectManager->SelectObject(pCameraObject);
- GetIEditor()->AcceptUndo("Select Current Camera");
- }
-}
-
-static AzFramework::CameraState CameraStateFromCCamera(
- const CCamera& camera, const float fov, const float width, const float height)
-{
- FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
- AzFramework::CameraState state;
- state.m_forward = LYVec3ToAZVec3(camera.GetViewdir());
- state.m_up = LYVec3ToAZVec3(camera.GetUp());
- state.m_side = state.m_forward.Cross(state.m_up);
- state.m_position = LYVec3ToAZVec3(camera.GetPosition());
- state.m_fovOrZoom = fov;
- state.m_nearClip = camera.GetNearPlane();
- state.m_farClip = camera.GetFarPlane();
- state.m_orthographic = false;
- state.m_viewportSize = AZ::Vector2(width, height);
-
- return state;
-}
-
-AzFramework::CameraState CRenderViewport::GetCameraState()
-{
- return CameraStateFromCCamera(GetCamera(), GetFOV(), m_rcClient.width(), m_rcClient.height());
-}
-
-bool CRenderViewport::GridSnappingEnabled()
-{
- return false;
-}
-
-float CRenderViewport::GridSize()
-{
- return 0.0f;
-}
-
-bool CRenderViewport::ShowGrid()
-{
- return false;
-}
-
-bool CRenderViewport::AngleSnappingEnabled()
-{
- return false;
-}
-
-float CRenderViewport::AngleStep()
-{
- return 0.0f;
-}
-
-AZ::Vector3 CRenderViewport::PickTerrain(const AzFramework::ScreenPoint& point)
-{
- FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
- return LYVec3ToAZVec3(ViewToWorld(AzToolsFramework::ViewportInteraction::QPointFromScreenPoint(point), nullptr, true));
-}
-
-AZ::EntityId CRenderViewport::PickEntity(const AzFramework::ScreenPoint& point)
-{
- FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
- PreWidgetRendering();
-
- AZ::EntityId entityId;
- HitContext hitInfo;
- hitInfo.view = this;
- if (HitTest(AzToolsFramework::ViewportInteraction::QPointFromScreenPoint(point), hitInfo))
- {
- if (hitInfo.object && (hitInfo.object->GetType() == OBJTYPE_AZENTITY))
- {
- auto entityObject = static_cast(hitInfo.object);
- entityId = entityObject->GetAssociatedEntityId();
- }
- }
-
- PostWidgetRendering();
-
- return entityId;
-}
-
-float CRenderViewport::TerrainHeight(const AZ::Vector2& position)
-{
- return GetIEditor()->GetTerrainElevation(position.GetX(), position.GetY());
-}
-
-void CRenderViewport::FindVisibleEntities(AZStd::vector& visibleEntitiesOut)
-{
- FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
- if (ed_visibility_use)
- {
- visibleEntitiesOut.assign(m_entityVisibilityQuery.Begin(), m_entityVisibilityQuery.End());
- }
- else
- {
- if (m_displayContext.GetView() == nullptr)
- {
- return;
- }
-
- const AZStd::vector& entityIdCache =
- m_displayContext.GetView()->GetVisibleObjectsCache()->GetEntityIdCache();
-
- visibleEntitiesOut.assign(entityIdCache.begin(), entityIdCache.end());
- }
-}
-
-AzFramework::ScreenPoint CRenderViewport::ViewportWorldToScreen(const AZ::Vector3& worldPosition)
-{
- FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
- PreWidgetRendering();
- const AzFramework::ScreenPoint screenPosition =
- AzToolsFramework::ViewportInteraction::ScreenPointFromQPoint(WorldToView(AZVec3ToLYVec3(worldPosition)));
- PostWidgetRendering();
-
- return screenPosition;
-}
-
-bool CRenderViewport::IsViewportInputFrozen()
-{
- return m_freezeViewportInput;
-}
-
-void CRenderViewport::FreezeViewportInput(bool freeze)
-{
- m_freezeViewportInput = freeze;
-}
-
-QWidget* CRenderViewport::GetWidgetForViewportContextMenu()
-{
- return this;
-}
-
-void CRenderViewport::BeginWidgetContext()
-{
- PreWidgetRendering();
-}
-
-void CRenderViewport::EndWidgetContext()
-{
- PostWidgetRendering();
-}
-
-bool CRenderViewport::ShowingWorldSpace()
-{
- using namespace AzToolsFramework::ViewportInteraction;
- return BuildKeyboardModifiers(QGuiApplication::queryKeyboardModifiers()).Shift();
-}
-
-void CRenderViewport::SetWindowTitle(const AZStd::string& title)
-{
- // Do not support the WindowRequestBus changing the editor window title
- AZ_UNUSED(title);
-}
-
-AzFramework::WindowSize CRenderViewport::GetClientAreaSize() const
-{
- return AzFramework::WindowSize(m_rcClient.width(), m_rcClient.height());
-}
-
-
-void CRenderViewport::ResizeClientArea(AzFramework::WindowSize clientAreaSize)
-{
- QWidget* window = this->window();
- window->resize(aznumeric_cast(clientAreaSize.m_width), aznumeric_cast(clientAreaSize.m_height));
-}
-
-bool CRenderViewport::GetFullScreenState() const
-{
- // CRenderViewport does not currently support full screen.
- return false;
-}
-
-void CRenderViewport::SetFullScreenState([[maybe_unused]]bool fullScreenState)
-{
- // CRenderViewport does not currently support full screen.
-}
-
-bool CRenderViewport::CanToggleFullScreenState() const
-{
- // CRenderViewport does not currently support full screen.
- return false;
-}
-
-void CRenderViewport::ToggleFullScreenState()
-{
- // CRenderViewport does not currently support full screen.
-}
-
-void CRenderViewport::ConnectViewportInteractionRequestBus()
-{
- AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler::BusConnect(GetViewportId());
- AzToolsFramework::ViewportInteraction::ViewportInteractionRequestBus::Handler::BusConnect(GetViewportId());
- AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler::BusConnect(GetViewportId());
- m_viewportUi.ConnectViewportUiBus(GetViewportId());
-
- AzFramework::InputSystemCursorConstraintRequestBus::Handler::BusConnect();
-}
-
-void CRenderViewport::DisconnectViewportInteractionRequestBus()
-{
- AzFramework::InputSystemCursorConstraintRequestBus::Handler::BusDisconnect();
-
- m_viewportUi.DisconnectViewportUiBus();
- AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler::BusDisconnect();
- AzToolsFramework::ViewportInteraction::ViewportInteractionRequestBus::Handler::BusDisconnect();
- AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler::BusDisconnect();
-}
-
-//////////////////////////////////////////////////////////////////////////
-static void ToggleBool(bool* variable, bool* disableVariableIfOn)
-{
- *variable = !*variable;
- if (*variable && disableVariableIfOn)
- {
- *disableVariableIfOn = false;
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-static void ToggleInt(int* variable)
-{
- *variable = !*variable;
-}
-
-//////////////////////////////////////////////////////////////////////////
-static void AddCheckbox(QMenu* menu, const QString& text, bool* variable, bool* disableVariableIfOn = nullptr)
-{
- QAction* action = menu->addAction(text);
- QObject::connect(action, &QAction::triggered, action, [variable, disableVariableIfOn] { ToggleBool(variable, disableVariableIfOn);
- });
- action->setCheckable(true);
- action->setChecked(*variable);
-}
-
-//////////////////////////////////////////////////////////////////////////
-static void AddCheckbox(QMenu* menu, const QString& text, int* variable)
-{
- QAction* action = menu->addAction(text);
- QObject::connect(action, &QAction::triggered, action, [variable] { ToggleInt(variable);
- });
- action->setCheckable(true);
- action->setChecked(*variable);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnTitleMenu(QMenu* menu)
-{
- const int nWireframe = gEnv->pConsole->GetCVar("r_wireframe")->GetIVal();
- QAction* action = menu->addAction(tr("Wireframe"));
- connect(action, &QAction::triggered, action, OnMenuDisplayWireframe);
- action->setCheckable(true);
- action->setChecked(nWireframe == R_WIREFRAME_MODE);
-
- const bool bDisplayLabels = GetIEditor()->GetDisplaySettings()->IsDisplayLabels();
- action = menu->addAction(tr("Labels"));
- connect(action, &QAction::triggered, this, [bDisplayLabels] {GetIEditor()->GetDisplaySettings()->DisplayLabels(!bDisplayLabels);
- });
- action->setCheckable(true);
- action->setChecked(bDisplayLabels);
-
- AddCheckbox(menu, tr("Show Safe Frame"), &gSettings.viewports.bShowSafeFrame);
- AddCheckbox(menu, tr("Show Construction Plane"), &gSettings.snap.constructPlaneDisplay);
- AddCheckbox(menu, tr("Show Trigger Bounds"), &gSettings.viewports.bShowTriggerBounds);
- AddCheckbox(menu, tr("Show Icons"), &gSettings.viewports.bShowIcons, &gSettings.viewports.bShowSizeBasedIcons);
- AddCheckbox(menu, tr("Show Size-based Icons"), &gSettings.viewports.bShowSizeBasedIcons, &gSettings.viewports.bShowIcons);
- AddCheckbox(menu, tr("Show Helpers of Frozen Objects"), &gSettings.viewports.nShowFrozenHelpers);
-
- if (!m_predefinedAspectRatios.IsEmpty())
- {
- QMenu* aspectRatiosMenu = menu->addMenu(tr("Target Aspect Ratio"));
-
- for (size_t i = 0; i < m_predefinedAspectRatios.GetCount(); ++i)
- {
- const QString& aspectRatioString = m_predefinedAspectRatios.GetName(i);
- QAction* aspectRatioAction = aspectRatiosMenu->addAction(aspectRatioString);
- connect(aspectRatioAction, &QAction::triggered, this, [i, this] { OnMenuTargetAspectRatio(m_predefinedAspectRatios.GetValue(i));
- });
- aspectRatioAction->setCheckable(true);
- aspectRatioAction->setChecked(m_predefinedAspectRatios.IsCurrent(i));
- }
- }
-
- // Set ourself as the active viewport so the following actions create a camera from this view
- GetIEditor()->GetViewManager()->SelectViewport(this);
-
- CGameEngine* gameEngine = GetIEditor()->GetGameEngine();
-
- if (Camera::EditorCameraSystemRequestBus::HasHandlers())
- {
- action = menu->addAction(tr("Create camera entity from current view"));
- connect(action, &QAction::triggered, this, &CRenderViewport::OnMenuCreateCameraEntityFromCurrentView);
-
- if (!gameEngine || !gameEngine->IsLevelLoaded())
- {
- action->setEnabled(false);
- action->setToolTip(tr(TextCantCreateCameraNoLevel));
- menu->setToolTipsVisible(true);
- }
- }
-
- if (!gameEngine || !gameEngine->IsLevelLoaded())
- {
- action->setEnabled(false);
- action->setToolTip(tr(TextCantCreateCameraNoLevel));
- menu->setToolTipsVisible(true);
- }
-
- if (GetCameraObject())
- {
- action = menu->addAction(tr("Select Current Camera"));
- connect(action, &QAction::triggered, this, &CRenderViewport::OnMenuSelectCurrentCamera);
- }
-
- // Add Cameras.
- bool bHasCameras = AddCameraMenuItems(menu);
- CRenderViewport* pFloatingViewport = nullptr;
-
- if (GetIEditor()->GetViewManager()->GetViewCount() > 1)
- {
- for (int i = 0; i < GetIEditor()->GetViewManager()->GetViewCount(); ++i)
- {
- CViewport* vp = GetIEditor()->GetViewManager()->GetView(i);
- if (!vp)
- {
- continue;
- }
-
- if (viewport_cast(vp) == nullptr)
- {
- continue;
- }
-
- if (vp->GetViewportId() == MAX_NUM_VIEWPORTS - 1)
- {
- menu->addSeparator();
-
- QMenu* floatViewMenu = menu->addMenu(tr("Floating View"));
-
- pFloatingViewport = (CRenderViewport*)vp;
- pFloatingViewport->AddCameraMenuItems(floatViewMenu);
-
- if (bHasCameras)
- {
- floatViewMenu->addSeparator();
- }
-
- QMenu* resolutionMenu = floatViewMenu->addMenu(tr("Resolution"));
-
- QStringList customResPresets;
- CViewportTitleDlg::LoadCustomPresets("ResPresets", "ResPresetFor2ndView", customResPresets);
- CViewportTitleDlg::AddResolutionMenus(resolutionMenu, [this](int width, int height) { ResizeView(width, height); }, customResPresets);
- if (!resolutionMenu->actions().isEmpty())
- {
- resolutionMenu->addSeparator();
- }
- QAction* customResolutionAction = resolutionMenu->addAction(tr("Custom..."));
- connect(customResolutionAction, &QAction::triggered, this, &CRenderViewport::OnMenuResolutionCustom);
- break;
- }
- }
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::AddCameraMenuItems(QMenu* menu)
-{
- if (!menu->isEmpty())
- {
- menu->addSeparator();
- }
-
- AddCheckbox(menu, "Lock Camera Movement", &m_bLockCameraMovement);
- menu->addSeparator();
-
- // Camera Sub menu
- QMenu* customCameraMenu = menu->addMenu(tr("Camera"));
-
- QAction* action = customCameraMenu->addAction("Editor Camera");
- action->setCheckable(true);
- action->setChecked(m_viewSourceType == ViewSourceType::None);
- connect(action, &QAction::triggered, this, &CRenderViewport::SetDefaultCamera);
-
- AZ::EBusAggregateResults getCameraResults;
- Camera::CameraBus::BroadcastResult(getCameraResults, &Camera::CameraRequests::GetCameras);
-
- const int numCameras = getCameraResults.values.size();
-
- // only enable if we're editing a sequence in Track View and have cameras in the level
- bool enableSequenceCameraMenu = (GetIEditor()->GetAnimation()->GetSequence() && numCameras);
-
- action = customCameraMenu->addAction(tr("Sequence Camera"));
- action->setCheckable(true);
- action->setChecked(m_viewSourceType == ViewSourceType::SequenceCamera);
- action->setEnabled(enableSequenceCameraMenu);
- connect(action, &QAction::triggered, this, &CRenderViewport::SetSequenceCamera);
-
- QVector additionalCameras;
- additionalCameras.reserve(getCameraResults.values.size());
-
- for (const AZ::EntityId& entityId : getCameraResults.values)
- {
- AZStd::string entityName;
- AZ::ComponentApplicationBus::BroadcastResult(entityName, &AZ::ComponentApplicationRequests::GetEntityName, entityId);
- action = new QAction(QString(entityName.c_str()), nullptr);
- additionalCameras.append(action);
- action->setCheckable(true);
- action->setChecked(m_viewEntityId == entityId && m_viewSourceType == ViewSourceType::CameraComponent);
- connect(action, &QAction::triggered, this, [this, entityId](bool isChecked)
- {
- if (isChecked)
- {
- SetComponentCamera(entityId);
- }
- else
- {
- SetDefaultCamera();
- }
- });
- }
-
- std::sort(additionalCameras.begin(), additionalCameras.end(), [] (QAction* a1, QAction* a2) {
- return QString::compare(a1->text(), a2->text(), Qt::CaseInsensitive) < 0;
- });
-
- for (QAction* cameraAction : additionalCameras)
- {
- customCameraMenu->addAction(cameraAction);
- }
-
- action = customCameraMenu->addAction(tr("Look through entity"));
- AzToolsFramework::EntityIdList selectedEntityList;
- AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
- action->setCheckable(selectedEntityList.size() > 0 || m_viewSourceType == ViewSourceType::AZ_Entity);
- action->setEnabled(selectedEntityList.size() > 0 || m_viewSourceType == ViewSourceType::AZ_Entity);
- action->setChecked(m_viewSourceType == ViewSourceType::AZ_Entity);
- connect(action, &QAction::triggered, this, [this](bool isChecked)
- {
- if (isChecked)
- {
- AzToolsFramework::EntityIdList selectedEntityList;
- AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
- if (selectedEntityList.size())
- {
- SetEntityAsCamera(*selectedEntityList.begin());
- }
- }
- else
- {
- SetDefaultCamera();
- }
- });
- return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ResizeView(int width, int height)
-{
- const QRect rView = rect().translated(mapToGlobal(QPoint()));
- int deltaWidth = width - rView.width();
- int deltaHeight = height - rView.height();
-
- if (window()->isFullScreen())
- {
- setGeometry(rView.left(), rView.top(), rView.width() + deltaWidth, rView.height() + deltaHeight);
- }
- else
- {
- QWidget* window = this->window();
- if (window->isMaximized())
- {
- window->showNormal();
- }
-
- const QSize deltaSize = QSize(width, height) - size();
- window->move(0, 0);
- window->resize(window->size() + deltaSize);
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ToggleCameraObject()
-{
- if (m_viewSourceType == ViewSourceType::SequenceCamera)
- {
- ResetToViewSourceType(ViewSourceType::LegacyCamera);
- }
- else
- {
- ResetToViewSourceType(ViewSourceType::SequenceCamera);
- }
- PostCameraSet();
- GetIEditor()->GetAnimation()->ForceAnimation();
-}
-
-void CRenderViewport::OnMouseWheel(Qt::KeyboardModifiers modifiers, short zDelta, const QPoint& point)
-{
- using namespace AzToolsFramework::ViewportInteraction;
- using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
-
- if (GetIEditor()->IsInGameMode() || m_freezeViewportInput)
- {
- return;
- }
-
- const auto scaledPoint = WidgetToViewport(point);
- const auto mouseInteraction = BuildMouseInteractionInternal(
- MouseButtonsFromButton(MouseButton::None),
- BuildKeyboardModifiers(modifiers),
- BuildMousePick(scaledPoint));
-
- bool handled = false;
- MouseInteractionResult result = MouseInteractionResult::None;
- AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::EventResult(
- result, AzToolsFramework::GetEntityContextId(),
- &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
- MouseInteractionEvent(mouseInteraction, zDelta));
-
- handled = result != MouseInteractionResult::None;
-
- if (!handled)
- {
- Matrix34 m = GetViewTM();
- const Vec3 ydir = m.GetColumn1().GetNormalized();
-
- Vec3 pos = m.GetTranslation();
-
- const float posDelta = 0.01f * zDelta * gSettings.wheelZoomSpeed;
- pos += ydir * posDelta;
- m_orbitDistance = m_orbitDistance - posDelta;
- m_orbitDistance = fabs(m_orbitDistance);
-
- m.SetTranslation(pos);
- SetViewTM(m, true);
-
- QtViewport::OnMouseWheel(modifiers, zDelta, scaledPoint);
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::SetCamera(const CCamera& camera)
-{
- m_Camera = camera;
- SetViewTM(m_Camera.GetMatrix());
-}
-
-//////////////////////////////////////////////////////////////////////////
-float CRenderViewport::GetCameraMoveSpeed() const
-{
- return gSettings.cameraMoveSpeed;
-}
-
-//////////////////////////////////////////////////////////////////////////
-float CRenderViewport::GetCameraRotateSpeed() const
-{
- return gSettings.cameraRotateSpeed;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::GetCameraInvertYRotation() const
-{
- return gSettings.invertYRotation;
-}
-
-//////////////////////////////////////////////////////////////////////////
-float CRenderViewport::GetCameraInvertPan() const
-{
- return gSettings.invertPan;
-}
-
-//////////////////////////////////////////////////////////////////////////
-CRenderViewport* CRenderViewport::GetPrimaryViewport()
-{
- return m_pPrimaryViewport;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::focusOutEvent([[maybe_unused]] QFocusEvent* event)
-{
- // if we lose focus, the keyboard map needs to be cleared immediately
- if (!m_keyDown.isEmpty())
- {
- m_keyDown.clear();
-
- releaseKeyboard();
- }
-}
-
-void CRenderViewport::keyPressEvent(QKeyEvent* event)
-{
- // Special case Escape key and bubble way up to the top level parent so that it can cancel us out of any active tool
- // or clear the current selection
- if (event->key() == Qt::Key_Escape)
- {
- QCoreApplication::sendEvent(GetIEditor()->GetEditorMainWindow(), event);
- }
-
- // NOTE: we keep track of keypresses and releases explicitly because the OS/Qt will insert a slight delay between sending
- // keyevents when the key is held down. This is standard, but makes responding to key events for game style input silly
- // because we want the movement to be butter smooth.
- if (!event->isAutoRepeat())
- {
- if (m_keyDown.isEmpty())
- {
- grabKeyboard();
- }
-
- m_keyDown.insert(event->key());
- }
-
- QtViewport::keyPressEvent(event);
-
-#if defined(AZ_PLATFORM_WINDOWS)
- // In game mode on windows we need to forward raw text events to the input system.
- if (GetIEditor()->IsInGameMode() && GetType() == ET_ViewportCamera)
- {
- // Get the QString as a '\0'-terminated array of unsigned shorts.
- // The result remains valid until the string is modified.
- const ushort* codeUnitsUTF16 = event->text().utf16();
- while (ushort codeUnitUTF16 = *codeUnitsUTF16)
- {
- AzFramework::RawInputNotificationBusWindows::Broadcast(&AzFramework::RawInputNotificationsWindows::OnRawInputCodeUnitUTF16Event, codeUnitUTF16);
- ++codeUnitsUTF16;
- }
- }
-#endif // defined(AZ_PLATFORM_WINDOWS)
-}
-
-void CRenderViewport::ProcessKeyRelease(QKeyEvent* event)
-{
- if (!event->isAutoRepeat())
- {
- if (m_keyDown.contains(event->key()))
- {
- m_keyDown.remove(event->key());
-
- if (m_keyDown.isEmpty())
- {
- releaseKeyboard();
- }
- }
- }
-}
-
-void CRenderViewport::keyReleaseEvent(QKeyEvent* event)
-{
- ProcessKeyRelease(event);
-
- QtViewport::keyReleaseEvent(event);
-}
-
-void CRenderViewport::SetViewTM(const Matrix34& viewTM, bool bMoveOnly)
-{
- Matrix34 camMatrix = viewTM;
-
- // If no collision flag set do not check for terrain elevation.
- if (GetType() == ET_ViewportCamera)
- {
- if ((GetIEditor()->GetDisplaySettings()->GetSettings() & SETTINGS_NOCOLLISION) == 0)
- {
- Vec3 p = camMatrix.GetTranslation();
- bool adjustCameraElevation = true;
- auto terrain = AzFramework::Terrain::TerrainDataRequestBus::FindFirstHandler();
- if (terrain)
- {
- AZ::Aabb terrainAabb(terrain->GetTerrainAabb());
-
- // Adjust the AABB to include all Z values. Since the goal here is to snap the camera to the terrain height if
- // it's below the terrain, we only want to verify the camera is within the XY bounds of the terrain to adjust the elevation.
- terrainAabb.SetMin(AZ::Vector3(terrainAabb.GetMin().GetX(), terrainAabb.GetMin().GetY(), -AZ::Constants::FloatMax));
- terrainAabb.SetMax(AZ::Vector3(terrainAabb.GetMax().GetX(), terrainAabb.GetMax().GetY(), AZ::Constants::FloatMax));
-
- if (!terrainAabb.Contains(LYVec3ToAZVec3(p)))
- {
- adjustCameraElevation = false;
- }
- else if (terrain->GetIsHoleFromFloats(p.x, p.y))
- {
- adjustCameraElevation = false;
- }
- }
-
- if (adjustCameraElevation)
- {
- float z = GetIEditor()->GetTerrainElevation(p.x, p.y);
- if (p.z < z + 0.25)
- {
- p.z = z + 0.25;
- camMatrix.SetTranslation(p);
- }
- }
- }
-
- // Also force this position on game.
- if (GetIEditor()->GetGameEngine())
- {
- GetIEditor()->GetGameEngine()->SetPlayerViewMatrix(viewTM);
- }
- }
-
- CBaseObject* cameraObject = GetCameraObject();
- if (cameraObject)
- {
- // Ignore camera movement if locked.
- if (IsCameraMovementLocked() || (!GetIEditor()->GetAnimation()->IsRecordMode() && !IsCameraObjectMove()))
- {
- return;
- }
-
- AZ::Matrix3x3 lookThroughEntityCorrection = AZ::Matrix3x3::CreateIdentity();
- if (m_viewEntityId.IsValid())
- {
- LmbrCentral::EditorCameraCorrectionRequestBus::EventResult(
- lookThroughEntityCorrection, m_viewEntityId,
- &LmbrCentral::EditorCameraCorrectionRequests::GetInverseTransformCorrection);
- }
-
- if (m_pressedKeyState != KeyPressedState::PressedInPreviousFrame)
- {
- CUndo undo("Move Camera");
- if (bMoveOnly)
- {
- // specify eObjectUpdateFlags_UserInput so that an undo command gets logged
- cameraObject->SetWorldPos(camMatrix.GetTranslation(), eObjectUpdateFlags_UserInput);
- }
- else
- {
- // specify eObjectUpdateFlags_UserInput so that an undo command gets logged
- cameraObject->SetWorldTM(camMatrix * AZMatrix3x3ToLYMatrix3x3(lookThroughEntityCorrection), eObjectUpdateFlags_UserInput);
- }
- }
- else
- {
- if (bMoveOnly)
- {
- // Do not specify eObjectUpdateFlags_UserInput, so that an undo command does not get logged; we covered it already when m_pressedKeyState was PressedThisFrame
- cameraObject->SetWorldPos(camMatrix.GetTranslation());
- }
- else
- {
- // Do not specify eObjectUpdateFlags_UserInput, so that an undo command does not get logged; we covered it already when m_pressedKeyState was PressedThisFrame
- cameraObject->SetWorldTM(camMatrix * AZMatrix3x3ToLYMatrix3x3(lookThroughEntityCorrection));
- }
- }
-
- using namespace AzToolsFramework;
- ComponentEntityObjectRequestBus::Event(cameraObject, &ComponentEntityObjectRequestBus::Events::UpdatePreemptiveUndoCache);
- }
- else if (m_viewEntityId.IsValid())
- {
- // Ignore camera movement if locked.
- if (IsCameraMovementLocked() || (!GetIEditor()->GetAnimation()->IsRecordMode() && !IsCameraObjectMove()))
- {
- return;
- }
-
- if (m_pressedKeyState != KeyPressedState::PressedInPreviousFrame)
- {
- CUndo undo("Move Camera");
- if (bMoveOnly)
- {
- AZ::TransformBus::Event(
- m_viewEntityId, &AZ::TransformInterface::SetWorldTranslation,
- LYVec3ToAZVec3(camMatrix.GetTranslation()));
- }
- else
- {
- AZ::TransformBus::Event(
- m_viewEntityId, &AZ::TransformInterface::SetWorldTM,
- LYTransformToAZTransform(camMatrix));
- }
- }
- else
- {
- if (bMoveOnly)
- {
- AZ::TransformBus::Event(
- m_viewEntityId, &AZ::TransformInterface::SetWorldTranslation,
- LYVec3ToAZVec3(camMatrix.GetTranslation()));
- }
- else
- {
- AZ::TransformBus::Event(
- m_viewEntityId, &AZ::TransformInterface::SetWorldTM,
- LYTransformToAZTransform(camMatrix));
- }
- }
-
- AzToolsFramework::PropertyEditorGUIMessages::Bus::Broadcast(
- &AzToolsFramework::PropertyEditorGUIMessages::RequestRefresh,
- AzToolsFramework::PropertyModificationRefreshLevel::Refresh_AttributesAndValues);
- }
-
- if (m_pressedKeyState == KeyPressedState::PressedThisFrame)
- {
- m_pressedKeyState = KeyPressedState::PressedInPreviousFrame;
- }
-
- QtViewport::SetViewTM(camMatrix);
-
- m_Camera.SetMatrix(camMatrix);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderSelectedRegion()
-{
- AABB box;
- GetIEditor()->GetSelectedRegion(box);
- if (box.IsEmpty())
- {
- return;
- }
-
- float x1 = box.min.x;
- float y1 = box.min.y;
- float x2 = box.max.x;
- float y2 = box.max.y;
-
- DisplayContext& dc = m_displayContext;
-
- float fMaxSide = MAX(y2 - y1, x2 - x1);
- if (fMaxSide < 0.1f)
- {
- return;
- }
- float fStep = fMaxSide / 100.0f;
-
- float fMinZ = 0;
- float fMaxZ = 0;
-
- // Draw yellow border lines.
- dc.SetColor(1, 1, 0, 1);
- float offset = 0.01f;
- Vec3 p1, p2;
-
- const float defaultTerrainHeight = AzFramework::Terrain::TerrainDataRequests::GetDefaultTerrainHeight();
- auto terrain = AzFramework::Terrain::TerrainDataRequestBus::FindFirstHandler();
-
- for (float y = y1; y < y2; y += fStep)
- {
- p1.x = x1;
- p1.y = y;
- p1.z = terrain ? terrain->GetHeightFromFloats(p1.x, p1.y) + offset : defaultTerrainHeight + offset;
-
- p2.x = x1;
- p2.y = y + fStep;
- p2.z = terrain ? terrain->GetHeightFromFloats(p2.x, p2.y) + offset : defaultTerrainHeight + offset;
- dc.DrawLine(p1, p2);
-
- p1.x = x2;
- p1.y = y;
- p1.z = terrain ? terrain->GetHeightFromFloats(p1.x, p1.y) + offset : defaultTerrainHeight + offset;
-
- p2.x = x2;
- p2.y = y + fStep;
- p2.z = terrain ? terrain->GetHeightFromFloats(p2.x, p2.y) + offset : defaultTerrainHeight + offset;
- dc.DrawLine(p1, p2);
-
- fMinZ = min(fMinZ, min(p1.z, p2.z));
- fMaxZ = max(fMaxZ, max(p1.z, p2.z));
- }
- for (float x = x1; x < x2; x += fStep)
- {
- p1.x = x;
- p1.y = y1;
- p1.z = terrain ? terrain->GetHeightFromFloats(p1.x, p1.y) + offset : defaultTerrainHeight + offset;
-
- p2.x = x + fStep;
- p2.y = y1;
- p2.z = terrain ? terrain->GetHeightFromFloats(p2.x, p2.y) + offset : defaultTerrainHeight + offset;
- dc.DrawLine(p1, p2);
-
- p1.x = x;
- p1.y = y2;
- p1.z = terrain ? terrain->GetHeightFromFloats(p1.x, p1.y) + offset : defaultTerrainHeight + offset;
-
- p2.x = x + fStep;
- p2.y = y2;
- p2.z = terrain ? terrain->GetHeightFromFloats(p2.x, p2.y) + offset : defaultTerrainHeight + offset;
- dc.DrawLine(p1, p2);
-
- fMinZ = min(fMinZ, min(p1.z, p2.z));
- fMaxZ = max(fMaxZ, max(p1.z, p2.z));
- }
-
- {
- // Draw a box area
- float fBoxOver = fMaxSide / 5.0f;
- float fBoxHeight = fBoxOver + fMaxZ - fMinZ;
-
- ColorB boxColor(64, 64, 255, 128); // light blue
- ColorB transparent(boxColor.r, boxColor.g, boxColor.b, 0);
-
- Vec3 base[] = {
- Vec3(x1, y1, fMinZ),
- Vec3(x2, y1, fMinZ),
- Vec3(x2, y2, fMinZ),
- Vec3(x1, y2, fMinZ)
- };
-
-
- // Generate vertices
- static AABB boxPrev(AABB::RESET);
- static std::vector verts;
- static std::vector colors;
-
- if (!IsEquivalent(boxPrev, box))
- {
- verts.resize(0);
- colors.resize(0);
- for (int i = 0; i < 4; ++i)
- {
- Vec3& p = base[i];
-
- verts.push_back(p);
- verts.push_back(Vec3(p.x, p.y, p.z + fBoxHeight));
- verts.push_back(Vec3(p.x, p.y, p.z + fBoxHeight + fBoxOver));
-
- colors.push_back(boxColor);
- colors.push_back(boxColor);
- colors.push_back(transparent);
- }
- boxPrev = box;
- }
-
- // Generate indices
- const int numInds = 4 * 12;
- static vtx_idx inds[numInds];
- static bool bNeedIndsInit = true;
- if (bNeedIndsInit)
- {
- vtx_idx* pInds = &inds[0];
-
- for (int i = 0; i < 4; ++i)
- {
- int over = 0;
- if (i == 3)
- {
- over = -12;
- }
-
- int ind = i * 3;
- *pInds++ = ind;
- *pInds++ = ind + 3 + over;
- *pInds++ = ind + 1;
-
- *pInds++ = ind + 1;
- *pInds++ = ind + 3 + over;
- *pInds++ = ind + 4 + over;
-
- ind = i * 3 + 1;
- *pInds++ = ind;
- *pInds++ = ind + 3 + over;
- *pInds++ = ind + 1;
-
- *pInds++ = ind + 1;
- *pInds++ = ind + 3 + over;
- *pInds++ = ind + 4 + over;
- }
- bNeedIndsInit = false;
- }
-
- // Draw lines
- for (int i = 0; i < 4; ++i)
- {
- Vec3& p = base[i];
-
- dc.DrawLine(p, Vec3(p.x, p.y, p.z + fBoxHeight), ColorF(1, 1, 0, 1), ColorF(1, 1, 0, 1));
- dc.DrawLine(Vec3(p.x, p.y, p.z + fBoxHeight), Vec3(p.x, p.y, p.z + fBoxHeight + fBoxOver), ColorF(1, 1, 0, 1), ColorF(1, 1, 0, 0));
- }
-
- // Draw volume
- dc.DepthWriteOff();
- dc.CullOff();
- dc.pRenderAuxGeom->DrawTriangles(&verts[0], verts.size(), &inds[0], numInds, &colors[0]);
- dc.CullOn();
- dc.DepthWriteOn();
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ProcessKeys()
-{
- FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
-
- if (m_PlayerControl || GetIEditor()->IsInGameMode() || !CheckRespondToInput() || m_freezeViewportInput)
- {
- return;
- }
-
- //m_Camera.UpdateFrustum();
- Matrix34 m = GetViewTM();
- Vec3 ydir = m.GetColumn1().GetNormalized();
- Vec3 xdir = m.GetColumn0().GetNormalized();
- Vec3 zdir = m.GetColumn2().GetNormalized();
-
- Vec3 pos = GetViewTM().GetTranslation();
-
- float speedScale = AZStd::GetMin(
- 60.0f * GetIEditor()->GetSystem()->GetITimer()->GetFrameTime(), 20.0f);
-
- speedScale *= GetCameraMoveSpeed();
-
- // Use the global modifier keys instead of our keymap. It's more reliable.
- const bool shiftPressed = QGuiApplication::queryKeyboardModifiers() & Qt::ShiftModifier;
- const bool controlPressed = QGuiApplication::queryKeyboardModifiers() & Qt::ControlModifier;
-
- if (shiftPressed)
- {
- speedScale *= gSettings.cameraFastMoveSpeed;
- }
-
- if (controlPressed)
- {
- return;
- }
-
- bool bIsPressedSome = false;
-
- if (IsKeyDown(Qt::Key_Up) || IsKeyDown(Qt::Key_W))
- {
- // move forward
- bIsPressedSome = true;
- pos = pos + (speedScale * m_moveSpeed * ydir);
- }
-
- if (IsKeyDown(Qt::Key_Down) || IsKeyDown(Qt::Key_S))
- {
- // move backward
- bIsPressedSome = true;
- pos = pos - (speedScale * m_moveSpeed * ydir);
- }
-
- if (IsKeyDown(Qt::Key_Left) || IsKeyDown(Qt::Key_A))
- {
- // move left
- bIsPressedSome = true;
- pos = pos - (speedScale * m_moveSpeed * xdir);
- }
-
- if (IsKeyDown(Qt::Key_Right) || IsKeyDown(Qt::Key_D))
- {
- // move right
- bIsPressedSome = true;
- pos = pos + (speedScale * m_moveSpeed * xdir);
- }
-
- if (IsKeyDown(Qt::Key_E))
- {
- // move Up
- bIsPressedSome = true;
- pos = pos + (speedScale * m_moveSpeed * zdir);
- }
-
- if (IsKeyDown(Qt::Key_Q))
- {
- // move down
- bIsPressedSome = true;
- pos = pos - (speedScale * m_moveSpeed * zdir);
- }
-
- if (bIsPressedSome)
- {
- // Only change the keystate to pressed if it wasn't already marked in
- // a previous frame. Otherwise, the undo/redo stack will be all off
- // from what SetViewTM() does.
- if (m_pressedKeyState == KeyPressedState::AllUp)
- {
- m_pressedKeyState = KeyPressedState::PressedThisFrame;
- }
-
- m.SetTranslation(pos);
- SetViewTM(m, true);
- }
-
- bool mouseModifierKeysDown = ((QGuiApplication::mouseButtons() & (Qt::RightButton | Qt::MiddleButton)) != 0);
-
- if (!bIsPressedSome && !mouseModifierKeysDown)
- {
- m_pressedKeyState = KeyPressedState::AllUp;
- }
-}
-
-Vec3 CRenderViewport::WorldToView3D(const Vec3& wp, [[maybe_unused]] int nFlags) const
-{
- AZ_Assert(m_cameraSetForWidgetRenderingCount > 0,
- "WorldToView3D was called but viewport widget rendering was not set. PreWidgetRendering must be called before.");
-
- Vec3 out(0, 0, 0);
- float x, y, z;
-
- m_renderer->ProjectToScreen(wp.x, wp.y, wp.z, &x, &y, &z);
- if (_finite(x) && _finite(y) && _finite(z))
- {
- out.x = (x / 100) * m_rcClient.width();
- out.y = (y / 100) * m_rcClient.height();
- out.x /= QHighDpiScaling::factor(windowHandle()->screen());
- out.y /= QHighDpiScaling::factor(windowHandle()->screen());
- out.z = z;
- }
- return out;
-}
-
-//////////////////////////////////////////////////////////////////////////
-QPoint CRenderViewport::WorldToView(const Vec3& wp) const
-{
- AZ_Assert(m_cameraSetForWidgetRenderingCount > 0,
- "WorldToView was called but viewport widget rendering was not set. PreWidgetRendering must be called before.");
-
- QPoint p;
- float x, y, z;
-
- m_renderer->ProjectToScreen(wp.x, wp.y, wp.z, &x, &y, &z);
- if (_finite(x) || _finite(y))
- {
- p.rx() = (x / 100) * m_rcClient.width();
- p.ry() = (y / 100) * m_rcClient.height();
- }
- else
- {
- QPoint(0, 0);
- }
-
- return p;
-}
-//////////////////////////////////////////////////////////////////////////
-QPoint CRenderViewport::WorldToViewParticleEditor(const Vec3& wp, int width, int height) const
-{
- QPoint p;
- float x, y, z;
-
- m_renderer->ProjectToScreen(wp.x, wp.y, wp.z, &x, &y, &z);
- if (_finite(x) || _finite(y))
- {
- p.rx() = (x / 100) * width;
- p.ry() = (y / 100) * height;
- }
- else
- {
- QPoint(0, 0);
- }
- return p;
-}
-
-//////////////////////////////////////////////////////////////////////////
-Vec3 CRenderViewport::ViewToWorld(const QPoint& vp, bool* collideWithTerrain, bool onlyTerrain, bool bSkipVegetation, bool bTestRenderMesh, bool* collideWithObject) const
-{
- AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
-
- // Make sure we initialize the value if a pointer has been passed in
- if (collideWithTerrain != nullptr)
- {
- *collideWithTerrain = false;
- }
-
- // Make sure we initialize the value if a pointer has been passed in
- if (collideWithObject != nullptr)
-{
- *collideWithObject = false;
- }
-
- if (!m_renderer)
- {
- return Vec3(0, 0, 0);
- }
-
- QRect rc = m_rcClient;
-
- Vec3 pos0;
- if (!m_Camera.Unproject(Vec3(vp.x(), rc.bottom() - vp.y(), 0), pos0))
- {
- return Vec3(0, 0, 0);
- }
- if (!IsVectorInValidRange(pos0))
- {
- pos0.Set(0, 0, 0);
- }
-
- Vec3 pos1;
- if (!m_Camera.Unproject(Vec3(vp.x(), rc.bottom() - vp.y(), 1), pos1))
- {
- return Vec3(0, 0, 0);
- }
- if (!IsVectorInValidRange(pos1))
- {
- pos1.Set(1, 0, 0);
- }
-
- const float maxDistance = 10000.f;
-
- Vec3 v = (pos1 - pos0);
- v = v.GetNormalized();
- v = v * maxDistance;
-
- if (!_finite(v.x) || !_finite(v.y) || !_finite(v.z))
- {
- return Vec3(0, 0, 0);
- }
-
- Vec3 colp = pos0 + 0.002f * v;
-
- AZ_UNUSED(vp)
- AZ_UNUSED(bTestRenderMesh)
- AZ_UNUSED(bSkipVegetation)
- AZ_UNUSED(bSkipVegetation)
- AZStd::optional> hitDistancePosition;
-
- if (!onlyTerrain && !GetIEditor()->IsTerrainAxisIgnoreObjects())
- {
- AzFramework::EntityContextId editorContextId;
- AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(
- editorContextId, &AzToolsFramework::EditorEntityContextRequests::GetEditorEntityContextId);
-
- AzFramework::RenderGeometry::RayRequest ray;
- ray.m_startWorldPosition = LYVec3ToAZVec3(pos0);
- ray.m_endWorldPosition = LYVec3ToAZVec3(pos0 + v);
- ray.m_onlyVisible = true;
-
- AzFramework::RenderGeometry::RayResult result;
- AzFramework::RenderGeometry::IntersectorBus::EventResult(result, editorContextId,
- &AzFramework::RenderGeometry::IntersectorInterface::RayIntersect, ray);
-
- if (result)
- {
- if (!hitDistancePosition || result.m_distance < hitDistancePosition->first)
- {
- hitDistancePosition = {result.m_distance, result.m_worldPosition};
- if (collideWithObject)
- {
- *collideWithObject = true;
- }
- }
- }
- }
-
- if (hitDistancePosition)
- {
- colp = AZVec3ToLYVec3(hitDistancePosition->second);
- }
-
-
- return colp;
-}
-
-//////////////////////////////////////////////////////////////////////////
-Vec3 CRenderViewport::ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh)
-{
- AZ_UNUSED(vp)
- AZ_UNUSED(bTestRenderMesh)
-
- AZ_Assert(m_cameraSetForWidgetRenderingCount > 0,
- "ViewToWorldNormal was called but viewport widget rendering was not set. PreWidgetRendering must be called before.");
-
- AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
-
- if (!m_renderer)
- {
- return Vec3(0, 0, 1);
- }
-
- QRect rc = m_rcClient;
-
- Vec3 pos0, pos1;
- float wx, wy, wz;
- m_renderer->UnProjectFromScreen(vp.x(), rc.bottom() - vp.y(), 0, &wx, &wy, &wz);
- if (!_finite(wx) || !_finite(wy) || !_finite(wz))
- {
- return Vec3(0, 0, 1);
- }
- pos0(wx, wy, wz);
- if (!IsVectorInValidRange(pos0))
- {
- pos0.Set(0, 0, 0);
- }
-
- m_renderer->UnProjectFromScreen(vp.x(), rc.bottom() - vp.y(), 1, &wx, &wy, &wz);
- if (!_finite(wx) || !_finite(wy) || !_finite(wz))
- {
- return Vec3(0, 0, 1);
- }
- pos1(wx, wy, wz);
-
- Vec3 v = (pos1 - pos0);
- if (!IsVectorInValidRange(pos1))
- {
- pos1.Set(1, 0, 0);
- }
-
- const float maxDistance = 2000.f;
- v = v.GetNormalized();
- v = v * maxDistance;
-
- if (!_finite(v.x) || !_finite(v.y) || !_finite(v.z))
- {
- return Vec3(0, 0, 1);
- }
-
- Vec3 colp(0, 0, 0);
-
-
- AZStd::optional> hitDistanceNormal;
-
- if (!onlyTerrain && !GetIEditor()->IsTerrainAxisIgnoreObjects())
- {
- AzFramework::EntityContextId editorContextId;
- AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(
- editorContextId, &AzToolsFramework::EditorEntityContextRequests::GetEditorEntityContextId);
-
- AzFramework::RenderGeometry::RayRequest ray;
- ray.m_startWorldPosition = LYVec3ToAZVec3(pos0);
- ray.m_endWorldPosition = LYVec3ToAZVec3(pos0 + v);
- ray.m_onlyVisible = true;
-
- AzFramework::RenderGeometry::RayResult result;
- AzFramework::RenderGeometry::IntersectorBus::EventResult(result, editorContextId,
- &AzFramework::RenderGeometry::IntersectorInterface::RayIntersect, ray);
-
- if (result)
- {
- if (!hitDistanceNormal || result.m_distance < hitDistanceNormal->first)
- {
- hitDistanceNormal = { result.m_distance, result.m_worldNormal };
- }
- }
- }
-
- return hitDistanceNormal ? AZVec3ToLYVec3(hitDistanceNormal->second) : Vec3(0, 0, 1);
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::AdjustObjectPosition(const ray_hit& hit, Vec3& outNormal, Vec3& outPos) const
-{
- Matrix34A objMat, objMatInv;
- Matrix33 objRot, objRotInv;
-
- if (hit.pCollider->GetiForeignData() != PHYS_FOREIGN_ID_STATIC)
- {
- return false;
- }
-
- IRenderNode* pNode = (IRenderNode*) hit.pCollider->GetForeignData(PHYS_FOREIGN_ID_STATIC);
- if (!pNode || !pNode->GetEntityStatObj())
- {
- return false;
- }
-
- IStatObj* pEntObject = pNode->GetEntityStatObj(hit.partid, 0, &objMat, false);
- if (!pEntObject || !pEntObject->GetRenderMesh())
- {
- return false;
- }
-
- objRot = Matrix33(objMat);
- objRot.NoScale(); // No scale.
- objRotInv = objRot;
- objRotInv.Invert();
-
- float fWorldScale = objMat.GetColumn(0).GetLength(); // GetScale
- float fWorldScaleInv = 1.0f / fWorldScale;
-
- // transform decal into object space
- objMatInv = objMat;
- objMatInv.Invert();
-
- // put into normal object space hit direction of projection
- Vec3 invhitn = -(hit.n);
- Vec3 vOS_HitDir = objRotInv.TransformVector(invhitn).GetNormalized();
-
- // put into position object space hit position
- Vec3 vOS_HitPos = objMatInv.TransformPoint(hit.pt);
- vOS_HitPos -= vOS_HitDir * RENDER_MESH_TEST_DISTANCE * fWorldScaleInv;
-
- IRenderMesh* pRM = pEntObject->GetRenderMesh();
-
- AABB aabbRNode;
- pRM->GetBBox(aabbRNode.min, aabbRNode.max);
- Vec3 vOut(0, 0, 0);
- if (!Intersect::Ray_AABB(Ray(vOS_HitPos, vOS_HitDir), aabbRNode, vOut))
- {
- return false;
- }
-
- if (!pRM || !pRM->GetVerticesCount())
- {
- return false;
- }
-
- if (RayRenderMeshIntersection(pRM, vOS_HitPos, vOS_HitDir, outPos, outNormal))
- {
- outNormal = objRot.TransformVector(outNormal).GetNormalized();
- outPos = objMat.TransformPoint(outPos);
- return true;
- }
- return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::RayRenderMeshIntersection(IRenderMesh*, const Vec3&, const Vec3&, Vec3&, Vec3&) const
-{
- return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const
-{
- AZ_Assert(m_cameraSetForWidgetRenderingCount > 0,
- "ViewToWorldRay was called but SScopedCurrentContext was not set at a higher scope! This means the camera for this call is incorrect.");
-
- if (!m_renderer)
- {
- return;
- }
-
- QRect rc = m_rcClient;
-
- Vec3 pos0, pos1;
- float wx, wy, wz;
- m_renderer->UnProjectFromScreen(vp.x(), rc.bottom() - vp.y(), 0, &wx, &wy, &wz);
- if (!_finite(wx) || !_finite(wy) || !_finite(wz))
- {
- return;
- }
- if (fabs(wx) > 1000000 || fabs(wy) > 1000000 || fabs(wz) > 1000000)
- {
- return;
- }
- pos0(wx, wy, wz);
- m_renderer->UnProjectFromScreen(vp.x(), rc.bottom() - vp.y(), 1, &wx, &wy, &wz);
- if (!_finite(wx) || !_finite(wy) || !_finite(wz))
- {
- return;
- }
- if (fabs(wx) > 1000000 || fabs(wy) > 1000000 || fabs(wz) > 1000000)
- {
- return;
- }
- pos1(wx, wy, wz);
-
- Vec3 v = (pos1 - pos0);
- v = v.GetNormalized();
-
- raySrc = pos0;
- rayDir = v;
-}
-
-//////////////////////////////////////////////////////////////////////////
-float CRenderViewport::GetScreenScaleFactor(const Vec3& worldPoint) const
-{
- float dist = m_Camera.GetPosition().GetDistance(worldPoint);
- if (dist < m_Camera.GetNearPlane())
- {
- dist = m_Camera.GetNearPlane();
- }
- return dist;
-}
-//////////////////////////////////////////////////////////////////////////
-float CRenderViewport::GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position)
-{
- Vec3 camPos = camera.GetPosition();
- float dist = camPos.GetDistance(object_position);
- return dist;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnDestroy()
-{
- DestroyRenderContext();
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::CheckRespondToInput() const
-{
- if (!Editor::EditorQtApplication::IsActive())
- {
- return false;
- }
-
- if (!hasFocus())
- {
- return false;
- }
-
- return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::HitTest(const QPoint& point, HitContext& hitInfo)
-{
- hitInfo.camera = &m_Camera;
- hitInfo.pExcludedObject = GetCameraObject();
- return QtViewport::HitTest(point, hitInfo);
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::IsBoundsVisible(const AABB& box) const
-{
- // If at least part of bbox is visible then its visible.
- return m_Camera.IsAABBVisible_F(AABB(box.min, box.max));
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::CenterOnSelection()
-{
- if (!GetIEditor()->GetSelection()->IsEmpty())
- {
- // Get selection bounds & center
- CSelectionGroup* sel = GetIEditor()->GetSelection();
- AABB selectionBounds = sel->GetBounds();
- CenterOnAABB(selectionBounds);
- }
-}
-
-void CRenderViewport::CenterOnAABB(const AABB& aabb)
-{
- Vec3 selectionCenter = aabb.GetCenter();
-
- // Minimum center size is 40cm
- const float minSelectionRadius = 0.4f;
- const float selectionSize = std::max(minSelectionRadius, aabb.GetRadius());
-
- // Move camera 25% further back than required
- const float centerScale = 1.25f;
-
- // Decompose original transform matrix
- const Matrix34& originalTM = GetViewTM();
- AffineParts affineParts;
- affineParts.SpectralDecompose(originalTM);
-
- // Forward vector is y component of rotation matrix
- Matrix33 rotationMatrix(affineParts.rot);
- const Vec3 viewDirection = rotationMatrix.GetColumn1().GetNormalized();
-
- // Compute adjustment required by FOV != 90 degrees
- const float fov = GetFOV();
- const float fovScale = (1.0f / tan(fov * 0.5f));
-
- // Compute new transform matrix
- const float distanceToTarget = selectionSize * fovScale * centerScale;
- const Vec3 newPosition = selectionCenter - (viewDirection * distanceToTarget);
- Matrix34 newTM = Matrix34(rotationMatrix, newPosition);
-
- // Set new orbit distance
- m_orbitDistance = distanceToTarget;
- m_orbitDistance = fabs(m_orbitDistance);
-
- SetViewTM(newTM);
-}
-
-void CRenderViewport::CenterOnSliceInstance()
-{
- AzToolsFramework::EntityIdList selectedEntityList;
- AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
-
- AZ::SliceComponent::SliceInstanceAddress sliceAddress;
- AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(sliceAddress,
- &AzToolsFramework::ToolsApplicationRequestBus::Events::FindCommonSliceInstanceAddress, selectedEntityList);
-
- if (!sliceAddress.IsValid())
- {
- return;
- }
-
- AZ::EntityId sliceRootEntityId;
- AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(sliceRootEntityId,
- &AzToolsFramework::ToolsApplicationRequestBus::Events::GetRootEntityIdOfSliceInstance, sliceAddress);
-
- if (!sliceRootEntityId.IsValid())
- {
- return;
- }
-
- AzToolsFramework::ToolsApplicationRequestBus::Broadcast(
- &AzToolsFramework::ToolsApplicationRequestBus::Events::SetSelectedEntities, AzToolsFramework::EntityIdList{sliceRootEntityId});
-
- const AZ::SliceComponent::InstantiatedContainer* instantiatedContainer = sliceAddress.GetInstance()->GetInstantiated();
-
- AABB aabb(Vec3(std::numeric_limits::max()), Vec3(-std::numeric_limits::max()));
- for (AZ::Entity* entity : instantiatedContainer->m_entities)
- {
- CEntityObject* entityObject = nullptr;
- AzToolsFramework::ComponentEntityEditorRequestBus::EventResult(entityObject, entity->GetId(),
- &AzToolsFramework::ComponentEntityEditorRequestBus::Events::GetSandboxObject);
- AABB box;
- entityObject->GetBoundBox(box);
- aabb.Add(box.min);
- aabb.Add(box.max);
- }
- CenterOnAABB(aabb);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::SetFOV(float fov)
-{
- if (m_pCameraFOVVariable)
- {
- m_pCameraFOVVariable->Set(fov);
- }
- else
- {
- m_camFOV = fov;
- }
-
- if (m_viewPane)
- {
- m_viewPane->OnFOVChanged(fov);
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-float CRenderViewport::GetFOV() const
-{
- if (m_viewSourceType == ViewSourceType::SequenceCamera)
- {
- CBaseObject* cameraObject = GetCameraObject();
-
- AZ::EntityId cameraEntityId;
- AzToolsFramework::ComponentEntityObjectRequestBus::EventResult(cameraEntityId, cameraObject, &AzToolsFramework::ComponentEntityObjectRequestBus::Events::GetAssociatedEntityId);
- if (cameraEntityId.IsValid())
- {
- // component Camera
- float fov = DEFAULT_FOV;
- Camera::CameraRequestBus::EventResult(fov, cameraEntityId, &Camera::CameraComponentRequests::GetFov);
- return AZ::DegToRad(fov);
- }
- }
-
- if (m_pCameraFOVVariable)
- {
- float fov;
- m_pCameraFOVVariable->Get(fov);
- return fov;
- }
- else if (m_viewEntityId.IsValid())
- {
- float fov = AZ::RadToDeg(m_camFOV);
- Camera::CameraRequestBus::EventResult(fov, m_viewEntityId, &Camera::CameraComponentRequests::GetFov);
- return AZ::DegToRad(fov);
- }
-
- return m_camFOV;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::CreateRenderContext()
-{
- // Create context.
- if (m_renderer && !m_bRenderContextCreated)
- {
- m_bRenderContextCreated = true;
-
- AzFramework::WindowRequestBus::Handler::BusConnect(renderOverlayHWND());
- AzFramework::WindowSystemNotificationBus::Broadcast(&AzFramework::WindowSystemNotificationBus::Handler::OnWindowCreated, renderOverlayHWND());
-
- WIN_HWND oldContext = m_renderer->GetCurrentContextHWND();
- m_renderer->CreateContext(renderOverlayHWND());
- m_renderer->SetCurrentContext(oldContext); // restore prior context
- return true;
- }
- return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::DestroyRenderContext()
-{
- // Destroy render context.
- if (m_renderer && m_bRenderContextCreated)
- {
- // Do not delete primary context.
- if (m_hwnd != m_renderer->GetHWND())
- {
- m_renderer->DeleteContext(m_hwnd);
- }
- m_bRenderContextCreated = false;
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::SetDefaultCamera()
-{
- if (IsDefaultCamera())
- {
- return;
- }
- ResetToViewSourceType(ViewSourceType::None);
- GetViewManager()->SetCameraObjectId(m_cameraObjectId);
- SetName(m_defaultViewName);
- SetViewTM(m_defaultViewTM);
- PostCameraSet();
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::IsDefaultCamera() const
-{
- return m_viewSourceType == ViewSourceType::None;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::SetSequenceCamera()
-{
- if (m_viewSourceType == ViewSourceType::SequenceCamera)
- {
- // Reset if we were checked before
- SetDefaultCamera();
- }
- else
- {
- ResetToViewSourceType(ViewSourceType::SequenceCamera);
-
- SetName(tr("Sequence Camera"));
- SetViewTM(GetViewTM());
-
- GetViewManager()->SetCameraObjectId(m_cameraObjectId);
- PostCameraSet();
-
- // ForceAnimation() so Track View will set the Camera params
- // if a camera is animated in the sequences.
- if (GetIEditor() && GetIEditor()->GetAnimation())
- {
- GetIEditor()->GetAnimation()->ForceAnimation();
- }
-}
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::SetComponentCamera(const AZ::EntityId& entityId)
-{
- ResetToViewSourceType(ViewSourceType::CameraComponent);
- SetViewEntity(entityId);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::SetEntityAsCamera(const AZ::EntityId& entityId, bool lockCameraMovement)
-{
- ResetToViewSourceType(ViewSourceType::AZ_Entity);
- SetViewEntity(entityId, lockCameraMovement);
-}
-
-void CRenderViewport::SetFirstComponentCamera()
-{
- AZ::EBusAggregateResults results;
- Camera::CameraBus::BroadcastResult(results, &Camera::CameraRequests::GetCameras);
- AZStd::sort_heap(results.values.begin(), results.values.end());
- AZ::EntityId entityId;
- if (results.values.size() > 0)
- {
- entityId = results.values[0];
- }
- SetComponentCamera(entityId);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::SetSelectedCamera()
-{
- AZ::EBusAggregateResults cameraList;
- Camera::CameraBus::BroadcastResult(cameraList, &Camera::CameraRequests::GetCameras);
- if (cameraList.values.size() > 0)
- {
- AzToolsFramework::EntityIdList selectedEntityList;
- AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
- for (const AZ::EntityId& entityId : selectedEntityList)
- {
- if (AZStd::find(cameraList.values.begin(), cameraList.values.end(), entityId) != cameraList.values.end())
- {
- SetComponentCamera(entityId);
- }
- }
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::IsSelectedCamera() const
-{
- CBaseObject* pCameraObject = GetCameraObject();
- if (pCameraObject && pCameraObject == GetIEditor()->GetSelectedObject())
- {
- return true;
- }
-
- AzToolsFramework::EntityIdList selectedEntityList;
- AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(
- selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
-
- if ((m_viewSourceType == ViewSourceType::CameraComponent || m_viewSourceType == ViewSourceType::AZ_Entity)
- && !selectedEntityList.empty()
- && AZStd::find(selectedEntityList.begin(), selectedEntityList.end(), m_viewEntityId) != selectedEntityList.end())
- {
- return true;
- }
-
- return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::CycleCamera()
-{
- // None -> Sequence -> LegacyCamera -> ... LegacyCamera -> CameraComponent -> ... CameraComponent -> None
- // AZ_Entity has been intentionally left out of the cycle for now.
- switch (m_viewSourceType)
- {
- case CRenderViewport::ViewSourceType::None:
- {
- SetFirstComponentCamera();
- break;
- }
- case CRenderViewport::ViewSourceType::SequenceCamera:
- {
- AZ_Error("CRenderViewport", false, "Legacy cameras no longer exist, unable to set sequence camera.");
- break;
- }
- case CRenderViewport::ViewSourceType::LegacyCamera:
- {
- AZ_Warning("CRenderViewport", false, "Legacy cameras no longer exist, using first found component camera instead.");
- SetFirstComponentCamera();
- break;
- }
- case CRenderViewport::ViewSourceType::CameraComponent:
- {
- AZ::EBusAggregateResults results;
- Camera::CameraBus::BroadcastResult(results, &Camera::CameraRequests::GetCameras);
- AZStd::sort_heap(results.values.begin(), results.values.end());
- auto&& currentCameraIterator = AZStd::find(results.values.begin(), results.values.end(), m_viewEntityId);
- if (currentCameraIterator != results.values.end())
- {
- ++currentCameraIterator;
- if (currentCameraIterator != results.values.end())
- {
- SetComponentCamera(*currentCameraIterator);
- break;
- }
- }
- SetDefaultCamera();
- break;
- }
- case CRenderViewport::ViewSourceType::AZ_Entity:
- {
- // we may decide to have this iterate over just selected entities
- SetDefaultCamera();
- break;
- }
- default:
- {
- SetDefaultCamera();
- break;
- }
- }
-}
-
-void CRenderViewport::SetViewFromEntityPerspective(const AZ::EntityId& entityId)
-{
- SetViewAndMovementLockFromEntityPerspective(entityId, false);
-}
-
-void CRenderViewport::SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement)
-{
- if (!m_ignoreSetViewFromEntityPerspective)
- {
- SetEntityAsCamera(entityId, lockCameraMovement);
- }
-}
-
-bool CRenderViewport::GetActiveCameraPosition(AZ::Vector3& cameraPos)
-{
- cameraPos = LYVec3ToAZVec3(m_viewTM.GetTranslation());
- return true;
-}
-
-bool CRenderViewport::GetActiveCameraState(AzFramework::CameraState& cameraState)
-{
- if (m_pPrimaryViewport == this)
- {
- if (GetIEditor()->IsInGameMode())
- {
- return false;
- }
- else
- {
- const auto& camera = GetCamera();
- cameraState = CameraStateFromCCamera(camera, GetFOV(), m_rcClient.width(), m_rcClient.height());
- }
-
- return true;
- }
-
- return false;
-}
-
-void CRenderViewport::OnStartPlayInEditor()
-{
- if (m_viewEntityId.IsValid())
- {
- m_viewEntityIdCachedForEditMode = m_viewEntityId;
- AZ::EntityId runtimeEntityId;
- AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
- &AzToolsFramework::EditorEntityContextRequestBus::Events::MapEditorIdToRuntimeId,
- m_viewEntityId, runtimeEntityId);
-
- m_viewEntityId = runtimeEntityId;
- }
- // Force focus the render viewport, otherwise we don't receive keyPressEvents until the user first clicks a
- // mouse button. See also CRenderViewport::mousePressEvent for a deatiled description of the underlying bug.
- // We need to queue this up because we don't actually lose focus until sometime after this function returns.
- QTimer::singleShot(0, this, &CRenderViewport::ActivateWindowAndSetFocus);
-}
-
-void CRenderViewport::OnStopPlayInEditor()
-{
- if (m_viewEntityIdCachedForEditMode.IsValid())
- {
- m_viewEntityId = m_viewEntityIdCachedForEditMode;
- m_viewEntityIdCachedForEditMode.SetInvalid();
- }
-}
-
-void CRenderViewport::ActivateWindowAndSetFocus()
-{
- window()->activateWindow();
- setFocus();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderConstructionPlane()
-{
- // noop
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RenderSnappingGrid()
-{
- // noop
-}
-
-//////////////////////////////////////////////////////////////////////////
-CRenderViewport::SPreviousContext CRenderViewport::SetCurrentContext(int newWidth, int newHeight) const
-{
- SPreviousContext x;
- x.window = reinterpret_cast(m_renderer->GetCurrentContextHWND());
- x.mainViewport = m_renderer->IsCurrentContextMainVP();
- x.width = m_renderer->GetCurrentContextViewportWidth();
- x.height = m_renderer->GetCurrentContextViewportHeight();
- x.rendererCamera = m_renderer->GetCamera();
-
- const float scale = CLAMP(gEnv->pConsole->GetCVar("r_ResolutionScale")->GetFVal(), MIN_RESOLUTION_SCALE, MAX_RESOLUTION_SCALE);
- const QSize newSize = WidgetToViewport(QSize(newWidth, newHeight)) * scale;
-
- // No way to query the requested Qt scale here, so do it this way for now
- float widthScale = aznumeric_cast(newSize.width()) / aznumeric_cast(newWidth);
- float heightScale = aznumeric_cast(newSize.height()) / aznumeric_cast(newHeight);
-
- m_renderer->SetCurrentContext(renderOverlayHWND());
- m_renderer->ChangeViewport(0, 0, newWidth, newHeight, true, widthScale, heightScale);
- m_renderer->SetCamera(m_Camera);
-
- return x;
-}
-
-//////////////////////////////////////////////////////////////////////////
-CRenderViewport::SPreviousContext CRenderViewport::SetCurrentContext() const
-{
- const auto r = rect();
- return SetCurrentContext(r.width(), r.height());
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::RestorePreviousContext(const SPreviousContext& x) const
-{
- if (x.window && x.window != m_renderer->GetCurrentContextHWND())
- {
- m_renderer->SetCurrentContext(x.window);
- m_renderer->ChangeViewport(0, 0, x.width, x.height, x.mainViewport);
- m_renderer->SetCamera(x.rendererCamera);
- }
-}
-
-void CRenderViewport::PreWidgetRendering()
-{
- // if we have not already set the render context for the viewport, do it now
- // based on the current state of the renderer/viewport, record the previous
- // context to restore afterwards
- if (m_cameraSetForWidgetRenderingCount == 0)
- {
- m_preWidgetContext = SetCurrentContext();
- }
-
- // keep track of how many times we've attempted to update the context
- m_cameraSetForWidgetRenderingCount++;
-}
-
-void CRenderViewport::PostWidgetRendering()
-{
- if (m_cameraSetForWidgetRenderingCount > 0)
- {
- m_cameraSetForWidgetRenderingCount--;
-
- // unwinding - when the viewport context is no longer required,
- // restore the previous context when widget rendering first began
- if (m_cameraSetForWidgetRenderingCount == 0)
- {
- RestorePreviousContext(m_preWidgetContext);
- }
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::OnCameraFOVVariableChanged([[maybe_unused]] IVariable* var)
-{
- if (m_viewPane)
- {
- m_viewPane->OnFOVChanged(GetFOV());
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::HideCursor()
-{
- if (m_bCursorHidden || !gSettings.viewports.bHideMouseCursorWhenCaptured)
- {
- return;
- }
-
- qApp->setOverrideCursor(Qt::BlankCursor);
-#if AZ_TRAIT_OS_PLATFORM_APPLE
- StartFixedCursorMode(this);
-#endif
- m_bCursorHidden = true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::ShowCursor()
-{
- if (!m_bCursorHidden || !gSettings.viewports.bHideMouseCursorWhenCaptured)
- {
- return;
- }
-
-#if AZ_TRAIT_OS_PLATFORM_APPLE
- StopFixedCursorMode();
-#endif
- qApp->restoreOverrideCursor();
- m_bCursorHidden = false;
-}
-
-bool CRenderViewport::IsKeyDown(Qt::Key key) const
-{
- return m_keyDown.contains(key);
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::PushDisableRendering()
-{
- assert(m_disableRenderingCount >= 0);
- ++m_disableRenderingCount;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::PopDisableRendering()
-{
- assert(m_disableRenderingCount >= 1);
- --m_disableRenderingCount;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool CRenderViewport::IsRenderingDisabled() const
-{
- return m_disableRenderingCount > 0;
-}
-
-//////////////////////////////////////////////////////////////////////////
-QPoint CRenderViewport::WidgetToViewport(const QPoint &point) const
-{
- return point * WidgetToViewportFactor();
-}
-
-QPoint CRenderViewport::ViewportToWidget(const QPoint &point) const
-{
- return point / WidgetToViewportFactor();
-}
-
-//////////////////////////////////////////////////////////////////////////
-QSize CRenderViewport::WidgetToViewport(const QSize &size) const
-{
- return size * WidgetToViewportFactor();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::BeginUndoTransaction()
-{
- PushDisableRendering();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CRenderViewport::EndUndoTransaction()
-{
- PopDisableRendering();
- Update();
-}
-
-void CRenderViewport::UpdateCurrentMousePos(const QPoint& newPosition)
-{
- m_prevMousePos = m_mousePos;
- m_mousePos = newPosition;
-}
-
-void CRenderViewport::BuildDragDropContext(AzQtComponents::ViewportDragContext& context, const QPoint& pt)
-{
- const auto scaledPoint = WidgetToViewport(pt);
- QtViewport::BuildDragDropContext(context, scaledPoint);
-}
-
-void* CRenderViewport::GetSystemCursorConstraintWindow() const
-{
- AzFramework::SystemCursorState systemCursorState = AzFramework::SystemCursorState::Unknown;
-
- AzFramework::InputSystemCursorRequestBus::EventResult(
- systemCursorState,
- AzFramework::InputDeviceMouse::Id,
- &AzFramework::InputSystemCursorRequests::GetSystemCursorState);
-
- const bool systemCursorConstrained =
- (systemCursorState == AzFramework::SystemCursorState::ConstrainedAndHidden ||
- systemCursorState == AzFramework::SystemCursorState::ConstrainedAndVisible);
-
- return systemCursorConstrained ? renderOverlayHWND() : nullptr;
-}
-
-void CRenderViewport::RestoreViewportAfterGameMode()
-{
- Matrix34 preGameModeViewTM = m_preGameModeViewTM;
-
- QString text =
- QString(
- tr("When leaving \" Game Mode \" the engine will automatically restore your camera position to the default position before you "
- "had entered Game mode.
If you dislike this setting you can always change this anytime in the global "
- "preferences.
"))
- .arg(EditorPreferencesGeneralRestoreViewportCameraSettingName);
- QString restoreOnExitGameModePopupDisabledRegKey("Editor/AutoHide/ViewportCameraRestoreOnExitGameMode");
-
- // Read the popup disabled registry value
- QSettings settings;
- QVariant restoreOnExitGameModePopupDisabledRegValue = settings.value(restoreOnExitGameModePopupDisabledRegKey);
-
- // Has the user previously disabled being asked about restoring the camera on exiting game mode?
- if (restoreOnExitGameModePopupDisabledRegValue.isNull())
- {
- // No, ask them now
- QMessageBox messageBox(QMessageBox::Question, "O3DE", text, QMessageBox::StandardButtons(QMessageBox::No | QMessageBox::Yes), this);
- messageBox.setDefaultButton(QMessageBox::Yes);
-
- QCheckBox* checkBox = new QCheckBox(QStringLiteral("Do not show this message again"));
- checkBox->setChecked(true);
- messageBox.setCheckBox(checkBox);
-
- // Unconstrain the system cursor and make it visible before we show the dialog box, otherwise the user can't see the cursor.
- AzFramework::InputSystemCursorRequestBus::Event(AzFramework::InputDeviceMouse::Id,
- &AzFramework::InputSystemCursorRequests::SetSystemCursorState,
- AzFramework::SystemCursorState::UnconstrainedAndVisible);
-
- int response = messageBox.exec();
-
- if (checkBox->isChecked())
- {
- settings.setValue(restoreOnExitGameModePopupDisabledRegKey, response);
- }
-
- // Update the value only if the popup hasn't previously been disabled and the value has changed
- bool newSetting = (response == QMessageBox::Yes);
- if (newSetting != GetIEditor()->GetEditorSettings()->restoreViewportCamera)
- {
- GetIEditor()->GetEditorSettings()->restoreViewportCamera = newSetting;
- GetIEditor()->GetEditorSettings()->Save();
- }
- }
-
- bool restoreViewportCamera = GetIEditor()->GetEditorSettings()->restoreViewportCamera;
- if (restoreViewportCamera)
- {
- SetViewTM(preGameModeViewTM);
- }
- else
- {
- SetViewTM(m_gameTM);
- }
-}
-
-#include
diff --git a/Code/Editor/RenderViewport.h b/Code/Editor/RenderViewport.h
deleted file mode 100644
index c66d56176e..0000000000
--- a/Code/Editor/RenderViewport.h
+++ /dev/null
@@ -1,649 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-#ifndef CRYINCLUDE_EDITOR_RENDERVIEWPORT_H
-#define CRYINCLUDE_EDITOR_RENDERVIEWPORT_H
-
-#pragma once
-// RenderViewport.h : header file
-//
-
-#if !defined(Q_MOC_RUN)
-#include
-
-#include
-
-#include "Viewport.h"
-#include "Objects/DisplayContext.h"
-#include "Undo/Undo.h"
-#include "Util/PredefinedAspectRatios.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#endif
-
-#include
-#include
-
-// forward declarations.
-class CBaseObject;
-class QMenu;
-class QKeyEvent;
-class EditorEntityNotifications;
-struct ray_hit;
-struct IRenderMesh;
-struct IVariable;
-
-namespace AzToolsFramework
-{
- class ManipulatorManager;
-}
-
-// CRenderViewport window
-AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
-AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-class SANDBOX_API CRenderViewport
- : public QtViewport
- , public IEditorNotifyListener
- , public IUndoManagerListener
- , public Camera::EditorCameraRequestBus::Handler
- , public AzFramework::InputSystemCursorConstraintRequestBus::Handler
- , public AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler
- , public AzToolsFramework::ViewportInteraction::ViewportInteractionRequestBus::Handler
- , public AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler
- , public AzFramework::WindowRequestBus::Handler
-{
-AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
- Q_OBJECT
-public:
- struct SResolution
- {
- SResolution()
- : width(0)
- , height(0)
- {
- }
-
- SResolution(int w, int h)
- : width(w)
- , height(h)
- {
- }
-
- int width;
- int height;
- };
-
-public:
- CRenderViewport(const QString& name, QWidget* parent = nullptr);
-
- static const GUID& GetClassID()
- {
- return QtViewport::GetClassID();
- }
-
- /** Get type of this viewport.
- */
- virtual EViewportType GetType() const { return ET_ViewportCamera; }
- virtual void SetType([[maybe_unused]] EViewportType type) { assert(type == ET_ViewportCamera); };
-
- // Implementation
-public:
- virtual ~CRenderViewport();
-
- Q_INVOKABLE void InjectFakeMouseMove(int deltaX, int deltaY, Qt::MouseButtons buttons);
-
-public:
- virtual void Update();
-
- virtual void ResetContent();
- virtual void UpdateContent(int flags);
-
- void OnTitleMenu(QMenu* menu) override;
-
- void SetCamera(const CCamera& camera);
- const CCamera& GetCamera() const { return m_Camera; };
- virtual void SetViewTM(const Matrix34& tm)
- {
- if (m_viewSourceType == ViewSourceType::None)
- {
- m_defaultViewTM = tm;
- }
- SetViewTM(tm, false);
- }
-
- //! Map world space position to viewport position.
- virtual QPoint WorldToView(const Vec3& wp) const;
- virtual QPoint WorldToViewParticleEditor(const Vec3& wp, int width, int height) const;
- virtual Vec3 WorldToView3D(const Vec3& wp, int nFlags = 0) const;
-
- //! Map viewport position to world space position.
- virtual Vec3 ViewToWorld(const QPoint& vp, bool* collideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
- virtual void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const override;
- virtual Vec3 ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh = false) override;
- virtual float GetScreenScaleFactor(const Vec3& worldPoint) const;
- virtual float GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position);
- virtual float GetAspectRatio() const;
- virtual bool HitTest(const QPoint& point, HitContext& hitInfo);
- virtual bool IsBoundsVisible(const AABB& box) const;
- virtual void CenterOnSelection();
- virtual void CenterOnAABB(const AABB& aabb);
- void CenterOnSliceInstance() override;
-
- void focusOutEvent(QFocusEvent* event) override;
- void keyPressEvent(QKeyEvent* event) override;
- void keyReleaseEvent(QKeyEvent* event) override;
-
- void SetFOV(float fov);
- float GetFOV() const;
-
- void SetDefaultCamera();
- bool IsDefaultCamera() const;
- void SetSequenceCamera();
- bool IsSequenceCamera() const { return m_viewSourceType == ViewSourceType::SequenceCamera; }
- void SetSelectedCamera();
- bool IsSelectedCamera() const;
- void SetComponentCamera(const AZ::EntityId& entityId);
- void SetEntityAsCamera(const AZ::EntityId& entityId, bool lockCameraMovement = false);
- void SetFirstComponentCamera();
- void SetViewEntity(const AZ::EntityId& cameraEntityId, bool lockCameraMovement = false);
- void PostCameraSet();
- // This switches the active camera to the next one in the list of (default, all custom cams).
- void CycleCamera();
-
- // Camera::EditorCameraRequestBus
- void SetViewFromEntityPerspective(const AZ::EntityId& entityId) override;
- void SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement) override;
- AZ::EntityId GetCurrentViewEntityId() override { return m_viewEntityId; }
- bool GetActiveCameraPosition(AZ::Vector3& cameraPos) override;
- bool GetActiveCameraState(AzFramework::CameraState& cameraState) override;
-
- // AzToolsFramework::EditorEntityContextNotificationBus (handler moved to cpp to resolve link issues in unity builds)
- virtual void OnStartPlayInEditor();
- virtual void OnStopPlayInEditor();
-
- // AzToolsFramework::EditorContextMenu::Bus (handler moved to cpp to resolve link issues in unity builds)
- // We use this to determine when the viewport context menu is being displayed so we can exit move mode
- void PopulateEditorGlobalContextMenu(QMenu* /*menu*/, const AZ::Vector2& /*point*/, int /*flags*/);
-
- // AzToolsFramework::ViewportInteractionRequestBus
- AzFramework::CameraState GetCameraState() override;
- bool GridSnappingEnabled() override;
- float GridSize() override;
- bool ShowGrid() override;
- bool AngleSnappingEnabled() override;
- float AngleStep() override;
- AzFramework::ScreenPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition) override;
- AZStd::optional ViewportScreenToWorld(const AzFramework::ScreenPoint&, float) override
- {
- return {};
- }
- AZStd::optional ViewportScreenToWorldRay(
- const AzFramework::ScreenPoint&) override
- {
- return {};
- }
- float DeviceScalingFactor() override { return 1.0f; }
-
- // AzToolsFramework::ViewportFreezeRequestBus
- bool IsViewportInputFrozen() override;
- void FreezeViewportInput(bool freeze) override;
-
- // AzToolsFramework::MainEditorViewportInteractionRequestBus
- AZ::EntityId PickEntity(const AzFramework::ScreenPoint& point) override;
- AZ::Vector3 PickTerrain(const AzFramework::ScreenPoint& point) override;
- float TerrainHeight(const AZ::Vector2& position) override;
- void FindVisibleEntities(AZStd::vector& visibleEntitiesOut) override;
- bool ShowingWorldSpace() override;
- QWidget* GetWidgetForViewportContextMenu() override;
- void BeginWidgetContext() override;
- void EndWidgetContext() override;
-
- // WindowRequestBus::Handler...
- void SetWindowTitle(const AZStd::string& title) override;
- AzFramework::WindowSize GetClientAreaSize() const override;
- void ResizeClientArea(AzFramework::WindowSize) override;
- bool GetFullScreenState() const override;
- void SetFullScreenState(bool fullScreenState) override;
- bool CanToggleFullScreenState() const override;
- void ToggleFullScreenState() override;
- float GetDpiScaleFactor() const override { return 1.0f; };
-
- void ConnectViewportInteractionRequestBus();
- void DisconnectViewportInteractionRequestBus();
-
- void ActivateWindowAndSetFocus();
-
- void LockCameraMovement(bool bLock) { m_bLockCameraMovement = bLock; }
- bool IsCameraMovementLocked() const { return m_bLockCameraMovement; }
-
- void EnableCameraObjectMove(bool bMove) { m_bMoveCameraObject = bMove; }
- bool IsCameraObjectMove() const { return m_bMoveCameraObject; }
-
- void SetPlayerControl(uint32 i) { m_PlayerControl = i; };
- uint32 GetPlayerControl() { return m_PlayerControl; };
-
- const DisplayContext& GetDisplayContext() const { return m_displayContext; }
- CBaseObject* GetCameraObject() const;
-
- QPoint WidgetToViewport(const QPoint& point) const;
- QPoint ViewportToWidget(const QPoint& point) const;
- QSize WidgetToViewport(const QSize& size) const;
-
- AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point) override;
-
- void SetPlayerPos()
- {
- Matrix34 m = GetViewTM();
- m.SetTranslation(m.GetTranslation() - m_PhysicalLocation.t);
- SetViewTM(m);
-
- m_AverageFrameTime = 0.14f;
-
- m_PhysicalLocation.SetIdentity();
-
- m_LocalEntityMat.SetIdentity();
- m_PrevLocalEntityMat.SetIdentity();
-
- m_absCameraHigh = 2.0f;
- m_absCameraPos = Vec3(0, 3, 2);
- m_absCameraPosVP = Vec3(0, -3, 1.5);
-
- m_absCurrentSlope = 0.0f;
-
- m_absLookDirectionXY = Vec2(0, 1);
-
- m_LookAt = Vec3(ZERO);
- m_LookAtRate = Vec3(ZERO);
- m_vCamPos = Vec3(ZERO);
- m_vCamPosRate = Vec3(ZERO);
-
- m_relCameraRotX = 0;
- m_relCameraRotZ = 0;
-
- uint32 numSample6 = m_arrAnimatedCharacterPath.size();
- for (uint32 i = 0; i < numSample6; i++)
- {
- m_arrAnimatedCharacterPath[i] = Vec3(ZERO);
- }
-
- numSample6 = m_arrSmoothEntityPath.size();
- for (uint32 i = 0; i < numSample6; i++)
- {
- m_arrSmoothEntityPath[i] = Vec3(ZERO);
- }
-
- uint32 numSample7 = m_arrRunStrafeSmoothing.size();
- for (uint32 i = 0; i < numSample7; i++)
- {
- m_arrRunStrafeSmoothing[i] = 0;
- }
-
- m_vWorldDesiredBodyDirection = Vec2(0, 1);
- m_vWorldDesiredBodyDirectionSmooth = Vec2(0, 1);
- m_vWorldDesiredBodyDirectionSmoothRate = Vec2(0, 1);
-
- m_vWorldDesiredBodyDirection2 = Vec2(0, 1);
-
- m_vWorldDesiredMoveDirection = Vec2(0, 1);
- m_vWorldDesiredMoveDirectionSmooth = Vec2(0, 1);
- m_vWorldDesiredMoveDirectionSmoothRate = Vec2(0, 1);
- m_vLocalDesiredMoveDirection = Vec2(0, 1);
- m_vLocalDesiredMoveDirectionSmooth = Vec2(0, 1);
- m_vLocalDesiredMoveDirectionSmoothRate = Vec2(0, 1);
-
- m_vWorldAimBodyDirection = Vec2(0, 1);
-
- m_MoveSpeedMSec = 5.0f;
- m_key_W = 0;
- m_keyrcr_W = 0;
- m_key_S = 0;
- m_keyrcr_S = 0;
- m_key_A = 0;
- m_keyrcr_A = 0;
- m_key_D = 0;
- m_keyrcr_D = 0;
- m_key_SPACE = 0;
- m_keyrcr_SPACE = 0;
- m_ControllMode = 0;
-
- m_State = -1;
- m_Stance = 1; //combat
-
- m_udGround = 0.0f;
- m_lrGround = 0.0f;
- AABB aabb = AABB(Vec3(-40.0f, -40.0f, -0.25f), Vec3(+40.0f, +40.0f, +0.0f));
- m_GroundOBB = OBB::CreateOBBfromAABB(Matrix33(IDENTITY), aabb);
- m_GroundOBBPos = Vec3(0, 0, -0.01f);
- };
-
- static CRenderViewport* GetPrimaryViewport();
-
- AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
- CCamera m_Camera;
- AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-
-protected:
- struct SScopedCurrentContext;
-
- void SetViewTM(const Matrix34& tm, bool bMoveOnly);
-
- virtual float GetCameraMoveSpeed() const;
- virtual float GetCameraRotateSpeed() const;
- virtual bool GetCameraInvertYRotation() const;
- virtual float GetCameraInvertPan() const;
-
- // Called to render stuff.
- virtual void OnRender();
-
- virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
-
- //! Get currently active camera object.
- void ToggleCameraObject();
-
- void RenderConstructionPlane();
- void RenderSnapMarker();
- void RenderCursorString();
- void RenderSnappingGrid();
- void ProcessMouse();
- void ProcessKeys();
-
- void RenderAll();
- void DrawAxis();
- void DrawBackground();
- void InitDisplayContext();
- void ResetCursor();
-
- struct SPreviousContext
- {
- CCamera rendererCamera;
- HWND window;
- int width;
- int height;
- bool mainViewport;
- };
-
- SPreviousContext m_preWidgetContext;
-
- // Create an auto-sized render context that is sized based on the Editor's current
- // viewport.
- SPreviousContext SetCurrentContext() const;
-
- SPreviousContext SetCurrentContext(int newWidth, int newHeight) const;
- void RestorePreviousContext(const SPreviousContext& x) const;
-
- void PreWidgetRendering() override;
- void PostWidgetRendering() override;
-
- // Update the safe frame, safe action, safe title, and borders rectangles based on
- // viewport size and target aspect ratio.
- void UpdateSafeFrame();
-
- // Draw safe frame, safe action, safe title rectangles and borders.
- void RenderSafeFrame();
-
- // Draw one of the safe frame rectangles with the desired color.
- void RenderSafeFrame(const QRect& frame, float r, float g, float b, float a);
-
- // Draw the selection rectangle.
- void RenderSelectionRectangle();
-
- // Draw a selected region if it has been selected
- void RenderSelectedRegion();
-
- virtual bool CreateRenderContext();
- virtual void DestroyRenderContext();
-
- void OnMenuCommandChangeAspectRatio(unsigned int commandId);
-
- bool AdjustObjectPosition(const ray_hit& hit, Vec3& outNormal, Vec3& outPos) const;
- bool RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const;
-
- bool AddCameraMenuItems(QMenu* menu);
- void ResizeView(int width, int height);
-
- void OnCameraFOVVariableChanged(IVariable* var);
-
- void HideCursor();
- void ShowCursor();
-
- bool IsKeyDown(Qt::Key key) const;
-
- enum class ViewSourceType
- {
- None,
- SequenceCamera,
- LegacyCamera,
- CameraComponent,
- AZ_Entity,
- ViewSourceTypesCount,
- };
- void ResetToViewSourceType(const ViewSourceType& viewSourType);
-
- //! Assigned renderer.
- IRenderer* m_renderer = nullptr;
- bool m_bRenderContextCreated = false;
- bool m_bInRotateMode = false;
- bool m_bInMoveMode = false;
- bool m_bInOrbitMode = false;
- bool m_bInZoomMode = false;
-
- QPoint m_mousePos = QPoint(0, 0);
- QPoint m_prevMousePos = QPoint(0, 0); // for tablets, you can't use SetCursorPos and need to remember the prior point and delta with that.
-
-
- float m_moveSpeed = 1;
-
- float m_orbitDistance = 10.0f;
- AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
- Vec3 m_orbitTarget;
-
- //-------------------------------------------
- //--- player-control in CharEdit ---
- //-------------------------------------------
- f32 m_MoveSpeedMSec;
-
- uint32 m_key_W, m_keyrcr_W;
- uint32 m_key_S, m_keyrcr_S;
- uint32 m_key_A, m_keyrcr_A;
- uint32 m_key_D, m_keyrcr_D;
-
- uint32 m_key_SPACE, m_keyrcr_SPACE;
- uint32 m_ControllMode;
-
- int32 m_Stance;
- int32 m_State;
- f32 m_AverageFrameTime;
-
- uint32 m_PlayerControl = 0;
-
- f32 m_absCameraHigh;
- Vec3 m_absCameraPos;
- Vec3 m_absCameraPosVP;
-
- f32 m_absCurrentSlope; //in radiants
-
- Vec2 m_absLookDirectionXY;
-
- Vec3 m_LookAt;
- Vec3 m_LookAtRate;
- Vec3 m_vCamPos;
- Vec3 m_vCamPosRate;
- float m_camFOV;
-
- f32 m_relCameraRotX;
- f32 m_relCameraRotZ;
-
- QuatTS m_PhysicalLocation;
-
- Matrix34 m_AnimatedCharacterMat;
-
- Matrix34 m_LocalEntityMat; //this is used for data-driven animations where the character is running on the spot
- Matrix34 m_PrevLocalEntityMat;
-
- std::vector m_arrVerticesHF;
- std::vector m_arrIndicesHF;
-
- std::vector m_arrAnimatedCharacterPath;
- std::vector m_arrSmoothEntityPath;
- std::vector m_arrRunStrafeSmoothing;
-
- Vec2 m_vWorldDesiredBodyDirection;
- Vec2 m_vWorldDesiredBodyDirectionSmooth;
- Vec2 m_vWorldDesiredBodyDirectionSmoothRate;
-
- Vec2 m_vWorldDesiredBodyDirection2;
-
-
- Vec2 m_vWorldDesiredMoveDirection;
- Vec2 m_vWorldDesiredMoveDirectionSmooth;
- Vec2 m_vWorldDesiredMoveDirectionSmoothRate;
- Vec2 m_vLocalDesiredMoveDirection;
- Vec2 m_vLocalDesiredMoveDirectionSmooth;
- Vec2 m_vLocalDesiredMoveDirectionSmoothRate;
- Vec2 m_vWorldAimBodyDirection;
-
- f32 m_udGround;
- f32 m_lrGround;
- OBB m_GroundOBB;
- Vec3 m_GroundOBBPos;
-
- // Index of camera objects.
- mutable GUID m_cameraObjectId = GUID_NULL;
- mutable AZ::EntityId m_viewEntityId;
- mutable ViewSourceType m_viewSourceType = ViewSourceType::None;
- AZ::EntityId m_viewEntityIdCachedForEditMode;
- Matrix34 m_preGameModeViewTM;
- uint m_disableRenderingCount = 0;
- bool m_bLockCameraMovement;
- bool m_bUpdateViewport = false;
- bool m_bMoveCameraObject = true;
-
- enum class KeyPressedState
- {
- AllUp,
- PressedThisFrame,
- PressedInPreviousFrame,
- };
- KeyPressedState m_pressedKeyState = KeyPressedState::AllUp;
-
- Matrix34 m_defaultViewTM;
- const QString m_defaultViewName;
-
- DisplayContext m_displayContext;
-
-
- bool m_isOnPaint = false;
- static CRenderViewport* m_pPrimaryViewport;
-
- QRect m_safeFrame;
- QRect m_safeAction;
- QRect m_safeTitle;
-
- CPredefinedAspectRatios m_predefinedAspectRatios;
-
- IVariable* m_pCameraFOVVariable = nullptr;
- bool m_bCursorHidden = false;
-
- void OnMenuResolutionCustom();
- void OnMenuCreateCameraEntityFromCurrentView();
- void OnMenuSelectCurrentCamera();
-
- int OnCreate();
- void resizeEvent(QResizeEvent* event) override;
- void paintEvent(QPaintEvent* event) override;
- void mousePressEvent(QMouseEvent* event) override;
- void OnLButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
- void OnLButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
- void OnLButtonDblClk(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
- void OnMButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
- void OnMButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
- void OnRButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
- void OnRButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
- void OnMouseMove(Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, const QPoint& point) override;
- void OnMouseWheel(Qt::KeyboardModifiers modifiers, short zDelta, const QPoint& pt) override;
-
- // From a series of input primitives, compose a complete mouse interaction.
- AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteractionInternal(
- AzToolsFramework::ViewportInteraction::MouseButtons buttons,
- AzToolsFramework::ViewportInteraction::KeyboardModifiers modifiers,
- const AzToolsFramework::ViewportInteraction::MousePick& mousePick) const;
- // Given a point in the viewport, return the pick ray into the scene.
- // note: The argument passed to parameter **point**, originating
- // from a Qt event, must first be passed to WidgetToViewport before being
- // passed to BuildMousePick.
- AzToolsFramework::ViewportInteraction::MousePick BuildMousePick(const QPoint& point);
-
- bool event(QEvent* event) override;
- void OnDestroy();
-
- bool CheckRespondToInput() const;
-
- // AzFramework::InputSystemCursorConstraintRequestBus
- void* GetSystemCursorConstraintWindow() const override;
-
- void BuildDragDropContext(AzQtComponents::ViewportDragContext& context, const QPoint& pt) override;
-
-private:
- void ProcessKeyRelease(QKeyEvent* event);
- void PushDisableRendering();
- void PopDisableRendering();
- bool IsRenderingDisabled() const;
- AzToolsFramework::ViewportInteraction::MousePick BuildMousePickInternal(
- const QPoint& point) const;
-
- void RestoreViewportAfterGameMode();
-
- double WidgetToViewportFactor() const
- {
-#if defined(AZ_PLATFORM_WINDOWS)
- // Needed for high DPI mode on windows
- return devicePixelRatioF();
-#else
- return 1.0f;
-#endif
- }
-
- void BeginUndoTransaction() override;
- void EndUndoTransaction() override;
-
- void UpdateCurrentMousePos(const QPoint& newPosition);
-
- AzFramework::EntityVisibilityQuery m_entityVisibilityQuery;
-
- SPreviousContext m_previousContext;
- QSet m_keyDown;
-
- bool m_freezeViewportInput = false;
-
- size_t m_cameraSetForWidgetRenderingCount = 0; ///< How many calls to PreWidgetRendering happened before
- ///< subsequent calls to PostWidetRendering.
- AZStd::shared_ptr m_manipulatorManager;
-
- // Used to prevent circular set camera events
- bool m_ignoreSetViewFromEntityPerspective = false;
- bool m_windowResizedEvent = false;
-
- // Cache hwnd value for teardown to avoid infinite loops in retrieving it from destroyed widgets.
- HWND m_hwnd;
-
- AZStd::unique_ptr m_editorEntityNotifications;
-
- AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-};
-
-#endif // CRYINCLUDE_EDITOR_RENDERVIEWPORT_H
diff --git a/Code/Editor/ResizeResolutionDialog.cpp b/Code/Editor/ResizeResolutionDialog.cpp
index ad57650afa..f2a03fb1b2 100644
--- a/Code/Editor/ResizeResolutionDialog.cpp
+++ b/Code/Editor/ResizeResolutionDialog.cpp
@@ -89,7 +89,7 @@ int ResizeResolutionModel::SizeRow(uint32 dwSize) const
// CResizeResolutionDialog dialog
-CResizeResolutionDialog::CResizeResolutionDialog(QWidget* pParent /*=NULL*/)
+CResizeResolutionDialog::CResizeResolutionDialog(QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_model(new ResizeResolutionModel(this))
, ui(new Ui::CResizeResolutionDialog)
diff --git a/Code/Editor/Resource.h b/Code/Editor/Resource.h
index a6f714afa4..b3640fac70 100644
--- a/Code/Editor/Resource.h
+++ b/Code/Editor/Resource.h
@@ -82,7 +82,6 @@
#define ID_TOOLS_CUSTOMIZEKEYBOARD 32914
#define ID_EXPORT_INDOORS 32915
#define ID_VIEW_CYCLE2DVIEWPORT 32916
-#define ID_SNAPANGLE 32917
#define ID_PHYSICS_GETPHYSICSSTATE 32937
#define ID_PHYSICS_RESETPHYSICSSTATE 32938
#define ID_GAME_SYNCPLAYER 32941
@@ -108,9 +107,6 @@
#define ID_MOVE_OBJECT 33481
#define ID_RENAME_OBJ 33483
#define ID_FETCH 33496
-#define ID_EDITMODE_ROTATE 33506
-#define ID_EDITMODE_SCALE 33507
-#define ID_EDITMODE_MOVE 33508
#define ID_SELECTION_DELETE 33512
#define ID_EDIT_ESCAPE 33513
#define ID_UNDO 33524
@@ -137,7 +133,6 @@
#define ID_ADDNODE 33570
#define ID_ADDSCENETRACK 33573
#define ID_FIND 33574
-#define ID_SNAP_TO_GRID 33575
#define ID_TAG_LOC1 33576
#define ID_TAG_LOC2 33577
#define ID_TAG_LOC3 33578
diff --git a/Code/Editor/ResourceSelectorHost.cpp b/Code/Editor/ResourceSelectorHost.cpp
index d265b3ffbe..af6c398fe7 100644
--- a/Code/Editor/ResourceSelectorHost.cpp
+++ b/Code/Editor/ResourceSelectorHost.cpp
@@ -101,7 +101,7 @@ public:
}
private:
- typedef std::map > TTypeMap;
+ using TTypeMap = std::map>;
TTypeMap m_typeMap;
std::map m_globallySelectedResources;
diff --git a/Code/Editor/SelectEAXPresetDlg.cpp b/Code/Editor/SelectEAXPresetDlg.cpp
index 4a5ea9b66c..733de8b9cf 100644
--- a/Code/Editor/SelectEAXPresetDlg.cpp
+++ b/Code/Editor/SelectEAXPresetDlg.cpp
@@ -49,7 +49,7 @@ QString CSelectEAXPresetDlg::GetCurrPreset() const
{
return m_ui->listView->currentIndex().data().toString();
}
- // EXCEPTION: OCX Property Pages should return FALSE
+ // EXCEPTION: OCX Property Pages should return false
return QString();
}
diff --git a/Code/Editor/Settings.cpp b/Code/Editor/Settings.cpp
index 8f86c74b25..06aae5b8f1 100644
--- a/Code/Editor/Settings.cpp
+++ b/Code/Editor/Settings.cpp
@@ -26,6 +26,7 @@
// AzFramework
#include
+#include
// AzToolsFramework
#include
@@ -189,6 +190,7 @@ SEditorSettings::SEditorSettings()
consoleBackgroundColorTheme = AzToolsFramework::ConsoleColorTheme::Dark;
bShowTimeInConsole = false;
+ clearConsoleOnGameModeStart = false;
enableSceneInspector = false;
@@ -243,7 +245,7 @@ SEditorSettings::SEditorSettings()
gui.nToolbarIconSize = static_cast(AzQtComponents::ToolBar::ToolBarIconSize::Default);
- int lfHeight = 8;// -MulDiv(8, GetDeviceCaps(GetDC(NULL), LOGPIXELSY), 72);
+ int lfHeight = 8;// -MulDiv(8, GetDeviceCaps(GetDC(nullptr), LOGPIXELSY), 72);
gui.nDefaultFontHieght = lfHeight;
gui.hSystemFont = QFont("Ms Shell Dlg 2", lfHeight, QFont::Normal);
gui.hSystemFontBold = QFont("Ms Shell Dlg 2", lfHeight, QFont::Bold);
@@ -499,6 +501,7 @@ void SEditorSettings::Save()
SaveValue("Settings", "AutoBackupTime", autoBackupTime);
SaveValue("Settings", "AutoBackupMaxCount", autoBackupMaxCount);
SaveValue("Settings", "AutoRemindTime", autoRemindTime);
+ SaveValue("Settings", "MaxDisplayedItemsNumInSearch", maxNumberOfItemsShownInSearch);
SaveValue("Settings", "CameraMoveSpeed", cameraMoveSpeed);
SaveValue("Settings", "CameraRotateSpeed", cameraRotateSpeed);
SaveValue("Settings", "StylusMode", stylusMode);
@@ -527,10 +530,12 @@ void SEditorSettings::Save()
SaveValue("Settings", "ConsoleBackgroundColorThemeV2", (int)consoleBackgroundColorTheme);
+ SaveValue("Settings", "ClearConsoleOnGameModeStart", clearConsoleOnGameModeStart);
+
SaveValue("Settings", "ShowTimeInConsole", bShowTimeInConsole);
SaveValue("Settings", "EnableSceneInspector", enableSceneInspector);
-
+
//////////////////////////////////////////////////////////////////////////
// Viewport settings.
//////////////////////////////////////////////////////////////////////////
@@ -623,7 +628,7 @@ void SEditorSettings::Save()
SaveValue("Settings\\AssetBrowser", "AutoFilterFromViewportSelection", sAssetBrowserSettings.bAutoFilterFromViewportSelection);
SaveValue("Settings\\AssetBrowser", "VisibleColumnNames", sAssetBrowserSettings.sVisibleColumnNames);
SaveValue("Settings\\AssetBrowser", "ColumnNames", sAssetBrowserSettings.sColumnNames);
-
+
//////////////////////////////////////////////////////////////////////////
// Deep Selection Settings
//////////////////////////////////////////////////////////////////////////
@@ -702,7 +707,7 @@ void SEditorSettings::Load()
QString strPlaceholderString;
// Load settings from registry.
LoadValue("Settings", "UndoLevels", undoLevels);
- LoadValue("Settings", "UndoSliceOverrideSaveValue", m_undoSliceOverrideSaveValue);
+ LoadValue("Settings", "UndoSliceOverrideSaveValue", m_undoSliceOverrideSaveValue);
LoadValue("Settings", "ShowWelcomeScreenAtStartup", bShowDashboardAtStartup);
LoadValue("Settings", "ShowCircularDependencyError", m_showCircularDependencyError);
LoadValue("Settings", "LoadLastLevelAtStartup", bAutoloadLastLevelAtStartup);
@@ -711,6 +716,7 @@ void SEditorSettings::Load()
LoadValue("Settings", "AutoBackupTime", autoBackupTime);
LoadValue("Settings", "AutoBackupMaxCount", autoBackupMaxCount);
LoadValue("Settings", "AutoRemindTime", autoRemindTime);
+ LoadValue("Settings", "MaxDisplayedItemsNumInSearch", maxNumberOfItemsShownInSearch);
LoadValue("Settings", "CameraMoveSpeed", cameraMoveSpeed);
LoadValue("Settings", "CameraRotateSpeed", cameraRotateSpeed);
LoadValue("Settings", "StylusMode", stylusMode);
@@ -745,6 +751,8 @@ void SEditorSettings::Load()
consoleBackgroundColorTheme = AzToolsFramework::ConsoleColorTheme::Dark;
}
+ LoadValue("Settings", "ClearConsoleOnGameModeStart", clearConsoleOnGameModeStart);
+
LoadValue("Settings", "ShowTimeInConsole", bShowTimeInConsole);
LoadValue("Settings", "EnableSceneInspector", enableSceneInspector);
@@ -1083,7 +1091,7 @@ void SEditorSettings::ConvertPath(const AZStd::string_view sourcePath, AZStd::st
AzToolsFramework::EditorSettingsAPIRequests::SettingOutcome SEditorSettings::GetValue(const AZStd::string_view path)
{
- if (path.find("|") < 0)
+ if (path.find("|") == AZStd::string_view::npos)
{
return { AZStd::string("Invalid Path - could not find separator \"|\"") };
}
@@ -1101,7 +1109,7 @@ AzToolsFramework::EditorSettingsAPIRequests::SettingOutcome SEditorSettings::Get
AzToolsFramework::EditorSettingsAPIRequests::SettingOutcome SEditorSettings::SetValue(const AZStd::string_view path, const AZStd::any& value)
{
- if (path.find("|") < 0)
+ if (path.find("|") == AZStd::string_view::npos)
{
return { AZStd::string("Invalid Path - could not find separator \"|\"") };
}
@@ -1204,3 +1212,8 @@ AzToolsFramework::ConsoleColorTheme SEditorSettings::GetConsoleColorTheme() cons
{
return consoleBackgroundColorTheme;
}
+
+int SEditorSettings::GetMaxNumberOfItemsShownInSearchView() const
+{
+ return SEditorSettings::maxNumberOfItemsShownInSearch;
+}
diff --git a/Code/Editor/Settings.h b/Code/Editor/Settings.h
index 979820e5e6..51931ab955 100644
--- a/Code/Editor/Settings.h
+++ b/Code/Editor/Settings.h
@@ -289,6 +289,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
SettingOutcome GetValue(const AZStd::string_view path) override;
SettingOutcome SetValue(const AZStd::string_view path, const AZStd::any& value) override;
AzToolsFramework::ConsoleColorTheme GetConsoleColorTheme() const override;
+ int GetMaxNumberOfItemsShownInSearchView() const override;
void ConvertPath(const AZStd::string_view sourcePath, AZStd::string& category, AZStd::string& attribute);
@@ -364,6 +365,13 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
int autoRemindTime;
//////////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////////
+ // Asset Browser Search View.
+ //////////////////////////////////////////////////////////////////////////
+ //! Current maximum number of items that can be displayed in the AssetBrowser Search View.
+ int maxNumberOfItemsShownInSearch;
+ //////////////////////////////////////////////////////////////////////////
+
//! If true preview windows is displayed when browsing geometries.
bool bPreviewGeometryWindow;
@@ -380,6 +388,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
//! Source Control Enabling.
bool enableSourceControl;
+ bool clearConsoleOnGameModeStart;
//! Text editor.
QString textEditorForScript;
diff --git a/Code/Editor/SettingsManager.cpp b/Code/Editor/SettingsManager.cpp
index 82e3eaf1e6..27031ca43e 100644
--- a/Code/Editor/SettingsManager.cpp
+++ b/Code/Editor/SettingsManager.cpp
@@ -105,7 +105,7 @@ bool CSettingsManager::CreateDefaultLayoutSettingsFile()
AZStd::vector CSettingsManager::BuildSettingsList()
{
- XmlNodeRef root = NULL;
+ XmlNodeRef root = nullptr;
root = m_pSettingsManagerMemoryNode;
@@ -132,8 +132,8 @@ void CSettingsManager::BuildSettingsList_Helper(const XmlNodeRef& node, const AZ
{
for (int i = 0; i < node->getNumAttributes(); ++i)
{
- const char* key = NULL;
- const char* value = NULL;
+ const char* key = nullptr;
+ const char* value = nullptr;
node->getAttributeByIndex(i, &key, &value);
if (!pathToNode.empty())
{
@@ -163,7 +163,7 @@ void CSettingsManager::BuildSettingsList_Helper(const XmlNodeRef& node, const AZ
result
);
}
-
+
}
}
}
@@ -190,7 +190,7 @@ void CSettingsManager::SaveSetting(const QString& path, const QString& attr, con
// Spaces in node names not allowed
writeAttr.replace(" ", "");
- XmlNodeRef root = NULL;
+ XmlNodeRef root = nullptr;
root = m_pSettingsManagerMemoryNode;
@@ -276,11 +276,11 @@ XmlNodeRef CSettingsManager::LoadSetting(const QString& path, const QString& att
// Spaces in node names not allowed
readAttr.replace(" ", "");
- XmlNodeRef root = NULL;
+ XmlNodeRef root = nullptr;
root = m_pSettingsManagerMemoryNode;
- XmlNodeRef tmpNode = NULL;
+ XmlNodeRef tmpNode = nullptr;
if (NeedSettingsNode(path))
{
@@ -293,7 +293,7 @@ XmlNodeRef CSettingsManager::LoadSetting(const QString& path, const QString& att
if (!tmpNode)
{
- return 0;
+ return nullptr;
}
for (int i = 0; i < strNodes.size(); ++i)
@@ -304,13 +304,13 @@ XmlNodeRef CSettingsManager::LoadSetting(const QString& path, const QString& att
}
else
{
- return 0;
+ return nullptr;
}
}
if (!tmpNode->findChild(readAttr.toUtf8().data()))
{
- return 0;
+ return nullptr;
}
else
{
@@ -360,7 +360,7 @@ void CSettingsManager::AddToolVersion(const QString& toolName, const QString& to
return;
}
- if (stl::find_in_map(m_toolNames, toolName, NULL) == "")
+ if (stl::find_in_map(m_toolNames, toolName, nullptr) == "")
{
if (!toolVersion.isEmpty())
{
@@ -380,7 +380,7 @@ void CSettingsManager::AddToolName(const QString& toolName, const QString& human
return;
}
- if (stl::find_in_map(m_toolNames, toolName, NULL) == "")
+ if (stl::find_in_map(m_toolNames, toolName, nullptr) == "")
{
if (!humanReadableName.isEmpty())
{
@@ -499,7 +499,7 @@ void CSettingsManager::GetMatchingLayoutNames(TToolNamesMap& foundTools, XmlNode
return;
}
- TToolNamesMap* toolNames = NULL;
+ TToolNamesMap* toolNames = nullptr;
if (!foundTools.empty())
{
@@ -593,11 +593,11 @@ bool CSettingsManager::NeedSettingsNode(const QString& path)
{
if ((path != EDITOR_LAYOUT_ROOT_NODE) && (path != TOOLBOX_NODE) && (path != TOOLBOXMACROS_NODE))
{
- return TRUE;
+ return true;
}
else
{
- return FALSE;
+ return false;
}
}
@@ -605,13 +605,13 @@ void CSettingsManager::SerializeCVars(XmlNodeRef& node, bool bLoad)
{
int nNumberOfVariables(0);
int nCurrentVariable(0);
- IConsole* piConsole(NULL);
- ICVar* piVariable(NULL);
+ IConsole* piConsole(nullptr);
+ ICVar* piVariable(nullptr);
std::vector cszVariableNames;
- char* szKey(NULL);
- char* szValue(NULL);
- ICVar* piCVar(NULL);
+ char* szKey(nullptr);
+ char* szValue(nullptr);
+ ICVar* piCVar(nullptr);
piConsole = gEnv->pConsole;
@@ -622,7 +622,7 @@ void CSettingsManager::SerializeCVars(XmlNodeRef& node, bool bLoad)
if (bLoad)
{
- XmlNodeRef readNode = NULL;
+ XmlNodeRef readNode = nullptr;
XmlNodeRef inputCVarsNode = node->findChild(CVARS_NODE);
if (!inputCVarsNode)
@@ -649,7 +649,7 @@ void CSettingsManager::SerializeCVars(XmlNodeRef& node, bool bLoad)
}
else
{
- XmlNodeRef newCVarNode = NULL;
+ XmlNodeRef newCVarNode = nullptr;
XmlNodeRef oldCVarsNode = node->findChild(CVARS_NODE);
if (oldCVarsNode)
@@ -660,9 +660,9 @@ void CSettingsManager::SerializeCVars(XmlNodeRef& node, bool bLoad)
XmlNodeRef cvarsNode = XmlHelpers::CreateXmlNode(CVARS_NODE);
nNumberOfVariables = piConsole->GetNumVisibleVars();
- cszVariableNames.resize(nNumberOfVariables, NULL);
+ cszVariableNames.resize(nNumberOfVariables, nullptr);
- if (piConsole->GetSortedVars((const char**)&cszVariableNames.front(), nNumberOfVariables, NULL) != nNumberOfVariables)
+ if (piConsole->GetSortedVars((const char**)&cszVariableNames.front(), nNumberOfVariables, nullptr) != nNumberOfVariables)
{
assert(false);
return;
@@ -711,8 +711,8 @@ void CSettingsManager::ReadValueStr(XmlNodeRef& sourceNode, const QString& path,
// Spaces in node names not allowed
readAttr.replace(" ", "");
- XmlNodeRef root = NULL;
- XmlNodeRef tmpNode = NULL;
+ XmlNodeRef root = nullptr;
+ XmlNodeRef tmpNode = nullptr;
if (NeedSettingsNode(path))
{
@@ -809,7 +809,7 @@ bool CSettingsManager::IsEventSafe(const SEventLog& event)
if (!root)
{
- return TRUE;
+ return true;
}
QString eventName = event.m_eventName;
@@ -823,7 +823,7 @@ bool CSettingsManager::IsEventSafe(const SEventLog& event)
// Log entry not found, so it is safe to start
if (!resNode)
{
- return TRUE;
+ return true;
}
XmlNodeRef callerVersion = resNode->findChild(EVENT_LOG_CALLER_VERSION);
@@ -841,15 +841,15 @@ bool CSettingsManager::IsEventSafe(const SEventLog& event)
{
if (callerVersionStr != GetToolVersion(eventName))
{
- return TRUE;
+ return true;
}
}
// The same version of tool/level found
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
//////////////////////////////////////////////////////////////////////////
@@ -947,15 +947,15 @@ XmlNodeRef CSettingsManager::LoadLogEventSetting(const QString& path, const QStr
if (!root)
{
- return 0;
+ return nullptr;
}
- XmlNodeRef tmpNode = NULL;
+ XmlNodeRef tmpNode = nullptr;
tmpNode = root;
if (!tmpNode)
{
- return 0;
+ return nullptr;
}
for (int i = 0; i < strNodes.size(); ++i)
@@ -966,7 +966,7 @@ XmlNodeRef CSettingsManager::LoadLogEventSetting(const QString& path, const QStr
}
else
{
- return 0;
+ return nullptr;
}
}
@@ -975,7 +975,7 @@ XmlNodeRef CSettingsManager::LoadLogEventSetting(const QString& path, const QStr
return tmpNode;
}
- return 0;
+ return nullptr;
}
QString CSettingsManager::GenerateContentHash(XmlNodeRef& node, QString sourceName)
diff --git a/Code/Editor/SettingsManagerDialog.cpp b/Code/Editor/SettingsManagerDialog.cpp
index 3f1c718b38..f8b720ae55 100644
--- a/Code/Editor/SettingsManagerDialog.cpp
+++ b/Code/Editor/SettingsManagerDialog.cpp
@@ -84,7 +84,7 @@ void CSettingsManagerDialog::OnReadBtnClick()
ui->m_layoutListBox->clear();
TToolNamesMap toolNames;
- XmlNodeRef dummyNode = NULL;
+ XmlNodeRef dummyNode = nullptr;
GetIEditor()->GetSettingsManager()->GetMatchingLayoutNames(toolNames, dummyNode, m_importFileStr);
diff --git a/Code/Editor/StartupLogoDialog.cpp b/Code/Editor/StartupLogoDialog.cpp
index 38d733f8df..d9625aff1a 100644
--- a/Code/Editor/StartupLogoDialog.cpp
+++ b/Code/Editor/StartupLogoDialog.cpp
@@ -27,14 +27,14 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
/////////////////////////////////////////////////////////////////////////////
// CStartupLogoDialog dialog
-CStartupLogoDialog* CStartupLogoDialog::s_pLogoWindow = 0;
+CStartupLogoDialog* CStartupLogoDialog::s_pLogoWindow = nullptr;
-CStartupLogoDialog::CStartupLogoDialog(QString versionText, QString richTextCopyrightNotice, QWidget* pParent /*=NULL*/)
+CStartupLogoDialog::CStartupLogoDialog(QString versionText, QString richTextCopyrightNotice, QWidget* pParent /*=nullptr*/)
: QWidget(pParent, Qt::Dialog | Qt::FramelessWindowHint)
, m_ui(new Ui::StartupLogoDialog)
{
m_ui->setupUi(this);
-
+
s_pLogoWindow = this;
m_backgroundImage = QPixmap(QStringLiteral(":/StartupLogoDialog/splashscreen_background_developer_preview.jpg"));
@@ -61,7 +61,7 @@ CStartupLogoDialog::CStartupLogoDialog(QString versionText, QString richTextCopy
CStartupLogoDialog::~CStartupLogoDialog()
{
- s_pLogoWindow = 0;
+ s_pLogoWindow = nullptr;
}
void CStartupLogoDialog::SetText(const char* text)
diff --git a/Code/Editor/StringDlg.h b/Code/Editor/StringDlg.h
index a1ee3908c7..e52cd207d1 100644
--- a/Code/Editor/StringDlg.h
+++ b/Code/Editor/StringDlg.h
@@ -25,7 +25,7 @@ typedef bool (StringDlgPredicate)(QString input);
class StringDlg : public QInputDialog
{
public:
- StringDlg(const QString &title, QWidget* pParent = NULL, bool bFileNameLimitation = false);
+ StringDlg(const QString &title, QWidget* pParent = nullptr, bool bFileNameLimitation = false);
void SetCheckCallback(const std::function& Check) {
m_Check = Check;
diff --git a/Code/Editor/ToolBox.cpp b/Code/Editor/ToolBox.cpp
index 77cb479873..bac02d7460 100644
--- a/Code/Editor/ToolBox.cpp
+++ b/Code/Editor/ToolBox.cpp
@@ -186,7 +186,7 @@ const CToolBoxMacro* CToolBoxManager::GetMacro(int iIndex, bool bToolbox) const
assert(0 <= iIndex && iIndex < m_shelveMacros.size());
return m_shelveMacros[iIndex];
}
- return NULL;
+ return nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -202,7 +202,7 @@ CToolBoxMacro* CToolBoxManager::GetMacro(int iIndex, bool bToolbox)
assert(0 <= iIndex && iIndex < m_shelveMacros.size());
return m_shelveMacros[iIndex];
}
- return NULL;
+ return nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -240,14 +240,14 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in
const int macroCount = m_macros.size();
if (macroCount > ID_TOOL_LAST - ID_TOOL_FIRST + 1)
{
- return NULL;
+ return nullptr;
}
for (size_t i = 0; i < macroCount; ++i)
{
if (QString::compare(m_macros[i]->GetTitle(), title, Qt::CaseInsensitive) == 0)
{
- return NULL;
+ return nullptr;
}
}
@@ -264,7 +264,7 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in
const int shelveMacroCount = m_shelveMacros.size();
if (shelveMacroCount > ID_TOOL_SHELVE_LAST - ID_TOOL_SHELVE_FIRST + 1)
{
- return NULL;
+ return nullptr;
}
CToolBoxMacro* pNewTool = new CToolBoxMacro(title);
@@ -275,7 +275,7 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in
m_shelveMacros.push_back(pNewTool);
return pNewTool;
}
- return NULL;
+ return nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -321,48 +321,19 @@ bool CToolBoxManager::SetMacroTitle(int index, const QString& title, bool bToolb
}
//////////////////////////////////////////////////////////////////////////
-void CToolBoxManager::Load(ActionManager* actionManager)
+void CToolBoxManager::Load([[maybe_unused]] ActionManager* actionManager)
{
Clear();
QString path;
GetSaveFilePath(path);
Load(path, nullptr, true, nullptr);
-
- if (actionManager)
- {
- auto engineSourceAssetPath = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Assets";
- LoadShelves((engineSourceAssetPath / "Editor" / "Scripts").c_str(),
- (engineSourceAssetPath / "Editor" / "Scripts" / "Shelves").c_str(), actionManager);
- }
-}
-
-void CToolBoxManager::LoadShelves(QString scriptPath, QString shelvesPath, ActionManager* actionManager)
-{
- IFileUtil::FileArray files;
- CFileUtil::ScanDirectory(shelvesPath, "*.xml", files);
-
- const int shelfCount = files.size();
- for (int idx = 0; idx < shelfCount; ++idx)
- {
- if (Path::GetExt(files[idx].filename) != "xml")
- {
- continue;
- }
-
- QString shelfName(PathUtil::GetFileName(files[idx].filename.toUtf8().data()));
-
- AmazonToolbar toolbar(shelfName, shelfName);
- Load(shelvesPath + QString("/") + files[idx].filename, &toolbar, false, actionManager);
-
- m_toolbars.push_back(toolbar);
- }
}
void CToolBoxManager::Load(QString xmlpath, AmazonToolbar* pToolbar, bool bToolbox, ActionManager* actionManager)
{
XmlNodeRef toolBoxNode = XmlHelpers::LoadXmlFromFile(xmlpath.toUtf8().data());
- if (toolBoxNode == NULL)
+ if (toolBoxNode == nullptr)
{
return;
}
diff --git a/Code/Editor/ToolBox.h b/Code/Editor/ToolBox.h
index 691b9cd089..eefc74f791 100644
--- a/Code/Editor/ToolBox.h
+++ b/Code/Editor/ToolBox.h
@@ -129,7 +129,6 @@ public:
void Save() const;
// Load macros configuration from registry.
void Load(ActionManager* actionManager = nullptr);
- void LoadShelves(QString scriptPath, QString shelvesPath, ActionManager* actionManager);
//! Get the number of managed macros.
int GetMacroCount(bool bToolbox) const;
@@ -138,7 +137,7 @@ public:
CToolBoxMacro* GetMacro(int iIndex, bool bToolbox);
//! Get the index of a macro from its title.
int GetMacroIndex(const QString& title, bool bToolbox) const;
- //! Creates a new macro in the manager. If the title is duplicate, this returns NULL.
+ //! Creates a new macro in the manager. If the title is duplicate, this returns nullptr.
CToolBoxMacro* NewMacro(const QString& title, bool bToolbox, int* newIdx);
//! Try to change the title of a macro. If the title is duplicate, the change is aborted and this returns false.
bool SetMacroTitle(int index, const QString& title, bool bToolbox);
diff --git a/Code/Editor/ToolsConfigPage.cpp b/Code/Editor/ToolsConfigPage.cpp
index a2328550e0..bae70f0cfe 100644
--- a/Code/Editor/ToolsConfigPage.cpp
+++ b/Code/Editor/ToolsConfigPage.cpp
@@ -109,7 +109,7 @@ private:
QStringList m_iconFiles;
};
-CIconListDialog::CIconListDialog(QWidget* pParent /* = NULL */)
+CIconListDialog::CIconListDialog(QWidget* pParent /* = nullptr */)
: QDialog(pParent)
, m_ui(new Ui::IconListDialog)
{
@@ -498,7 +498,7 @@ CToolsConfigPage::CToolsConfigPage(QWidget* parent)
QKeySequence shortcut(value);
m_ui->m_macroShortcutKey->setKeySequence(shortcut);
}
-
+
if (m_ui->m_macroShortcutKey->keySequence().count() >= 1)
{
m_ui->m_assignShortcut->setEnabled(true);
@@ -703,7 +703,7 @@ void CToolsConfigPage::OnAssignMacroShortcut()
{
auto pShortcutMgr = MainWindow::instance()->GetShortcutManager();
- if (pShortcutMgr == NULL)
+ if (pShortcutMgr == nullptr)
{
return;
}
diff --git a/Code/Editor/TrackView/2DBezierKeyUIControls.cpp b/Code/Editor/TrackView/2DBezierKeyUIControls.cpp
index 1709ea2eac..81cd151373 100644
--- a/Code/Editor/TrackView/2DBezierKeyUIControls.cpp
+++ b/Code/Editor/TrackView/2DBezierKeyUIControls.cpp
@@ -26,19 +26,19 @@ public:
CSmartVariableArray mv_table;
CSmartVariable mv_value;
- virtual void OnCreateVars()
+ void OnCreateVars() override
{
AddVariable(mv_table, "Key Properties");
AddVariable(mv_table, mv_value, "Value");
}
- bool SupportTrackType([[maybe_unused]] const CAnimParamType& paramType, EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const
+ bool SupportTrackType([[maybe_unused]] const CAnimParamType& paramType, EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const override
{
return trackType == eAnimCurveType_BezierFloat;
}
- virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys);
- virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys);
+ bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override;
+ void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override;
- virtual unsigned int GetPriority() const { return 0; }
+ unsigned int GetPriority() const override { return 0; }
static const GUID& GetClassID()
{
diff --git a/Code/Editor/TrackView/AssetBlendKeyUIControls.cpp b/Code/Editor/TrackView/AssetBlendKeyUIControls.cpp
index a8e24cf58d..038a9d9780 100644
--- a/Code/Editor/TrackView/AssetBlendKeyUIControls.cpp
+++ b/Code/Editor/TrackView/AssetBlendKeyUIControls.cpp
@@ -41,7 +41,7 @@ public:
CSmartVariable mv_blendInTime;
CSmartVariable mv_blendOutTime;
- virtual void OnCreateVars()
+ void OnCreateVars() override
{
// Init to an invalid id
AZ::Data::AssetId assetId;
@@ -62,15 +62,15 @@ public:
mv_timeScale->SetLimits(0.001f, 100.f);
}
- bool SupportTrackType([[maybe_unused]] const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, AnimValueType valueType) const
+ bool SupportTrackType([[maybe_unused]] const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, AnimValueType valueType) const override
{
return valueType == AnimValueType::AssetBlend;
}
- virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys);
- virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys);
+ bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override;
+ void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override;
- virtual unsigned int GetPriority() const { return 1; }
+ unsigned int GetPriority() const override { return 1; }
static const GUID& GetClassID()
{
diff --git a/Code/Editor/TrackView/CaptureKeyUIControls.cpp b/Code/Editor/TrackView/CaptureKeyUIControls.cpp
index 821066d4a3..e6d88a6cd6 100644
--- a/Code/Editor/TrackView/CaptureKeyUIControls.cpp
+++ b/Code/Editor/TrackView/CaptureKeyUIControls.cpp
@@ -27,7 +27,7 @@ public:
CSmartVariable mv_folder;
CSmartVariable mv_once;
- virtual void OnCreateVars()
+ void OnCreateVars() override
{
mv_duration.GetVar()->SetLimits(0, 100000.0f);
mv_timeStep.GetVar()->SetLimits(0.001f, 1.0f);
@@ -39,14 +39,14 @@ public:
AddVariable(mv_table, mv_folder, "Output Folder");
AddVariable(mv_table, mv_once, "Just one frame?");
}
- bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const
+ bool SupportTrackType(const CAnimParamType& paramType, [[maybe_unused]] EAnimCurveType trackType, [[maybe_unused]] AnimValueType valueType) const override
{
return paramType == AnimParamType::Capture;
}
- virtual bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys);
- virtual void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys);
+ bool OnKeySelectionChange(CTrackViewKeyBundle& selectedKeys) override;
+ void OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys) override;
- virtual unsigned int GetPriority() const { return 1; }
+ unsigned int GetPriority() const override { return 1; }
static const GUID& GetClassID()
{
diff --git a/Code/Editor/TrackView/CharacterKeyUIControls.cpp b/Code/Editor/TrackView/CharacterKeyUIControls.cpp
index 9ff41f1275..24bfd9f680 100644
--- a/Code/Editor/TrackView/CharacterKeyUIControls.cpp
+++ b/Code/Editor/TrackView/CharacterKeyUIControls.cpp
@@ -33,7 +33,7 @@ public:
CSmartVariable