private void PerformEditorAction() { if (!editor.IsEditorSettingsValid()) { return; } if (!editorTarget.splineSettings.dirty) { return; } if (editorTarget.splineSettings.spawnMechanism == SpawnMechanism.Manual) { return; } editorTarget.splineModule.PlaceObjects(); editorTarget.splineSettings.dirty = false; // Set the editor spline dirty, so that the changed settings (e.g.control points got dragged in the scene) get updated. // Ensure the control points get saved when they are changed in the scene if we wouldn't do that, they'd only be change when something changes in the inspector EditorUtility.SetDirty(editor.target); }
private void AddPrefabs(RaycastHit hit) { if (!editor.IsEditorSettingsValid()) { return; } switch (editorTarget.brushSettings.distribution) { case BrushSettings.Distribution.Center: // create a prefab brushDistribution.CreatePreviewPrefab(); // add prefab brushDistribution.AddPrefabs_Center(hit.point, hit.normal); break; case BrushSettings.Distribution.Fluent: // use preview prefab brushDistribution.AddPrefabs_Center(hit.point, hit.normal); // create next preview prefab brushDistribution.CreatePreviewPrefab(); break; case BrushSettings.Distribution.Poisson_Any: brushDistribution.AddPrefabs_Poisson_Any(hit.point, hit.normal); break; case BrushSettings.Distribution.Poisson_Terrain: brushDistribution.AddPrefabs_Poisson_Terrain(hit.point, hit.normal); break; case BrushSettings.Distribution.FallOff: Debug.Log("Not implemented yet: " + editorTarget.brushSettings.distribution); break; case BrushSettings.Distribution.FallOff2d: Debug.Log("Not implemented yet: " + editorTarget.brushSettings.distribution); break; } }