dmitriy.ogorodnikov Posted October 3, 2014 Share Posted October 3, 2014 Hello! I'm learning hot to use C++ project. There are a lot of tutorials, so I took one C:\Unigine Sim evaluation\source\samples\Api\Systems\World I'll plan to copy this project do disk D in the future. So I desided to do it step by step. First of all I created a copy of World.bat file (C:\Unigine Sim evaluation\source\samples\Api\Systems\World\World1.bat). Then I decided to replace local path by global. Original file World.bat: World -data_path ../../../../../ ^ -engine_config ../../data/unigine.cfg ^ -system_script ../../data/unigine.cpp ^ -console_command "world_load data/world" ^ -video_mode 2 I replaced -data_path to global path: World -data_path "C:/Unigine Sim evaluation" ^ and it didn't work During launching I catch error "Engine::init(): can't initialize filesystem". Also I checked two cases: World -data_path "C:/Unigine Sim evaluation/" ^ World -data_path C:/Unigine Sim evaluation ^ The second line of bat-file contains path to cfg-file, that also contains data_path parameter -engine_config ../../data/unigine.cfg I replaced local path to global in cfg-file, but I didn't also help. Link to comment
silent Posted October 6, 2014 Share Posted October 6, 2014 Hello, Dmitry! Unfortunately, data_path can be only relative to the binaries location. However, you can add one or more external locations (outside of data directory) via -extern_directory command or using the .ulink file. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
dmitriy.ogorodnikov Posted October 8, 2014 Author Share Posted October 8, 2014 Thank you for helping! My goal was to know how to create Custom C++ project. And today I thought that I went wrong way before and asked wrong questions. Standard Docs wasn't too clear for me, so Today I've done next steps: 1. Copy project do drive D. 2. Run bat-file and get errors. 3. Corect errors and run bat-file again until success. 4. Open vcxproj-file at MS Visual Studio, set required settings of solution using Docs, build exe-file and try to debug it (just for test). 5. Copy project to clean computer and run bat-file there. 1. I've copied project World from drive C to drive D from C:\Unigine Sim evaluation\source\samples\Api\Systems\World to d:\World 2. Run d:\World\World.bat and get errors Xml::load(): can't open "D:/World/ ../../data/unigine.cfg 3. I've open World.bat file World -data_path ../../../../../ ^ -engine_config ../../data/unigine.cfg ^ -system_script ../../data/unigine.cpp ^ -console_command "world_load data/world" ^ -video_mode 2 Corected it to World -data_path ./ ^ -engine_config data/unigine.cfg ^ -system_script data/unigine.cpp ^ -console_command "world_load data/world" ^ -video_mode 2 Copy files unigine.cfg and unigine.cpp from drive C to drive D from C:\Unigine Sim evaluation\source\samples\Api\data to d:\World\data Get next errors: FontTTF::FontTTF(): can't open "core/gui/font.ttf" file and another lines that direct to "core" directory Then I copied core directory from drive C to drive D C:\Unigine Sim evaluation\data\core\editor\ to d:\World\data\core\ Run again, unigine editor was loaded, but console had error Mesh::info_mesh(): can't open "../../data/cbox.mesh" file I searched string "../../data/cbox.mesh" in all files of project (d:\World) I found that cbox.node contains several lines like this: - <node type="ObjectMesh" id="372338091" name="cbox_00"> <mesh>../../data/cbox.mesh</mesh> <surface name="cbox" material="mesh_base" property="surface_base" /> <transform>1 0 0 0 0 1 0 0 0 0 1 0 -0.5 -0.5 0 1</transform> </node> I change path to "data/cbox.mesh" and copy cbox.mesh to drive D from C:\Unigine Sim evaluation\source\samples\Api\data\ to d:\World\data\ <node type="ObjectMesh" id="372338091" name="cbox_00"> <mesh>data/cbox.mesh</mesh> <surface name="cbox" material="mesh_base" property="surface_base"/> <transform>1 0 0 0 0 1 0 0 0 0 1 0 -0.5 -0.5 0 1</transform> </node> At that time world was successfully loaded. 4. I ran World.vcxproj in Microsoft VS 2010, save solution and build. Got errors and used Docs. Set include and lib directories at Debug-Double configuration: C:\Unigine Sim evaluation\include C:\Unigine Sim evaluation\lib Successfully built solution (Worldd.exe) Created World_d.bat (a copy of World.bat that runs Worldd.exe) Ran World_d.bat - world was successfully loaded. Copied content of bat-file to Properties -> Debugging -> Command arguments -data_path ./ -engine_config data/unigine.cfg -system_script data/unigine.cpp -console_command "world_load data/world" -video_mode 2 Ran in debug mode from Visual Studio, set a couple of breakpoints and check that they work. 5. Copy a project (d:\World\) to second clear computer. Ran World_d.bat and got error: Unigine_x86d.dll wasn't found. Like said in Docs, I copied this dll to second clear computer (d:\World\) Ran World_d.bat again and everything was good - world was loaded. If I saw something like this tutorial at Docs It would save me a time :) Thank you. You can close the question. Link to comment
silent Posted October 8, 2014 Share Posted October 8, 2014 Great! We surely will update C++ application tutorial and include more detailed description for each step.Thank you for sharing! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
renato.semadeni Posted November 13, 2014 Share Posted November 13, 2014 Great post! Thanks! Link to comment
Recommended Posts