[Bf-committers] BGE 2.49 external python modules...

Natanael Olaiz nolaiz at gmail.com
Sat May 23 13:31:05 CEST 2009


BTW, these are some of the things that we are doing with Blender/BGE: 
hacking YoFrankie to combine with CLAM for 3D audio processing (binaural 
/ n speakers arrays):
http://lad.linuxaudio.org/events/2009_cdm/Thursday/05_Arumi/index.html
http://www.youtube.com/watch?v=KSfqJUIAiXk



El 05/23/2009 01:06 PM, Natanael Olaiz escribió:
> 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..
>
>
> Best regards,
> Natanael.
>
> 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,
>> http://blenderartists.org/forum/showthread.php?t=156672
>>
>> In 2.49 the blendfiles path is always added to the sys.path,
>>
>> The module feature is not limited to...
>>  module.func
>> You can do this too...
>>   module.submodule.func
>> Or...
>>   package.module.func
>> Its not limited, if you wanted you could do this and it would not be
>> any slower to run...
>>   a.b.c.d.f.someFunc
>>
>> 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...
>> /home/me/game/someGame.blend
>> /home/me/game/scripts/someScript.py
>> However this is a bit arbitrary.
>>
>> A nicer way to manage this is with python packages
>> /home/me/game/someGame.blend
>> /home/me/game/MyScript/__init__.py
>> /home/me/game/MyScript/someScript.py
>>
>> 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
>> "MyScript.someScript.main"
>>
>> Even though this seems a bit complicated Id assume youd only do this
>> in bigger projects where 10+ scripts are going to clutter your
>> directory.
>> 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,
>>> Natanael.
>>>
>>>
>>> El 05/22/2009 06:04 PM, Natanael Olaiz escribió:
>>>    
>>>> Hi!,
>>>>
>>>> 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,
>>>> Natanael.
>>>>
>>>>
>>>>
>>>>       
>>> _______________________________________________
>>> 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