Get status of some Blender buttons state in python ?

(Gwenouille) #1

Hello again: i ve browsed the API_ Intro stuff and i couldn’t find the answer for the following:

Is it possible to get the status of a particular button/toggle in Blender’ GUI in a python script ? I’d like to know the state of the Rotation/Scaling Pivot mode (is it “active object”, “3D cursor” etc…). In which module would that kind of information be available ?

2nd Question: The NMesh module: It is mentionned “deprecated” but it seems to be where i could find the tools to assign materials to meshes, not to Objects. Is there an alternative ? getMaterials() on a Mesh doesnt work… What does “deprecated” actually involve ?
Will support for this module stop ? Will it disappear alltogether ?

3rd and last (for today): Is it possible to set the step of a Number button ? I mean the increments when you click the triangles left and right. Or is it automatically tuned on the range of the button ?

okok enough for now…
I hope i wont spoil too much of your time !

0 Likes

(Gwenouille) #2

Hello again !

Really no one knows ? :D:confused:

0 Likes

(jms) #3

Nothing : just the death of all the scripts written with this module since 1999.

0 Likes

(Gwenouille) #4

Allright… I am sure some one has a clue on these questions…
Thanks JMS: does that mean it is stupid to write something involving the use of NMesh ?
Cause i can’t figure out how to assign a material to a mesh, and not to an Object (which is fairly easy). The only examples i could find (like Material Works) use NMesh…

0 Likes

(Meta-Androcto) #5

2nd question?
me = ob[0].getData()
mats = me.getMaterials()
found these refs to ‘me’
in the materializer script by Mariano Hidalgo a.k.a. uselessdreamer
don’t know if it’s any use?
but it sets the materials/textures to ‘me’
m.a.

0 Likes

(jms) #6

This mesh is managed by the NMesh module.
Look at the doc :
http://www.zoo-logique.org/3D.Blender/scripts_python/API/Object.Object-class.html#getData

0 Likes

(Gwenouille) #7

What if you use:
me=ob[0].getData(False,True) ?

after that i can use me.materials…

That won’t use the NMesh module, will it ?
(sorry if i sound stupid or ridiculous: learning curve is a strong one for a complete programming noob :o)

I am making progress tonight: merci pour ton aide jms !

What about the question about the step of a Number Button ?
Someone knows ?
It doesn’t seem possible to finetune that…

0 Likes

(jms) #8

It’s easier to write : me=ob[0].getData(mesh=1)

0 Likes

(ideasman42) #9
  1. short answer is no, the info your looking for is not available. - though that depends on exactly what you want, the view pivot isnt though.
  2. answered above
  3. the number of floats in a button can be set in C, in python its based on the range so you cant explicitly set this.
0 Likes

(Gwenouille) #10

@jms: certes…:slight_smile:
@ideasman: thanks for your answers…
Too bad i can’t get the status for the pivot point…I wanted toknow it to adjust the behaviour of some mirroring , rotationning functions in a script i am writing (I told you i wouldn’t give up learning programation ! :))

materials: OK i worked it out…

NumberButtons range: that is a shame… grrrr Nevermind !

Thank you !

0 Likes