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

=?GB2312?B?w/fTWA==?= shi.minjue at gmail.com
Thu Apr 23 14:48:34 CEST 2009


2009/4/23 Toni Alatalo <antont at kyperjokki.fi>:
> Ã÷ÓX kirjoitti:
>>> It is possible to make Blender 'contain' any code.
>>>
>> but you cannot make all the users to face the blender user interface
>> when they want to make mechanical analysis, it's not polite to my
>> users, I cannot tell them: "oh, do not be surprised, you will find the
>> buttons you want to look at the mechanical analysis."
>>
>
> With <2.5 you can make your tool so that it's e.g. a .blend file which
> opens with your GUI visible, other things hidden, so the users are not
> faced with the default Blender UI setup and don't need to search for the
> buttons you want to show them. The default layout defined when opening
> is just a file called .b.blend
>
> With 2.5 the UI layouts are defined in .py files that you can modify
> without needing to make your own version of Blender otherwise, so you
> can define the 'mechanical engineering' or 'robotics' Blender UI the way
> you want.

thanks for the explanation, yes, I have worked on a python file for
blender in which the users input math equations to define a surface,
and the 3dview will display it. it's possible to implement some of my
functions in this way, but I don't like this way, because 3D display
is just a part of my program, about 10%-20%, I cannot port the other
80%-90% of code to python script in order to use blender, it's not
reasonable. Another thing is I don't like writing code in python.

>
> I'm not saying this is what you must do, am just explaining what is
> possible with Blender now :)
>
> ~Toni
>
>>> Blender is an application, not a set of libraries for other applications
>>> 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
>>>
>>>
>>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Bf-committers mailing list
>> Bf-committers at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-committers
>>
>
>
> _______________________________________________
> 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.


More information about the Bf-committers mailing list