### possible bug re: saving forest objects

Friendly conversations, and everything that doesn't fit into the other forums.

#### possible bug re: saving forest objects

chriscalef
Posts: 381
Joined: Mon Feb 09, 2015 7:48 pm
Just started messing around with a forest in my current T3D build (haven't updated in a couple of weeks, sorry if it's been fixed) and I noticed I could place a forest and add a few trees, but on save and reload my forest would be gone.

On further investigation it turned out to be what looks like a bug, easily solved. When you initially create the forest, it gets saved, empty, to a new .forest file. However, when you save the mission, in tools/forestEditor/main.cs it calls "theForest.saveDataFile()" with no argument.

Unfortunately, in forest.cpp, the saveDataFile console method expects a path, and if it finds none it apparently sends an empty string rather than a null on to the saveDataFile engine function, which then resets its mDataFileName to "" instead of the useful path it had before.

I fixed this locally by the following change to the console method.

Code: Select all

DefineConsoleMethod( Forest, saveDataFile, void, (const char * path), (""), "saveDataFile( [path] )" ) { object->saveDataFile( path ); }

Code: Select all

DefineConsoleMethod( Forest, saveDataFile, void, (const char * path), (""), "saveDataFile( [path] )" ) { if (strlen(path)>0) object->saveDataFile( path ); else object->saveDataFile(); }
Which seems to work fine.

#### Re: possible bug re: saving forest objects

Jason Campbell
Posts: 335
Joined: Fri Feb 13, 2015 2:51 am

I wonder why no one has responded. This perhaps should be included in a bugfix for a future version. I know I had tons of trouble with forest editor in 3.5.

#### Re: possible bug re: saving forest objects

Johxz
Posts: 447
Joined: Sat Feb 07, 2015 11:37 pm
@
chriscalef

How can we replicate the bug?

#### Re: possible bug re: saving forest objects

Duion
Posts: 1420
Joined: Sun Feb 08, 2015 1:51 am

The forest editor is known for various issues, it probably needs a complete redesign.

#### Re: possible bug re: saving forest objects

chriscalef
Posts: 381
Joined: Mon Feb 09, 2015 7:48 pm
I can't say for sure it isn't a local issue, but to replicate the bug, if you have it, simply create a new mission, add a forest, create some trees, save it, and see if the trees are still there when you reload it next time.

#### Re: possible bug re: saving forest objects

Johxz
Posts: 447
Joined: Sat Feb 07, 2015 11:37 pm
I was toying with the forest editor and don't have "bugs". I tested in a clean 3.6.3 and development version. I add a forest and mixes trees from the library/meshes, save and the forest still there.

What version do you have, development or 3.6.3? Are you using default models or custom one?
can you create a new project with the same template you used? and check if you still have the bug.

#### Re: possible bug re: saving forest objects

TorqueFan
Posts: 110
Joined: Thu Apr 30, 2015 5:35 am
Bumped into the same issue and applied the fix by ChrisCalef. Recompiled, worked like a charm. Thanks a lot Chris!

#### Re: possible bug re: saving forest objects

buckmaster
Steering Committee
Posts: 321
Joined: Thu Feb 05, 2015 1:02 am
I wonder if this is the same issue solved in this PR.

#### Who is online

Users browsing this forum: No registered users and 2 guests