Hey all. I am creating an operator to make a custom object. But, I have a couple questions about the FloatVectorPorperty() function. First Question: How can I get “X”, “Y”, and “Z” to show up in the user dialog? (The way it does when any other object is created) Is there a parameter that I need to pass to the function? Second Question: How can I set the number of decimal places displayed? Thanks.
Here is a definition I have in one of my scripts.
bpy.types.Object.Origin = bpy.props.FloatVectorProperty(name='Object Origin',subtype='XYZ',precision=4,size=3,default=(0.0,0.0,0.0),update=ChangeLocation)
“Subtype” and “precision”, along with “size”, are what you are looking for. It will show X,Y and Z in the UI Panel when your reference the property. “Origin” in my case.
Here is the link to the entry in the 2.77a API for more info.
Thanks Traveller. That was exactly what I needed (I knew that it had to be simple). Thanks also for the link. For some reason, Goo— wasn’t finding that API, when I did a search for FloatVectorProperty().
Perhaps, you might have an answer to another question. When using IntProperty(), is there a way to put two different calls on the same line of the panel (integers are small, and don’t need a full line). it would make my panel look a little cleaner. If you don’t know, I can just start a new thread. Thanks again.
I don’t have that specific case in my scripts, but I do have a label and a property on one line. Something similar won’t work with two properties? Pseudo code follows:
box = layout.box() brow = box.row() brow.label('label') brow.prop(property,'Property Value',text='')
box = layout.box() brow = box.row() brow.prop(property1,'Property 1 Value',text='') brow.prop(property2,'Property 2 Value',text='')
I do have two boxes on the same line in my scripts. So maybe the “.split” could be used for two properties on one line if the above doesn’t work? Actual code from my script follows (“lbox” is the left hand box, “rbox” is the right hand box):
box = layout.box() row = box.row() row.label('Animation Information') row = box.row() lrow = row.split(0.50) lbox = lrow.box() lbox.label('Animation Type:') lbox.prop(xx,'Animation',text='Base Type',expand=True) if xx.Animation != '1': if xx.Animation == '7': rbox = lrow.box() rrow = rbox.row() rbox.label('Movie Float:') rrow = rbox.row() rbox.prop(xx,'Animation_Frequency',text='')
Thanks. I’ll have to study that, to see if it can be adapted to Properties. If not, I’ll post the question to a new thread. Thanks again