[Bf-committers] extending Blender (Re: What documents should Iread in order to embedblender?)

Toni Alatalo antont at kyperjokki.fi
Thu Apr 23 15:01:43 CEST 2009


Remo Pini kirjoitti:
> If you look at Blender from a "Windows user" point of view, the UI is horrible. I'm not saying that it doesn't work or anything in that direction, but it violates pretty much every UI-guideline set forward for Windows programs. Which is fine for the main purpose as a 3D application that has to be portable. However, if you consider the OPs problem, this is about the most user unfriendly way of

The original post does not mention wanting a Windows UI, but yes that's
a fair point.

One option to reuse existing e.g. Windows UI code for a 'Blender
application' may be to run an application that creates new windows etc.
from within Blender. I haven't tested it yet, but expect e.g. this to
work executed from BPython: import myguilib; myguilib.createwindow()
#creates a normal window within our windowing env that your guilib uses.

It probably would get tricky to pass the callbacks and data etc., deal
with the threading etc., but perhaps possible.

> What probably would work fine is if he could wrap Blender functionality into an API that can be used from within another application and only expose the "final" OpenGL viewport / render window.
>   

Yes, might be possible with some serious trickstery.

I think this is my last post to this thread on this mailing list, as
this is getting perhaps a bit far from actual development topics .. or
at least a largish discussion. Perhaps some forum thread on e.g.
blender.org would be in place if someone wants to continue, I can join
in there.

> Remo
>   

~Toni

> -----Original Message-----
> From: bf-committers-bounces at blender.org [mailto:bf-committers-bounces at blender.org] On Behalf Of ??
> Sent: Donnerstag, 23. April 2009 14:33
> To: bf-blender developers
> Subject: Re: [Bf-committers] extending Blender (Re: What documents should Iread in order to embedblender?)
>
> 2009/4/23 Toni Alatalo <antont at kyperjokki.fi>:
>   
>> 明覺 kirjoitti:
>>     
>>> 2009/4/23 Wael EL ORAIBY <wael.eloraiby at gmail.com>:
>>>
>>>       
>>>> I would advise you to do it the other way around: embed your code 
>>>> into blender! I think it's better. If not, there are plenty of OSS 
>>>> engine
>>>>
>>>>         
>>> result. So this is program mainly used in mechanical field, it's not 
>>> possible to make blender contain those mechanical analysis code,
>>>
>>>       
>> It is possible to make Blender 'contain' any code.
>>
>> Blender is an application, not a set of libraries for other 
>> applications
>>     
> I do not agree with you, in my opinion, free software is to make code reusable to other application, even commercial software exports APIs for others to use.
>
>   
>> to use -- the embedding you originally thought about would probably be 
>> possible to hack somehow, but much easier would indeed be to make your 
>> application to be added functionality within Blender itself. The 
>> existing things in Blender, like the 3d modelling or the sequencer
>> (video) editor, are in a way already independent applications on top 
>> of the common base (which gives them the database, UI tools etc).
>>
>> A way to add functionality to Blender is using the Python API. That 
>> has been limited with regard to e.g. UI, but as a part of the 2.5 work 
>> that has been made better so that tools that register to Blender via 
>> py should be able to integrate to the normal UI in the same way as the 
>> default c written tools are. I don't personally know the status nor 
>> the details of that there yet, but am looking forward to benefitting 
>> from that myself for own custom tools.
>>
>> You mention wanting to use the C language. If it is for performance, 
>> one thing you can do is to implement the processing things in C, and 
>> add a py api to that so your library can be called from the Python 
>> running on the Blender side. It's pretty straightforward. If the 
>> reason for wanting to use C is because that's what you know well from 
>> before, it doesn't hurt to give Python a chance too 'cause it wont 
>> take you many hours to test something with it.
>>
>> Another way is to write your own code in C similarily to how the 
>> builtin 'applications' in Blender are, define your own spacetype etc 
>> if that's how you wish to do the UI. There is no separate C API for 
>> that though, AFAIK not in 2.5 either, so I'm afraid that would mean 
>> having to maintain your own fork of Blender if you wan't to distribute 
>> it to others too. Via the py API your own code could be used with the 
>> unmodified Blender.
>>
>> Feasibility of these approaches depend on the exact functionality that 
>> you need (e.g. the UI, data storage etc), but many things are 
>> certainly possible.
>>
>> ~Toni
>>
>> _______________________________________________
>> Bf-committers mailing list
>> Bf-committers at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-committers
>>
>>
>>     
>
>
>
> --
> My platform is debian-sid gnome mozilla eclipse monodevelop blender.
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>   



More information about the Bf-committers mailing list