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!