Re: Follow Path Python constraint
9件表示
すべてのコメント一覧へ
投稿ツリー
-
Follow Path Python constraint (tsurubaso, 2007/12/29 9:02)
-
Re: Follow Path Python constraint (yamyam, 2007/12/29 12:39)
-
Re: Follow Path Python constraint (tsurubaso, 2007/12/29 13:28)
-
Re: Follow Path Python constraint (yamyam, 2007/12/29 13:54)
-
Re: Follow Path Python constraint (tsurubaso, 2007/12/30 0:06)
«
-
Re: Follow Path Python constraint (yamyam, 2007/12/30 1:57)
-
Re: Follow Path Python constraint (tsurubaso, 2008/1/1 2:42)
-
Re: Follow Path Python constraint (tsurubaso, 2008/1/3 1:21)
- Re: Follow Path Python constraint (yamyam, 2008/1/3 12:17)
-
Re: Follow Path Python constraint (tsurubaso, 2008/1/3 1:21)
-
Re: Follow Path Python constraint (tsurubaso, 2008/1/1 2:42)
-
Re: Follow Path Python constraint (yamyam, 2007/12/30 1:57)
-
Re: Follow Path Python constraint (tsurubaso, 2007/12/30 0:06)
«
-
Re: Follow Path Python constraint (yamyam, 2007/12/29 13:54)
-
Re: Follow Path Python constraint (tsurubaso, 2007/12/29 13:28)
-
Re: Follow Path Python constraint (yamyam, 2007/12/29 12:39)
tsurubaso
投稿数: 17
Ok I write here the code,
but It is full of mistakes...
I will Edit it,
but It is full of mistakes...
I will Edit it,
import Blender
from Blender import *
from Blender import Camera,Object, Scene, Ipo,Window, Curve, BezTriple, Mathutils, BezTriple, Mathutils,
# script author 80% enhzflep 20% tsurubaso
#isolate the selected object
cur = Scene.getCurrent()
object = cur.objects.active
#change the position of the moved object to (0,0,0)in order to be in the center of the circle
object.setLocation (0.0,0.0,0.0)
#create a new camera and set it active
c = Camera.New('ortho','Camera-Vue01')
ob = Object.New('Camera','Vue01')
ob.link(c)
cur.link(ob)
cur.setCurrentCamera(ob)
c.setLens(35.00)
c.setClipStart(0.10)
c.setClipEnd(200.00)
ob.Layer = 2
#put the active object in an empty layer
StartLayer = 1
EndLayer = 2
ObList = Blender.Object.GetSelected()
for Object in ObList:
if Object.Layer == StartLayer:
Object.Layer = EndLayer
#add a circle
cu = Curve.New() # create new curve data
cur = Scene.getCurrent() # get current scene
obcurve = Object.New('Curve') # make curve object
obcurve.link(cu) # link curve data with this object
cur.link(obcurve) # link object into scene
center = (0,0,0)
#Here you change the radius to change the distance of the camera
radius = 1
AUTO = BezTriple.HandleTypes.AUTO
# Build four points at radius distance in the four cardnal directions
p1 = (0, -radius, 0)
p2 = (radius, 0, 0)
p3 = (0, radius, 0)
p4 = (-radius, 0, 0)
p1 = BezTriple.New(p1)
p2 = BezTriple.New(p2)
p3 = BezTriple.New(p3)
p4 = BezTriple.New(p4)
# Can't have a curve without points...
curve = c.appendNurb(p1)
curve.append(p2)
curve.append(p3)
curve.append(p4)
# Set both handles to auto for each point
for point in curve:
point.handleTypes = [AUTO, AUTO]
curve.flagU = 1 # Set curve cyclic
c.update()
ob.loc = center # Put it where it goes
Blender.Redraw()
#set a Track to constraint
ob.constraints.append(2)
const = ob.constraints[len(ob.constraints)-1] #last constraint in the list
const[Constraint.Settings.TARGET] = object
const.__setitem__(Constraint.Settings.TRACK, Constraint.Settings.TRACKNEGZ)
const.__setitem__(Constraint.Settings.UP, Constraint.Settings.UPY)
const2 = ob.constraints[len(ob.constraints)0]
#set a Follow Path constraint(hhhhhhhhhhhhhhhhhhhhhhhhheeeeeeeeeeeeeeeeeelllllllllllllllllllllllppppppppp)
# Used by Follow Path (FOLLOWPATH) constraint:
* FOLLOW (bool)
* OFFSET (float): clamped to [-maxframe:maxframe]
* FORWARD (int): values are TRACKX, TRACKY, TRACKZ, TRACKNEGX, TRACKNEGY, TRACKNEGZ
* UP (int): values are UPX, UPY, UPZ
# Used by Lock Track (FOLLOWPATH) constraint:
* TRACK (int): values are TRACKX, TRACKY, TRACKZ, TRACKNEGX, TRACKNEGY, TRACKNEGZ
* LOCK (int): values are LOCKX, LOCKY, LOCKZ
#ok I am not sure how to use the ipo but I give a try
ipo2 = Ipo.New('Object','Ipo2')
ob.setIpo(ipo2)
locy=ipo2.addCurve('LocY')
locy.setInterpolation('Bezier')
locy.setExtrapolation('Constant')
locy.addBezier((5.0,0.0))
locy.addBezier((10.0,radius.o))
Window.RedrawAll()
投票数:12
平均点:9.17
ログイン
クイックリンク
2021/07/01版
●Blender.org
BlenderFoundation
- Blenderのダウンロード
- 公式チュート等
- 公式マニュアル(和訳)
●ニュース(英文)
BlenderNation
●Blenderコミュニティ
blenderartists.org
●Blender Q&A
- Blender Stack Exchange
●テストビルド
Buildbot(自動生成)
●開発関連
公式開発サイト
Blender開発blog
Blender Wiki
●Blender.org
BlenderFoundation
- Blenderのダウンロード
- 公式チュート等
- 公式マニュアル(和訳)
●ニュース(英文)
BlenderNation
●Blenderコミュニティ
blenderartists.org
●Blender Q&A
- Blender Stack Exchange
●テストビルド
Buildbot(自動生成)
●開発関連
公式開発サイト
Blender開発blog
Blender Wiki