DIRECTORY Atom, SVCoordSys, Feedback, Imager, IO, Labels, Menus, Rope, SV2d, SV3d, SVCoordSys2d, SVEditUser, SVEditUserB, SVEvent, SVFileOut, SVGraphics, SVInterfaceTypes, SVModelTypes, SVScene, SVSceneTypes, SVSelections, SVTransforms, SVViewersOnScene, SVViewerTools, SVWindow, SVParseIn, SVParseOut, ViewerClasses, ViewerTools; SVEditUserImplD: CEDAR PROGRAM IMPORTS Atom, SVCoordSys, Feedback, IO, Labels, Rope, SVEditUser, SVEvent, SVFileOut, SVGraphics, SVScene, SVSelections, SVTransforms, SVViewersOnScene, SVViewerTools, SVWindow, SVParseIn, SVParseOut, ViewerTools EXPORTS SVEditUser, SVEditUserB = BEGIN Artwork: TYPE = SVModelTypes.Artwork; Slice: TYPE = SVSceneTypes.Slice; SliceList: TYPE = SVSceneTypes.SliceList; AssemblyGenerator: TYPE = SVScene.AssemblyGenerator; Camera: TYPE = SVModelTypes.Camera; Color: TYPE = Imager.Color; CoordSystem: TYPE = SVModelTypes.CoordSystem; DrawStyle: TYPE = SVModelTypes.DrawStyle; EditToolData: TYPE = SVEditUser.EditToolData; FileCamera: TYPE = SVSceneTypes.FileCamera; FileCameraList: TYPE = SVSceneTypes.FileCameraList; FrameBox: TYPE = SVModelTypes.FrameBox; LightSource: TYPE = SVModelTypes.LightSource; Material: TYPE = SVModelTypes.Material; Matrix3by3: TYPE = SV2d.Matrix3by3; MasterObject: TYPE = SVSceneTypes.MasterObject; MasterObjectList: TYPE = SVSceneTypes.MasterObjectList; Matrix4by4: TYPE = SV3d.Matrix4by4; MouseButton: TYPE = Menus.MouseButton; NameAlreadyPresent: SIGNAL = SVScene.NameAlreadyPresent; OMap: TYPE = SVModelTypes.OMap; Plane: TYPE = SV3d.Plane; Point3d: TYPE = SV3d.Point3d; Projection: TYPE = SVModelTypes.Projection; Scene: TYPE = SVSceneTypes.Scene; Selection: TYPE = SVInterfaceTypes.Selection; SelectionGenerator: TYPE = SVInterfaceTypes.SelectionGenerator; SMap: TYPE = SVModelTypes.SMap; SpaceFunction: TYPE = SVModelTypes.SpaceFunction; Tube: TYPE = SVModelTypes.Tube; Box: TYPE = SVModelTypes.Box; Viewer: TYPE = ViewerClasses.Viewer; ViewerCell: TYPE = SVInterfaceTypes.ViewerCell; SVData: TYPE = SVInterfaceTypes.SVData; globalProjectionCount: NAT = SVEditUser.globalProjectionCount; globalProjectionArray: PUBLIC ARRAY[1..globalProjectionCount] OF Rope.ROPE _ ["perspect", "ortho"]; globalMatCount: NAT = SVEditUser.globalMatCount; globalMatArray: PUBLIC ARRAY[1..globalMatCount] OF Rope.ROPE _ ["plastic", "chalk"]; ListScenes: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { g: SVScene.SceneGenerator; scene: Scene; outHandle: IO.STREAM _ Feedback.GetTypescriptStream[$Solidviews]; g _ SVScene.GetSceneGenerator[]; scene _ SVScene.NextScene[g]; outHandle.PutRope["Listing Current Scenes...\n"]; UNTIL scene = NIL DO outHandle.PutF[" %g\n",[rope[scene.name]]]; scene _ SVScene.NextScene[g]; ENDLOOP; }; -- end of ListScenes ListAssemblies: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; scene: Scene _ editToolData.sceneSection.currentScene; name: Rope.ROPE; outHandle: IO.STREAM _ Feedback.GetTypescriptStream[$Solidviews]; g: AssemblyGenerator; a: Slice; outHandle.PutF["Listing top level assemblies in scene: %g\n", [rope[scene.name]]]; g _ SVScene.GetAssemblyGenerator[scene]; a _ SVScene.NextAssembly[g]; UNTIL a = NIL DO name _ a.name; outHandle.PutF[" %g coordSys: %g wrt: %g", [rope[name]], [rope[SVCoordSys.Name[a.coordSys]]], [rope[SVCoordSys.Name[SVCoordSys.Parent[a.coordSys]]]]]; IF ISTYPE[a.shape, SliceList] THEN outHandle.PutF[" [cluster]\n"] ELSE outHandle.PutF[" [primitive]\n"]; a _ SVScene.NextAssembly[g]; ENDLOOP; }; -- end of ListAssemblies ListCoordSystems: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; currentScene: Scene _ editToolData.sceneSection.currentScene; g: SVScene.CoordSysGenerator; outHandle: IO.STREAM _ Feedback.GetTypescriptStream[$Solidviews]; g _ SVScene.GetCoordSysGenerator[currentScene]; outHandle.PutF["Listing Current CoordinateSystems in %g...\n", [rope[currentScene.name]]]; FOR cs: CoordSystem _ SVScene.NextCoordSys[g], SVScene.NextCoordSys[g] UNTIL cs = NIL DO outHandle.PutF[" %g",[rope[SVCoordSys.Name[cs]]]]; outHandle.PutChar[IO.SP]; outHandle.PutRope["parent: "]; IF SVCoordSys.Parent[cs] = NIL THEN IO.PutRope[outHandle,"NIL"] ELSE IO.PutRope[outHandle, SVCoordSys.Name[SVCoordSys.Parent[cs]]]; IF SVCoordSys.IsScalarsOnly[cs] THEN { IO.PutRope[outHandle, " scalars: "]; SVParseOut.FileoutPoint3d[outHandle, SVCoordSys.GetScalars[cs]]; } ELSE { IO.PutRope[outHandle, " mat:\n"]; SVParseOut.FileoutMatrix[outHandle, SVCoordSys.GetMat[cs]]; }; IO.PutChar[outHandle, IO.CR]; IO.PutChar[outHandle, IO.CR]; ENDLOOP; }; -- end of ListCoordSystems ListLights: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; currentScene: Scene _ editToolData.sceneSection.currentScene; outHandle: IO.STREAM _ Feedback.GetTypescriptStream[$Solidviews]; outHandle.PutRope["Listing Current LightSources...\n"]; SVFileOut.FileoutLightSources[outHandle, currentScene.lightSources]; }; ListMasterObjects: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; currentScene: Scene _ editToolData.sceneSection.currentScene; outHandle: IO.STREAM _ Feedback.GetTypescriptStream[$Solidviews]; list: MasterObjectList; outHandle.PutRope["Listing Current MasterObjects...\n"]; FOR list _ SVScene.MasterObjectsOfScene[currentScene], list.rest UNTIL list = NIL DO outHandle.PutF["%g\n", [rope[list.first.name]] ]; ENDLOOP; }; ListViewers: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; firstViewer: Viewer; count: NAT; outHandle: IO.STREAM _ Feedback.GetTypescriptStream[$Solidviews]; FOR allList: LIST OF ViewerCell _ editToolData.allViewers, allList.rest UNTIL allList = NIL DO firstViewer _ allList.first.viewersOnScene; IF firstViewer = NIL THEN LOOP; svData _ NARROW[firstViewer.data]; outHandle.PutF["\n%g: 1", [rope[svData.scene.name]]]; count _ 1; FOR viewerList: Viewer _ firstViewer.link, viewerList.link UNTIL viewerList = firstViewer OR viewerList = NIL DO count _ count + 1; outHandle.PutF[", %g", [integer[count]]]; ENDLOOP; ENDLOOP; }; ListCameras: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; currentScene: Scene _ editToolData.sceneSection.currentScene; outHandle: IO.STREAM _ Feedback.GetTypescriptStream[$Solidviews]; list: FileCameraList; outHandle.PutRope["Listing Current Cameras...\n"]; FOR list _ currentScene.cameras, list.rest UNTIL list = NIL DO outHandle.PutF["%g\n", [rope[list.first.name]] ]; ENDLOOP; }; GetCamera: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { cameraName: Rope.ROPE _ ViewerTools.GetSelectionContents[]; editToolData: EditToolData _ svData.editToolData; GetCameraNamed[cameraName, editToolData]; }; GetCameraNamed: PUBLIC PROC [cameraName: Rope.ROPE, editToolData: EditToolData] = { currentScene: Scene _ editToolData.sceneSection.currentScene; success: BOOL; outStream: IO.STREAM; fileCamera: FileCamera; frameRope, visibleAssemblyRope, clippingRope, projectionRope: Rope.ROPE; IF Rope.Length[cameraName] = 0 THEN { Feedback.AppendRaw[$Solidviews, "Please select a camera name.", oneLiner]; Feedback.BlinkRaw[$Solidviews]; RETURN; }; [fileCamera, success] _ SVScene.FindFileCameraFromName[cameraName, currentScene]; IF NOT success THEN { Feedback.AppendRaw[$Solidviews, Rope.Cat["Camera ", cameraName, " not found"], oneLiner]; Feedback.BlinkRaw[$Solidviews]; } ELSE { ViewerTools.SetContents[editToolData.cameraSection.name, cameraName]; SVViewerTools.SetThreeReals[editToolData.cameraSection.origin, fileCamera.origin[1], fileCamera.origin[2], fileCamera.origin[3]]; SVViewerTools.SetThreeReals[editToolData.cameraSection.focusPoint, fileCamera.focusPoint[1], fileCamera.focusPoint[2], fileCamera.focusPoint[3]]; SVViewerTools.SetReal[editToolData.cameraSection.slant, fileCamera.slant]; SVViewerTools.SetReal[editToolData.cameraSection.resolution, fileCamera.resolution]; SVViewerTools.SetReal[editToolData.cameraSection.focalLength, fileCamera.focalLength]; projectionRope _ SVGraphics.ProjectionToRope[fileCamera.projection]; ViewerTools.SetContents[editToolData.cameraSection.projection, projectionRope]; outStream _ IO.ROS[]; SVParseOut.FileoutFrame[outStream, fileCamera.frame]; frameRope _ IO.RopeFromROS[outStream]; IO.Close[outStream]; ViewerTools.SetContents[editToolData.cameraSection.frame, frameRope]; outStream _ IO.ROS[]; SVParseOut.FileoutClippingPlanes[outStream, fileCamera.clippingPlanes]; clippingRope _ IO.RopeFromROS[outStream, FALSE]; ViewerTools.SetContents[editToolData.cameraSection.clippingPlanes, clippingRope]; IO.Reset[outStream]; SVParseOut.FileoutListOfRope[outStream, fileCamera.visibleAssemblies]; visibleAssemblyRope _ IO.RopeFromROS[outStream, TRUE]; ViewerTools.SetContents[editToolData.cameraSection.visibleAssemblies, visibleAssemblyRope]; }; }; -- end of GetCameraNamed SetCamera: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; currentScene: Scene _ editToolData.sceneSection.currentScene; currentSVData: SVData _ NARROW[editToolData.currentSVData]; camera: Camera _ currentSVData.camera; focusPoint, origin: Point3d; success: BOOL; focalLength, slant, resolution: REAL; cameraName, frameRope, clippingPlaneRope, visibleAssembliesRope: Rope.ROPE; frame: FrameBox; fileCamera, oldFileCamera: FileCamera; frameStream, clippingStream, visibleAssembliesStream: IO.STREAM; clippingPlanes: LIST OF Plane; visibleAssemblies: LIST OF Rope.ROPE; projection: Projection; projectionRope: Rope.ROPE; cameraName _ ViewerTools.GetContents[editToolData.cameraSection.name]; IF Rope.Length[cameraName] = 0 THEN { Feedback.AppendRaw[$Solidviews, "Please give camera a name.", oneLiner]; Feedback.BlinkRaw[$Solidviews]; RETURN; }; origin _ SVEditUser.GetPoint3d[editToolData.cameraSection.origin]; focusPoint _ SVEditUser.GetPoint3d[editToolData.cameraSection.focusPoint]; slant _ SVViewerTools.GetReal[editToolData.cameraSection.slant, 0]; resolution _ SVViewerTools.GetReal[editToolData.cameraSection.resolution, 10.0]; focalLength _ SVViewerTools.GetReal[editToolData.cameraSection.focalLength, 1800]; projectionRope _ ViewerTools.GetContents[editToolData.cameraSection.projection]; [projection, success] _ SVGraphics.RopeToProjection[projectionRope]; IF NOT success THEN projection _ perspective; frameRope _ ViewerTools.GetContents[editToolData.cameraSection.frame]; frameStream _ IO.RIS[frameRope]; frame _ SVParseIn.ReadFrame[frameStream, SVScene.version]; clippingPlaneRope _ ViewerTools.GetContents[editToolData.cameraSection.clippingPlanes]; clippingStream _ IO.RIS[clippingPlaneRope]; clippingPlanes _ SVParseIn.ReadClippingPlanes[clippingStream]; visibleAssembliesRope _ ViewerTools.GetContents[editToolData.cameraSection.visibleAssemblies]; visibleAssembliesStream _ IO.RIS[visibleAssembliesRope]; visibleAssemblies _ SVParseIn.ReadListOfRope[visibleAssembliesStream]; [oldFileCamera, success] _ SVScene.FindFileCameraFromName[cameraName, currentScene]; IF success THEN {-- put new information in old camera oldFileCamera.origin _ origin; oldFileCamera.focusPoint _ focusPoint; oldFileCamera.slant _ slant; oldFileCamera.resolution _ resolution; oldFileCamera.focalLength _ focalLength; oldFileCamera.projection _ projection; oldFileCamera.frame _ frame; oldFileCamera.clippingPlanes _ clippingPlanes; oldFileCamera.visibleAssemblies _ visibleAssemblies; fileCamera _ oldFileCamera; } ELSE { fileCamera _ SVScene.CreateFileCamera[cameraName, origin, focusPoint, slant, resolution, focalLength, projection, frame, clippingPlanes, visibleAssemblies]; SVScene.AddCameraToScene[fileCamera, currentScene]; }; SVViewersOnScene.SceneNewVersion[currentSVData]; IF Rope.Equal[fileCamera.name, camera.viewName, TRUE] THEN { UseCameraInternal[fileCamera.name, currentScene, currentSVData]; }; }; -- end of SetCamera UseCamera: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; cameraName: Rope.ROPE _ ViewerTools.GetSelectionContents[]; currentSVData: SVData _ editToolData.currentSVData; currentScene: Scene _ currentSVData.scene; IF Rope.Length[cameraName] = 0 THEN { Feedback.AppendRaw[$Solidviews, "Please select a camera name.", oneLiner]; Feedback.BlinkRaw[$Solidviews]; } ELSE { UseCameraInternal[cameraName, currentScene, currentSVData]; SVWindow.RestoreScreenAndInvariants[paintAction: $PaintEntireScene, svData: currentSVData, remake: triggerBag, backgndOK: FALSE, edited: FALSE, okToClearFeedback: TRUE]; }; }; -- end of UseCamera UseCameraInternal: PRIVATE PROC [cameraName: Rope.ROPE, currentScene: Scene, currentSVData: SVData] = { fileCamera: FileCamera; success: BOOL; style: DrawStyle; worldCS, screenCS: CoordSystem; worldCS _ currentScene.coordSysRoot; screenCS _ currentSVData.camera.screenCS; [fileCamera, success] _ SVScene.FindFileCameraFromName[cameraName, currentScene]; IF NOT success THEN { Feedback.AppendRaw[$Solidviews, Rope.Cat["Camera ", cameraName, " not found"], oneLiner]; Feedback.BlinkRaw[$Solidviews]; } ELSE { style _ currentSVData.camera.style; SVScene.StuffCameraFromFileCamera[currentSVData.camera, fileCamera, style, currentScene]; }; SVEvent.UpdateHeader[currentScene.name, currentSVData]; }; -- end of UseCameraInternal GetCameraOrder: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; currentScene: Scene _ editToolData.sceneSection.currentScene; currentSVData: SVData _ NARROW[editToolData.currentSVData]; cameraOrderStream: IO.STREAM; cameraOrderRope: Rope.ROPE; cameraOrderStream _ IO.ROS[]; SVParseOut.FileoutListOfRope[cameraOrderStream, currentScene.cameraOrder]; cameraOrderRope _ IO.RopeFromROS[cameraOrderStream]; ViewerTools.SetContents[editToolData.cameraOrderSection.order, cameraOrderRope]; }; SetCameraOrder: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; currentScene: Scene _ editToolData.sceneSection.currentScene; currentSVData: SVData _ NARROW[editToolData.currentSVData]; cameraOrderRope: Rope.ROPE _ ViewerTools.GetContents[editToolData.cameraOrderSection.order]; cameraOrderStream: IO.STREAM _ IO.RIS[cameraOrderRope]; cameraOrder: LIST OF Rope.ROPE _ SVParseIn.ReadListOfRope[cameraOrderStream]; currentScene.cameraOrder _ cameraOrder; SVViewersOnScene.SceneNewVersion[currentSVData]; }; -- end of SetCameraOrder SetShadows: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; currentScene: Scene _ editToolData.sceneSection.currentScene; currentSVData: SVData _ NARROW[editToolData.currentSVData]; currentScene.shadows _ editToolData.shadowSection.shadowValue; SVViewersOnScene.SceneNewVersion[currentSVData]; }; -- end of SetShadows NormalizeRot: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; scene: Scene _ editToolData.sceneSection.currentScene; found: BOOL _ TRUE; targetCS: CoordSystem; g: SelectionGenerator; selectionsExist: BOOL; targetCS _ SVSelections.TopTargetCoinCoordSys[]; IF targetCS = NIL THEN RETURN; [g, selectionsExist] _ SVSelections.GetSelectionGenerator[movee]; SVSelections.ComplainIfNot[selectionsExist]; IF NOT selectionsExist THEN RETURN; FOR thisSel: Selection _ SVSelections.NextSelection[g], SVSelections.NextSelection[g] UNTIL thisSel = NIL DO IF thisSel.referentType = hook THEN SVTransforms.NormalizeRotTug[thisSel.indirect, scene, thisSel.coincident, targetCS] ELSE SVTransforms.NormalizeRot[thisSel.coincident, scene, targetCS]; ENDLOOP; SVViewersOnScene.SceneNewVersion[editToolData.currentSVData]; SVViewersOnScene.PaintSceneAllViewers[$PaintEntireScene, editToolData, scene]; }; -- end of NormalizeRot Normalize: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; scene: Scene _ editToolData.sceneSection.currentScene; found: BOOL _ TRUE; targetCS: CoordSystem; g: SelectionGenerator; selectionsExist: BOOL; targetCS _ SVSelections.TopTargetCoinCoordSys[]; IF targetCS = NIL THEN RETURN; [g, selectionsExist] _ SVSelections.GetSelectionGenerator[movee]; SVSelections.ComplainIfNot[selectionsExist]; IF NOT selectionsExist THEN RETURN; FOR thisSel: Selection _ SVSelections.NextSelection[g], SVSelections.NextSelection[g] UNTIL thisSel = NIL DO IF thisSel.referentType = hook THEN SVTransforms.NormalizeTug[thisSel.indirect, scene, thisSel.coincident, targetCS] ELSE SVTransforms.Normalize[thisSel.coincident, scene, targetCS]; ENDLOOP; SVViewersOnScene.SceneNewVersion[editToolData.currentSVData]; SVViewersOnScene.PaintSceneAllViewers[$PaintEntireScene, editToolData, scene]; }; -- end of Normalize Align: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; scene: Scene _ editToolData.sceneSection.currentScene; found: BOOL _ TRUE; targetCS: CoordSystem; g: SelectionGenerator; selectionsExist: BOOL; targetCS _ SVSelections.TopTargetCoinCoordSys[]; IF targetCS = NIL THEN RETURN; [g, selectionsExist] _ SVSelections.GetSelectionGenerator[movee]; SVSelections.ComplainIfNot[selectionsExist]; IF NOT selectionsExist THEN RETURN; FOR thisSel: Selection _ SVSelections.NextSelection[g], SVSelections.NextSelection[g] UNTIL thisSel = NIL DO IF thisSel.referentType = hook THEN SVTransforms.AlignTug[thisSel.indirect, scene, thisSel.coincident, targetCS] ELSE SVTransforms.Align[thisSel.coincident, scene, targetCS]; ENDLOOP; SVViewersOnScene.SceneNewVersion[editToolData.currentSVData]; SVViewersOnScene.PaintSceneAllViewers[$PaintEntireScene, editToolData, scene]; }; -- end of Align Abut: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; scene: Scene _ editToolData.sceneSection.currentScene; found: BOOL _ TRUE; targetCS: CoordSystem; g: SelectionGenerator; selectionsExist: BOOL; targetCS _ SVSelections.TopTargetCoinCoordSys[]; IF targetCS = NIL THEN RETURN; [g, selectionsExist] _ SVSelections.GetSelectionGenerator[movee]; SVSelections.ComplainIfNot[selectionsExist]; IF NOT selectionsExist THEN RETURN; FOR thisSel: Selection _ SVSelections.NextSelection[g], SVSelections.NextSelection[g] UNTIL thisSel = NIL DO IF thisSel.referentType = hook THEN SVTransforms.AbutTug[thisSel.indirect, scene, thisSel.coincident, targetCS] ELSE SVTransforms.Abut[thisSel.coincident, scene, targetCS]; ENDLOOP; SVViewersOnScene.SceneNewVersion[editToolData.currentSVData]; SVViewersOnScene.PaintSceneAllViewers[$PaintEntireScene, editToolData, scene]; }; -- end of Abut AbutX: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; AbutAxis[editToolData, 1]; }; AbutY: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; AbutAxis[editToolData, 2]; }; AbutZ: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; AbutAxis[editToolData, 3]; }; AbutAxis: PUBLIC PROC [editToolData: EditToolData, axis: [1..3]] = { scene: Scene _ editToolData.sceneSection.currentScene; found: BOOL _ TRUE; targetCS: CoordSystem; g: SelectionGenerator; selectionsExist: BOOL; targetCS _ SVSelections.TopTargetCoinCoordSys[]; IF targetCS = NIL THEN RETURN; [g, selectionsExist] _ SVSelections.GetSelectionGenerator[movee]; SVSelections.ComplainIfNot[selectionsExist]; IF NOT selectionsExist THEN RETURN; FOR thisSel: Selection _ SVSelections.NextSelection[g], SVSelections.NextSelection[g] UNTIL thisSel = NIL DO IF thisSel.referentType = hook THEN SVTransforms.AbutTugAxis[thisSel.indirect, scene, axis, thisSel.coincident, targetCS] ELSE SVTransforms.AbutAxis[thisSel.coincident, scene, axis, targetCS]; ENDLOOP; SVViewersOnScene.SceneNewVersion[editToolData.currentSVData]; SVViewersOnScene.PaintSceneAllViewers[$PaintEntireScene, editToolData, scene]; }; -- end of AbutAxis ProjectionCycle: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; editToolData.cameraSection.projectionValue _ IF editToolData.cameraSection.projectionValue = globalProjectionCount THEN 1 ELSE editToolData.cameraSection.projectionValue + 1; Labels.Set[editToolData.cameraSection.projection, globalProjectionArray[editToolData.cameraSection.projectionValue]]; }; MaterialCycle: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; editToolData.artworkSection.materialValue _ IF editToolData.artworkSection.materialValue = globalMatCount THEN 1 ELSE editToolData.artworkSection.materialValue + 1; Labels.Set[editToolData.artworkSection.material, globalMatArray[editToolData.artworkSection.materialValue]]; }; ShadowsPrompt: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; IF editToolData.shadowSection.shadowValue THEN { Labels.Set[editToolData.shadowSection.shadowLabel, "FALSE"]; editToolData.shadowSection.shadowValue _ FALSE; } ELSE { Labels.Set[editToolData.shadowSection.shadowLabel, "TRUE"]; editToolData.shadowSection.shadowValue _ TRUE; }; }; AddLight: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; scene: Scene _ editToolData.sceneSection.currentScene; lightsource: LightSource; name: Rope.ROPE; position: Point3d; success, alreadyPresent: BOOL; color: Color; arg: ATOM _ NARROW[event.rest.first]; name _ ViewerTools.GetContents[editToolData.lightSection.name]; [position[1], position[2], position[3]] _ SVViewerTools.GetThreeReals[editToolData.lightSection.position]; [color, success] _ SVViewerTools.GetColor[editToolData.lightSection.color]; IF NOT success THEN RETURN; IF arg = $Add THEN { lightsource _ SVScene.CreateLightSource[name, position, color]; alreadyPresent _ FALSE; SVScene.AddLightSourceToScene[lightsource, scene !SVScene.NameAlreadyPresent => {alreadyPresent _ TRUE; CONTINUE}]; IF alreadyPresent THEN { Feedback.AppendRaw[$Solidviews, Rope.Cat["Lightsource named ", name, " is already present"], oneLiner]; Feedback.BlinkRaw[$Solidviews]; RETURN} } ELSE IF arg = $Replace THEN { [lightsource, success] _ SVScene.FindLightFromName[name, scene]; IF NOT success THEN { Feedback.AppendRaw[$Solidviews, Rope.Cat["Lightsource named ", name, " is not present"], oneLiner]; Feedback.BlinkRaw[$Solidviews]; RETURN}; lightsource.position _ position; lightsource.color _ color; } ELSE Feedback.PutF[svData.feedback, oneLiner, "Illegal option: %g", [rope[Atom.GetPName[arg]]]]; SVViewersOnScene.PaintSceneAllViewers[paintAction: $PaintEntireScene, editToolData: editToolData, scene: scene, remake: none, backgndOK: FALSE, edited: TRUE, okToClearFeedback: FALSE]; }; DeleteLight: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; scene: Scene _ editToolData.sceneSection.currentScene; name: Rope.ROPE; name _ ViewerTools.GetContents[editToolData.lightSection.name]; SVScene.DeleteLightSourceNamed[name, scene]; SVViewersOnScene.SceneNewVersion[editToolData.currentSVData]; SVViewersOnScene.PaintSceneAllViewers[$PaintEntireScene, editToolData, scene]; }; EditLight: PUBLIC PROC [event: LIST OF REF ANY, svData: SVData] = { editToolData: EditToolData _ svData.editToolData; scene: Scene _ editToolData.sceneSection.currentScene; success: BOOL; lightName: Rope.ROPE; light: LightSource; lightName _ ViewerTools.GetContents[editToolData.lightSection.name]; [light, success] _ SVScene.FindLightFromName[lightName, scene]; IF NOT success THEN { Feedback.AppendRaw[$Solidviews, Rope.Cat["Lightsource: ", lightName, "not found."], oneLiner]; Feedback.BlinkRaw[$Solidviews]; RETURN; }; SVViewerTools.SetThreeReals[editToolData.lightSection.position, light.position[1], light.position[2], light.position[3]]; SVViewerTools.SetColor[editToolData.lightSection.color, light.color]; }; -- end of EditLight END.  File: SVEditUserImplD.mesa Last edited by Bier on July 22, 1987 4:16:24 pm PDT Copyright c 1984 by Xerox Corporation. All rights reserved. Contents: All of the procedures called by SVEditTool when menus and buttons are pressed (part 4) GLOBAL VARIABLES IO.PutChar[outHandle, IO.CR]; IO.PutRope[outHandle, "wrtCamera:\n"]; SVParseOut.FileoutMatrix[outHandle, cs.wrtCamera]; Get the camera named in the "name" slot of the edittool camera section. Stuff all of the file camera fields into the appropriate slots. name origin, focus point and slant resolution, focal length, and projection frame clipping planes and visible assemblies name origin, focus point, and slant resolution, focal length and projection frame clipping planes and visible Assemblies just one clipping plane for now make the camera SVEvent.EraseAndDrawScene[currentSVData]; -- Bier, April 9, 1986 Find the mat between source and the distinguished target, remove its rotational components leaving translation and scaling as they were. Find the mat between each source and the distinguished target, remove its rotational and translational components leaving scaling as it was. Find the mat between each source and the distinguished target, rotate it as little as possible so that the axes of the source are parallel to some ordering of the axes of the target. Simply translate each source to the origin of the distinguished target. Change the x translation between each source and the distinguished target to be zero. Stuff position and color into the appropriate spaces. สผ˜Iheadšœ™Jšœ3™3Jšœ ฯmœ1™Jš œžœžœžœžœ˜MJšœ˜Jšœžœ˜0Jš œžœžœžœžœ˜?Jšœ˜J˜—šฯn œžœžœ žœžœžœžœ˜DJšœ˜Jšœ ˜ Jšœ žœžœ-˜AJšœ ˜ Jšœ˜šœ1˜1Jšžœ žœž˜Jšœ,˜,Jšœ˜Jšžœ˜—Jšœฯc˜—šŸœžœžœ žœžœžœžœ˜HJšœ1˜1Jšœ6˜6Jšœ žœ˜Jšœ žœžœ-˜AJšœ˜Jšœ ˜ Jšœ=˜=Jšœ˜Jšœ(˜(Jšœ˜šžœžœž˜Jšœ˜Jšœ+˜+Jšœk˜kJšžœžœžœ˜AJšžœ"˜&Jšœ˜Jšžœ˜—Jšœ ˜J˜—šŸœžœžœ žœžœžœžœ˜JJšœ1˜1Jšœ=˜=Jšœ˜Jšœ žœžœ-˜AJšœ/˜/J˜JšœZ˜ZšžœDžœžœž˜XJšœ3˜3Jšœžœžœ˜Jšœ˜Jšžœž˜Jšžœžœ˜ Jšžœžœ<˜Cšžœžœ˜&Jšžœ"˜$Jšœ@˜@J˜—šžœ˜Jšžœ˜!Jšœ;˜;Jšžœžœžœ™Jšžœ$™&Jšœ2™2J˜—Jšžœžœžœ˜Jšžœžœžœ˜Jšžœ˜—Jšœ ˜J˜—šŸ œžœžœ žœžœžœžœ˜DJšœ1˜1Jšœ=˜=Jšœ žœžœ-˜AJšœ7˜7JšœD˜DJšœ˜—šŸœžœžœ žœžœžœžœ˜KJšœ1˜1Jšœ=˜=Jšœ žœžœ-˜AJšœ˜Jšœ8˜8šžœ>žœžœž˜TJšœ˜Jšœ˜Jšžœ˜—Jšœ˜J˜—šŸ œžœžœ žœžœžœžœ˜EJšœ1˜1Jšœ˜Jšœžœ˜ Jšœ žœžœ-˜Aš žœ žœžœ4žœ žœž˜^Jšœ+˜+Jšžœžœžœžœ˜Jšœ žœ˜"Jšœ5˜5Jšœ ˜ š žœ7žœžœžœž˜pšœ˜Jšœ)˜)—Jšžœ˜—Jšžœ˜—Jšœ˜J˜—šŸ œžœžœ žœžœžœžœ˜EJšœ1˜1Jšœ=˜=Jšœ žœžœ-˜AJšœ˜Jšœ2˜2šžœ(žœžœž˜>Jšœ˜Jšœ˜Jšžœ˜—Jšœ˜—J˜šŸ œžœžœ žœžœžœžœ˜CJšœG™GJšœžœ&˜;Jšœ1˜1Jšœ)˜)J˜J™—šŸœžœžœžœ!˜SJšœ=˜=Jšœ žœ˜Jšœ žœžœ˜Jšœ˜JšœCžœ˜Išžœžœ˜%JšœJ˜JJšœ˜Jšžœ˜J˜—JšœQ˜Qšžœžœ žœ˜JšœY˜YJšœ˜Jšœ˜—šžœ˜Jšœ?™?Jšฯb™JšœF˜FJšก™Jšœ˜Jšœ‘˜‘JšœJ˜JJ˜Jšก(™(JšœT˜TJšœV˜VJšœD˜DJšœO˜OJ˜Jšก™Jšœ žœžœ˜Jšœ5˜5Jšœ žœ˜&Jšžœ˜JšœE˜EJ˜Jšก&™&Jšœ žœžœ˜JšœG˜GJšœžœžœ˜0JšœQ˜QJšžœ˜JšœF˜FJšœžœžœ˜6Jšœ[˜[Jšœ˜—Jšœ ˜J˜—šŸ œžœžœ žœžœžœžœ˜CJšœ1˜1Jšœ=˜=Jšœžœ˜;Jšœ&˜&Jšœ˜Jšœ žœ˜Jšœ žœ˜%JšœFžœ˜KJšœ˜J˜&Jšœ6žœžœ˜@Jšœžœžœ˜Jšœžœžœžœ˜%Jšœ˜Jšœžœ˜J˜Jšก™JšœF˜Fšžœžœ˜%JšœH˜HJšœ˜Jšžœ˜J˜—J˜Jšก™JšœB˜BJšœJ˜JJšœC˜CJ˜Jšก'™'JšœP˜PJšœR˜RJšœP˜PJšœD˜DJšžœžœ žœ˜-J˜Jšก™JšœF˜FJšœžœžœ ˜ Jšœ:˜:J˜Jšก&™&Jšœ™JšœW˜WJšœžœžœ˜+Jšœ>˜>Jšœ^˜^Jšœžœžœ˜8JšœG˜GJšก™JšœT˜Tšžœ žœ $˜5Jšœ˜Jšœ&˜&Jšœ˜Jšœ&˜&Jšœ(˜(Jšœ&˜&Jšœ˜Jšœ.˜.Jšœ4˜4Jšœ˜Jšœ˜—šžœ˜Jšœœ˜œJšœ3˜3Jšœ˜—Jšœ0˜0šžœ.žœžœ˜˜>Jšœ0˜0Jšœ ˜—J˜šŸ œžœžœ žœžœžœžœ˜FJšœˆ™ˆJšœ1˜1Jšœ6˜6Jšœžœžœ˜Jšœ˜Jšœ˜Jšœžœ˜J˜Jšœ0˜0Jšžœ žœžœžœ˜JšœA˜AJšœ,˜,Jšžœžœžœžœ˜#šžœSžœ žœž˜lšžœž˜#Jšœ กœ7˜S—Jšžœก œ&˜DJšžœ˜—Jšœ=˜=IprocšœN˜NJšœ ˜J˜—šŸ œžœžœ žœžœžœžœ˜CJšœŒ™ŒJšœ1˜1Jšœ6˜6Jšœžœžœ˜Jšœ˜Jšœ˜Jšœžœ˜J˜Jšœ0˜0Jšžœ žœžœžœ˜JšœA˜AJšœ,˜,Jšžœžœžœžœ˜#šžœSžœ žœž˜lšžœž˜#Jšœ ก œ7˜P—Jšžœก œ&˜AJšžœ˜—Jšœ=˜=LšœN˜NJšœ ˜—šŸœžœžœ žœžœžœžœ˜?Jšœถ™ถJšœ1˜1Jšœ6˜6Jšœžœžœ˜Jšœ˜Jšœ˜Jšœžœ˜J˜Jšœ0˜0Jšžœ žœžœžœ˜JšœA˜AJšœ,˜,Jšžœžœžœžœ˜#šžœSžœ žœž˜lšžœž˜#Jšœ กœ7˜L—Jšžœกœ&˜=—Jšžœ˜Jšœ=˜=LšœN˜NJšœ ˜—šŸœžœžœ žœžœžœžœ˜>JšœG™GJšœ1˜1Jšœ6˜6Jšœžœžœ˜Jšœ˜Jšœ˜Jšœžœ˜J˜Jšœ0˜0Jšžœ žœžœžœ˜JšœA˜AJšœ,˜,Jšžœžœžœžœ˜#šžœSžœ žœž˜lšžœž˜#Jšœ กœ7˜K—Jšžœกœ&˜<—Jšžœ˜Jšœ=˜=LšœN˜NJšœ ˜J˜—šŸœžœžœ žœžœžœžœ˜?Jšœ1˜1Jšœ˜J˜—šŸœžœžœ žœžœžœžœ˜?Jšœ1˜1Jšœ˜J˜—šŸœžœžœ žœžœžœžœ˜?Jšœ1˜1Jšœ˜J˜J˜—šŸœžœžœ/˜DJšœU™UJšœ6˜6Jšœžœžœ˜Jšœ˜Jšœ˜Jšœžœ˜J˜Jšœ0˜0Jšžœ žœžœžœ˜JšœA˜AJšœ,˜,Jšžœžœžœžœ˜#šžœSžœ žœž˜lšžœž˜#Jšœ Ÿ œ=˜U—JšžœŸœ,˜F—Jšžœ˜Jšœ=˜=LšœN˜NJšœ ˜—J˜J˜šŸœžœžœ žœžœžœžœ˜IJšœ1˜1Jšœ-žœDžœžœ0˜ฎJšœu˜uJšœ˜—šŸ œžœžœ žœžœžœžœ˜GJšœ1˜1Jšœ,žœ<žœžœ/˜คJšœl˜lJšœ˜—šŸ œžœžœ žœžœžœžœ˜GJšœ1˜1šžœ(žœ˜0Jšœ<˜