Esempio n. 1
0
		public static pb_Lightmap_Editor Init(pb_Editor _editor)
		{
			pb_Lightmap_Editor win = EditorWindow.GetWindow<pb_Lightmap_Editor>(true, "UV2 Param Gen. Settings", true);
			win.Show();
			win.editor = _editor;
			win.OnSelectionUpdate(win.editor.selection);

			return win;
		}
Esempio n. 2
0
	public static void SelectHiddenFaces(pb_Editor editor, float collision_distance)
	{
		// Open the pb_Editor window if it isn't already open.
		// pb_Editor editor = pb_Editor.instance;

		// Clear out all selected
		editor.ClearSelection();

		// If we're in Mode based editing, make sure that we're also in geo mode. 
		editor.SetEditLevel(EditLevel.Geometry);

		// aaand also set to face seelction mode
		editor.SetSelectionMode(SelectMode.Face);

		// Find all ProBuilder objects in the scene.
		pb_Object[] pbs = (pb_Object[])Object.FindObjectsOfType(typeof(pb_Object));

		// Cycle through every quad
		foreach(pb_Object pb in pbs)
		{
			// Ignore if it isn't a detail or occluder
			if(pb.GetComponent<pb_Entity>().entityType != EntityType.Detail && pb.GetComponent<pb_Entity>().entityType != EntityType.Occluder)
				continue;	

			bool addToSelection = false;

			for(int i = 0; i < pb.faces.Length; i++)
			{
				pb_Face q = pb.faces[i];
				if(HiddenFace(pb, q, collision_distance))
				{
					// If a hidden face is found, set material to NoDraw
					// pb.SetQuadMaterial(q, nodrawMat);

					// Mark this object to be added to selection
					addToSelection = true;

					// Add hit face to SelectedFaces
					pb.AddToFaceSelection(i);
				}

			}

			if(addToSelection)
				editor.AddToSelection(pb.gameObject);
		}

		editor.UpdateSelection();
	}
Esempio n. 3
0
	public void OnEnable()
	{
		_instance = this;

		graphics.LoadPrefs( pb_Preferences_Internal.ToHashtable() );

		HookDelegates();

		// make sure load prefs is called first, because other methods depend on the preferences set here
		LoadPrefs();

		InitGUI();

		show_Detail 	= pb_Preferences_Internal.GetBool(pb_Constant.pbShowDetail);
		show_Mover 		= pb_Preferences_Internal.GetBool(pb_Constant.pbShowMover);
		show_Collider 	= pb_Preferences_Internal.GetBool(pb_Constant.pbShowCollider);
		show_Trigger 	= pb_Preferences_Internal.GetBool(pb_Constant.pbShowTrigger);

		// EditorUtility.UnloadUnusedAssets();
		ToggleEntityVisibility(EntityType.Detail, true);

		UpdateSelection(true);

		HideSelectedWireframe();
		
		findNearestVertex = typeof(HandleUtility).GetMethod("FindNearestVertex", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Instance);
	}
Esempio n. 4
0
	private void OnDisable()
	{
		_instance = null;

		ClearFaceSelection();

		UpdateSelection();

		if( OnSelectionUpdate != null )
			OnSelectionUpdate(null);

		pb_ProGrids_Interface.UnsubscribePushToGridEvent(PushToGrid);

		SceneView.onSceneGUIDelegate -= this.OnSceneGUI;
		Undo.undoRedoPerformed -= this.UndoRedoPerformed;

		EditorPrefs.SetInt(pb_Constant.pbHandleAlignment, (int)handleAlignment);

		if(pb_LineRenderer.Valid())
			pb_LineRenderer.instance.Clear();

		// re-enable unity wireframe
		foreach(pb_Object pb in FindObjectsOfType(typeof(pb_Object)))
		{
			Renderer ren = pb.gameObject.GetComponent<Renderer>();
			EditorUtility.SetSelectedWireframeHidden(ren, false);
		}

		SceneView.RepaintAll();
	}