Пример #1
0
	def applyGrowthCrease(self, a):
		
		# LETS LOOK AT CREASES!
		vec = a['crease']
		
		# Now we want to find out how many steps we made
		steps = self.ob['growsteps']
		if steps:
			
			# Loop through all the steps
			for i in range(int(steps)):
			
				select_faces.outermost(True)		
			
				# Find all the selected vertices
				selFaces = mesh_extras.get_selected_faces()
				selVerts = []
				for f in selFaces:
					selVerts.extend(f.vertices)
				
				# Loop through all edges
				for e in self.me.edges:
				
					eVerts = e.vertices
					
					# If an edge has only 1 selected vert... it's "long" and on the outside of the selection
					intersection = [v for v in e.vertices if v in selVerts]

					if len(intersection) == 1 and e.crease < 1.0:
						e.crease = vec
Пример #2
0
	def applyGrowthCrease(self, a):
		
		# LETS LOOK AT CREASES!
		vec = a['crease']
		
		# Now we want to find out how many steps we made
		steps = self.ob['growsteps']
		if steps:
			
			# Loop through all the steps
			for i in range(int(steps)):
			
				select_faces.outermost(True)		
			
				# Find all the selected vertices
				selFaces = mesh_extras.get_selected_faces()
				selVerts = []
				for f in selFaces:
					selVerts.extend(f.vertices)
				
				# Loop through all edges
				for e in self.me.edges:
				
					eVerts = e.vertices
					
					# If an edge has only 1 selected vert... it's "long" and on the outside of the selection
					intersection = [v for v in e.vertices if v in selVerts]

					if len(intersection) == 1 and e.crease < 1.0:
						e.crease = vec
Пример #3
0
	def applyGrowthColor(self, a):
	
		# Just apply the vertex colour to all the verts if it applies... easy!
		if self.options['palettes']:
		
			vec = list(a['vertexcolor'])
			selFaces = []
			
			for f in self.ob.data.faces:
			
				if f.select:
					selFaces.append(f)
					
					if a['colorstyle'] == 'soft':
						for v in f.vertices:
							self.applyColorToVert(v, vec)
							
					else:
						self.applyColorToFace(f.index, vec)
						
			select_faces.outermost()
			
			vec = list(a['jointcolor'])
			
			selVerts = []
			outFaces = []
			
			for f in self.ob.data.faces:
			
				if f.select:
					if a['colorstyle'] == 'soft':
						for v in f.vertices:
							self.applyColorToVert(v, vec)
					else:
						selVerts.extend(f.vertices)
						outFaces.append(f)
						self.applyColorToFace(f.index, vec)
						
			# Lets make some sharp edges
			if  a['type'] == 'bump' and a['colorstyle'] == 'hard':
			
				# Check every edge
				for e in self.ob.data.edges:
				
					v0 = e.vertices[0]
					v1 = e.vertices[1]
					
					# If both verts in the edge are selected... this could be sharp
					if v0 in selVerts and v1 in selVerts:
						ond = 0
						snd = 0
						
						# See how many faces this edge is part of
						for f in outFaces:
							if v0 in f.vertices and v1 in f.vertices:
								ond += 1
								
						for f in selFaces:
							if not f in outFaces:
								if v0 in f.vertices and v1 in f.vertices:
									snd += 1
								
						# If the edge is only part of one seleced face it's on the outside
						if ond == 1: # and snd == 1:
							e.crease = 1.0
							'''
							sharp = 0
							pole = 1
							
							for ec in self.ob.data.edges:
								if not ec == e:
									ecVerts = ec.vertices
									if v0 in ecVerts or v1 in ecVerts:
										pole += 1
										if ec.use_edge_sharp:
											sharp += 1
						
							if pole == 4 and sharp < 2:
								e.use_edge_sharp = True
							'''
						
			# Set the selection of faces back to the original
			for f in selFaces:
				f.select = True
Пример #4
0
	def applyGrowthColor(self, a):
	
		# Just apply the vertex colour to all the verts if it applies... easy!
		if self.options['palettes']:
		
			vec = list(a['vertexcolor'])
			selFaces = []
			
			for f in self.ob.data.faces:
			
				if f.select:
					selFaces.append(f)
					
					if a['colorstyle'] == 'soft':
						for v in f.vertices:
							self.applyColorToVert(v, vec)
							
					else:
						self.applyColorToFace(f.index, vec)
						
			select_faces.outermost()
			
			vec = list(a['jointcolor'])
			
			selVerts = []
			outFaces = []
			
			for f in self.ob.data.faces:
			
				if f.select:
					if a['colorstyle'] == 'soft':
						for v in f.vertices:
							self.applyColorToVert(v, vec)
					else:
						selVerts.extend(f.vertices)
						outFaces.append(f)
						self.applyColorToFace(f.index, vec)
						
			# Lets make some sharp edges
			if  a['type'] == 'bump' and a['colorstyle'] == 'hard':
			
				# Check every edge
				for e in self.ob.data.edges:
				
					v0 = e.vertices[0]
					v1 = e.vertices[1]
					
					# If both verts in the edge are selected... this could be sharp
					if v0 in selVerts and v1 in selVerts:
						ond = 0
						snd = 0
						
						# See how many faces this edge is part of
						for f in outFaces:
							if v0 in f.vertices and v1 in f.vertices:
								ond += 1
								
						for f in selFaces:
							if not f in outFaces:
								if v0 in f.vertices and v1 in f.vertices:
									snd += 1
								
						# If the edge is only part of one seleced face it's on the outside
						if ond == 1: # and snd == 1:
							e.crease = 1.0
							'''
							sharp = 0
							pole = 1
							
							for ec in self.ob.data.edges:
								if not ec == e:
									ecVerts = ec.vertices
									if v0 in ecVerts or v1 in ecVerts:
										pole += 1
										if ec.use_edge_sharp:
											sharp += 1
						
							if pole == 4 and sharp < 2:
								e.use_edge_sharp = True
							'''
						
			# Set the selection of faces back to the original
			for f in selFaces:
				f.select = True