incorporating a different language?

i wasnt sure where i should post this so…

i was wondering if it was possible to incorporate a different programming/scripting language into blender. or if it was possible to make a webbrowser in blender. basically a webbrowser would be all that i need the other language for. so is it possible to either make a web browser in blender or incorporate another scripting/programming language into blender?

Is it possible? Yes, if it can be embedded in C and expose Blender functions.

Web browser in Blender, that’s a little harder challenge. Currently, with python, if you were to put in the work, you could get a web browser to function in Blender (not that it’d be any less work with other languages, though). It might have some severe limitations, but in theory, if you were willing to put in the work you could pull it off.

One of the biggest limitations would undoubtedly be size. The source code for a browser, by the time you GUI-ized, had a standards compliant renderer (for different versions of html, xhtml, etc.), etc. would likely be quite large. Don’t forget, you’d likely want at least CSS, if not Javascript (since there are few web pages that function without it), and perhaps flash as well. Those are completely separate challenges, not to mention requests that are necessary for php, asp, and other dynamic languages. For instance, see the HTML 4 spec.

Also don’t forget, some API changes in the future (2.50, perhaps) could make this easier (or indeed, harder), or make writing one currently a waste of time.

So in short, the answer to both questions is yes.

ok so very hard? but now (with the permission of the browser of course) if i incorporated the source code of an open source web browser that was already made, how could i do that, would i possibly need to edit the source code of blender and then compile blender from my edited version? so now that i know its posible, i wont ask exactly how, (unless u can tell me how :stuck_out_tongue: ) as i was saying i wont ask exactly how to incorporate the new language, but i will ask, would i need t edit the source code of blender? and if so, do u know wut file in the hole big directory of the blender source code would i edit to be able to insert the source code for the web browser? thanks in advanced, and thank u very much to forTe.

To take an open source browser and incorporate it into Blender at a source level, would of course require editing the source. The way to approach I would guess, would be to add the main functionality, sans interface (unless it uses OpenGL drawing commands for rendering), as a library. You then add a browser window type, and from there its translating whatever output it gives you into proper OpenGL drawing commands to have it rendered correctly.

In truth this would be easier than doing it in Python depending on your level of C and C++ experience. The main issue will be finding a web browser that supports standards compliant rendering, css, and a javascript engine and that can provide the necessary libraries to be linked, while still being relatively lightweight.

Editing the source for this would not be a just easy drop the source in compile and you got it. It’d likely take a good deal of work, study, expletives (;)), and debug cycles to accomplish, even for an experienced programmer to get it to a remotely usable level, let alone an efficient one concerning processor and memory usage as well as executable size and incorporation into the blender workflow. On top of that, you may start now, and when 2.50 development starts picking up in the next year (hopefully ;)), you may have to redo/undo a lot of work (just speculation on this last bit, somebody like JesterKing or brecht or Theeth or other developers more familiar with how 2.50 is going to go could probably say better).

If you want to incorporate a new language, then yes you will also need to edit the source. Likely, you’d want to create a new directory something like ‘language_api’ in the src directory (like where python is, for instance if you wanted to integrate ruby, you might do Ruby_api), and from there it’d be exposing Blender’s objects to that particular language as well as getting it to place nicely with other things.

ok id rather not edit the source code but if i hav to then, i will not abandon this project!

if i were just to write a browser in python, would that require editting the source code?

You’d have to write the Python source of course (:p), but not edit the internal C/C++ source.

ok thanks forte, so i would write the web browser in python, and then wut object would i put it into, a text object? im assuming the browser would hav to be text based rite?

dude, just get like Visual Studio…you can make a web browser in like 5 minutes…

No it would not be difficult to do as long as you have knowledge. The easiest way to do this is probably modifying blender and either adding commands through the python to execute your code through Blenders Source. Get what i mean?

To replace the scripts, again, you would need the blender sources. I am not familiar with Blender’s sources but im sure it would involve alot of changing of the source. Something much easier would to make a wrapper in Python to execute your desired language. The problem with this is speed. (Your language > Python > C/C++)

i know how easy it is to make a web browser in visual studio but if making a web browser in python would mean not having to edit the source code of blender then im willing to do that, and plus im clueless wen it comes to editing the blender source code. u’d hav to give me ALOT of help with it and u probably hav better things to do than that.

No it would not be difficult to do as long as you have knowledge. The easiest way to do this is probably modifying blender and either adding commands through the python to execute your code through Blenders Source. Get what i mean?

i think i kinda get wut u mean but which file/files would i edit to get blender to execute my commands, im guessing doing this would be like adding a plugin to blender rite?

Why would you like a browser in blender?

i need a webbrowser in blender cuz im making a BlenderOS and wuts an operating system without a webbrowser?

If you’re coding an OS based on Blender (without an existing OS codebase, i.e. from the hardware up), then I would assume you would probably know enough about C and Assembly and the codebase of Blender that you could probably code it fairly easily, or figure how to incorporate an existing one.

If you’re basing it on Linux or other OSS OSes, then it’d be best just to include one that already exists (i.e. Firefox, konqeror, etc.), as it’d be much less work really.

Regarding different languages embedded in Blender: (on-hold, but still good as example).


well actually i use the term ‘OS’ very loosely, its gonna be a OS that u can run inside of ur current OS, sorta like a virtual machine, just without the whole installation and .iso file mess. and i was hoping to base it off of ubuntu and call it Blubuntu, :stuck_out_tongue: