本文整理汇总了C#中UnityEditor.SceneView类的典型用法代码示例。如果您正苦于以下问题:C# SceneView类的具体用法?C# SceneView怎么用?C# SceneView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SceneView类属于UnityEditor命名空间,在下文中一共展示了SceneView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SceneViewState
public SceneViewState(SceneView.SceneViewState other)
{
this.showFog = other.showFog;
this.showMaterialUpdate = other.showMaterialUpdate;
this.showSkybox = other.showSkybox;
this.showFlares = other.showFlares;
}
示例2: Update
public static void Update(SceneView view) {
Event e = Event.current;
if (Selection.activeGameObject == null || e.type == EventType.MouseUp)
currentlyActiveGameObject = null;
if (SceneView.currentDrawingSceneView != EditorWindow.focusedWindow) {
if (isDragging)
StopDragging();
return;
}
Ray ray = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
hit = new RaycastHit();
var controlID = GUIUtility.GetControlID(FocusType.Passive);
var eventType = e.GetTypeForControl(controlID);
if (e.button == 0 && e.keyCode == DRAG_KEY && Selection.activeGameObject != null) {
if (Physics.Raycast(ray, out hit, Mathf.Infinity, rayDetectorLayerMask)) {
mousePos = new Vector3(hit.point.x, hit.point.y, hit.point.z);
if (!isDragging)
StartDragging(Selection.gameObjects);
else
DragItems(Selection.activeGameObject, mousePos);
}
}
if (isDragging && e.type == EventType.KeyUp && e.keyCode == DRAG_KEY)
StopDragging();
}
示例3: GetSceneViewCamera
public static SceneViewCamera GetSceneViewCamera(SceneView sceneView)
{
Vector3 cameraForward = sceneView.camera.transform.forward;
if (cameraForward == new Vector3(0, -1, 0))
{
return SceneViewCamera.Top;
}
else if (cameraForward == new Vector3(0, 1, 0))
{
return SceneViewCamera.Bottom;
}
else if (cameraForward == new Vector3(1, 0, 0))
{
return SceneViewCamera.Left;
}
else if (cameraForward == new Vector3(-1, 0, 0))
{
return SceneViewCamera.Right;
}
else if (cameraForward == new Vector3(0, 0, -1))
{
return SceneViewCamera.Front;
}
else if (cameraForward == new Vector3(0, 0, 1))
{
return SceneViewCamera.Back;
}
else
{
return SceneViewCamera.Other;
}
}
示例4: ToolGUI
public override void ToolGUI(SceneView view, Vector3 handlePosition, bool isStatic)
{
Quaternion handleRotation = Tools.handleRotation;
EditorGUI.BeginChangeCheck();
Quaternion quaternion2 = Handles.RotationHandle(handleRotation, handlePosition);
if (EditorGUI.EndChangeCheck() && !isStatic)
{
float num;
Vector3 vector;
(Quaternion.Inverse(handleRotation) * quaternion2).ToAngleAxis(out num, out vector);
Undo.RecordObjects(Selection.transforms, "Rotate");
foreach (Transform transform in Selection.transforms)
{
if (Tools.pivotMode == PivotMode.Center)
{
transform.RotateAround(handlePosition, (Vector3) (handleRotation * vector), num);
}
else if (TransformManipulator.individualSpace)
{
transform.Rotate((Vector3) (transform.rotation * vector), num, Space.World);
}
else
{
transform.Rotate((Vector3) (handleRotation * vector), num, Space.World);
}
transform.SetLocalEulerHint(transform.GetLocalEulerAngles(transform.rotationOrder));
if (transform.parent != null)
{
transform.SendTransformChangedScale();
}
}
Tools.handleRotation = quaternion2;
}
}
示例5: OnSceneGUI
public void OnSceneGUI(SceneView sceneView)
{
if(teleportJump==null)
return;
teleportJump.playerNewPosition = Handles.DoPositionHandle(teleportJump.playerNewPosition, Quaternion.Euler(teleportJump.playerNewRotation));
Vector3 point = teleportJump.playerNewPosition;
Quaternion startRot = Quaternion.Euler(teleportJump.playerNewRotation);
Handles.color = new Color(0f, 1f, 0f);
Handles.color = new Color(1f, 0f, 0f);
Handles.DrawLine(point, point + (startRot * new Vector3(-1f, 0, 0)));
Handles.DrawLine(point, point + (startRot * new Vector3(1f, 0, 0)));
Handles.DrawLine(point, point + (startRot * new Vector3(0, 1f, 0)));
Handles.DrawLine(point, point + (startRot * new Vector3(0, -1f, 0)));
if(!teleportJump.useRotation)
return;
Handles.color = new Color(1f, 1f, 0f);
Vector3 seePoint = teleportJump.playerNewPosition + startRot*new Vector3(0f,0f,1f);
Handles.DrawLine(point, seePoint);
Handles.ConeCap(0,seePoint,startRot,0.1f);
}
示例6: Input
/// <summary>
/// Handles input for the editor.
/// </summary>
public void Input (SceneView view) {
Event e = Event.current;
if (e.isKey) {
if (e.type == EventType.KeyDown) {
if (e.keyCode == settingsObject.APPLY_SINGLE) {
PaintAtHoverPosition();
}
if (e.keyCode == settingsObject.APPLY_ALL) {
//paint all of selection
}
}
}
}
示例7: OnSceneGUI
public static void OnSceneGUI(SceneView sceneView, Event e)
{
if (e.type == EventType.Repaint || e.type == EventType.Layout)
{
OnRepaint(sceneView, e);
}
}
示例8: OnSceneDrag
public static void OnSceneDrag(SceneView sceneView)
{
Event current = Event.current;
if (current.type != EventType.DragUpdated && current.type != EventType.DragPerform && current.type != EventType.DragExited)
{
return;
}
Sprite[] spriteFromDraggedPathsOrObjects = SpriteUtility.GetSpriteFromDraggedPathsOrObjects();
if (spriteFromDraggedPathsOrObjects.Length == 0)
{
return;
}
Sprite x = spriteFromDraggedPathsOrObjects[0];
if (x == null)
{
return;
}
DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
EventType type = current.type;
if (type == EventType.DragPerform)
{
Vector3 point = HandleUtility.GUIPointToWorldRay(current.mousePosition).GetPoint(10f);
point.z = 0f;
GameObject objectToUndo = SpriteUtility.DropFramesToSceneToCreateGO(spriteFromDraggedPathsOrObjects, point);
Undo.RegisterCreatedObjectUndo(objectToUndo, "Create Sprite");
current.Use();
}
}
示例9: Draw
/// <summary>
/// Draws the in-scene GUI controls for the currently active BeholdR component
/// </summary>
/// <param name="sceneView">The currently drawing scene view</param>
public static void Draw(SceneView sceneView)
{
if( BeholdR.ActiveInstance == null ||
BeholdR.ActiveInstance.IsSyncSupressed ||
!BeholdR.ActiveInstance.ShowGuiControls)
{
return;
}
// calculate drawing area
_controlsGuiRect = CalculateGuiRect(BeholdR.ActiveInstance.ControlsAnchor, sceneView.camera, Utilities.IsEditorVisible("UnityEditor.CameraEditor"));
// do the actual drawing
Handles.BeginGUI();
{
GUILayout.BeginArea(_controlsGuiRect, GUI.skin.box);
{
DrawViewLinkControl(sceneView);
DrawFilterControl(sceneView);
}
GUILayout.EndArea();
//EditorGUILayout.Toggle("HDR?", sceneView.camera.hdr);
//DrawCameraPostFx(sceneView.camera);
}
Handles.EndGUI();
}
示例10: Input
public override void Input (SceneView sceneView) {
base.Input(sceneView);
Event e = Event.current;
if (e.isKey) {
if (e.type == EventType.KeyDown) {
if (e.keyCode == settingsObject.SET_MODE_TO_SELECT) { currentModeIndex = 0; VMEGlobal.Hidden = false; }
if (e.keyCode == settingsObject.SET_MODE_TO_MOVE) { currentModeIndex = 1; VMEGlobal.Hidden = true; }
if (e.keyCode == settingsObject.SET_MODE_TO_EDIT) { currentModeIndex = 2; VMEGlobal.Hidden = true; }
if (e.keyCode == settingsObject.SET_MODE_TO_PAINT) { currentModeIndex = 3; VMEGlobal.Hidden = true; }
if (e.keyCode == settingsObject.SET_MODE_TO_REMOVE) { currentModeIndex = 4; VMEGlobal.Hidden = true; }
}
}
switch (currentModeIndex) {
case 1: selectionControls.Input(sceneView); break;
case 0: break;
case 2: editControls.Input(sceneView); break;
case 3: paintControls.Input(sceneView); break;
case 4: break;
}
}
示例11: OnSceneGUI
void OnSceneGUI(SceneView sceneView)
{
if (layerMesh == null)
return;
if (resolution <= 0)
resolution = 1;
if (hairLayers.Length >= 2) {
if (drawCorners) {
Handles.color = Color.black;
var vertices = layerMesh.vertices;
for (var i = 0; i < vertices.Length; i++) {
var p = vertices[i];
var spl = GetSplineInWorld(p);
DrawSplineInScene (spl);
}
}
}
if (Selection.activeGameObject == this.gameObject) {
for (var i = 0; i < hairLayers.Length; i++) {
var tr = hairLayers[i].transform;
switch (Tools.current) {
case Tool.Move:
tr.position = Handles.PositionHandle(tr.position, tr.rotation);
break;
case Tool.Rotate:
tr.rotation = Handles.RotationHandle(tr.rotation, tr.position);
break;
case Tool.Scale:
tr.localScale = Handles.ScaleHandle(tr.localScale, tr.position, tr.rotation, 5f);
break;
}
}
}
}
示例12: DisplayControls
public void DisplayControls(SceneView sceneView)
{
LightmapVisualization.showLightProbeLocations = EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Show Light Probes"), LightmapVisualization.showLightProbeLocations, new GUILayoutOption[0]);
++EditorGUI.indentLevel;
LightmapVisualization.showLightProbeCells = EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Show Cells"), LightmapVisualization.showLightProbeCells, new GUILayoutOption[0]);
--EditorGUI.indentLevel;
}
示例13: ToolGUI
public override void ToolGUI(SceneView view, Vector3 handlePosition, bool isStatic)
{
Quaternion handleRotation = Tools.handleRotation;
EditorGUI.BeginChangeCheck();
Quaternion quaternion = Handles.RotationHandle(handleRotation, handlePosition);
if (!EditorGUI.EndChangeCheck() || isStatic)
return;
float angle;
Vector3 axis1;
(Quaternion.Inverse(handleRotation) * quaternion).ToAngleAxis(out angle, out axis1);
Vector3 vector3 = handleRotation * axis1;
if (TransformManipulator.individualSpace)
vector3 = Quaternion.Inverse(Tools.handleRotation) * vector3;
Undo.RecordObjects((Object[]) Selection.transforms, "Rotate");
foreach (Transform transform in Selection.transforms)
{
Vector3 axis2 = vector3;
if (TransformManipulator.individualSpace)
axis2 = transform.rotation * vector3;
if (Tools.pivotMode == PivotMode.Center)
transform.RotateAround(handlePosition, axis2, angle);
else
transform.RotateAround(transform.position, axis2, angle);
if ((Object) transform.parent != (Object) null)
transform.SendTransformChangedScale();
}
Tools.handleRotation = quaternion;
}
示例14: OnGUI
public static void OnGUI(SceneView view)
{
if (MoveTool.s_Instance == null)
{
MoveTool.s_Instance = new MoveTool();
}
MoveTool.s_Instance.OnToolGUI(view);
}
示例15: OnGUI
public static void OnGUI(SceneView view)
{
if (RotateTool.s_Instance == null)
{
RotateTool.s_Instance = new RotateTool();
}
RotateTool.s_Instance.OnToolGUI(view);
}