public void SetRenderDistancesAll(float value) { value = Mathf.Clamp(Gizmos.ConvertRoundBackToMeters(value), 50f, 24000f); foreach (var obj in POGroup.AllObjectsInSelection(selection, logic.selectedGroup)) { if (!obj.renderDistLocked) { obj.renderDistance = value; } } }
public override void OnOpen(List <ProceduralObject> selection) { selection = POGroup.AllObjectsInSelection(logic.pObjSelection, logic.selectedGroup); if (selection.Count <= 1) { ExitAction(); return; } base.OnOpen(selection); clipboard = new ClipboardProceduralObjects(ClipboardProceduralObjects.ClipboardType.Selection); clipboard.MakeSelectionList(selection, null); }
public override void OnOpen(List <ProceduralObject> selection) { confirmed = false; this.selection = POGroup.AllObjectsInSelection(selection, logic.selectedGroup); if (this.selection.Count < 2) { ExitAction(); return; } oldColors = new Dictionary <ProceduralObject, Color>(); foreach (var obj in this.selection) { oldColors.Add(obj, obj.m_color); } gradientTex = TextureUtils.PlainTexture(100, 22, Color.white); maxObjects = VertexUtils.OutmostPoints(this.selection.ToArray()); gradient = new Gradient(); }
public override void OnOpen(List <ProceduralObject> selection) { this.selection = POGroup.AllObjectsInSelection(selection, logic.selectedGroup); foreach (var po in this.selection) { if (po.meshStatus == 1) { continue; } try { po.historyEditionBuffer.InitializeNewStep(EditingStep.StepType.vertices, po.vertices); ProceduralUtils.RecenterObjOrigin(po, po.vertices); po.ApplyModelChange(); po.historyEditionBuffer.ConfirmNewStep(po.vertices); } catch (Exception e) { Debug.LogWarning("[ProceduralObjects] PO could not recenter object origin of object #" + po.id + " of type " + po.basePrefabName + "\n" + e); po.historyEditionBuffer.ConfirmNewStep(po.vertices); } } ExitAction(); }
public override void OnOpen(List <ProceduralObject> selection) { base.OnOpen(selection); if (logic.clipboard == null) { ExitAction(); return; } if (logic.clipboard.type == ClipboardProceduralObjects.ClipboardType.Single) { if (logic.clipboard.single_object == null) { ExitAction(); return; } } else if (logic.clipboard.type == ClipboardProceduralObjects.ClipboardType.Selection) { if (logic.clipboard.selection_objects == null || logic.selectedGroup != null) { ExitAction(); return; } } GUIUtils.ShowModal(LocalizationManager.instance.current["confirmPasteInto_title"], string.Format(LocalizationManager.instance.current["confirmPasteInto_descSelection"], selection.Count), (bool ok) => { if (ok) { for (int i = 0; i < selection.Count; i++) { bool mustAddToGroup = false, mustSetAsRoot = false; if (logic.selectedGroup == null) { if (selection[i].isRootOfGroup) { POGroup.DeleteGroup(logic, selection[i].group); logic.activeIds.Add(selection[i].id); } } else { mustAddToGroup = true; if (selection[i] == logic.selectedGroup.root) { mustSetAsRoot = true; } logic.selectedGroup.Remove(logic, selection[i]); } logic.proceduralObjects.Remove(selection[i]); if (logic.clipboard.type == ClipboardProceduralObjects.ClipboardType.Single) { var obj = new ProceduralObject(logic.clipboard.single_object, selection[i].id, selection[i].m_position, logic.layerManager); if (mustAddToGroup) { logic.selectedGroup.AddToGroup(obj); if (mustSetAsRoot) { logic.selectedGroup.ChooseAsRoot(obj); } } obj.RecalculateBoundsNormalsExtras(obj.meshStatus); if (obj.meshStatus != 1) { if (obj.RequiresUVRecalculation && !obj.disableRecalculation) { obj.m_mesh.uv = Vertex.RecalculateUVMap(obj, Vertex.CreateVertexList(obj)); } } obj.m_rotation = selection[i].m_rotation; logic.proceduralObjects.Add(obj); } else if (logic.clipboard.type == ClipboardProceduralObjects.ClipboardType.Selection) { Quaternion qDiff = Quaternion.Inverse(logic.clipboard.selection_objects.Keys.ToArray()[0].m_rotation) * selection[i].m_rotation; var cacheRealPairs = new Dictionary <CacheProceduralObject, ProceduralObject>(); for (int j = 0; j < logic.clipboard.selection_objects.Count; j++) { var kvp = logic.clipboard.selection_objects.ElementAt(j); if (j == 0) { var obj = new ProceduralObject(kvp.Key, selection[i].id, selection[i].m_position, logic.layerManager); cacheRealPairs.Add(kvp.Key, obj); obj.RecalculateBoundsNormalsExtras(obj.meshStatus); if (obj.meshStatus != 1) { if (obj.RequiresUVRecalculation && !obj.disableRecalculation) { obj.m_mesh.uv = Vertex.RecalculateUVMap(obj, Vertex.CreateVertexList(obj)); } } obj.m_rotation = selection[i].m_rotation; logic.proceduralObjects.Add(obj); } else { var obj = new ProceduralObject(kvp.Key, logic.proceduralObjects.GetNextUnusedId(), selection[i].m_position + (qDiff * kvp.Value), logic.layerManager); cacheRealPairs.Add(kvp.Key, obj); obj.RecalculateBoundsNormalsExtras(obj.meshStatus); if (obj.meshStatus != 1) { if (obj.RequiresUVRecalculation && !obj.disableRecalculation) { obj.m_mesh.uv = Vertex.RecalculateUVMap(obj, Vertex.CreateVertexList(obj)); } } obj.m_rotation = obj.m_rotation * qDiff; logic.proceduralObjects.Add(obj); } } logic.clipboard.RecreateGroups(cacheRealPairs); } } logic.pObjSelection.Clear(); } ExitAction(); }); }
public override void OnOpen(List <ProceduralObject> selection) { this.selection = POGroup.AllObjectsInSelection(selection, logic.selectedGroup); }
public override void OnOpen(List <ProceduralObject> selection) { base.OnOpen(selection); value = Gizmos.ConvertRoundToDistanceUnit(GetAvgRenderDistance(POGroup.AllObjectsInSelection(selection, logic.selectedGroup))); renderDistInput = new GUIUtils.FloatInputField(value); }