Major request for 2.51

Yes 2.51, I have no idea what the next version will be after Durian is complete, but after fighting with getting “into” python for the last few days…coming from a “C” background…I thought why am I fighting with this, can we not have “C” integrated into blender like we do with python?..I’m not experienced enough to do something on this level(especially, since I have not looked at blender code…ever)
-anyway I would love to see the option to use “C” right inside of blender…(compiling…is one problem…on the fly???)

-Justin

IANAP, but I do know enough to understand that blender is fundamentally built around OO programming.

That means tons of classes and function within a function type stuff that would really make it a mess trying to create an API for a non-OO language like C. Basically it would involve re-writing tons of the core code.

I think blender is written in C which is not an OO language…

deathguppie: Blender’s straight c, and while it has some object-like stuff going on, it’s not for example a class-based project.

On this general topic – it ain’t going to happen.

yeah I feel your pain… I come from a delphi background, and wrapping my head around python took a while… until I actually forced myself to start writing scripts with it, then it just seemed to come together really quickly…
its not actually that bad- you will get it quickly im sure

Slippery ground. OOP is more about the conception that the language. Anyway, I think Blender 2.5 allows a more easier integration of other scripting languages. The only thing is to write the wrapping to the target language and consider C as a target scripting language.
http://root.cern.ch/drupal/content/cint.

EDIT : However, I think you’f be better by learning OOP concepts and practicing them with python. Python will then seem to be just english with some extra dots in the middle of sentences.

Dani

Blender is not at all built around OOP. There are a few sub-systems written in C++ that use some OOP structures, but the core in written in C, and is much more a structured style of programming and is kinda like a big database / directory with custom operators for working with the chunks of data.

There are so many reasons why this would not really be possible:

  • C requires a compiler
  • It’s a low level language where you want a high level language
  • The API (in 2.5) is auto-generated at run-time
  • Lots more I’m sure others could add

Besides, if you are familiar with C / C++ then python should be quite easy to pick up.

Compiling on the fly I doubt is an option if it’s a script you run a lot. Also if you make something complex you might introduce additional dependencies, etc which would make it tougher to distribute (if you were to do so). In theory you could maybe make a sort of C interpreter, but I’m willing to bet it would take a very long time to fully develop, and even after that probably the only real gain you would get is the syntactical difference.

IMO it would be more helpful to have a sort of plugin interface where I can write and compile my own “modules” so to speak. It’d be great if I could just write something (custom modifiers? etc) that implements a certain Blender-specified interface, compile it once and stick it in a folder for Blender to use. That way I get the performance of compiled C and the convenience of the scripts folder. The big problem I see with that is if I want to distribute something I’d have to compile and test it separately for Windows, Linux and Mac in addition to the dependency issue I mentioned before.

What’s interesting is afaik Blender is largely written in C

You can just write your python classes and functions in compiled c and import those into the blender python interpreter…today.

Not that hard really, you can also just write your c code and then let something like pybindgen at it to make the python wrapper automagically.

This is quite insane. Python is whole lot simpler and easier to use than C. If you want to program in C, that means recompiling Blender with your modifications. That’s overblown for a script…

Python basically means no type declarations for variables, high level useful datatypes like lists and mappings integrated (objects in python are just mappings) and convenient control flow mechanics like iterating through elements of a list with “for i in list”. Blocks are delimited by identation and functions can have named arguments. Many goodies and not truly hard at all on C programmers. I know because I’m one of them.

The reason that blender uses python is because it is a scripting language and is interpreted, meaning you can right python and have it execute in real time. Languages like C and C++ are not interpreted, they are compiled, meaning if blender were to use it, you would have to compile it first, which is time consuming, and if their was an error, you would have to fix it and then recompile. Interpreted languages are a lot better to use for scripting, and python, it is a very easy language to grasp, much easier the C. I think python is even easier than BASIC. Just learn python, I read only a couple hours worth of tutorials, and now I can write scripts in python without problems. Learning the blender python API is the only real time consuming part, and it would be no matter what language blender used.

If only Blender had some kind of programming language accessible to users that was both object oriented and allowed compile-on-the-fly!

If you’ve got to learn Python for the first time, count your blessings. I spent a lot of time in college learning Maya’s proprietary language, MELscript, and (get this!) it has absolutely zero use outside Maya.

Point is, if you’ve got to pick up a new language, there’s worse things to be forced into than Python.

You know, I have a C background too. And I hope I can delve into the source too someday soon. Well… I really have an Assembly background, but C for me is just as elegant. Programming for Blender would be right up my ally.

I always wished to contribute code to renderers like povray or luxrender, but unfortunately it’s not code that matters the most: it’s math that is well beyond my skills… :stuck_out_tongue:

  • Some of blenders C code is (kindof) OO, best example is derived mesh which fills in struct pointers with functions so there can be different backends for mesh generation/rendering. in 2.5 RNA is also OO but more like GObject or PyObject without garbage collection.

  • If you want to be a blender dev I’d not worry about math too much, yesterday I added jitter to the paint tools, simple X/Y randomization, other parts of blender like the video sequencer, game logic, parts of the animation system and render api are hardly math related. - you can get by with simple year 8-9 math. - I’m not even kidding, a lot of it is very basic.

  • You could also pick an area of blender hardly anyone works on now, theme load/saving. driver bugs, interface (not highly math related). UI/python code & api. Docs!..

So you see there are no excuses :slight_smile:

now you got me! :o

It’s like dreaming of being rich and famous (developing big shiny renderer) while mopping the floor (patching driver/interface bugs etc)… :smiley:

@namekuseijin, right, you have to enjoy starting with simple development before you get to work on cool stuff.
I dont mean development in general is “easy” - but many parts of blender are made of very simple concepts that join together to make something useful.

If you want to work on paint tools, you can deal with x/y coords, if you want to deal with the video editor, they are a list of star/end points. - Normally I find the tricky part is that you need time to read and understand even simple data structures in code (guru devs need to do this too).
I think people expect/hope thay can read code and instantly know how to add features, but normally it takes some time to get your head around the internals of code you didnt work on before.

re: Math. the are functions to do the nitty gritty stuff - like interpolate 2 rotations, convert a triangle into a rotation, you dont need to understand all this math to make use of those functions, you only need to know how to apply it in a useful way, and that you can learn by reading existing code.

My issue was not the learning of python…lol, but the speed. Speed as in, I want to jump into something now without coming up against all those *roadblocks, *like no variable definitions. and app specific functions…(blender)some of those take time to work through…I’m accustomed to writing everything on my own…anyway…just a thought, I wanted to make it more comfortable to get into…most languages have a lot in common, and I could learn more, but then there is the whole changing gears in my head thing…I am old and it confuses me sometimes…lol…
I got the answer I needed though, python is a must it seems, until I have the time to get into blenders code…not ATM.