public virtual void Setup() { // push history stream, so that we can do undo/redo internal to tool, // that will not end up in external history push_history_stream(); // clear selection here so that multi-select GroupSO goes away, otherwise // when we copy frmaes below, they are relative to that GroupSO, and things move inputSelection = new List <SceneObject>(Scene.Selected); set_allow_selection_changes(true); Scene.ClearSelection(); set_allow_selection_changes(false); objects = new List <TargetObject>(); foreach (var so in InputSOs) { TargetObject o = new TargetObject(); o.SO = so; o.InputMeshV = new DVector <double>(o.SO.Mesh.VerticesBuffer); if (o.SO.Mesh.HasVertexNormals) { o.InputMeshN = new DVector <float>(o.SO.Mesh.NormalsBuffer); } o.objFrame = so.GetLocalFrame(CoordSpace.ObjectCoords); o.sceneFrame = so.GetLocalFrame(CoordSpace.SceneCoords); o.sceneToObjUnitScale = SceneTransforms.SceneToObject(o.SO, 1.0f); o.localScale = so.GetLocalScale(); o.localBounds = so.GetLocalBoundingBox(); Box3f sb = so.GetBoundingBox(CoordSpace.SceneCoords); o.sceneBounds = sb.ToAABB(); o.curLocalScale = o.localScale; o.curSceneFrame = o.sceneFrame; objects.Add(o); } if (false && objects.Count == 1) { originalDims = objects[0].localBounds; } else { originalDims = objects[0].sceneBounds; for (int k = 1; k < objects.Count; ++k) { originalDims.Contain(objects[k].sceneBounds); } } currentDims = originalDims; sharedOriginS = (Vector3f)originalDims.Point(0, -1, 0); initialize_parameters(); }
virtual public void PreRender() { if (in_shutdown()) { return; } if (parameters_dirty) { PolyLine2d spiral = PolyLine2d.MakeBoxSpiral(Vector2d.Zero, length, PathWidth + spacing); DMesh3 mesh = new DMesh3(); List <int> bottom_verts = new List <int>(); List <int> top_verts = new List <int>(); for (int i = 0; i < spiral.VertexCount; ++i) { Vector2d x = spiral[i]; Vector3d vb = new Vector3d(x.x, 0, x.y); bottom_verts.Add(mesh.AppendVertex(vb)); top_verts.Add(mesh.AppendVertex(vb + Height * Vector3d.AxisY)); } MeshEditor editor = new MeshEditor(mesh); editor.StitchSpan(bottom_verts, top_verts); PreviewSO.ReplaceMesh(mesh, true); Vector3d translate = scene_bounds.Point(1, -1, 1); translate.x += spiral.Bounds.Width + PathWidth; Frame3f sceneF = Frame3f.Identity.Translated((Vector3f)translate); PreviewSO.SetLocalFrame(sceneF, CoordSpace.SceneCoords); parameters_dirty = false; } }