so I’ve looked at the API, which I have to say is quite bland… I can’t seem to find anything past:
bge.logic.getCurrentController()
I did a search for “cont.owner” which came up with no results…
IK most people tend to use ‘cont’ for this, so what are the class methods and variables??
same goes for cont.mesh.[?] and cont.owner.[?] which I see alot on google, mainly for shader usage.
I also need to know the stuff for I think cont.owner.parent, as for me, this would be a rig object…
thanks
also, if I may please ask mods/admins not to close this thread.
I’d love feedback on this for as long as possible.
for this game I’m making, I’m using a global armature get the envelopes of the bones dynamically connected to a bone on (this) object.
find the bone labeled “%s_connect”%(cont.owner.meshes[0].name)
get the envelopes from the children (if any) connected to this bone to morph (this) mesh by
cont = bge.logic.getCurrentController()
own = cont.owner
mesh = own.meshes[0]
armature = own.parent
collections = [] # get envelopes from here
for bone in armature.channels:
if bone.parent.name == "%s_connect"%(mesh.name):
collections.append(bone) # we'll want the children of this bone for their envelopes
for bone in collections:
# deform this mesh's vertices with these bones
The armature is the object. Any armature object is a type bl_armatureobject
So if the parent of the object running the script is an armature, controller.owner.parent is the armature
yea… the issue I’m having is trying to build a script following a poorly structured API…
I’m taking my answer I’m looking for in steps… since what I want to do hasn’t been done before, and is too complex to simply ‘ask’.
so I’ve gotten that step done…
now on to the next:
deforms = []
for bone in [ C.bone for C in armature.channels if C.bone.parent and C.bone.parent.name == "%s_connect"%(mesh.name)]:
# how do I get the envelopes here??
EDIT:
also, I learn by following examples and seeing how they work, not by people explaining things to me…
though yes, a small amount of explaination does go a long way… even for me…
EDIT2:
if I must mention, I’ve tried asking about this before here…
those threads still have no response yet… >_>
probably because I didn’t know what attributes did what, and was a REAL noob when I wrote that code…
and the fact that code was only written as a guess and was expected not to work.
but still… wrong code man
look at my later posts for a working code
here it is again:
deforms = []
for bone in [ C.bone for C in armature.channels if C.bone.parent and C.bone.parent.name == "%s_connect"%(mesh.name)]:
print(bone.name)
@experienced users:
go ahead and test it, I already have it working…
but now I need to get the envelopes from the bones to send to the vertex shader.
EDIT:
I’m sorry… I re-read the post…
I only need specific bones which are the children of “%s_connect”%(mesh.name)
According to your above statements you are not familiar in reading API docs. I really advice you do some Python training and check the Python docs.
The BGE API is similar structured as the Python API. It describes each available object type with its attributes, sometimes with examples.
In difference to the Python API the BGE API does not contain a tutorial section, especially not a Python one. This is not the Purpose of the BGE API. The BGE API is a reference.
Avoid to rely on samples you found somewhere. Obviously this is not covered by any API doc. In a lot of cases it contains irritating names and questionable structures. E.g. you will never find a description of a “cont” or “main”. You need to train yourself to distinguish API related code from custom code.
It is not likely that you can find chained attributes in an API documentation. You can search for the attribute name. The results will tell you what object types have such an attribute. You can search for the object type. The results will show you where it is referred to.
but referring to the python API…
the python API is (to put it simply) a nightmare and nothing more than a hassle to try to follow. (it should be burned)
(I’ve already puked (multiple times) at the fact the blender API follows it’s structure…)
2.49’s downloadable (<3) API helped me out ALOT better than the current API
(especially the function/class tree browser (<3 <3) )
I am experienced with python2.7 (I can’t call myself an expert though), especially in the PyOpenGL area.
(PyOpenGL runs slower on Python3 (no intent to fix, as nothing needs to be “fixed”), so I stick with 2.7)
@API devs:
perhapse you guys should take some tips from my project’s functions: http://tcll5850.proboards.com/thread/182/layout (note: highly unfinished)
my project makes model importing more like OpenGL’s automated state engine (no ‘.’ operator), so it’s ALOT easier to follow and script for.
(scripting for blender has become even more of a nightmare since 24x, so I’ve developed this to take it’s place)
^ only applies to model I/O
anyways, my point is the structure-tree…
this is basically my project’s docs which contains references and simple explainations as to how the function works.
(it’s meant mainly to help noobs but to also help pros to keep them from misunderstanding things)
now doesn’t this seem alot better than Blender’s API?
(no “search” needed, just click the function you want and get it with anything it needs on the fly.)
something for me alone, if you guys want to copy:
I’ve made my docs on my forum specifically for user feedback on my functions.
I believe a convenient way of user feedback is an added benefit to aid development.
so why not start with the functions everyone will be using
I absolutely agree with you that the old API structure was much better then the current one. Unfortunately it is as it is.
The differences beween Python 2.7 and 3.x are in most cases very small.
The differences between bge 2.49 and 2.5+ are mostly additions. So you still can use the old API.
Typical with the bge you do not program in OpenGL as the bge does that for you. You are supposed to describe behavior on an higher level. Nevertheless you can do. But I’m not sure if that is better placed at the BGE sources directly.
but referring to the python API…
the python API is (to put it simply) a nightmare and nothing more than a hassle to try to follow. (it should be burned)
(I’ve already puked (multiple times) at the fact the blender API follows it’s structure…)
To each their own I guess, but I’ve lost count the amount of times the Python API helped me code a complex function. A lot of the Python2 stuff works perfectly fine (or easily enough adapted) to work in Python3. I would appreciate it if you spoke about the hard work put into Python (and Blender) with a little more respect.
I followed your link but it took me to a page with just a list of functions. Was that intended? I couldn’t see any descriptions or list of inputs. A fair amount of those functions looked like they could easily be replaced by publicly accessible variables.