「Extensions:2.4/Py/Nodes/Cookbook/Value」の版間の差分

提供: wiki
< Extensions:2.4‎ | Py‎ | Nodes‎ | Cookbook
移動先: 案内検索
(Bot: Fixing redirects)
 
(1版 をインポートしました)
 
(相違点なし)

2018年6月29日 (金) 02:54時点における最新版

Back to index

Ideas

  • Add your idea here.

Recipes

Quantize Value

This script quantizes the given value by the Quantize value.

from Blender import Node

class QuantizeValue(Node.Scripted):
	def __init__(self, sockets):
		val = Node.Socket('Value', val=-10e6, min=0.001, max=10e6)
		qval = Node.Socket('Quantize', val=1.0, min=0.001, max=100.0)
		sockets.input = [val, qval]
		sockets.output = [val]
		
	def __call__(self):
		oval = self.input.Value
		oqval = self.input.Quantize
		self.output.Value = ((oval/oqval)-(oval%oqval))*oqval
		
__node__ = QuantizeValue