在Blender中用程式化生成Animation_Nodes动画01
2021/7/27 11:06:14
本文主要是介绍在Blender中用程式化生成Animation_Nodes动画01,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
用如下代码可以自动在Blender中生成AnimationNodes动画。效果如附图。
bpy.ops.mesh.primitive_monkey_add(location=(0,4,10))
msource = bpy.context.object
if len(mssource.particle_systems) == 0:
bpy.context.view_layer.objects.active = mssource
mssource.modifiers.new("part", type='PARTICLE_SYSTEM')
part = mssource.particle_systems[0]
settings = part.settings
settings.count=200
settings.frame_end=120
settings.lifetime=100
settings.effector_weights.gravity=0
bpy.data.node_groups.new("NodeTree","an_AnimationNodeTree")
bpy.data.node_groups['NodeTree'].name='MyNodeTree'
ng = bpy.data.node_groups['MyNodeTree']
particleSystemsFromObject = ng.nodes.new("an_ParticleSystemsFromObjectNode")
particleSystemsFromObject.location=(-600,0)
particleSystemsFromObject.inputs[0].object=mssource
particleSystemParticlesData = ng.nodes.new("an_ParticleSystemParticlesDataNode")
particleSystemParticlesData.location=(-400,0)
findClosePoints = ng.nodes.new("an_FindClosePointsNode")
findClosePoints.location=(-200,0)
splinesFromEdges = ng.nodes.new("an_SplinesFromEdgesNode")
splinesFromEdges.location=(100,0)
splinesFromEdges.algorithmType='BRANCH'
curveObjectOutput= ng.nodes.new("an_CurveObjectOutputNode")
curveObjectOutput.location=(400,0)
curveObjectOutput.inputs[1].isUsed=True
curveObjectOutput.inputs[2].isUsed=True
curveObjectOutput.inputs[0].createObject()
curveObjectOutput.inputs[2].value=0.5
#add link
ng.links.new(particleSystemsFromObject.outputs[0],particleSystemParticlesData.inputs[0])
ng.links.new(particleSystemParticlesData.outputs[0],findClosePoints.inputs[0])
#ng.links.new(particleSystemParticlesData.outputs[0],combineMesh.inputs[0])
ng.links.new(findClosePoints.outputs[0],splinesFromEdges.inputs[1])
ng.links.new(particleSystemParticlesData.outputs[0],splinesFromEdges.inputs[0])
ng.links.new(splinesFromEdges.outputs[0],curveObjectOutput.inputs[1])
这篇关于在Blender中用程式化生成Animation_Nodes动画01的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-06-26结对编程到底难不难?答案在这里
- 2024-06-19《2023版Java工程师》课程升级公告
- 2024-06-15matplotlib作图不显示3D图,怎么办?
- 2024-06-1503-Loki 日志监控
- 2024-06-1504-让LLM理解知识 -Prompt
- 2024-06-05做软件测试需要懂代码吗?
- 2024-06-0514-ShardingSphere的分布式主键实现
- 2024-06-03为什么以及如何要进行架构设计权衡?
- 2024-05-31全网首发第二弹!软考2024年5月《软件设计师》真题+解析+答案!(11-20题)
- 2024-05-31全网首发!软考2024年5月《软件设计师》真题+解析+答案!(21-30题)