[Bf-committers] BGE 2.49 external python modules...
nolaiz at gmail.com
Sat May 23 13:06:59 CEST 2009
Wow, RT editing while the engine is running: amazing. :)
Thank you very much!!
BTW, I want to ask a question: how difficult do you think that could
make the API able to manage the logic connections? As I said, I found
the external scripting so useful to script based on SVN revisions (so,
now I can do diffs/merges/etc directly)... but the connections are still
a problem in that sense, since there are only in the binary .blend files..
El 05/23/2009 04:36 AM, Campbell Barton escribió:
> Heres a video of how to use modules, though it looks like you got this far,
> In 2.49 the blendfiles path is always added to the sys.path,
> The module feature is not limited to...
> You can do this too...
> Its not limited, if you wanted you could do this and it would not be
> any slower to run...
> The way the directories are setup for YoFrankie currently use python
> packages, blender doesn't need to know about how packages work, python
> does this automatic.
> ----- explained on the forum
> @Sim88, Originally I made blender look in "./scripts" a bit like how
> many games have "./textures"
> where the blendfile was in...
> However this is a bit arbitrary.
> A nicer way to manage this is with python packages
> This way you can import the directory as if its a module, Look up py
> docs on how to write a package, but basically __init__.py just needs
> to import 'someScript.py'
> Then the py-controller module can use the string
> Even though this seems a bit complicated Id assume youd only do this
> in bigger projects where 10+ scripts are going to clutter your
> In these cases setting up a python package is no bug deal, I tested
> this for YoFrankie and it works well.
> On Fri, May 22, 2009 at 3:10 PM, Natanael Olaiz <nolaiz at gmail.com> wrote:
>> Testing further, putting "relativepath/module.method" it works!
>> But I still don't understand: in YoFrankie python modules names, after
>> the relative path is a "." instead a "/" . Why there it works like that
>> and in a new scene it doesn't??
>> Anyway, congratulations for the improvements that you are making in
>> Blender and BGE. :)
>> Best regards,
>> El 05/22/2009 06:04 PM, Natanael Olaiz escribió:
>>> I updated my Yofrankie sandbox, and I'm glad to see the actual
>>> external scripts!! (I was hacking them, and it was a mess everytime
>>> that the binary .blend files were updated...)
>>> But..... I can't found where the modules figure in the blender files
>>> or how to import them!! I mean, in Yofrankie files I see that the
>>> python controllers have the execution mode as "module", but I can't
>>> found those scripts anywhere inside the blender file, and I tried to
>>> create a new scene using the same name conventions of external files
>>> for a simple script (to see if works in that way) without luck (I get
>>> an ImportError: no module named....)
>>> I would be really grateful if you could give me any hint.
>>> Thanks in advance,
>> Bf-committers mailing list
>> Bf-committers at blender.org
More information about the Bf-committers