how to use ogrexmltoflower.rb

caifie

05-05-2010 09:50:20

hi!

i'm using ogre1.7+nxogre1.5.5. nxogre need some special mesh format,so i use flour. but there are some problems.

when i use flour0.32, it can convert heightfield, like *.raw to *.nxs, but can not convert *.mesh(runtime error).

so i download flour 0.4, but it no longer surpport *.mesh. and betajaen give us the ogrexmltoflower.rb, which is Ruby script to convert an Ogre Mesh XML into flower, and then convert *.flower to *.nxs.

but how can i use ogrexmltoflower.rb.

can anybody kowns that help me.

thanks!

betajaen

05-05-2010 11:28:35

1. Make sure you have Ruby installed (http://rubyinstaller.org/).
2. Copy your mesh.xml to the same directory as ogrexmltoflower.rb
2. Open a Command Prompt (DOS) Window, and CD to the Directory where you have ogrexmltoflower.rb in.
3. Type, and press enter.

ogrexmltoflower mymesh.mesh.xml

(Where mymesh.mesh.xml is the name of your mesh).

4. You should have a new file called "mymesh.flower" which you can then give to flower for conversion.

I you have any problems, reply back, and I'll help.

caifie

05-05-2010 11:53:10

thanks very much!

i have installed the Ruby 1.9.1-p378 (RC2), and i copy the ogrexmltoflower.rb and fence4.mesh.xml to c:\ruby19,

and in dos window, i cd to the c:\ruby19, and the cmd line are like below,
c:\runy19> ogrexmltoflower fence4.mesh.xml

but the result is that,
ogrexmltoflower is not inner or outer cmd
and ofcourse there is not a new file fence4.flower or fence4.mesh.flower.

what is wrong about this?

betajaen

05-05-2010 12:23:55

You put ogrexmltoflower.rb and your mesh in C:/Ruby19 right?

If so; try:

ruby ogrexmltoflower.rb fence4.mesh.xml

caifie

05-05-2010 12:54:20

it does not work still.

show the error,
c:\ruby19>ruby ogrexmltoflower.rb fence.mesh.xml
c:/ruby19/lib/ruby/site_ruby/1.9.1/rubygems.rb:827:in 'report_actevate_error':
could not find rubygem hpricot <>=0.6 <gem::loaderror>
from c:/ruby19/lib/ruby/site_ruby/1.9.1/rubygems.rb:261:in 'activate'
from c:/ruby19/lib/ruby/site_ruby/1.9.1/rubygems.rb:68:in 'gem'
from <internal:gem_prelude>:273:in 'push_gem_version_on_load_path'
from <internal:gem_prelude>:14:in 'gem'
from ogrexmltoflower.rb:1:in '<main>'

betajaen

05-05-2010 13:05:05

Not particually helpful.

Copy and Paste the contents of the DOS window, or take a screen shot of you trying to convert the mesh file.

caifie

05-05-2010 13:07:22

i have edited the last post, i don't kown how to upload a screenshort, :oops:

betajaen

05-05-2010 13:36:23

Okay, type in the DOS Window.

gem install hpricot

Then try it again.

caifie

05-05-2010 14:05:10

thanks again and again! :D

but i'm so sorry, i'll type the result, it seems that hpricot failed to build.

betajaen

05-05-2010 14:11:31

Again, what is the error message?

caifie

05-05-2010 14:39:27

below is the result,
c:\ruby19> gem install hpricot
bulding natice extensions. this could take a while...
error: error installing horicot:
error: faild to build gem natice extention.

c:/ruby19/bin/ruby.exe extconf.rb
checking for stdio.h... *** extconf.rb failed ***
could not create makefile due to some reason, probably lack of
necessary libraries and/or headers. check the mkmf.log file for more details.
you may need configurations.

provided configuration option:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=c:/uby19/bin/ruby
c:/ruby19/lib/ruby/1.9.1/mkmf.rb:364:in 'try_do': the complier faild to generate
an executable file. <runtimeerror>
you have to install development tools first.
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:433:in: 'try_cpp'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:811:in 'block in have_header'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:670:in: 'block in checking_for'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:276:in 'block <2 levels> in postpone'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:250:in 'open'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:276:in 'block in postpone'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:250:in 'open'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:272:in 'postpone'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:669:in 'checking for'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:810:in 'have_header'
from extconf.rb:2:in '<main>'

gem files will remain installed in c:/ruby19/lib/ruby/gems/1.9.1/gems/hpricot-0.82 for inspection
results logged to c:/ruby19/lib/gems/1.9.1/hpricot-0.8.2/ext/fast_xs/gem_make.out


i have checked the mkmf.log, but it's empty, nothing in it.

betajaen

05-05-2010 14:45:56

Try this:

gem install hpricot -v0.6

If a menu comes up choose the option that says mswin32".

caifie

05-05-2010 15:03:07

error still, a little difference


c:\ruby19> gem install hpricot -v0.6
bulding natice extensions. this could take a while...
error: error installing horicot:
error: faild to build gem natice extention.

c:/ruby19/bin/ruby.exe extconf.rb
checking for main<> in -1c... *** extconf.rb failed ***
could not create makefile due to some reason, probably lack of
necessary libraries and/or headers. check the mkmf.log file for more details.
you may need configurations.

provided configuration option:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=c:/uby19/bin/ruby

--with-hpricot_scan-dir
--without-hpricot_scan-
--with-hpricot_scan-include
--without-hpricot_scan-include=${hpricot_scan-dir}/include
--with-hpricot_scan-lib
--without-hpricot_scan-lib=${hpricot_scan-dir}/lib
--with-clib
--without-clib

c:/ruby19/lib/ruby/1.9.1/mkmf.rb:364:in 'try_do': the complier faild to generate
an executable file. <runtimeerror>
you have to install development tools first.
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:417:in: 'try_link0'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:421:in 'try_link'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:529:in: 'try_func'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:725:in: 'block in have_library'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:670:in: 'block in checking_for'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:276:in 'block <2 levels> in postpone'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:250:in 'open'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:276:in 'block in postpone'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:250:in 'open'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:272:in 'postpone'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:669:in 'checking for'
from c:/ruby19/lib/ruby/1.9.1/mkmf.rb:720:in 'have_header'
from extconf.rb:2:in '<main>'

gem files will remain installed in c:/ruby19/lib/ruby/gems/1.9.1/gems/hpricot-0.6 for inspection
results logged to c:/ruby19/lib/gems/1.9.1/hpricot-0.6/ext/fast_xs/gem_make.out

betajaen

05-05-2010 16:19:27

Try a number of options from here:

http://stackoverflow.com/questions/1718 ... on-windows

I had no problems with installing hpricot on my computer, it is weird that you have.

caifie

06-05-2010 02:38:47

thanks so much!

the ruby and the gem hpricot had installed successfully.

but there may be something wrong with your script, or just syntax is wrong, my result is like below,

c:\ruby19>ruby ogrexmltoflower.rb fence4.mesh.xml
i can only convert into convex, triangle or cloth. not a 'fence4.mesh.xml'

c:\ruby19>ruby ogrexmltoflower.rb column.mesh.xml
i can only convert into convex, triangle or cloth. not a 'column.mesh.xml'

c:\ruby19>ruby ogrexmltoflower.rb column.xml
i can only convert into convex, triangle or cloth. not a 'column.xml'

betajaen

06-05-2010 07:45:44

You forgot to put what it wants to be:

ruby ogrexmltoflower.rb triangle fence4.mesh.xml

caifie

06-05-2010 09:11:51

ok, succeed now!

thanks betajaen for the patient guide! :D

any one who want to use ogrexmltoflower.rb may follow the guide below.(exactly from betajaen)

routine:
1. use ogrexmltoflower.rb to convert ogre mesh xml(*.xml) to the format flower(*.flower).
2. use flour 0.4 to convert the flower (*.flower) to nxs flies(*.nxs).

practice:
1. install Ruby and devkit (http://rubyinstaller.org/download.html)
2. install gem hpricot. Open a Command Prompt (DOS) Window, and CD to the Directory your ruby installed(like c:\ruby19).the syntax is that:

gem install hpricot v-0.8.2
any problem can see this,http://stackoverflow.com/questions/1718500/installing-hpricot-on-ruby-1-9-1-on-windows

3. Copy your mesh.xml and ogrexmltoflower.rbt o the same directory (like c:\ruby19).
4. in the last Command Prompt (DOS) Window(if you closed it, open a new and cd to the same Directory), use the syntax to convert the mesh.xml to mesh.flower. Type, and press enter.

ruby ogrexmltoflower.rb triangle mesh.xml
triangle can be conver or cloth also, mesh.xml is your choice(like column.xml). after this there will be mesh.flower in your direction.(like column.flower)
5. install flour 0.4 and follow its syntx to convert mesh.flower to mesh.nxs.(http://www.ogre3d.org/addonforums/viewtopic.php?f=6&t=11000)

krikkit

12-06-2010 13:51:36

Hello,

i have nearly the same problem.
If i load my program with an relativ media path like this


NxOgre::ResourceSystem::getSingleton()->openArchive("media","file:..//nxs");

i get an Debug Error:

HEAP CORRUPTION DETECTED: after Normal block.....
but i have no problems with collision. (<- i think the nxs files are ok!)

If i make the media path absolut. I have no problems and no error message.
I have tested "flour 0.3.2" and "flour 0.4".

But what can i do with the message?

Thanks for your help.

betajaen

12-06-2010 15:11:29

Which NxOgre are you using?

krikkit

12-06-2010 19:19:42

NxOgre.1.5.5.BloodyMess

OgreSDK_vc9_v1-7-0

betajaen

12-06-2010 20:19:03

I think there is a problem with the resource system in BM. You should upgrade to Detritus and Critter, it's far better.