コード例 #1
0
	def bakeSound(self):
		if self.filePath == "":
			return
		forbidCompiling()
		scene = bpy.context.scene
		oldFrame = scene.frame_current
		scene.frame_current = 1
		soundObject = self.getSoundObject()
		self.removeSoundCurves(soundObject)
		soundCombinations = [(0, 50), (50, 150), (150, 300), (300, 500), (500, 1000), (1000, 2000), (2000, 4000), (4000, 10000), (10000, 20000)]
		wm = bpy.context.window_manager
		wm.progress_begin(0.0, len(soundCombinations) - 1.0)
		wm.progress_update(0.0)
		for index, (low, high) in enumerate(soundCombinations):
			self.bakeIndividualSound(soundObject, self.filePath, low, high)
			wm.progress_update(index + 1.0)
		wm.progress_end()
		soundObject.hide = True
		self.name = re.sub(r"\W+", "", os.path.basename(self.filePath))
		loadSound(self.filePath)
		if self.setSyncMode:
			scene.sync_mode = "AUDIO_SYNC"
		scene.frame_current = oldFrame
		allowCompiling()
		nodeTreeChanged()
コード例 #2
0
	def addProperty(self, propertyName):
		"""This function called to add a shape key socket as input/output or both according to propertyIOType attribute of the node.
		
		Note:
			The new node socket has enabled attribute False, so execution string load it's proper value and enable it.
		
		Args:
			propertyName (str): The name of the property.
		"""
		forbidCompiling()
		# if propertyIOType is INPUT or BOTH add new input socket to the node
		if self.propertyIOType != 'OUTPUT':
			try:
				# Search for existing socket with the same name so no duplicates exists
				socket = self.inputs[propertyName]
			except KeyError:
				socket = self.inputs.new("mn_FloatSocket", propertyName)
			socket.removeable = True
			socket.callNodeToRemove = True
			socket.enabled = False
		# if propertyIOType is OUTPUT or BOTH add new output socket to the node
		if self.propertyIOType != 'INPUT':
			try:
				# Search for existing socket with the same name so no duplicates exists
				socket = self.outputs[propertyName]
			except KeyError:
				socket = self.outputs.new("mn_FloatSocket", propertyName)
			socket.removeable = True
			socket.callNodeToRemove = True
		allowCompiling()
		nodeTreeChanged()
コード例 #3
0
	def newInputSocket(self):
		forbidCompiling()
		newSocketName = str(len(self.inputs)) + "."
		newSocket = self.inputs.new("mn_StringSocket", newSocketName)
		self.inputs.move(len(self.inputs) - 1, len(self.inputs) - 2)
		allowCompiling()
		nodeTreeChanged()
コード例 #4
0
def updateNode(node, context):
	singleInputOperations = ["SINE", "COSINE", "TANGENT", "ARCSINE", "ARCCOSINE", "ARCTANGENT", "ABSOLUTE", "FLOOR", "CEILING"]
	if node.mathTypesProperty in singleInputOperations and not node.inputs[-1].hide:
		node.inputs[-1].hide = True
	elif node.mathTypesProperty not in singleInputOperations and node.inputs[-1].hide:
		node.inputs[-1].hide = False
	nodeTreeChanged()
コード例 #5
0
	def addProperty(self, propertyName):
		"""This function called to add a modifier property socket as input/output or both according to propertyIOType attribute of the node.
		
		Note:
			The new node socket has enabled attribute False, so execution string load it's proper value and enable it.
			Needs modifierSubClass attribute of node to determine the type of the socket.
		
		Args:
			propertyName (str): The name of the property.
		"""
		socketType = getSocketTypeByDataPath("bpy.types." + self.modifierSubClass + ".bl_rna.properties['" + propertyName + "']")
#		print("Socket: ", socketType)
		forbidCompiling()
		# if propertyIOType is INPUT or BOTH add new input socket to the node
		if self.propertyIOType != 'OUTPUT' and socketType is not None:
			try:
				# Search for existing socket with the same name so no duplicates exists
				socket = self.inputs[propertyName]
			except KeyError:
				socket = self.inputs.new(socketType, propertyName)
			socket.removeable = True
			socket.callNodeToRemove = True
			socket.enabled = False
#TODO: replace '_' from name with ' '
		# if propertyIOType is OUTPUT or BOTH add new output socket to the node
		if self.propertyIOType != 'INPUT' and socketType is not None:
			try:
				# Search for existing socket with the same name so no duplicates exists
				socket = self.outputs[propertyName]
			except KeyError:
				socket = self.outputs.new(socketType, propertyName)
			socket.removeable = True
			socket.callNodeToRemove = True
		allowCompiling()
		nodeTreeChanged()
コード例 #6
0
def updateNode(node, context):
    singleInputOperations = [
        "SINE", "COSINE", "TANGENT", "ARCSINE", "ARCCOSINE", "ARCTANGENT",
        "ABSOLUTE", "FLOOR", "CEILING"
    ]
    if node.mathTypesProperty in singleInputOperations and not node.inputs[
            -1].hide:
        node.inputs[-1].hide = True
    elif node.mathTypesProperty not in singleInputOperations and node.inputs[
            -1].hide:
        node.inputs[-1].hide = False
    nodeTreeChanged()
コード例 #7
0
def customNameChanged(self, context):
    if not self.customNameIsUpdating:
        self.customNameIsUpdating = True
        if self.customNameIsVariable:
            self.customName = makeVariableName(self.customName)
        if self.uniqueCustomName:
            customName = self.customName
            self.customName = "temporary name to avoid some errors"
            self.customName = getNotUsedCustomName(self.node,
                                                   prefix=customName)
        if self.callNodeWhenCustomNameChanged:
            self.node.customSocketNameChanged(self)
        self.customNameIsUpdating = False
        nodeTreeChanged()
コード例 #8
0
def customNameChanged(self, context):
	if not self.customNameIsUpdating:
		self.customNameIsUpdating = True
		if self.customNameIsVariable:
			newCustomName = ""
			for char in self.customName:
				if char.isalpha(): newCustomName += char
			self.customName = newCustomName
		if self.uniqueCustomName:
			customName = self.customName
			self.customName = "temporary name to avoid some errors"
			self.customName = getNotUsedCustomName(self.node, prefix = customName)
		if self.callNodeWhenCustomNameChanged:
			self.node.customSocketNameChanged(self)
		self.customNameIsUpdating = False
		nodeTreeChanged()
コード例 #9
0
ファイル: mn_script.py プロジェクト: miklobit/blenderpython
	def buildSocketsFromDescription(self, socketDescription):
		forbidCompiling()
		try:
			inputDescription = socketDescription[0]
			for d in inputDescription:
				blName = getSocketNameByDataType(d[0])
				name = d[1]
				identifier = d[2]
				self.inputs.new(blName, name, identifier)
				
			outputDescription = socketDescription[1]
			for d in outputDescription:
				blName = getSocketNameByDataType(d[0])
				name = d[1]
				self.outputs.new(blName, name)
			self.errorMessage = ""
		except:
			self.errorMessage = "cannot build sockets"
			self.removeSockets()
		allowCompiling()
		nodeTreeChanged()
コード例 #10
0
	def updateSockets(self, socketStartValue = (None, None), inputRemoved = False, outputRemoved = False):
		forbidCompiling()
		connections = getConnectionDictionaries(self)
		self.removeSockets()
		
		inputNode = getNodeFromTypeWithAttribute("mn_GroupInput", "groupName", self.activeGroup)
		if inputNode is not None and not inputRemoved:
			network = NodeNetwork.fromNode(inputNode)
			if network.type == "Group":
				for socket in inputNode.getSockets():
					newSocket = self.inputs.new(socket.bl_idname, socket.customName, socket.identifier)
					if socket == socketStartValue[0]: newSocket.setStoreableValue(socketStartValue[1])
				if not outputRemoved:
					outputNode = network.getGroupOutputNode()
					if outputNode is not None:
						for socket in outputNode.getSockets():
							newSocket = self.outputs.new(socket.bl_idname, socket.customName, socket.identifier)
							if socket == socketStartValue[0]: newSocket.setStoreableValue(socketStartValue[1])
		
		tryToSetConnectionDictionaries(self, connections)
		allowCompiling()
		nodeTreeChanged()
コード例 #11
0
 def loopNameChanged(self, context):
     if not self.nameIsChanging:
         self.nameIsChanging = True
         self.loopName = self.getNotUsedLoopName(prefix=self.loopName)
         self.nameIsChanging = False
         nodeTreeChanged()
コード例 #12
0
ファイル: mn_script.py プロジェクト: miklobit/blenderpython
	def selectedScriptChanged(self, context):
		updateScripts()
		self.buildSockets()
		self.errorMessage = ""
		nodeTreeChanged()
コード例 #13
0
 def updateCallerNodes(self, socketStartValue=(None, None)):
     nodes = getNodesFromTypeWithAttribute("mn_LoopCallerNode",
                                           "activeLoop", self.loopName)
     for node in nodes:
         node.updateSockets(socketStartValue)
     nodeTreeChanged()
コード例 #14
0
	def selectedSocketChanged(self, context):
		self.socketIsChanging = True
		self.setInputSocket()
		self.socketIsChanging = False
		nodeTreeChanged()
コード例 #15
0
	def removeInputSocket(self):
		forbidCompiling()
		if len(self.inputs) > 2:
			self.inputs.remove(self.inputs[len(self.inputs) - 2])
		allowCompiling()
		nodeTreeChanged()
コード例 #16
0
	def amountChanged(self, context):
		self.generateInputSockets()
		nodeTreeChanged()
コード例 #17
0
 def selectedSocketChanged(self, context):
     self.socketIsChanging = True
     self.setInputSocket()
     self.socketIsChanging = False
     nodeTreeChanged()
コード例 #18
0
	def updateCallerNodes(self, socketStartValue = (None, None)):
		nodes = getNodesFromTypeWithAttribute("mn_LoopCallerNode", "activeLoop", self.loopName)
		for node in nodes:
			node.updateSockets(socketStartValue)
		nodeTreeChanged()
コード例 #19
0
 def checkedPropertiesChanged(self, context):
     self.updateSocketVisibility()
     nodeTreeChanged()
コード例 #20
0
 def update(self):
     nodeTreeChanged()
コード例 #21
0
ファイル: mn_camera.py プロジェクト: vvFiCKvv/animation-nodes
	def usePropertyChanged(self, context):
		self.setHideProperty()
		nodeTreeChanged()
コード例 #22
0
	def usePropertyChanged(self, context):
		self.setHideProperty()
		nodeTreeChanged()
コード例 #23
0
	def loopNameChanged(self, context):
		if not self.nameIsChanging:
			self.nameIsChanging = True
			self.loopName = self.getNotUsedLoopName(prefix = self.loopName)
			self.nameIsChanging = False
			nodeTreeChanged()
コード例 #24
0
	def checkedPropertiesChanged(self, context):
		self.updateSocketVisibility()
		nodeTreeChanged()
コード例 #25
0
	def updateActiveLoop(self):
		if self.selectedLoop != "NONE":
			self.activeLoop = self.selectedLoop
		self.updateSockets()
		nodeTreeChanged()
コード例 #26
0
def updateNode(node, context):
    nodeTreeChanged()
コード例 #27
0
def updateNode(node, context):
	nodeTreeChanged()
コード例 #28
0
	def keyframeChanged(self, context):
		self.buildOutputSockets()
		nodeTreeChanged()
コード例 #29
0
 def keyframeChanged(self, context):
     self.buildOutputSockets()
     nodeTreeChanged()
コード例 #30
0
	def update(self):
		nodeTreeChanged()