예제 #1
0
파일: Edge.cs 프로젝트: Kundara/project1
		public static Edge Create(Node vertex1, Node vertex2)
		{
			Edge edge = ScriptableObject.CreateInstance<Edge>();
			edge.hideFlags = HideFlags.DontSave;
			edge.node1 = vertex1;
			edge.node2 = vertex2;
			
			return edge;
		}
예제 #2
0
		public void SetPosition(Node node, Vector2 position)
		{
			if(selectedBlendshape && selectedBlendshape.frames.Count > 0)
			{
				selectedBlendshape.frames[selectedFrameIndex].vertices[node.index] = position;
			}else{
				texcoords[node.index] = position;
			}
			isDirty = true;
		}
예제 #3
0
		public Vector2 GetPosition(Node node)
		{
			if(selectedBlendshape && selectedBlendshape.frames.Count > 0)
			{
				return selectedBlendshape.frames[selectedFrameIndex].vertices[node.index];
			}
			return texcoords[node.index];
		}
예제 #4
0
		public void Unselect(Node node)
		{
			if(IsSelected(node))
			{
				selectedNodes.Remove(node);
			}
		}
예제 #5
0
		public bool IsSelected(Node node)
		{
			return selectedNodes.Contains(node);
		}
예제 #6
0
		public void Select(Node node, bool append)
		{
			if(!IsSelected(node))
			{
				if(!append)
				{
					selectedNodes.Clear();
				}
				selectedNodes.Add(node);
			}
		}
예제 #7
0
		public BoneWeight GetBoneWeight(Node node)
		{
			return boneWeights[node.index];
		}
예제 #8
0
		public BoneWeight GetBoneWeight(Node node)
		{
			return boneWeights[node.index];
		}
		public bool ContainsNode(Node node)
		{
			return node1 == node || node2 == node;
		}
예제 #10
0
파일: Edge.cs 프로젝트: Kundara/project1
		public bool ContainsNode(Node node)
		{
			return node1 == node || node2 == node;
		}
예제 #11
0
		public void DeleteNode(Node node, bool triangulate = true)
		{
			List<Edge> l_edges = new List<Edge>();
			
			for(int i = 0; i < edges.Count; i++)
			{
				Edge edge = edges[i];
				if(edge.ContainsNode(node))
				{
					l_edges.Add(edge);
				}
			}
			
			if(l_edges.Count == 2)
			{
				Node node1 = l_edges[0].node1 != node ? l_edges[0].node1 : l_edges[0].node2;
				Node node2 = l_edges[1].node1 != node ? l_edges[1].node1 : l_edges[1].node2;
				
				edges.Remove(l_edges[0]);
				edges.Remove(l_edges[1]);
				
				AddEdge(node1,node2);
			}else{
				foreach(Edge edge in l_edges)
				{
					edges.Remove(edge);
				}
			}
			
			m_TexVertices.RemoveAt(node.index);
			boneWeights.RemoveAt(node.index);

			if(blendshapes.Count > 0)
			{
				List<Vector3> frameVertices = new List<Vector3>(nodes.Count);

				foreach(BlendShape blendShape in blendshapes)
				{
					foreach(BlendShapeFrame frame in blendShape.frames)
					{
						frameVertices.Clear();
						frameVertices.AddRange(frame.vertices);
						frameVertices.RemoveAt(node.index);
						frame.vertices = frameVertices.ToArray();
					}
				}
			}

			nodes.Remove(node);
			
			for(int i = 0; i < nodes.Count; ++i)
			{
				nodes[i].index = i;
			}
			
			if(triangulate)
			{
				Triangulate();
			}

			m_DirtyVertices = true;
		}
예제 #12
0
		public void Unselect(Node node)
		{
			selection.Select(node.index,false);
		}
예제 #13
0
		public bool IsSelected(Node node)
		{
			return selection.IsSelected(node.index);
		}
예제 #14
0
		public void SetBoneWeight(Node node, BoneWeight boneWeight)
		{
			boneWeights[node.index] = boneWeight;
			isDirty = true;
		}
예제 #15
0
		public void SetTexcoord(Node node, Vector2 position)
		{
			texcoords[node.index] = position;
			isDirty = true;
		}
예제 #16
0
		public void DeleteNode(Node node, bool triangulate = true)
		{
			List<Edge> l_edges = new List<Edge>();
			
			for(int i = 0; i < edges.Count; i++)
			{
				Edge edge = edges[i];
				if(edge.ContainsNode(node))
				{
					l_edges.Add(edge);
				}
			}
			
			if(l_edges.Count == 2)
			{
				Node node1 = l_edges[0].node1 != node ? l_edges[0].node1 : l_edges[0].node2;
				Node node2 = l_edges[1].node1 != node ? l_edges[1].node1 : l_edges[1].node2;
				
				edges.Remove(l_edges[0]);
				edges.Remove(l_edges[1]);
				
				AddEdge(node1,node2);
			}else{
				foreach(Edge edge in l_edges)
				{
					edges.Remove(edge);
				}
			}
			
			texcoords.RemoveAt(node.index);
			boneWeights.RemoveAt(node.index);
			
			nodes.Remove(node);
			
			for(int i = 0; i < nodes.Count; ++i)
			{
				nodes[i].index = i;
			}
			
			if(triangulate)
			{
				Triangulate();
			}
		}
예제 #17
0
		public Vector2 GetTexcoord(Node node)
		{
			return texcoords[node.index];
		}
예제 #18
0
		public void AddEdge(Node node1, Node node2)
		{
			Edge newEdge = Edge.Create(node1,node2);
			
			if(!edges.Contains(newEdge))
			{
				edges.Add(newEdge);
				Triangulate();
			}
		}
예제 #19
0
		public void SetBoneWeight(Node node, BoneWeight boneWeight)
		{
			boneWeights[node.index] = boneWeight;
			isDirty = true;
		}
예제 #20
0
		public void SetVertex(Node node, Vector2 position)
		{
			SetVertex(node.index,position);
		}