Blender object structure

verts = [] faces = [] vec=Vector(1,0,0) verts.extend([vec.x,vec.y,vec.z]) vec=Vector(1,1,0) verts.extend([vec.x,vec.y,vec.z]) vec=Vector(0,1,0) verts.extend([vec.x,vec.y,vec.z]) vec=Vector(0,0,0) verts.extend([vec.x,vec.y,vec.z]) faces.extend([0,1,2,3]) return verts, faces

This python code creates two groups which are vertices and faces. It is not elegant and not intended to be. This creates a single face using four corners and thus constitutes the simplest object that I can create to demonstrate how the interface is used to create more complex objects and models.

verts_loc, faces = add_face() mesh ="FaceOfBoe") mesh.add_geometry(int(len(verts_loc) / 3), 0, int(len(faces) / 4)) mesh.verts.foreach_set("co", verts_loc) mesh.faces.foreach_set("verts_raw", faces) mesh.faces.foreach_set("smooth", [False] * len(mesh.faces)) mesh.update() ob_new ="FaceOfBoe", mesh) ob_new.selected = True ob_new.location = scene.cursor_location

And an explanation of what the parts do.

verts_loc, faces = add_face() # as above procedure to create the elements mesh ="FaceOfBoe") # create object to hold all the data mesh.add_geometry(int(len(verts_loc) / 3), 0, int(len(faces) / 4)) mesh.verts.foreach_set("co", verts_loc) mesh.faces.foreach_set("verts_raw", faces) mesh.faces.foreach_set("smooth", [False] * len(mesh.faces)) #add the items to that structure and set some attributes mesh.update() #bookkeeping ob_new ="FaceOfBoe", mesh) # create object structure to be placed in scene #add that to the scene ob_new.selected = True #make it selected when done, optional ob_new.location = scene.cursor_location #it has to go somewhere so the cursor is a logical place Now blender has the data to display and use it.

I could just as well have meta code which interprets "Create a model that has 4 unique points at the corners of a square and add it to a scene". In this way I know what this method is doing and it abstracts the use further. All of the same things happen and it selects the points by its own code and by simply having a meta interface allows me to avoid remembering precisely what face.create.standard.sample,centered actually does. I would still have to create the code in this case, but in a more general case I can use the meta interpreter to select certain aspects which are mutable and apply those variations. I have used this method for 30 years. It was deadly slow in 1980 and is now usable. I would write code at the mock assembly level which was "Set variable owner of the data = 10". It is not ambiguous as the = sign and the first occurrence of "variable" and "set" are reserved. I could use the words "variable" and "set" in the name without conflict. The one thing that I could not do is name a variable with an = sign in it as that is the symbol which terminates name context. I intend to extend this syntax to make it completely unambiguous using unicode symbols to indicate and separate object names, actions and context. ⇒Maximum readability ⇐

By using the variable by name it allows the code to access variables in a way which is not compile time oriented and operations have nothing to do with the CPU.

One of the aspects of using blender or any other software is to get the general framework correct. At the start is a point or vertex which is a spatial position. This can be grouped with another vertex to represent an edge, and then a minimum of three connected edges makes a face. It is basic geometry of forms and space. The way in which the objects are stored accessed and manipulated is in some part determined by the software interface. By using Python, it is possible to determine what actions are available, how they are applied to the primitive elements and then create a procedure that either instantiates or modifies that object.

The dependencies are the ability to understand the geometry and topology of the forms and the ways in which they can be transformed. It also requires an understanding of the syntax and language structure to combine actions on objects so that a desired result is achieved.

There is advantage in having a solid framework to consider the matter. It is useful to see examples of how the interface is applied to achieve certain effects. However, the most important first step is to grasp the basics. When using Python there are basic data types which are common to all programming and some extensions. The primitives of the language and the primitives of the interface are the only way in which a result can be achieved.

The association of methods in programming and object structures in blender makes the entire process more clear and easier to extend. An example might be a list of vertices in a format that is x,y,z as the spatial location. A list. Python has methods that act on lists. An edge can be an association of members of a vertex list and is itself a list. The same holds true of faces. Once the objects become associated in more complex ways, it becomes necessary to understand how those objects are structured as data. Which elements or properties do they contain and what ways can they be manipulated.

It is not necessary to know the detail of how that is implemented and this is the style of object oriented programming. New members can be added to sets and it does not require a recompilation or changes to every reference. Python must handle the data types and methods in a consistent way, else it would no longer be python, but some other snake software. By dissolving the underlying structure and then reassembling it, I hope this makes the use of it simpler and more understandable to a person wanting to start generating results and needing a firm predictable place to start.

Whether you program to create product at the interface level by a series of actions or by a script, the end result is the same. By symbolically representing the underlying complexity it is possible to add another layer of abstraction which hides more of the implementation detail. By clicking add cube, a person is not required to know or care how the result is achieved. There are many levels of use and the level of interface is the most effective. The new interface exposes many more methods in a more intuitive fashion to a novice user and this is good. As a user of earlier versions it is a bump in the road.


Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen