Thread: Re: [pygccxml-development] Ogre Binding
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2006-06-02 09:37:00
Attachments:
generate_code.py
|
On 6/2/06, Lakin Wecker <lak...@gm...> wrote: > Good news: http://lakin.weckers.net/ogre/Screenshot.png this is > rendered from python using the pyplusplus ogre bindings that I'm > working on. Those are really good news. You did it! > ... only the CameraTrackingDemo.py is working) First step is the most important one! I did not see SharedPtr treatment, without it a lot of functionality will not be available. Few comments on script: 1. For some reason you prefer to use "multiple select" functions, why? For example: ogre_ns.classes ('ColourValue').always_expose_using_scope = True 2. There is nothing wrong with "always_expose_using_scope". The generated code is longer, but compiler is able to give better errors locations. I suggest you to set "always_expose_using_scope" to True for all classes. 3. StringVector from pyplusplus import code_creators code = """ class_< std::vector<Ogre::String> , boost::shared_ptr<std::vector<Ogre::String> > >("StringVector") .def(vector_indexing_suite<std::vector<OgreString> >()) ; """ mb = module_builder_t(...) mb.build_code_creator(...) mb.code_creator.body.adopt_creator( code_creators.custom_text_t( code ), 0 ) This will add code that register StringVector. I will send you the updated script 4. generate_code.py and sconscript could re-use ogre_settings. 4.1 please move gccxml location to ogre_settings 4.2 please move "build" dir to ogre_settings 4.3 import ogre_settings from sconscript. Thus you will be able to re-use all variables and settings. And of course I will don't have to change anything when I download your script 5. System wide configurations better to do at the end. ogre_ns.member_functions (lambda decl: decl.name.startswith( '_' )).exclude () ogre_ns.member_functions (lambda decl: decl.name == '', allow_empty=True).exclude () Because, when you configure classes, you include them. That is why few lines later you need to exclude some of the functions again. > > > There are quite a few things that I need to clear up. Some of them > may be my fault, some might be pyplusplus bugs. > > 1. I still have the call_policy for const Matrix4 & problem, (see the > matrix4 scons log), even though there is code in generate_code.py that > should specify call_policies for all references and pointer return > types. > > 2. There are some issues for compiling the Sorry, can not reproduce. The generated file compiles fine for me. May I guess? You are generating XML files from one Ogre header files, but compile python bindings with another. Or may be you use different compilation settings. Please put all environment variables into ogre_settings. > > > 3. There is some strangeness going on with Matrix3 (see > matrix_3_scons.log), but I suspect this is because I'll need to > manually wrap a few constructors that take Real[3] pointers. > > 4. If you look through the generate_code.py, you'll notice a number > of TODO statements. Some of these are simply that, things that I > still need to take care of, however, others are methods, or classes > that I've excluded because they cause problems, and I'm not sure how > to fix them. As I go back through and add them one at a time and see > if I can figure them out. If not, I'll post here with more questions. I will take a look on other issuer this evening. I suggest you to ask the questions, if you can not find solution in 30 minutes :-) > Keep up the good work guys, > > pyplusplus gets better with ever new feature I learn about. :) Thanks. > Lakin -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Lakin W. <lak...@gm...> - 2006-06-02 13:31:50
|
On 6/2/06, Roman Yakovenko <rom...@gm...> wrote: > On 6/2/06, Lakin Wecker <lak...@gm...> wrote: > > Good news: http://lakin.weckers.net/ogre/Screenshot.png this is > > rendered from python using the pyplusplus ogre bindings that I'm > > working on. > > Those are really good news. You did it! > > > ... only the CameraTrackingDemo.py is working) Thanks > First step is the most important one! > > I did not see SharedPtr treatment, without it a lot of functionality > will not be > available. Of course, and it is high up on my TODO list. > Few comments on script: > 1. For some reason you prefer to use "multiple select" functions, why? > For example: > > ogre_ns.classes ('ColourValue').always_expose_using_scope = True This is due to my laziness, I knew that this syntax worked at some point, so I continued to use it. I will be attempting to clean up the script over the next few days. > 2. There is nothing wrong with "always_expose_using_scope". The generated code > is longer, but compiler is able to give better errors locations. > I suggest you to set "always_expose_using_scope" to True for all classes. Will do. > 3. StringVector > from pyplusplus import code_creators > > code = """ > class_< std::vector<Ogre::String> > , boost::shared_ptr<std::vector<Ogre::String> > >("StringVector") > .def(vector_indexing_suite<std::vector<OgreString> >()) > ; > """ > > mb = module_builder_t(...) > mb.build_code_creator(...) > mb.code_creator.body.adopt_creator( code_creators.custom_text_t( code ), 0 ) > > This will add code that register StringVector. I will send you the > updated script Thanks > 4. generate_code.py and sconscript could re-use ogre_settings. > 4.1 please move gccxml location to ogre_settings > 4.2 please move "build" dir to ogre_settings > 4.3 import ogre_settings from sconscript. Thus you will be able to > re-use all > variables and settings. > And of course I will don't have to change anything when I download > your script Yes, this is the first thing on my TODO list. I had forgotten about some of the variables that I still had hard coded. :( > 5. System wide configurations better to do at the end. > > ogre_ns.member_functions (lambda decl: decl.name.startswith( '_' > )).exclude () > ogre_ns.member_functions (lambda decl: decl.name == '', > allow_empty=True).exclude () > > Because, when you configure classes, you include them. That is why few lines > later you need to exclude some of the functions again. Yes of course. I should have figured this out. > > 1. I still have the call_policy for const Matrix4 & problem, (see the > > matrix4 scons log), even though there is code in generate_code.py that > > should specify call_policies for all references and pointer return > > types. > > > > 2. There are some issues for compiling the > Sorry, can not reproduce. The generated file compiles fine for me. > May I guess? You are generating XML files from one Ogre header files, > but compile python bindings with another. Or may be you use different > compilation settings. > > Please put all environment variables into ogre_settings. For this one, are you referring to #1, #2, or both? I will go ahead and put all environment settings into ogre_settings. As for your first guess: I'm fairly certain that I am using the exact same headers for both steps. However, I will double check. > > 4. If you look through the generate_code.py, you'll notice a number > > of TODO statements. Some of these are simply that, things that I > > still need to take care of, however, others are methods, or classes > > that I've excluded because they cause problems, and I'm not sure how > > to fix them. As I go back through and add them one at a time and see > > if I can figure them out. If not, I'll post here with more questions. > > I will take a look on other issuer this evening. I suggest you to ask the > questions, if you can not find solution in 30 minutes :-) Of course. My general criteria for this is: Try it. If I have ideas try them. When I run out of ideas, use google, repeat. When I've finished trying everything that google has told me, I'll post here. Lakin |
From: Lakin W. <lak...@gm...> - 2006-06-02 14:42:30
|
> > > 1. I still have the call_policy for const Matrix4 & problem, (see the > > > matrix4 scons log), even though there is code in generate_code.py that > > > should specify call_policies for all references and pointer return > > > types. > > > > > > 2. There are some issues for compiling the > > Sorry, can not reproduce. The generated file compiles fine for me. > > May I guess? You are generating XML files from one Ogre header files, > > but compile python bindings with another. Or may be you use different > > compilation settings. > > > > Please put all environment variables into ogre_settings. > > For this one, are you referring to #1, #2, or both? I will go ahead > and put all environment settings into ogre_settings. As for your > first guess: I'm fairly certain that I am using the exact same > headers for both steps. However, I will double check. As a follow up: lakin@zedd:~/Desktop/OgrePython$ sudo find / -iname "ogre.h" /home/lakin/.local/include/OGRE/Ogre.h /home/lakin/Documents/non-backup/Software/Compile/ogrenew/OgreMain/include/Ogre.h lakin@zedd:~/Desktop/OgrePython$ There is only two copies of the ogre header file. One is from the build directory where I extracted the source. And the other is from the include directory where I installed ogre to. Lakin |
From: Lakin W. <lak...@gm...> - 2006-06-02 14:46:19
|
On 6/2/06, Lakin Wecker <lak...@gm...> wrote: > > > > 1. I still have the call_policy for const Matrix4 & problem, (see the > > > > matrix4 scons log), even though there is code in generate_code.py that > > > > should specify call_policies for all references and pointer return > > > > types. > > > > > > > > 2. There are some issues for compiling the > > > Sorry, can not reproduce. The generated file compiles fine for me. > > > May I guess? You are generating XML files from one Ogre header files, > > > but compile python bindings with another. Or may be you use different > > > compilation settings. If you are referring to the (#1) Matrix4 problem, it also currently compiles for me. However, Then the problem arises if I comment out any of the following code: # TODO: These function produce a compile error asking me to specify a call policy for # const Matrix4 &, but this should be covered by the loop at the bottom of set_call_policies ogre_ns.calldefs ('getParentEntityTransform').exclude () ogre_ns.calldefs ('_getFullTransform').exclude () ogre_ns.calldefs ('_getParentNodeFullTransform').exclude () Lakin |
From: Roman Y. <rom...@gm...> - 2006-06-02 15:44:35
|
On 6/2/06, Lakin Wecker <lak...@gm...> wrote: > On 6/2/06, Lakin Wecker <lak...@gm...> wrote: > > > > > 1. I still have the call_policy for const Matrix4 & problem, (see the > > > > > matrix4 scons log), even though there is code in generate_code.py that > > > > > should specify call_policies for all references and pointer return > > > > > types. > > > > > > > > > > 2. There are some issues for compiling the > > > > Sorry, can not reproduce. The generated file compiles fine for me. > > > > May I guess? You are generating XML files from one Ogre header files, > > > > but compile python bindings with another. Or may be you use different > > > > compilation settings. > > If you are referring to the (#1) Matrix4 problem, it also currently > compiles for me. However, Then the problem arises if I comment out > any of the following code: > # TODO: These function produce a compile error asking me to > specify a call policy for > # const Matrix4 &, but this should be covered by the loop at the > bottom of set_call_policies > ogre_ns.calldefs ('getParentEntityTransform').exclude () > ogre_ns.calldefs ('_getFullTransform').exclude () > ogre_ns.calldefs ('_getParentNodeFullTransform').exclude () I will take a look, thanks -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-06-02 15:42:45
|
On 6/2/06, Lakin Wecker <lak...@gm...> wrote: > > Few comments on script: > > 1. For some reason you prefer to use "multiple select" functions, why? > > For example: > > > > ogre_ns.classes ('ColourValue').always_expose_using_scope = True > > This is due to my laziness, I knew that this syntax worked at some > point, so I continued to use it. I will be attempting to clean up the > script over the next few days. Okey, I wanted you to be aware of another option. > > > 2. There are some issues for compiling the > > Sorry, can not reproduce. The generated file compiles fine for me. > > May I guess? You are generating XML files from one Ogre header files, > > but compile python bindings with another. Or may be you use different > > compilation settings. > > > > Please put all environment variables into ogre_settings. > > For this one, are you referring to #1, #2, or both? I will go ahead > and put all environment settings into ogre_settings. As for your > first guess: I'm fairly certain that I am using the exact same > headers for both steps. However, I will double check. Then I have another guess: may be your cache contains xml files generated from old declarations? -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Lakin W. <lak...@gm...> - 2006-06-02 15:52:48
|
On 6/2/06, Roman Yakovenko <rom...@gm...> wrote: > On 6/2/06, Lakin Wecker <lak...@gm...> wrote: > > > Few comments on script: > > > 1. For some reason you prefer to use "multiple select" functions, why? > > > For example: > > > > > > ogre_ns.classes ('ColourValue').always_expose_using_scope = True > > > > This is due to my laziness, I knew that this syntax worked at some > > point, so I continued to use it. I will be attempting to clean up the > > script over the next few days. > > Okey, I wanted you to be aware of another option. Thanks. > > > > 2. There are some issues for compiling the > > > Sorry, can not reproduce. The generated file compiles fine for me. > > > May I guess? You are generating XML files from one Ogre header files, > > > but compile python bindings with another. Or may be you use different > > > compilation settings. > > > > > > Please put all environment variables into ogre_settings. > > > > For this one, are you referring to #1, #2, or both? I will go ahead > > and put all environment settings into ogre_settings. As for your > > first guess: I'm fairly certain that I am using the exact same > > headers for both steps. However, I will double check. > > Then I have another guess: may be your cache contains xml files generated from > old declarations? Aaaah ... this is much more likely .... I will check this right now. Lakin |