dLoc via code has no effect in 2.49?

Hi All,

I was writing some code to animate an object using the dLoc values. But they do not seem to have any effect.

The goal is to use the dLoc set of parameters for algorithmic animation that is generated on the fly in a frame change event.

Consider this code:
It should create a Text3d object in memory, set some parameters, create a new object out of it and then assign dLocZ value.


import Blender

from Blender import *

scn = Scene.GetCurrent()

# Create a new text object in memory.
txt = Blender.Text3d.New("tx_TEXT3D")
txt.setText("A")
txt.setExtrudeDepth(0.1)
txt.setExtrudeBevelDepth(0.1)
txt.setAlignment(Text3d.MIDDLE)

# Fetch that new text object into another variable.
tempTXT = Blender.Text3d.Get("tx_TEXT3D")
tempTXT.setExtrudeDepth(1.0)

# Create a new object.
tobj = scn.objects.new(tempTXT,"myLetter")
tobj.link(tempTXT)

# Set The dLocZ value.
tobj.dLocZ = 20.0
tobj.makeDisplayList()

# Refresh the scene.
Window.RedrawAll()
scn.update(0)

# Display value to see if I am going crazy?
myDloc = tobj.dloc
print myDloc
print tobj.dLocZ

Shouldn’t the simple assignment of a value to dLocZ, followed by an update make the object appear in the offset location?

What is the secret to making the object refresh after setting the dLoc value?

When I run the code, my object is always centered at world origin.

Thanks for an help!

Hmm…

I just noticed the setDeltaLocation method, but it does not seem to work either.

tobj.setDeltaLocation([0.0,0.0,20.0])

Dang,

Now I get it.

From the API Guide:

This variable applies to IPO Objects only.
So what about a single point IPO? I could change that single point over time.

Does anyone have a function I could pass an XYZ coordinate to and it would create a single point IPO?

Kind of specific, I know…:spin:

Ah!

Some success, but there is a strange flicker as the object appears at it’s location, then is transferred to it’s dLoc.


import Blender

from Blender import *

scn = Scene.GetCurrent()

# Create a new text object in memory.
txt = Blender.Text3d.New("tx_TEXT3D")
txt.setText("A")
txt.setExtrudeDepth(0.1)
txt.setExtrudeBevelDepth(0.1)
txt.setAlignment(Text3d.MIDDLE)

#Make an IPO for the dLocZ
tempIPO = Ipo.New('Object', 'ipo_dLoc' )
dLocZIPO = tempIPO.addCurve( 'dLocZ' )
dLocZIPO.addBezier( (1,20) )

# Create a new object.
tobj = scn.objects.new(txt,"myLetter")
tobj.setIpo(tempIPO)
tobj.link(txt)
 

# Refresh the scene.
#tobj.makeDisplayList()
Blender.Redraw(-1)
scn.update(1)