| | 1 | | using DCL; |
| | 2 | | using DCL.Components; |
| | 3 | | using DCL.Configuration; |
| | 4 | | using DCL.Controllers; |
| | 5 | | using DCL.Helpers; |
| | 6 | | using DCL.Interface; |
| | 7 | | using DCL.Models; |
| | 8 | | using Newtonsoft.Json; |
| | 9 | | using System; |
| | 10 | | using System.Collections; |
| | 11 | | using System.Collections.Generic; |
| | 12 | | using UnityEngine; |
| | 13 | | using Environment = DCL.Environment; |
| | 14 | |
|
| | 15 | | public class BuilderInWorldEntityHandler : BIWController |
| | 16 | | { |
| | 17 | | [Header("Design variables")] |
| 198 | 18 | | public float duplicateOffset = 2f; |
| | 19 | |
|
| | 20 | | [Header("Prefab References")] |
| | 21 | | public BIWOutlinerController outlinerController; |
| | 22 | |
|
| | 23 | | public BIWModeController biwModeController; |
| | 24 | | public ActionController actionController; |
| | 25 | | public BuilderInWorldBridge builderInWorldBridge; |
| | 26 | | public BIWCreatorController biwCreatorController; |
| | 27 | |
|
| | 28 | | [Header("Build References")] |
| | 29 | | public Material editMaterial; |
| | 30 | |
|
| | 31 | | [SerializeField] internal LayerMask layerToRaycast; |
| | 32 | |
|
| | 33 | | [Header("InputActions")] |
| | 34 | | [SerializeField] |
| | 35 | | internal InputAction_Trigger hideSelectedEntitiesAction; |
| | 36 | |
|
| | 37 | | [SerializeField] |
| | 38 | | internal InputAction_Trigger showAllEntitiesAction; |
| | 39 | |
|
| 198 | 40 | | private Dictionary<string, DCLBuilderInWorldEntity> convertedEntities = new Dictionary<string, DCLBuilderInWorldEnti |
| 198 | 41 | | private List<DCLBuilderInWorldEntity> selectedEntities = new List<DCLBuilderInWorldEntity>(); |
| | 42 | |
|
| | 43 | | private BuilderInWorldMode currentActiveMode; |
| | 44 | | private bool isMultiSelectionActive = false; |
| | 45 | | private bool isSecondayClickPressed = false; |
| | 46 | |
|
| | 47 | | private float lastTransformReportTime; |
| | 48 | |
|
| 198 | 49 | | private List<string> entityNameList = new List<string>(); |
| | 50 | |
|
| | 51 | | private InputAction_Trigger.Triggered hideSelectedEntitiesDelegate; |
| | 52 | | private InputAction_Trigger.Triggered showAllEntitiesDelegate; |
| | 53 | |
|
| | 54 | | private BuildModeHUDController hudController; |
| | 55 | |
|
| | 56 | | public event Action<DCLBuilderInWorldEntity> OnEntityDeselected; |
| | 57 | | public event Action OnEntitySelected; |
| | 58 | | public event Action<List<DCLBuilderInWorldEntity>> OnDeleteSelectedEntities; |
| | 59 | | public event Action<DCLBuilderInWorldEntity> OnEntityDeleted; |
| | 60 | |
|
| | 61 | | private DCLBuilderInWorldEntity lastClickedEntity; |
| | 62 | | private float lastTimeEntityClicked; |
| | 63 | |
|
| | 64 | | private void Start() |
| | 65 | | { |
| 0 | 66 | | hideSelectedEntitiesDelegate = (action) => ChangeShowStateSelectedEntities(); |
| 0 | 67 | | showAllEntitiesDelegate = (action) => ShowAllEntities(); |
| | 68 | |
|
| 0 | 69 | | hideSelectedEntitiesAction.OnTriggered += hideSelectedEntitiesDelegate; |
| 0 | 70 | | showAllEntitiesAction.OnTriggered += showAllEntitiesDelegate; |
| 0 | 71 | | } |
| | 72 | |
|
| | 73 | | public override void Init() |
| | 74 | | { |
| 42 | 75 | | base.Init(); |
| 42 | 76 | | if (HUDController.i.builderInWorldMainHud != null) |
| | 77 | | { |
| 0 | 78 | | hudController = HUDController.i.builderInWorldMainHud; |
| 0 | 79 | | hudController.OnEntityDelete += DeleteSingleEntity; |
| 0 | 80 | | hudController.OnDuplicateSelectedAction += DuplicateSelectedEntitiesInput; |
| 0 | 81 | | hudController.OnDeleteSelectedAction += DeleteSelectedEntitiesInput; |
| 0 | 82 | | hudController.OnEntityClick += ChangeEntitySelectionFromList; |
| 0 | 83 | | hudController.OnEntityLock += ChangeEntityLockStatus; |
| 0 | 84 | | hudController.OnEntityChangeVisibility += ChangeEntityVisibilityStatus; |
| 0 | 85 | | hudController.OnEntityRename += SetEntityName; |
| 0 | 86 | | hudController.OnEntitySmartItemComponentUpdate += UpdateSmartItemComponentInKernel; |
| | 87 | | } |
| | 88 | |
|
| 42 | 89 | | actionController.OnRedo += ReSelectEntities; |
| 42 | 90 | | actionController.OnUndo += ReSelectEntities; |
| | 91 | |
|
| 42 | 92 | | BuilderInWorldInputWrapper.OnMouseDown += OnInputMouseDown; |
| 42 | 93 | | BuilderInWorldInputWrapper.OnMouseUp += OnInputMouseUp; |
| | 94 | |
|
| 42 | 95 | | DCL.Environment.i.world.sceneBoundsChecker.OnEntityBoundsCheckerStatusChanged += ChangeEntityBoundsCheckerStatus |
| 42 | 96 | | } |
| | 97 | |
|
| | 98 | | private void OnInputMouseDown(int buttonId, Vector3 mousePosition) |
| | 99 | | { |
| 0 | 100 | | if (buttonId == 1) |
| 0 | 101 | | isSecondayClickPressed = true; |
| 0 | 102 | | } |
| | 103 | |
|
| | 104 | | private void OnInputMouseUp(int buttonId, Vector3 mousePosition) |
| | 105 | | { |
| 0 | 106 | | if (buttonId == 1) |
| 0 | 107 | | isSecondayClickPressed = false; |
| 0 | 108 | | } |
| | 109 | |
|
| | 110 | | private void OnDestroy() |
| | 111 | | { |
| 0 | 112 | | DestroyCollidersForAllEntities(); |
| | 113 | |
|
| 0 | 114 | | actionController.OnRedo -= ReSelectEntities; |
| 0 | 115 | | actionController.OnUndo -= ReSelectEntities; |
| | 116 | |
|
| 0 | 117 | | hideSelectedEntitiesAction.OnTriggered -= hideSelectedEntitiesDelegate; |
| 0 | 118 | | showAllEntitiesAction.OnTriggered -= showAllEntitiesDelegate; |
| | 119 | |
|
| 0 | 120 | | DCL.Environment.i.world.sceneBoundsChecker.OnEntityBoundsCheckerStatusChanged -= ChangeEntityBoundsCheckerStatus |
| | 121 | |
|
| 0 | 122 | | BuilderInWorldInputWrapper.OnMouseDown -= OnInputMouseDown; |
| 0 | 123 | | BuilderInWorldInputWrapper.OnMouseUp -= OnInputMouseUp; |
| | 124 | |
|
| 0 | 125 | | if (hudController != null) |
| | 126 | | { |
| 0 | 127 | | hudController.OnEntityDelete -= DeleteSingleEntity; |
| 0 | 128 | | hudController.OnDuplicateSelectedAction -= DuplicateSelectedEntitiesInput; |
| 0 | 129 | | hudController.OnDeleteSelectedAction -= DeleteSelectedEntitiesInput; |
| 0 | 130 | | hudController.OnEntityClick -= ChangeEntitySelectionFromList; |
| 0 | 131 | | hudController.OnEntityLock -= ChangeEntityLockStatus; |
| 0 | 132 | | hudController.OnEntityChangeVisibility -= ChangeEntityVisibilityStatus; |
| 0 | 133 | | hudController.OnEntityChangeVisibility -= ChangeEntityVisibilityStatus; |
| 0 | 134 | | hudController.OnEntityRename -= SetEntityName; |
| 0 | 135 | | hudController.OnEntitySmartItemComponentUpdate -= UpdateSmartItemComponentInKernel; |
| | 136 | | } |
| 0 | 137 | | } |
| | 138 | |
|
| | 139 | | protected override void FrameUpdate() |
| | 140 | | { |
| 0 | 141 | | base.FrameUpdate(); |
| | 142 | |
|
| 0 | 143 | | if (selectedEntities.Count == 0) |
| 0 | 144 | | return; |
| 0 | 145 | | if ((DCLTime.realtimeSinceStartup - lastTransformReportTime) <= BuilderInWorldSettings.ENTITY_POSITION_REPORTING |
| 0 | 146 | | return; |
| | 147 | |
|
| 0 | 148 | | ReportTransform(); |
| 0 | 149 | | } |
| | 150 | |
|
| | 151 | | public void ReportTransform(bool forceReport = false) |
| | 152 | | { |
| 0 | 153 | | foreach (DCLBuilderInWorldEntity entity in selectedEntities) |
| | 154 | | { |
| 0 | 155 | | if (!entity.HasMovedSinceLastReport() && |
| | 156 | | !entity.HasScaledSinceLastReport() && |
| | 157 | | !entity.HasRotatedSinceLastReport() && |
| | 158 | | !forceReport) |
| 0 | 159 | | return; |
| 0 | 160 | | builderInWorldBridge.EntityTransformReport(entity.rootEntity, sceneToEdit); |
| 0 | 161 | | entity.PositionReported(); |
| 0 | 162 | | entity.ScaleReported(); |
| 0 | 163 | | entity.RotationReported(); |
| | 164 | | } |
| | 165 | |
|
| 0 | 166 | | lastTransformReportTime = DCLTime.realtimeSinceStartup; |
| 0 | 167 | | } |
| | 168 | |
|
| 0 | 169 | | public List<DCLBuilderInWorldEntity> GetSelectedEntityList() { return selectedEntities; } |
| | 170 | |
|
| 0 | 171 | | public bool IsAnyEntitySelected() { return selectedEntities.Count > 0; } |
| | 172 | |
|
| | 173 | | public void SetActiveMode(BuilderInWorldMode buildMode) |
| | 174 | | { |
| 5 | 175 | | currentActiveMode = buildMode; |
| 5 | 176 | | DeselectEntities(); |
| 5 | 177 | | } |
| | 178 | |
|
| 0 | 179 | | public void SetMultiSelectionActive(bool isActive) { isMultiSelectionActive = isActive; } |
| | 180 | |
|
| | 181 | | public override void EnterEditMode(ParcelScene scene) |
| | 182 | | { |
| 39 | 183 | | base.EnterEditMode(scene); |
| | 184 | |
|
| 39 | 185 | | SetupAllEntities(); |
| 39 | 186 | | EntityListChanged(); |
| 39 | 187 | | CheckErrorOnEntities(); |
| 39 | 188 | | } |
| | 189 | |
|
| | 190 | | private void CheckErrorOnEntities() |
| | 191 | | { |
| 114 | 192 | | foreach (DCLBuilderInWorldEntity entity in convertedEntities.Values) |
| | 193 | | { |
| 18 | 194 | | entity.CheckErrors(); |
| 18 | 195 | | if (entity.hasMissingCatalogItemError) |
| 18 | 196 | | biwCreatorController.CreateErrorOnEntity(entity); |
| | 197 | | } |
| 39 | 198 | | } |
| | 199 | |
|
| | 200 | | public bool IsPointerInSelectedEntity() |
| | 201 | | { |
| 0 | 202 | | DCLBuilderInWorldEntity entityInPointer = GetEntityOnPointer(); |
| 0 | 203 | | if (entityInPointer == null) |
| 0 | 204 | | return false; |
| | 205 | |
|
| 0 | 206 | | foreach (DCLBuilderInWorldEntity entity in selectedEntities) |
| | 207 | | { |
| 0 | 208 | | if (entityInPointer == entity) |
| 0 | 209 | | return true; |
| | 210 | | } |
| | 211 | |
|
| 0 | 212 | | return false; |
| 0 | 213 | | } |
| | 214 | |
|
| | 215 | | private void DeleteSelectedEntitiesInput() |
| | 216 | | { |
| 0 | 217 | | if (selectedEntities.Count > 0) |
| 0 | 218 | | DeleteSelectedEntities(); |
| 0 | 219 | | } |
| | 220 | |
|
| | 221 | | private void DuplicateSelectedEntitiesInput() |
| | 222 | | { |
| 0 | 223 | | if (selectedEntities.Count <= 0 || isSecondayClickPressed) |
| 0 | 224 | | return; |
| | 225 | |
|
| 0 | 226 | | DuplicateSelectedEntities(); |
| 0 | 227 | | } |
| | 228 | |
|
| | 229 | | public override void ExitEditMode() |
| | 230 | | { |
| 0 | 231 | | base.ExitEditMode(); |
| 0 | 232 | | DeselectEntities(); |
| | 233 | |
|
| 0 | 234 | | foreach (DCLBuilderInWorldEntity entity in convertedEntities.Values) |
| | 235 | | { |
| 0 | 236 | | entity.Dispose(); |
| | 237 | | } |
| | 238 | |
|
| 0 | 239 | | convertedEntities.Clear(); |
| 0 | 240 | | } |
| | 241 | |
|
| | 242 | | private void ChangeEntitySelectionFromList(DCLBuilderInWorldEntity entityToEdit) |
| | 243 | | { |
| 0 | 244 | | if (!selectedEntities.Contains(entityToEdit)) |
| 0 | 245 | | SelectFromList(entityToEdit); |
| | 246 | | else |
| 0 | 247 | | DeselectEntity(entityToEdit); |
| 0 | 248 | | } |
| | 249 | |
|
| | 250 | | private void SelectFromList(DCLBuilderInWorldEntity entityToEdit) |
| | 251 | | { |
| 0 | 252 | | if (!isMultiSelectionActive) |
| 0 | 253 | | DeselectEntities(); |
| 0 | 254 | | if (SelectEntity(entityToEdit)) |
| | 255 | | { |
| 0 | 256 | | if (!isMultiSelectionActive) |
| 0 | 257 | | outlinerController.OutlineEntity(entityToEdit); |
| | 258 | | else |
| 0 | 259 | | outlinerController.OutlineEntities(selectedEntities); |
| | 260 | | } |
| 0 | 261 | | } |
| | 262 | |
|
| | 263 | | public void DeselectEntity(DCLBuilderInWorldEntity entity) |
| | 264 | | { |
| 10 | 265 | | if (!selectedEntities.Contains(entity)) |
| 0 | 266 | | return; |
| | 267 | |
|
| 10 | 268 | | entity.Deselect(); |
| | 269 | |
|
| 10 | 270 | | outlinerController.CancelEntityOutline(entity); |
| 10 | 271 | | selectedEntities.Remove(entity); |
| 10 | 272 | | hudController?.UpdateEntitiesSelection(selectedEntities.Count); |
| 10 | 273 | | currentActiveMode?.EntityDeselected(entity); |
| 10 | 274 | | if (selectedEntities.Count <= 0 && |
| | 275 | | hudController != null) |
| 0 | 276 | | hudController.HideEntityInformation(); |
| | 277 | |
|
| 10 | 278 | | OnEntityDeselected?.Invoke(entity); |
| 0 | 279 | | } |
| | 280 | |
|
| | 281 | | public void DeselectEntities() |
| | 282 | | { |
| 73 | 283 | | if (selectedEntities.Count <= 0) |
| 64 | 284 | | return; |
| | 285 | |
|
| 9 | 286 | | int amountToDeselect = selectedEntities.Count; |
| 36 | 287 | | for (int i = 0; i < amountToDeselect; i++) |
| | 288 | | { |
| 9 | 289 | | DeselectEntity(selectedEntities[0]); |
| | 290 | | } |
| | 291 | |
|
| 9 | 292 | | currentActiveMode?.OnDeselectedEntities(); |
| | 293 | |
|
| 9 | 294 | | Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); |
| 9 | 295 | | } |
| | 296 | |
|
| | 297 | | public DCLBuilderInWorldEntity GetEntityOnPointer() |
| | 298 | | { |
| 0 | 299 | | Camera camera = Camera.main; |
| | 300 | |
|
| 0 | 301 | | if (camera == null) |
| 0 | 302 | | return null; |
| | 303 | |
|
| | 304 | | RaycastHit hit; |
| 0 | 305 | | UnityEngine.Ray ray = camera.ScreenPointToRay(biwModeController.GetMousePosition()); |
| 0 | 306 | | float distanceToSelect = biwModeController.GetMaxDistanceToSelectEntities(); |
| | 307 | |
|
| 0 | 308 | | if (Physics.Raycast(ray, out hit, distanceToSelect, layerToRaycast)) |
| | 309 | | { |
| 0 | 310 | | string entityID = hit.collider.gameObject.name; |
| | 311 | |
|
| 0 | 312 | | if (sceneToEdit.entities.ContainsKey(entityID)) |
| | 313 | | { |
| 0 | 314 | | return GetConvertedEntity(sceneToEdit.entities[entityID]); |
| | 315 | | } |
| | 316 | | } |
| | 317 | |
|
| 0 | 318 | | return null; |
| | 319 | | } |
| | 320 | |
|
| | 321 | | public void EntityClicked(DCLBuilderInWorldEntity entityToSelect) |
| | 322 | | { |
| 0 | 323 | | if (entityToSelect != null) |
| | 324 | | { |
| 0 | 325 | | if (!isMultiSelectionActive) |
| 0 | 326 | | DeselectEntities(); |
| | 327 | |
|
| 0 | 328 | | if (!entityToSelect.IsLocked) |
| 0 | 329 | | ChangeEntitySelectStatus(entityToSelect); |
| | 330 | |
|
| 0 | 331 | | if (entityToSelect == lastClickedEntity && (lastTimeEntityClicked + BuilderInWorldSettings.MOUSE_MS_DOUBLE_C |
| 0 | 332 | | biwModeController.EntityDoubleClick(entityToSelect); |
| | 333 | |
|
| 0 | 334 | | lastClickedEntity = entityToSelect; |
| 0 | 335 | | lastTimeEntityClicked = Time.realtimeSinceStartup; |
| 0 | 336 | | } |
| 0 | 337 | | else if (!isMultiSelectionActive) |
| | 338 | | { |
| 0 | 339 | | DeselectEntities(); |
| | 340 | | } |
| 0 | 341 | | } |
| | 342 | |
|
| | 343 | | void ReSelectEntities() |
| | 344 | | { |
| 46 | 345 | | List<DCLBuilderInWorldEntity> entitiesToReselect = new List<DCLBuilderInWorldEntity>(); |
| 92 | 346 | | foreach (DCLBuilderInWorldEntity entity in selectedEntities) |
| | 347 | | { |
| 0 | 348 | | entitiesToReselect.Add(entity); |
| | 349 | | } |
| | 350 | |
|
| 46 | 351 | | DeselectEntities(); |
| | 352 | |
|
| 92 | 353 | | foreach (DCLBuilderInWorldEntity entity in entitiesToReselect) |
| | 354 | | { |
| 0 | 355 | | SelectEntity(entity); |
| | 356 | | } |
| 46 | 357 | | } |
| | 358 | |
|
| | 359 | | void ChangeEntitySelectStatus(DCLBuilderInWorldEntity entityCliked) |
| | 360 | | { |
| 0 | 361 | | if (entityCliked.IsSelected) |
| 0 | 362 | | DeselectEntity(entityCliked); |
| | 363 | | else |
| 0 | 364 | | SelectEntity(entityCliked); |
| 0 | 365 | | } |
| | 366 | |
|
| | 367 | | public void CancelSelection() |
| | 368 | | { |
| 0 | 369 | | if (selectedEntities.Count == 0) |
| 0 | 370 | | return; |
| | 371 | |
|
| 0 | 372 | | DestroyLastCreatedEntities(); |
| 0 | 373 | | DeselectEntities(); |
| 0 | 374 | | } |
| | 375 | |
|
| | 376 | | public void ChangeLockStateSelectedEntities() |
| | 377 | | { |
| 0 | 378 | | foreach (DCLBuilderInWorldEntity entity in selectedEntities) |
| | 379 | | { |
| 0 | 380 | | entity.ToggleLockStatus(); |
| | 381 | | } |
| | 382 | |
|
| 0 | 383 | | DeselectEntities(); |
| 0 | 384 | | } |
| | 385 | |
|
| | 386 | | public void ShowAllEntities() |
| | 387 | | { |
| 0 | 388 | | foreach (DCLBuilderInWorldEntity entity in convertedEntities.Values) |
| | 389 | | { |
| 0 | 390 | | if (!entity.IsVisible) |
| 0 | 391 | | entity.ToggleShowStatus(); |
| | 392 | | } |
| 0 | 393 | | } |
| | 394 | |
|
| | 395 | | public void ChangeShowStateSelectedEntities() |
| | 396 | | { |
| 0 | 397 | | List<DCLBuilderInWorldEntity> entitiesToHide = new List<DCLBuilderInWorldEntity>(selectedEntities); |
| | 398 | |
|
| 0 | 399 | | foreach (DCLBuilderInWorldEntity entity in entitiesToHide) |
| | 400 | | { |
| 0 | 401 | | if (entity.IsVisible && entity.IsSelected) |
| 0 | 402 | | DeselectEntity(entity); |
| 0 | 403 | | entity.ToggleShowStatus(); |
| | 404 | | } |
| 0 | 405 | | } |
| | 406 | |
|
| | 407 | | public void Select(IDCLEntity entity) |
| | 408 | | { |
| 8 | 409 | | DCLBuilderInWorldEntity entityEditable = GetConvertedEntity(entity); |
| 8 | 410 | | if (entityEditable == null) |
| 0 | 411 | | return; |
| | 412 | |
|
| 8 | 413 | | SelectEntity(entityEditable, true); |
| 8 | 414 | | } |
| | 415 | |
|
| | 416 | | public bool SelectEntity(DCLBuilderInWorldEntity entityEditable, bool selectedFromCatalog = false) |
| | 417 | | { |
| 11 | 418 | | if (entityEditable.IsLocked) |
| 0 | 419 | | return false; |
| | 420 | |
|
| 11 | 421 | | if (entityEditable.IsSelected) |
| 0 | 422 | | return false; |
| | 423 | |
|
| 11 | 424 | | entityEditable.Select(); |
| | 425 | |
|
| 11 | 426 | | selectedEntities.Add(entityEditable); |
| | 427 | |
|
| 11 | 428 | | currentActiveMode?.SelectedEntity(entityEditable); |
| | 429 | |
|
| 11 | 430 | | if (HUDController.i.builderInWorldMainHud != null) |
| | 431 | | { |
| 0 | 432 | | hudController.UpdateEntitiesSelection(selectedEntities.Count); |
| 0 | 433 | | hudController.ShowEntityInformation(selectedFromCatalog); |
| 0 | 434 | | hudController.EntityInformationSetEntity(entityEditable, sceneToEdit); |
| | 435 | | } |
| | 436 | |
|
| 11 | 437 | | outlinerController.CancelAllOutlines(); |
| | 438 | |
|
| 11 | 439 | | OnEntitySelected?.Invoke(); |
| | 440 | |
|
| 11 | 441 | | return true; |
| | 442 | | } |
| | 443 | |
|
| | 444 | | public List<DCLBuilderInWorldEntity> GetAllVoxelsEntities() |
| | 445 | | { |
| 0 | 446 | | List<DCLBuilderInWorldEntity> voxelEntities = new List<DCLBuilderInWorldEntity>(); |
| 0 | 447 | | foreach (DCLBuilderInWorldEntity entity in convertedEntities.Values) |
| | 448 | | { |
| 0 | 449 | | if (entity.rootEntity.scene == sceneToEdit && entity.isVoxel) |
| 0 | 450 | | voxelEntities.Add(entity); |
| | 451 | | } |
| | 452 | |
|
| 0 | 453 | | return voxelEntities; |
| | 454 | | } |
| | 455 | |
|
| | 456 | | public List<DCLBuilderInWorldEntity> GetAllEntitiesFromCurrentScene() |
| | 457 | | { |
| 29 | 458 | | List<DCLBuilderInWorldEntity> entities = new List<DCLBuilderInWorldEntity>(); |
| 138 | 459 | | foreach (DCLBuilderInWorldEntity entity in convertedEntities.Values) |
| | 460 | | { |
| 40 | 461 | | if (entity.rootEntity.scene == sceneToEdit) |
| 40 | 462 | | entities.Add(entity); |
| | 463 | | } |
| | 464 | |
|
| 29 | 465 | | return entities; |
| | 466 | | } |
| | 467 | |
|
| | 468 | | public DCLBuilderInWorldEntity GetConvertedEntity(string entityId) |
| | 469 | | { |
| 6 | 470 | | if (convertedEntities.ContainsKey(GetConvertedUniqueKeyForEntity(entityId))) |
| 6 | 471 | | return convertedEntities[GetConvertedUniqueKeyForEntity(entityId)]; |
| | 472 | |
|
| 0 | 473 | | return null; |
| | 474 | | } |
| | 475 | |
|
| | 476 | | public DCLBuilderInWorldEntity GetConvertedEntity(IDCLEntity entity) |
| | 477 | | { |
| 12 | 478 | | if (convertedEntities.ContainsKey(GetConvertedUniqueKeyForEntity(entity))) |
| 12 | 479 | | return convertedEntities[GetConvertedUniqueKeyForEntity(entity)]; |
| | 480 | |
|
| 0 | 481 | | return null; |
| | 482 | | } |
| | 483 | |
|
| | 484 | | public void DuplicateSelectedEntities() |
| | 485 | | { |
| 1 | 486 | | BuildInWorldCompleteAction buildAction = new BuildInWorldCompleteAction(); |
| 1 | 487 | | buildAction.actionType = BuildInWorldCompleteAction.ActionType.CREATE; |
| | 488 | |
|
| 1 | 489 | | List<BuilderInWorldEntityAction> entityActionList = new List<BuilderInWorldEntityAction>(); |
| 1 | 490 | | List<DCLBuilderInWorldEntity> entitiesToDuplicate = new List<DCLBuilderInWorldEntity>(selectedEntities); |
| 1 | 491 | | DeselectEntities(); |
| | 492 | |
|
| 4 | 493 | | foreach (DCLBuilderInWorldEntity entityToDuplicate in entitiesToDuplicate) |
| | 494 | | { |
| 1 | 495 | | if (entityToDuplicate.isNFT) |
| | 496 | | continue; |
| | 497 | |
|
| 1 | 498 | | var entityDuplicated = DuplicateEntity(entityToDuplicate); |
| 1 | 499 | | BuilderInWorldEntityAction builderInWorldEntityAction = new BuilderInWorldEntityAction(entityDuplicated.root |
| 1 | 500 | | entityActionList.Add(builderInWorldEntityAction); |
| 1 | 501 | | SelectEntity(entityDuplicated); |
| | 502 | | } |
| | 503 | |
|
| 1 | 504 | | currentActiveMode?.SetDuplicationOffset(duplicateOffset); |
| | 505 | |
|
| 1 | 506 | | buildAction.CreateActionType(entityActionList, BuildInWorldCompleteAction.ActionType.CREATE); |
| 1 | 507 | | actionController.AddAction(buildAction); |
| 1 | 508 | | } |
| | 509 | |
|
| | 510 | | public DCLBuilderInWorldEntity DuplicateEntity(DCLBuilderInWorldEntity entityToDuplicate) |
| | 511 | | { |
| 2 | 512 | | IDCLEntity entity = SceneUtils.DuplicateEntity(sceneToEdit, entityToDuplicate.rootEntity); |
| | 513 | | //Note: If the entity contains the name component or DCLLockedOnEdit, we don't want to copy them |
| 2 | 514 | | entity.RemoveSharedComponent(typeof(DCLName), false); |
| 2 | 515 | | entity.RemoveSharedComponent(typeof(DCLLockedOnEdit), false); |
| | 516 | |
|
| 2 | 517 | | BuilderInWorldUtils.CopyGameObjectStatus(entityToDuplicate.gameObject, entity.gameObject, false, false); |
| 2 | 518 | | DCLBuilderInWorldEntity convertedEntity = SetupEntityToEdit(entity); |
| | 519 | |
|
| 2 | 520 | | NotifyEntityIsCreated(entity); |
| 2 | 521 | | EntityListChanged(); |
| 2 | 522 | | return convertedEntity; |
| | 523 | | } |
| | 524 | |
|
| | 525 | | public IDCLEntity CreateEntityFromJSON(string entityJson) |
| | 526 | | { |
| 2 | 527 | | EntityData data = BuilderInWorldUtils.ConvertJSONToEntityData(entityJson); |
| | 528 | |
|
| 2 | 529 | | IDCLEntity newEntity = sceneToEdit.CreateEntity(data.entityId); |
| | 530 | |
|
| | 531 | |
|
| 2 | 532 | | if (data.transformComponent != null) |
| | 533 | | { |
| 0 | 534 | | DCLTransform.model.position = data.transformComponent.position; |
| 0 | 535 | | DCLTransform.model.rotation = Quaternion.Euler(data.transformComponent.rotation); |
| 0 | 536 | | DCLTransform.model.scale = data.transformComponent.scale; |
| 0 | 537 | | sceneToEdit.EntityComponentCreateOrUpdateWithModel(newEntity.entityId, CLASS_ID_COMPONENT.TRANSFORM, DCLTran |
| | 538 | | } |
| | 539 | |
|
| 4 | 540 | | foreach (ProtocolV2.GenericComponent component in data.components) |
| | 541 | | { |
| 0 | 542 | | sceneToEdit.EntityComponentCreateOrUpdateWithModel(newEntity.entityId, (CLASS_ID_COMPONENT) component.compon |
| | 543 | | } |
| | 544 | |
|
| 4 | 545 | | foreach (ProtocolV2.GenericComponent component in data.sharedComponents) |
| | 546 | | { |
| 0 | 547 | | sceneToEdit.SharedComponentAttach(newEntity.entityId, component.classId); |
| | 548 | | } |
| | 549 | |
|
| 2 | 550 | | if (data.nftComponent != null) |
| | 551 | | { |
| 0 | 552 | | NFTShape nftShape = (NFTShape) sceneToEdit.SharedComponentCreate(data.nftComponent.id, Convert.ToInt32(CLASS |
| 0 | 553 | | nftShape.model = new NFTShape.Model(); |
| 0 | 554 | | nftShape.model.color = data.nftComponent.color.ToColor(); |
| 0 | 555 | | nftShape.model.src = data.nftComponent.src; |
| 0 | 556 | | nftShape.model.assetId = data.nftComponent.assetId; |
| | 557 | |
|
| 0 | 558 | | sceneToEdit.SharedComponentAttach(newEntity.entityId, nftShape.id); |
| | 559 | | } |
| | 560 | |
|
| 2 | 561 | | var convertedEntity = SetupEntityToEdit(newEntity, true); |
| | 562 | |
|
| 2 | 563 | | if (convertedEntity.rootEntity.TryGetSharedComponent(CLASS_ID.GLTF_SHAPE, out var gltfComponent)) |
| 0 | 564 | | gltfComponent.CallWhenReady(convertedEntity.ShapeLoadFinish); |
| | 565 | |
|
| 2 | 566 | | if (convertedEntity.rootEntity.TryGetSharedComponent(CLASS_ID.NFT_SHAPE, out var nftComponent)) |
| 0 | 567 | | nftComponent.CallWhenReady(convertedEntity.ShapeLoadFinish); |
| | 568 | |
|
| | 569 | |
|
| 2 | 570 | | biwCreatorController.CreateLoadingObject(convertedEntity); |
| 2 | 571 | | EntityListChanged(); |
| | 572 | |
|
| 2 | 573 | | return newEntity; |
| | 574 | | } |
| | 575 | |
|
| | 576 | | public DCLBuilderInWorldEntity CreateEmptyEntity(ParcelScene parcelScene, Vector3 entryPoint, Vector3 editionGOPosit |
| | 577 | | { |
| 26 | 578 | | IDCLEntity newEntity = parcelScene.CreateEntity(Guid.NewGuid().ToString()); |
| | 579 | |
|
| 26 | 580 | | DCLTransform.model.position = WorldStateUtils.ConvertUnityToScenePosition(entryPoint, parcelScene); |
| | 581 | |
|
| 26 | 582 | | Vector3 pointToLookAt = Camera.main.transform.position; |
| 26 | 583 | | pointToLookAt.y = editionGOPosition.y; |
| 26 | 584 | | Quaternion lookOnLook = Quaternion.LookRotation(editionGOPosition - pointToLookAt); |
| | 585 | |
|
| 26 | 586 | | DCLTransform.model.rotation = lookOnLook; |
| 26 | 587 | | DCLTransform.model.scale = newEntity.gameObject.transform.lossyScale; |
| | 588 | |
|
| 26 | 589 | | parcelScene.EntityComponentCreateOrUpdateWithModel(newEntity.entityId, CLASS_ID_COMPONENT.TRANSFORM, DCLTransfor |
| | 590 | |
|
| 26 | 591 | | DCLBuilderInWorldEntity convertedEntity = SetupEntityToEdit(newEntity, true); |
| 26 | 592 | | hudController?.UpdateSceneLimitInfo(); |
| | 593 | |
|
| 26 | 594 | | if (notifyEntityList) |
| 11 | 595 | | EntityListChanged(); |
| 26 | 596 | | return convertedEntity; |
| | 597 | | } |
| | 598 | |
|
| | 599 | | private void SetupAllEntities() |
| | 600 | | { |
| 114 | 601 | | foreach (IDCLEntity entity in sceneToEdit.entities.Values) |
| | 602 | | { |
| 18 | 603 | | SetupEntityToEdit(entity); |
| | 604 | | } |
| 39 | 605 | | } |
| | 606 | |
|
| | 607 | | public void DestroyLastCreatedEntities() |
| | 608 | | { |
| 0 | 609 | | List<DCLBuilderInWorldEntity> entitiesToRemove = new List<DCLBuilderInWorldEntity>(); |
| 0 | 610 | | foreach (DCLBuilderInWorldEntity entity in selectedEntities) |
| | 611 | | { |
| 0 | 612 | | if (entity.IsSelected && entity.IsNew) |
| 0 | 613 | | entitiesToRemove.Add(entity); |
| | 614 | | } |
| | 615 | |
|
| 0 | 616 | | if (entitiesToRemove.Count == 0) |
| 0 | 617 | | return; |
| | 618 | |
|
| 0 | 619 | | biwModeController.UndoEditionGOLastStep(); |
| | 620 | |
|
| 0 | 621 | | foreach (DCLBuilderInWorldEntity entity in entitiesToRemove) |
| | 622 | | { |
| 0 | 623 | | DeleteEntity(entity, false); |
| | 624 | | } |
| | 625 | |
|
| 0 | 626 | | hudController.HideEntityInformation(); |
| 0 | 627 | | } |
| | 628 | |
|
| | 629 | | public void EntityListChanged() |
| | 630 | | { |
| 77 | 631 | | if (HUDController.i.builderInWorldMainHud == null) |
| 77 | 632 | | return; |
| 0 | 633 | | hudController.SetEntityList(GetEntitiesInCurrentScene()); |
| 0 | 634 | | } |
| | 635 | |
|
| 0 | 636 | | public int GetCurrentSceneEntityCount() { return GetEntitiesInCurrentScene().Count; } |
| | 637 | |
|
| | 638 | | List<DCLBuilderInWorldEntity> GetEntitiesInCurrentScene() |
| | 639 | | { |
| 0 | 640 | | List<DCLBuilderInWorldEntity> currentEntitiesInScene = new List<DCLBuilderInWorldEntity>(); |
| 0 | 641 | | foreach (DCLBuilderInWorldEntity entity in convertedEntities.Values) |
| | 642 | | { |
| 0 | 643 | | if (entity.rootEntity.scene == sceneToEdit) |
| 0 | 644 | | currentEntitiesInScene.Add(entity); |
| | 645 | | } |
| | 646 | |
|
| 0 | 647 | | return currentEntitiesInScene; |
| | 648 | | } |
| | 649 | |
|
| | 650 | | DCLBuilderInWorldEntity SetupEntityToEdit(IDCLEntity entity, bool hasBeenCreated = false) |
| | 651 | | { |
| 48 | 652 | | if (!convertedEntities.ContainsKey(GetConvertedUniqueKeyForEntity(entity))) |
| | 653 | | { |
| 47 | 654 | | DCLBuilderInWorldEntity entityToEdit = entity.gameObject.AddComponent<DCLBuilderInWorldEntity>(); |
| 47 | 655 | | entityToEdit.Init(entity, editMaterial); |
| 47 | 656 | | convertedEntities.Add(entityToEdit.entityUniqueId, entityToEdit); |
| 47 | 657 | | entity.OnRemoved += RemoveConvertedEntity; |
| 47 | 658 | | entityToEdit.IsNew = hasBeenCreated; |
| | 659 | |
|
| 47 | 660 | | string entityName = entityToEdit.GetDescriptiveName(); |
| 47 | 661 | | var catalogItem = entityToEdit.GetCatalogItemAssociated(); |
| | 662 | |
|
| 47 | 663 | | if ((string.IsNullOrEmpty(entityName) || entityNameList.Contains(entityName)) && catalogItem != null) |
| | 664 | | { |
| 0 | 665 | | entityName = GetNewNameForEntity(catalogItem); |
| 0 | 666 | | SetEntityName(entityToEdit, entityName); |
| 0 | 667 | | } |
| 47 | 668 | | else if (!string.IsNullOrEmpty(entityName) && !entityNameList.Contains(entityName)) |
| | 669 | | { |
| 0 | 670 | | entityNameList.Add(entityName); |
| | 671 | | } |
| | 672 | |
|
| 47 | 673 | | return entityToEdit; |
| | 674 | | } |
| | 675 | | else |
| | 676 | | { |
| 1 | 677 | | return convertedEntities[GetConvertedUniqueKeyForEntity(entity)]; |
| | 678 | | } |
| | 679 | | } |
| | 680 | |
|
| | 681 | | private void ChangeEntityBoundsCheckerStatus(IDCLEntity entity, bool isInsideBoundaries) |
| | 682 | | { |
| 0 | 683 | | var convertedEntity = GetConvertedEntity(entity); |
| 0 | 684 | | if (convertedEntity == null) |
| 0 | 685 | | return; |
| | 686 | |
|
| 0 | 687 | | convertedEntity.SetEntityBoundariesError(isInsideBoundaries); |
| 0 | 688 | | } |
| | 689 | |
|
| 0 | 690 | | public string GetNewNameForEntity(CatalogItem sceneObject) { return GetNewNameForEntity(sceneObject.name); } |
| | 691 | |
|
| | 692 | | public string GetNewNameForEntity(string name) |
| | 693 | | { |
| 8 | 694 | | int i = 1; |
| 8 | 695 | | if (!entityNameList.Contains(name)) |
| 0 | 696 | | return name; |
| | 697 | |
|
| 8 | 698 | | string newName = name + " " + i; |
| 29 | 699 | | while (entityNameList.Contains(newName)) |
| | 700 | | { |
| 21 | 701 | | i++; |
| 21 | 702 | | newName = name + " " + i; |
| | 703 | | } |
| | 704 | |
|
| 8 | 705 | | return newName; |
| | 706 | | } |
| | 707 | |
|
| | 708 | | public void DeleteFloorEntities() |
| | 709 | | { |
| 4 | 710 | | List<DCLBuilderInWorldEntity> entitiesToDelete = new List<DCLBuilderInWorldEntity>(); |
| | 711 | |
|
| 22 | 712 | | foreach (DCLBuilderInWorldEntity entity in convertedEntities.Values) |
| | 713 | | { |
| 7 | 714 | | if (entity.isFloor) |
| | 715 | | { |
| 4 | 716 | | entitiesToDelete.Add(entity); |
| | 717 | | } |
| | 718 | | } |
| | 719 | |
|
| 16 | 720 | | foreach (DCLBuilderInWorldEntity entity in entitiesToDelete) |
| 4 | 721 | | DeleteEntity(entity, false); |
| 4 | 722 | | } |
| | 723 | |
|
| | 724 | | public void DeleteEntity(string entityId) |
| | 725 | | { |
| 3 | 726 | | DCLBuilderInWorldEntity entity = convertedEntities[GetConvertedUniqueKeyForEntity(entityId)]; |
| 3 | 727 | | DeleteEntity(entity, true); |
| 3 | 728 | | } |
| | 729 | |
|
| 2 | 730 | | public void DeleteEntity(DCLBuilderInWorldEntity entityToDelete) { DeleteEntity(entityToDelete, true); } |
| | 731 | |
|
| | 732 | | public void DeleteEntity(DCLBuilderInWorldEntity entityToDelete, bool checkSelection) |
| | 733 | | { |
| 8 | 734 | | if (entityToDelete.IsSelected && checkSelection) |
| 0 | 735 | | DeselectEntity(entityToDelete); |
| | 736 | |
|
| 8 | 737 | | if (selectedEntities.Contains(entityToDelete)) |
| | 738 | | { |
| 0 | 739 | | selectedEntities.Remove(entityToDelete); |
| 0 | 740 | | hudController?.UpdateEntitiesSelection(selectedEntities.Count); |
| | 741 | | } |
| | 742 | |
|
| 8 | 743 | | string entityName = entityToDelete.GetDescriptiveName(); |
| | 744 | |
|
| 8 | 745 | | if (entityNameList.Contains(entityName)) |
| 4 | 746 | | entityNameList.Remove(entityName); |
| | 747 | |
|
| 8 | 748 | | RemoveConvertedEntity(entityToDelete.rootEntity); |
| 8 | 749 | | entityToDelete.rootEntity.OnRemoved -= RemoveConvertedEntity; |
| 8 | 750 | | entityToDelete.Delete(); |
| 8 | 751 | | string idToRemove = entityToDelete.rootEntity.entityId; |
| 8 | 752 | | OnEntityDeleted?.Invoke(entityToDelete); |
| 8 | 753 | | biwCreatorController.RemoveLoadingObjectInmediate(entityToDelete.rootEntity.entityId); |
| 8 | 754 | | if (sceneToEdit.entities.ContainsKey(idToRemove)) |
| 8 | 755 | | sceneToEdit.RemoveEntity(idToRemove, true); |
| 8 | 756 | | Destroy(entityToDelete); |
| 8 | 757 | | hudController?.RefreshCatalogAssetPack(); |
| 8 | 758 | | EntityListChanged(); |
| 8 | 759 | | builderInWorldBridge?.RemoveEntityOnKernel(idToRemove, sceneToEdit); |
| 0 | 760 | | } |
| | 761 | |
|
| | 762 | | public void DeleteSingleEntity(DCLBuilderInWorldEntity entityToDelete) |
| | 763 | | { |
| 0 | 764 | | actionController.CreateActionEntityDeleted(entityToDelete); |
| 0 | 765 | | DeleteEntity(entityToDelete, true); |
| 0 | 766 | | } |
| | 767 | |
|
| | 768 | | public void DeleteSelectedEntities() |
| | 769 | | { |
| 1 | 770 | | List<DCLBuilderInWorldEntity> entitiesToRemove = new List<DCLBuilderInWorldEntity>(); |
| | 771 | |
|
| 4 | 772 | | for (int i = 0; i < selectedEntities.Count; i++) |
| | 773 | | { |
| 1 | 774 | | entitiesToRemove.Add(selectedEntities[i]); |
| | 775 | | } |
| | 776 | |
|
| 1 | 777 | | actionController.CreateActionEntityDeleted(entitiesToRemove); |
| | 778 | |
|
| 1 | 779 | | DeselectEntities(); |
| | 780 | |
|
| 4 | 781 | | foreach (DCLBuilderInWorldEntity entity in entitiesToRemove) |
| | 782 | | { |
| 1 | 783 | | DeleteEntity(entity); |
| | 784 | | } |
| | 785 | |
|
| 1 | 786 | | OnDeleteSelectedEntities?.Invoke(entitiesToRemove); |
| 0 | 787 | | } |
| | 788 | |
|
| | 789 | | public void DeleteEntitiesOutsideSceneBoundaries() |
| | 790 | | { |
| 0 | 791 | | List<DCLBuilderInWorldEntity> entitiesToRemove = new List<DCLBuilderInWorldEntity>(); |
| 0 | 792 | | foreach (DCLBuilderInWorldEntity entity in convertedEntities.Values) |
| | 793 | | { |
| 0 | 794 | | if (entity.rootEntity.scene == sceneToEdit) |
| | 795 | | { |
| 0 | 796 | | if (!DCL.Environment.i.world.sceneBoundsChecker.IsEntityInsideSceneBoundaries(entity.rootEntity)) |
| | 797 | | { |
| 0 | 798 | | entitiesToRemove.Add(entity); |
| | 799 | | } |
| | 800 | | } |
| | 801 | | } |
| | 802 | |
|
| 0 | 803 | | foreach (DCLBuilderInWorldEntity entity in entitiesToRemove) |
| | 804 | | { |
| 0 | 805 | | DeleteEntity(entity); |
| | 806 | | } |
| 0 | 807 | | } |
| | 808 | |
|
| | 809 | | private void DestroyCollidersForAllEntities() |
| | 810 | | { |
| 0 | 811 | | foreach (DCLBuilderInWorldEntity entity in convertedEntities.Values) |
| | 812 | | { |
| 0 | 813 | | entity.DestroyColliders(); |
| | 814 | | } |
| 0 | 815 | | } |
| | 816 | |
|
| 94 | 817 | | private void RemoveConvertedEntity(IDCLEntity entity) { convertedEntities.Remove(GetConvertedUniqueKeyForEntity(enti |
| | 818 | |
|
| 17 | 819 | | public void NotifyEntityIsCreated(IDCLEntity entity) { builderInWorldBridge?.AddEntityOnKernel(entity, sceneToEdit); |
| | 820 | |
|
| 0 | 821 | | public void UpdateSmartItemComponentInKernel(DCLBuilderInWorldEntity entityToUpdate) { builderInWorldBridge?.UpdateS |
| | 822 | |
|
| 4 | 823 | | public void SetEntityName(DCLBuilderInWorldEntity entityToApply, string newName) { SetEntityName(entityToApply, newN |
| | 824 | |
|
| | 825 | | public void SetEntityName(DCLBuilderInWorldEntity entityToApply, string newName, bool sendUpdateToKernel = true) |
| | 826 | | { |
| 17 | 827 | | string currentName = entityToApply.GetDescriptiveName(); |
| | 828 | |
|
| 17 | 829 | | if (currentName == newName) |
| 0 | 830 | | return; |
| | 831 | |
|
| 17 | 832 | | if (entityNameList.Contains(newName)) |
| 8 | 833 | | newName = GetNewNameForEntity(newName); |
| | 834 | |
|
| 17 | 835 | | if (entityNameList.Contains(currentName)) |
| 0 | 836 | | entityNameList.Remove(currentName); |
| | 837 | |
|
| 17 | 838 | | entityToApply.SetDescriptiveName(newName); |
| 17 | 839 | | entityNameList.Add(newName); |
| | 840 | |
|
| 17 | 841 | | if (sendUpdateToKernel) |
| 2 | 842 | | builderInWorldBridge?.ChangedEntityName(entityToApply, sceneToEdit); |
| 15 | 843 | | } |
| | 844 | |
|
| | 845 | | private void ChangeEntityVisibilityStatus(DCLBuilderInWorldEntity entityToApply) |
| | 846 | | { |
| 0 | 847 | | entityToApply.ToggleShowStatus(); |
| 0 | 848 | | if (!entityToApply.IsVisible && selectedEntities.Contains(entityToApply)) |
| 0 | 849 | | DeselectEntity(entityToApply); |
| 0 | 850 | | } |
| | 851 | |
|
| | 852 | | private void ChangeEntityLockStatus(DCLBuilderInWorldEntity entityToApply) |
| | 853 | | { |
| 0 | 854 | | entityToApply.ToggleLockStatus(); |
| 0 | 855 | | if (entityToApply.IsLocked && selectedEntities.Contains(entityToApply)) |
| 0 | 856 | | DeselectEntity(entityToApply); |
| | 857 | |
|
| 0 | 858 | | builderInWorldBridge.ChangeEntityLockStatus(entityToApply, sceneToEdit); |
| 0 | 859 | | } |
| | 860 | |
|
| 15 | 861 | | private string GetConvertedUniqueKeyForEntity(string entityID) { return sceneToEdit.sceneData.id + entityID; } |
| | 862 | |
|
| 120 | 863 | | private string GetConvertedUniqueKeyForEntity(IDCLEntity entity) { return entity.scene.sceneData.id + entity.entityI |
| | 864 | |
|
| | 865 | | private bool AreAllSelectedEntitiesInsideBoundaries() |
| | 866 | | { |
| 0 | 867 | | foreach (DCLBuilderInWorldEntity entity in selectedEntities) |
| | 868 | | { |
| 0 | 869 | | if (!DCL.Environment.i.world.sceneBoundsChecker.IsEntityInsideSceneBoundaries(entity.rootEntity)) |
| | 870 | | { |
| 0 | 871 | | return false; |
| | 872 | | } |
| | 873 | | } |
| | 874 | |
|
| 0 | 875 | | return true; |
| 0 | 876 | | } |
| | 877 | |
|
| | 878 | | public bool AreAllEntitiesInsideBoundaries() |
| | 879 | | { |
| 2 | 880 | | bool areAllIn = true; |
| 7 | 881 | | foreach (DCLBuilderInWorldEntity entity in convertedEntities.Values) |
| | 882 | | { |
| 2 | 883 | | if (!DCL.Environment.i.world.sceneBoundsChecker.IsEntityInsideSceneBoundaries(entity.rootEntity)) |
| | 884 | | { |
| 1 | 885 | | areAllIn = false; |
| 1 | 886 | | break; |
| | 887 | | } |
| | 888 | | } |
| | 889 | |
|
| 2 | 890 | | return areAllIn; |
| | 891 | | } |
| | 892 | | } |