Tree Component for the tree creator.

Inheritance: Component
Beispiel #1
0
        public VoxelRenderer(Index index, Tree control)
            : this(index, control, new Vector3(
				index.x * control.sizes[index.depth],
				index.y * control.sizes[index.depth],
				index.z * control.sizes[index.depth]))
        {
        }
        /// <summary>
        /// Read the data into the specified value.
        /// </summary>
        /// <param name="value">Value.</param>
        /// <param name="reader">Reader.</param>
        public override void ReadInto(object value, ISaveGameReader reader)
        {
            UnityEngine.Tree tree = (UnityEngine.Tree)value;
            foreach (string property in reader.Properties)
            {
                switch (property)
                {
                case "data":
                    Type dataType = Type.GetType(reader.ReadProperty <System.String> ());
                    if (tree.data == null)
                    {
                        tree.data = (UnityEngine.ScriptableObject)reader.ReadProperty(dataType);
                    }
                    else
                    {
                        reader.ReadIntoProperty(tree.data);
                    }
                    break;

                case "tag":
                    tree.tag = reader.ReadProperty <System.String> ();
                    break;

                case "name":
                    tree.name = reader.ReadProperty <System.String> ();
                    break;

                case "hideFlags":
                    tree.hideFlags = reader.ReadProperty <UnityEngine.HideFlags> ();
                    break;
                }
            }
        }
 /// <summary>
 /// Write the specified value using the writer.
 /// </summary>
 /// <param name="value">Value.</param>
 /// <param name="writer">Writer.</param>
 public override void Write(object value, ISaveGameWriter writer)
 {
     UnityEngine.Tree tree = (UnityEngine.Tree)value;
     writer.WriteProperty("dataType", tree.data.GetType().AssemblyQualifiedName);
     writer.WriteProperty("data", tree.data);
     writer.WriteProperty("tag", tree.tag);
     writer.WriteProperty("name", tree.name);
     writer.WriteProperty("hideFlags", tree.hideFlags);
 }
Beispiel #4
0
		public VoxelRenderer(Index index, Tree control, Vector3 localPosition) {
			this.index = index;
			this.position = localPosition;
			this.control = control;
			size = 0;
			++rendCount;
			VERTS = new Vector3[0];
			NORMS = new Vector3[0];
			TRIS = new int[0];
			lock(control) {
				control.renderers[index] = this;
			}
		}
Beispiel #5
0
		public override Application setup(Tree target) {

			LineApplication app = new LineApplication();
			app.tree = target;
			app.position = target.globalToVoxelPosition(globalPoints[0]);
			app.points = new Vector3[globalPoints.Length];
			for (int i = 0; i < globalPoints.Length; ++i)
				app.points[i] = target.globalToVoxelPosition(globalPoints[i]) -app.position;
            app.childApp = (LocalApplication) child.setup(target);
			// TODO: set min, max and updateMesh.

			return app;
		}
Beispiel #6
0
		public override Application setup(Tree target) {
			Vector3 halfDimension = worldDimensions / target.voxelSize() /2f;
			Vector3 center = target.transform.InverseTransformPoint(worldPosition) / target.voxelSize();
			Vector3 exactMin = center - halfDimension;
			Vector3 exactMax = center + halfDimension;

			CubeApp app = new CubeApp();
			app.tree = target;
			app.halfDimension = halfDimension;
			app.min = new Index(target.maxDetail, (uint)exactMin.x, (uint)exactMin.y, (uint)exactMin.z);
			app.max = new Index(target.maxDetail, (uint)exactMax.x, (uint)exactMax.y, (uint)exactMax.z);
			app.position = center;
			return app;
		}
Beispiel #7
0
		public override Application setup(Tree target) {
			float radius = worldRadius / target.voxelSize();
			Vector3 radiusCube = new Vector3(radius, radius, radius);
			Vector3 center = target.globalToVoxelPosition(worldPosition);
			Vector3 exactMin = center - radiusCube;
			Vector3 exactMax = center + radiusCube;
			SphereApp app = new SphereApp();
			app.tree = target;
			app.min = new Index(target.maxDetail, (uint)exactMin.x, (uint)exactMin.y, (uint)exactMin.z);
			app.max = new Index(target.maxDetail, (uint)exactMax.x, (uint)exactMax.y, (uint)exactMax.z);
			app.position = center;
			app.radius = radius;
			return app;
		}
		public VoxelUpdateInfo(float size, VoxelHolder main, Tree control)
			: this() {
			this.size = size;
			this.detailLevel = 0;
			this.control = control;
			x = y = z = 0;
			for (byte xi = 0; xi < DIMENSION; ++xi) {
				for (byte yi = 0; yi < DIMENSION; ++yi) {
					for (byte zi = 0; zi < DIMENSION; ++zi) {
						blocks[xi, yi, zi] = Voxel.empty;
					}
				}
			}
			blocks[1, 1, 1] = main;
		}
		public void setFromSister(VoxelUpdateInfo sister, byte xi, byte yi, byte zi) {
			size = sister.size;
			detailLevel = sister.detailLevel;
			control = sister.control;
			x = sister.x + xi - 1;
			y = sister.y + yi - 1;
			z = sister.z + zi - 1;
			for (byte xii = (byte)(1 - (xi + 1) / 2); xii < DIMENSION - (xi / 2); ++xii) {
				for (byte yii = (byte)(1 - (yi + 1) / 2); yii < DIMENSION - (yi / 2); ++yii) {
					for (byte zii = (byte)(1 - (zi + 1) / 2); zii < DIMENSION - (zi / 2); ++zii) {
						blocks[xii, yii, zii] = sister.blocks[xii + xi - 1, yii + yi - 1, zii + zi - 1];
						renderers[xii, yii, zii] = sister.renderers[xii + xi - 1, yii + yi - 1, zii + zi - 1];
					}
				}
			}
		}
Beispiel #10
0
		public override Application setup(Tree target) {
			float radius = worldRadius / target.voxelSize();
			Vector3 radiusCube = new Vector3(radius, radius, radius);
			Vector3 center = target.transform.InverseTransformPoint(worldPosition) / target.voxelSize();
			Vector3 exactMin = center - radiusCube;
			Vector3 exactMax = center + radiusCube;
			BlurApp app = new BlurApp();
			app.tree = target;
			app.min = new Index(target.maxDetail, (uint)exactMin.x, (uint)exactMin.y, (uint)exactMin.z);
			app.max = new Index(target.maxDetail, (uint)exactMax.x, (uint)exactMax.y, (uint)exactMax.z);
			app.minRadius = radius - 1;
			app.maxRadius = radius + 1;
			app.position = center;
			app.radius = radius;
			app.setOriginal(target);
			return app;
		}
Beispiel #11
0
		public void set(byte detailLevel, int x, int y, int z, Voxel value, Tree control) {
			if (detailLevel > 0) {
				short factor = (short)(1 << (detailLevel - CHILD_COUNT_POWER));
				byte xi = (byte)(x / factor);
				byte yi = (byte)(y / factor);
				byte zi = (byte)(z / factor);
				if (detailLevel == CHILD_COUNT_POWER) {
					children[xi, yi, zi] = value;
				} else {
					if (children[xi, yi, zi].GetType() == typeof(Voxel)) {
						if (children[xi, yi, zi].Equals(value)) { ++skippedSubdivisions; return; }
						children[xi, yi, zi] = new VoxelBlock((Voxel)children[xi, yi, zi]);
					}
					((VoxelBlock)children[xi, yi, zi]).set((byte)(detailLevel - CHILD_COUNT_POWER), x - xi * factor, y - yi * factor, z - zi * factor, value, control);
				}
			} else
				set(value);
		}
Beispiel #12
0
		public VoxelUpdateInfo(VoxelUpdateInfo super, byte xi, byte yi, byte zi)
			: this() {
			size = super.size / VoxelBlock.CHILD_DIMENSION;
			detailLevel = (byte)(super.detailLevel + 1);
			control = super.control;
			x = super.x * VoxelBlock.CHILD_DIMENSION + xi;
			y = super.y * VoxelBlock.CHILD_DIMENSION + yi;
			z = super.z * VoxelBlock.CHILD_DIMENSION + zi;
			for (byte xii = 0; xii < DIMENSION; ++xii) {
				for (byte yii = 0; yii < DIMENSION; ++yii) {
					for (byte zii = 0; zii < DIMENSION; ++zii) {
						blocks[xii, yii, zii] = super.getSub(VoxelBlock.CHILD_COUNT_POWER, (byte)(xii + xi + VoxelBlock.CHILD_DIMENSION - 1), (byte)(yii + yi + VoxelBlock.CHILD_DIMENSION - 1), (byte)(zii + zi + VoxelBlock.CHILD_DIMENSION - 1));
						if (renderers[xii, yii, zii] == null || renderers[xii, yii, zii].old)
							renderers[xii, yii, zii] = control.getRenderer(new Index((byte)(detailLevel), (uint)(x -1 +xii), (uint)(y -1 +yii), (uint)(z -1 +zii)));
						if (renderers[xii, yii, zii] != null && renderers[xii, yii, zii].old)
							renderers[xii, yii, zii] = null;
					}
				}
			}
		}
Beispiel #13
0
 private static void UpdateMesh(Tree tree, bool callExitGUI)
 {
     TreeData treeData = GetTreeData(tree);
     if (treeData != null)
     {
         Material[] materialArray;
         Profiler.BeginSample("TreeEditor.UpdateMesh");
         treeData.UpdateMesh(tree.transform.worldToLocalMatrix, out materialArray);
         AssignMaterials(tree.GetComponent<Renderer>(), materialArray, true);
         s_SavedSourceMaterialsHash = treeData.materialHash;
         Profiler.EndSample();
         if (callExitGUI)
         {
             GUIUtility.ExitGUI();
         }
     }
 }
Beispiel #14
0
			public void setOriginal(Tree target) {
				original = target.getArray((int)min.x, (int)min.y, (int)min.z, (int)max.x + 1, (int)max.y + 1, (int)max.z + 1);
			}
Beispiel #15
0
		public void setToHeightmap(byte detailLevel, int x, int y, int z, ref float[,] map, byte material, Tree control) {
			if (detailLevel <= CHILD_COUNT_POWER) {
				for (int xi = 0; xi < CHILD_DIMENSION; ++xi) {
					for (int zi = 0; zi < CHILD_DIMENSION; ++zi) {
						for (int yi = 0; yi < CHILD_DIMENSION; ++yi) {
							if (yi + y >= map[x + xi, z + zi])
								break;
							else if (material == byte.MaxValue) {
								children[xi, yi, zi] = Voxel.empty;
							} else {
								if (yi + y >= map[x + xi, z + zi] - 1) {
									byte opacity = (byte)((map[x + xi, z + zi] - yi - y) * byte.MaxValue);
									if (opacity > control.isoLevel || children[xi, yi, zi].averageOpacity() <= opacity)
										children[xi, yi, zi] = new Voxel(material, opacity);
								} else {
									children[xi, yi, zi] = new Voxel(material, byte.MaxValue);
								}
							}
						}
					}
				}
			} else {
				int multiplier = (1 << (detailLevel - CHILD_COUNT_POWER));
				for (int xi = 0; xi < CHILD_DIMENSION; ++xi) {
					for (int zi = 0; zi < CHILD_DIMENSION; ++zi) {
						int xMax = x + (xi + 1) * multiplier;
						int zMax = z + (zi + 1) * multiplier;
						float yMin = float.MaxValue;
						float yMax = 0;
						for (int xPos = x + xi * multiplier; xPos < xMax; ++xPos) {
							for (int zPos = z + zi * multiplier; zPos < zMax; ++zPos) {
								if (map[xPos, zPos] < yMin) yMin = map[xPos, zPos];
								if (map[xPos, zPos] > yMax) yMax = map[xPos, zPos];
							}
						}

						int firstUnsolidBlock = Mathf.Min(((int)(yMin - y)) / multiplier, CHILD_DIMENSION);
						int lastUnsolidBlock = Mathf.Min(((int)(yMax - y)) / multiplier, CHILD_DIMENSION - 1);
						int yi = 0;
						for (; yi < firstUnsolidBlock; ++yi) {
							if (material == byte.MaxValue)
								children[xi, yi, zi] = Voxel.empty;
							else
								children[xi, yi, zi] = new Voxel(material, byte.MaxValue);
						}
						if (lastUnsolidBlock < 0) continue;
						for (; yi <= lastUnsolidBlock; ++yi) {
							if (children[xi, yi, zi].GetType() == typeof(Voxel))
								children[xi, yi, zi] = new VoxelBlock((Voxel)children[xi, yi, zi]);
							((VoxelBlock)children[xi, yi, zi]).setToHeightmap((byte)(detailLevel - CHILD_COUNT_POWER), x + xi * multiplier, y + yi * multiplier, z + zi * multiplier, ref map, material, control);
						}
					}
				}
			}
			control.dirty = true;
		}
Beispiel #16
0
		public CubeMutator(Tree control, Vector3 worldPosition, Vector3 worldDimensions, VoxelHolder value, bool updateMesh) {
			this.worldPosition = worldPosition;
			this.worldDimensions = worldDimensions;
			this.value = value.toVoxel();
		}
Beispiel #17
0
		public void setToHeightmap(byte detailLevel, int x, int y, int z, ref float[,] map, byte[,] mats, Tree control) {
			if (detailLevel <= CHILD_COUNT_POWER) {
				for (int xi = 0; xi < CHILD_DIMENSION; ++xi) {
					for (int zi = 0; zi < CHILD_DIMENSION; ++zi) {
						for (int yi = 0; yi < CHILD_DIMENSION; ++yi) {
							if (yi + y >= map[x + xi, z + zi])
								break;
							else if (yi + y >= map[x + xi, z + zi] - 1) {
								if (mats[x + xi, z + zi] == byte.MaxValue)
									children[xi, yi, zi] = Voxel.empty;
								else
									children[xi, yi, zi] = new Voxel(mats[x + xi, z + zi], (byte)((map[x + xi, z + zi] - yi - y) * byte.MaxValue));
							} else {
								if (mats[x + xi, z + zi] == byte.MaxValue)
									children[xi, yi, zi] = Voxel.empty;
								else
									children[xi, yi, zi] = new Voxel(mats[x + xi, z + zi], byte.MaxValue);
							}
						}
					}
				}
			} else {
				int multiplier = (1 << (detailLevel - CHILD_COUNT_POWER));
				for (int xi = 0; xi < CHILD_DIMENSION; ++xi) {
					for (int zi = 0; zi < CHILD_DIMENSION; ++zi) {
						int xMax = x + (xi + 1) * multiplier;
						int zMax = z + (zi + 1) * multiplier;
						float yMin = float.MaxValue;
						float yMax = 0;
						bool multipleMaterials = false;
						byte material = mats[x, z];
						for (int xPos = x + xi * multiplier; xPos < xMax; ++xPos) {
							for (int zPos = z + zi * multiplier; zPos < zMax; ++zPos) {
								if (map[xPos, zPos] < yMin) yMin = map[xPos, zPos];
								if (map[xPos, zPos] > yMax) yMax = map[xPos, zPos];
								if (mats[xPos, zPos] != material) multipleMaterials = true;
							}
						}

						if (multipleMaterials) yMin = 0;
						int firstUnsolidBlock = Mathf.Min(((int)(yMin - y)) / multiplier, CHILD_DIMENSION);
						int lastUnsolidBlock = Mathf.Min(((int)(yMax - y)) / multiplier, CHILD_DIMENSION - 1);
						int yi = 0;
						for (; yi < firstUnsolidBlock; ++yi) {
							if (mats[x + xi * multiplier, z + zi * multiplier] == byte.MaxValue)
								children[xi, yi, zi] = Voxel.empty;
							else
								children[xi, yi, zi] = new Voxel(mats[x + xi * multiplier, z + zi * multiplier], byte.MaxValue);
						}
						if (lastUnsolidBlock < 0) continue;
						for (; yi <= lastUnsolidBlock; ++yi) {
							VoxelBlock newChild = new VoxelBlock();
							newChild.setToHeightmap((byte)(detailLevel - CHILD_COUNT_POWER), x + xi * multiplier, y + yi * multiplier, z + zi * multiplier, ref map, mats, control);
							children[xi, yi, zi] = newChild;
						}
					}
				}
			}
			control.dirty = true;
		}
Beispiel #18
0
 private static void PreviewMesh(Tree tree, bool callExitGUI)
 {
     TreeData treeData = GetTreeData(tree);
     if (treeData != null)
     {
         Material[] materialArray;
         Profiler.BeginSample("TreeEditor.PreviewMesh");
         treeData.PreviewMesh(tree.transform.worldToLocalMatrix, out materialArray);
         AssignMaterials(tree.GetComponent<Renderer>(), materialArray, false);
         Profiler.EndSample();
         if (callExitGUI)
         {
             GUIUtility.ExitGUI();
         }
     }
 }
Beispiel #19
0
		public UpdateCheckJob(VoxelBlock block, Tree control, byte detailLevel) {
			this.block = block;
			this.control = control;
			this.detailLevel = detailLevel;
			control.addUpdateCheckJob();
		}
Beispiel #20
0
		public LinkRenderersJob(Tree control) {
			this.control = control;
		}
Beispiel #21
0
		public static bool isRenderLod(float x, float y, float z, float size, Tree control) {
			if (!control.useLod)
				return size == control.sizes[control.maxDetail];
			return getDistSquare(control.getLocalCamPosition(), new Vector3(x + 0.5f, y + 0.5f, z + 0.5f), size) >= size * size * control.getLodDetail();
		}
Beispiel #22
0
		public static bool isRenderSize(float size, Tree control) {
			return control.sizes[control.maxDetail - VoxelRenderer.VOXEL_COUNT_POWER] == size;
		}
Beispiel #23
0
		public void updateAll(uint x, uint y, uint z, byte detailLevel, Tree control, bool force = false) {
			// check if this is a high enough detail level.  If not, call the childrens' update methods
			VoxelRenderer renderer = control.getRenderer(new Index(detailLevel, x, y, z));
			if (!isRenderSize(control.sizes[detailLevel], control) && (!isRenderLod(x, y, z, control.sizes[detailLevel], control))) {
				for (byte xi = 0; xi < CHILD_DIMENSION; ++xi) {
					for (byte yi = 0; yi < CHILD_DIMENSION; ++yi) {
						for (byte zi = 0; zi < CHILD_DIMENSION; ++zi) {
							//VoxelUpdateInfo childInfo = new VoxelUpdateInfo(info, xi, yi, zi);
							if (children[xi, yi, zi].GetType() == typeof(Voxel)) {
								//if (!childInfo.isSolid())
								children[xi, yi, zi] = new VoxelBlock((Voxel)children[xi, yi, zi]);
								//else
								//continue;
							}
							UpdateCheckJob job = new UpdateCheckJob((VoxelBlock)children[xi, yi, zi], control, (byte)(detailLevel + 1));
							job.setOffset((byte)(x * CHILD_DIMENSION + xi), (byte)(y * CHILD_DIMENSION + yi), (byte)(z * CHILD_DIMENSION + zi));
							control.enqueueCheck(job);
						}
					}
				}
				if (renderer != null) {
					//GameObject.Destroy(renderer.ob);
					//lock (myControl) {
					//	myControl.enqueueJob(new DropRendererJob(renderer));
					//	renderer = null;
					//}
					renderer.old = true;
				}
				return;
			}

			// check if we already have a mesh
			if (renderer == null) {
				//clearSubRenderers();
				renderer = new VoxelRenderer(new Index(detailLevel, x, y, z), control);
				//info.renderers[1, 1, 1] = renderer;
			} else {
				renderer.old = false;
				if (!force) return;
			}

			// We should generate a mesh
			GenMeshJob updateJob = new GenMeshJob(this, control, detailLevel);
			updateJob.setOffset(x, y, z);
			control.enqueueUpdate(updateJob);
		}
Beispiel #24
0
		public GenMeshJob(VoxelBlock block, Tree control, byte detailLevel) {
			this.block = block;
			this.control = control;
			this.detailLevel = detailLevel;
		}
Beispiel #25
0
 private void FrameSelected(Tree tree)
 {
     TreeData treeData = GetTreeData(tree);
     Matrix4x4 localToWorldMatrix = tree.transform.localToWorldMatrix;
     Bounds bounds = new Bounds(localToWorldMatrix.MultiplyPoint(Vector3.zero), Vector3.zero);
     if (s_SelectedGroup != null)
     {
         if (s_SelectedGroup.GetType() == typeof(TreeGroupRoot))
         {
             MeshFilter component = tree.GetComponent<MeshFilter>();
             if ((component == null) || (s_SelectedGroup.childGroupIDs.Length == 0))
             {
                 float rootSpread = s_SelectedGroup.GetRootSpread();
                 Vector3 introduced14 = localToWorldMatrix.MultiplyPoint(Vector3.zero);
                 bounds = new Bounds(introduced14, localToWorldMatrix.MultiplyVector(new Vector3(rootSpread, rootSpread, rootSpread)));
             }
             else
             {
                 Vector3 introduced15 = localToWorldMatrix.MultiplyPoint(component.sharedMesh.bounds.center);
                 bounds = new Bounds(introduced15, localToWorldMatrix.MultiplyVector(component.sharedMesh.bounds.size));
             }
         }
         else if (s_SelectedNode != null)
         {
             if ((s_SelectedGroup.GetType() == typeof(TreeGroupLeaf)) && (s_SelectedPoint >= 0))
             {
                 Matrix4x4 matrixx2 = localToWorldMatrix * s_SelectedNode.matrix;
                 bounds = new Bounds(matrixx2.MultiplyPoint(s_SelectedNode.spline.nodes[s_SelectedPoint].point), Vector3.zero);
             }
             else
             {
                 bounds = this.CalcBounds(treeData, localToWorldMatrix, s_SelectedNode);
             }
         }
         else
         {
             for (int i = 0; i < s_SelectedGroup.nodeIDs.Length; i++)
             {
                 Bounds bounds4 = this.CalcBounds(treeData, localToWorldMatrix, treeData.GetNode(s_SelectedGroup.nodeIDs[i]));
                 if (i == 0)
                 {
                     bounds = bounds4;
                 }
                 else
                 {
                     bounds.Encapsulate(bounds4);
                 }
             }
         }
     }
     Vector3 center = bounds.center;
     float newSize = bounds.size.magnitude + 1f;
     SceneView lastActiveSceneView = SceneView.lastActiveSceneView;
     if (lastActiveSceneView != null)
     {
         lastActiveSceneView.LookAt(center, lastActiveSceneView.rotation, newSize);
     }
 }
Beispiel #26
0
 private static void PreviewMesh(Tree tree)
 {
     PreviewMesh(tree, true);
 }
Beispiel #27
0
		private static void UpdateMesh(Tree tree)
		{
			TreeEditor.UpdateMesh(tree, true);
		}
Beispiel #28
0
 private static void UpdateMesh(Tree tree)
 {
     UpdateMesh(tree, true);
 }
Beispiel #29
0
		public BlurMutator(Tree control, Vector3 worldPosition, float worldRadius, float strength) {
			this.strength = strength;
			this.worldPosition = worldPosition;
			this.worldRadius = worldRadius;
		}
Beispiel #30
0
 public void InspectorEditTools(Tree obj)
 {
     if (!EditorUtility.IsPersistent(obj))
     {
         string[] toolbarIconStringsBranch;
         string[] toolbarContentStringsBranch;
         if (s_SelectedGroup is TreeGroupBranch)
         {
             toolbarIconStringsBranch = TreeEditor.TreeEditor.toolbarIconStringsBranch;
             toolbarContentStringsBranch = TreeEditor.TreeEditor.toolbarContentStringsBranch;
         }
         else
         {
             toolbarIconStringsBranch = toolbarIconStringsLeaf;
             toolbarContentStringsBranch = toolbarContentStringsLeaf;
             if (TreeEditor.TreeEditor.editMode == EditMode.Freehand)
             {
                 TreeEditor.TreeEditor.editMode = EditMode.None;
             }
         }
         EditMode editMode = TreeEditor.TreeEditor.editMode;
         TreeEditor.TreeEditor.editMode = (EditMode) this.GUItoolbar((int) TreeEditor.TreeEditor.editMode, BuildToolbarContent(toolbarIconStringsBranch, toolbarContentStringsBranch, (int) TreeEditor.TreeEditor.editMode));
         if (editMode != TreeEditor.TreeEditor.editMode)
         {
             SceneView.RepaintAll();
         }
         EditorGUILayout.BeginVertical(EditorStyles.helpBox, new GUILayoutOption[0]);
         if (TreeEditor.TreeEditor.editMode == EditMode.None)
         {
             GUILayout.Label("No Tool Selected", new GUILayoutOption[0]);
             GUILayout.Label("Please select a tool", EditorStyles.wordWrappedMiniLabel, new GUILayoutOption[0]);
         }
         else
         {
             string uIString = TreeEditorHelper.GetUIString(toolbarContentStringsBranch[(int) TreeEditor.TreeEditor.editMode]);
             GUILayout.Label(TreeEditorHelper.ExtractLabel(uIString), new GUILayoutOption[0]);
             GUILayout.Label(TreeEditorHelper.ExtractTooltip(uIString), EditorStyles.wordWrappedMiniLabel, new GUILayoutOption[0]);
         }
         EditorGUILayout.EndVertical();
         EditorGUILayout.Space();
     }
 }
 /// <summary>
 /// Read the data using the reader.
 /// </summary>
 /// <param name="reader">Reader.</param>
 public override object Read(ISaveGameReader reader)
 {
     UnityEngine.Tree tree = SaveGameType.CreateComponent <UnityEngine.Tree> ();
     ReadInto(tree, reader);
     return(tree);
 }
Beispiel #32
0
 private static TreeData GetTreeData(Tree tree)
 {
     if (tree == null)
     {
         return null;
     }
     return (tree.data as TreeData);
 }
Beispiel #33
0
		private static void PreviewMesh(Tree tree)
		{
			TreeEditor.PreviewMesh(tree, true);
		}