2019-02-17 13:06 EST

View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0001929FSSCPFREDpublic2015-03-03 21:56
Assigned ToMageKing17 
PrioritynormalSeverityminorReproducibilityhave not tried
Product Version3.6.9 
Target VersionFixed in Version 
Summary0001929: Texture replacement more problems
DescriptionMessing around with some nameplates tonight I ran into a couple of quarks. First the texture replacement screen in FRED seems to sort the texture names into alphabetical order. Not a bad feature but if I replace say the fifth texture in the list it actually does replace the fifth texture as it appears in PCS2 not the sorted list.

Now it gets even messier. While trying to figure that out I had 2 of the same ship class in FRED. I started changing one texture on each ship while removing the previous change. Both ships changed but not even the right texture. Seems it decided not to remove one of the replacements or moved it to another texture.

Part 3 (probably what caused part 2) When I finally got the right texture in the sorted list that changed the nameplate and that wrong texture problem happened I looked at it in notepad. It actually stored it with the right name in the .fs2 file. So even though FRED says texture X the FRED file says texture_Y.

Part 4.(haven't double checked this one) Having a texture named Blank in PCS2 doesn't results in the texture not showing up in FRED. I renamed the texture in PCS2 and in the maps directory and it showed up in FRED.
Additional Information3.6.10 RC2. I'll try to add more info tomorrow. Just wanted to get this filed so I didn't forget about it.
TagsNo tags attached.
Attached Files
  • jpg file icon text_replace1.jpg (104,082 bytes) 2009-05-25 03:08 -
    jpg file icon text_replace1.jpg (104,082 bytes) 2009-05-25 03:08 +
  • jpg file icon text_replace2.jpg (147,427 bytes) 2009-05-25 03:09 -
    jpg file icon text_replace2.jpg (147,427 bytes) 2009-05-25 03:09 +
  • jpg file icon texreplace_prob.jpg (182,862 bytes) 2009-05-30 00:55 -
    jpg file icon texreplace_prob.jpg (182,862 bytes) 2009-05-30 00:55 +
  • patch file icon 1929.patch (2,086 bytes) 2015-02-23 21:58 -
    Index: code/fred2/fred.rc
    --- code/fred2/fred.rc	(revision 11257)
    +++ code/fred2/fred.rc	(working copy)
    @@ -1928,7 +1928,7 @@
         PUSHBUTTON      "Cancel",IDCANCEL,239,35,50,14
         LTEXT           "Old texture:",IDC_LABEL1,7,7,44,9
         LTEXT           "New texture:",IDC_LABEL2,152,7,44,9
    Index: code/fred2/shiptexturesdlg.cpp
    --- code/fred2/shiptexturesdlg.cpp	(revision 11257)
    +++ code/fred2/shiptexturesdlg.cpp	(working copy)
    @@ -126,7 +126,9 @@
     			if (!stricmp(ii->ship_name, Ships[self_ship].ship_name))
    -				end--;
    +				do {
    +					end--;
    +				} while (end != ii && !stricmp(end->ship_name, Ships[self_ship].ship_name));
     				if (end == ii)
     				texture_set(&(*ii), &(*end));
    @@ -134,7 +136,7 @@
     		if (end != Fred_texture_replacements.end())
    -			Fred_texture_replacements.erase(end);
    +			Fred_texture_replacements.erase(end, Fred_texture_replacements.end());
     		// now put the new entries on the end of the list
     		for (i=0; i<texture_count; i++)
    @@ -217,20 +219,22 @@
     			// make old texture lowercase
    -			// now add it to the box
    -			z = box->AddString(texture_file);
    -			// and add it to the field as well
    +			// add it to the field
     			strcpy_s(old_texture_name[texture_count], texture_file);
     			// increment
    -			// sort
    -			sort_textures();
    +	// now sort the filenames
    +	sort_textures();
    +	// and add them to the box
    +	for (i=0; i<texture_count; i++) {
    +		z = box->AddString(old_texture_name[i]);
    +	}
     	// now look for new textures
     	for (SCP_vector<texture_replace>::iterator ii = Fred_texture_replacements.begin(); ii != Fred_texture_replacements.end(); ++ii)
    patch file icon 1929.patch (2,086 bytes) 2015-02-23 21:58 +

has duplicate 0003145closedMageKing17 Texture replace dialog entries are offset by one 
has duplicate 0002340resolvedGoober5000 Texture replacment with invisible no longer working 



FUBAR-BDHR (developer)

Well this one is a little deeper then I though. Couldn't reproduce with retail data. Also couldn't reproduce with some TBP models. B5 and the EA explorer both exhibit the problem so it is reproducible with more then one model. Both models have both shine and glow maps as well as debris textures.

First pic shows the PCS2 texture order as well as where texture rotation6a is.. Second shows what happened when I tried to replace rotation6a with the asteroid texture. The .fs2 file saved it as:

$Texture Replace:
+old: b5rotation1a-shine
+new: asteroid01a

Which is 3 textures in the sorted FRED list above rotation6a. Interestingly enough there are 3 glow textures in the list. All 3 are above rotation6a in the unsorted list.


FUBAR-BDHR (developer)

Just uploaded another screenshot. The first ship with the Patton name plate was previously the only ship in the mission (besides Alpha 1) and had texture replacement that was fixed in notepad. Loaded the mission and added 4 more Novas. Didn't do anything else but you can see they all have missing textures. Saved the mission and checked it in notepad. It was correct and the texture replacement for the Patton did not change. Other 4 had no texture replacement as they should.


Goober5000 (administrator)

Is this still an issue? I didn't run into any such problems when I was working on 0002340.


FUBAR-BDHR (developer)

Tested 1 part and it still exists. Replaced texture b5rotation6a with asteroid01a just like in the screenshot above. Saved mission. FRED still shows b5rotation6a replaced but in notepad there is this:

$Texture Replace:
+old: b5rotation1a-shine
+new: asteroid01a

I think there are a few factors in reproducing this. First you need a model where the textures aren't in alphabetical order in PCS2. Second you need one that has "missing" maps. By missing I mean things like -glow -shine don't exist for some textures but do for others. So if you have a model with textures a.dds, b.dds, and c.dds where a has -glow, -shine, -normal, b only has -glow, and c only has -glow and -shine you should be able to repo this. I believe there are 2 things happening. First is with the sort order and second is with the routine assuming that all map types (probably all map types used previously on the model) will exist for every map on the model.

I'll see if I can come up with something in retail that can make this happen.


FUBAR-BDHR (developer)

Can't find anything retail but the 3.6.12 mediavp Arcidia can reproduce issues. Just add one to FRED and start replacing textures and looking at the mission in notepad. It seems more random then using b5 so I haven't figured out a single texture that will cause the issue yet.

Also I found another issue where the missing texture warning will pop up for valid textures the second time. I replaced texture cruisertile5 with asteroid01 as a first test. No warning. That didn't trigger the issue so I tried replacing a different texture with asteroid02a which triggered a warning as I assume there is no asteroid02a. I then changed it to asteroid01a and received 2 warnings that asteroid01a doesn't exist which it does.


Goober5000 (administrator)

Okay, well I just tried the mediaVPs Arcadia and the textures appeared exactly as expected.


FUBAR-BDHR (developer)

Alright here is one with that is reproducible every time. Start FRED, drop in Arcadia, texture replace install01-06 with asteroid01a. Save mission. Delete Arcadia. Add Arcadia. Go to texture replacement and look at install01-06. Save mission. Notice that the texture replacement is in the .fs2 file.


FUBAR-BDHR (developer)

Another one. Place Arcadia. Texture replace instal01-06 and install01-07 with asteroid01a. Save mission. Select Arcadia and texture replace install01-01c with asteroid01a. Save mission. Check the .fs2 file and you should see:

$Texture Replace:
+old: install01-01-glow
+new: asteroid01a
+old: install01-06
+new: asteroid01a
+old: install01-07
+new: asteroid01a


Goober5000 (administrator)

I wonder if you have the same Arcadia as I do. The mediaVPs one doesn't have the install01-06 and install01-07 textures; instead it has arcadia_01, etc. And the retail one has install01-06a, etc., not install01-06. (Note the a.)

Anyway, I followed your instructions and the only thing I noticed was that the texture replacements for "GTI Arcadia 1" carried over to the next ship called "GTI Arcadia 1" after I deleted and recreated it. That's because the texture replacement is assigned by name in FRED, and the two ships had the same name. But by the same token, since it was the "same" ship, just deleted and recreated, I'm not convinced it's an actual bug.

As for your second example, that one worked just fine for me, and I didn't see the results you reported.


FUBAR-BDHR (developer)

I am testing on the one from the 3.6.12 mediavps. Testing on retail doesn't work as there are no shine, glow, or normal maps.


Goober5000 (administrator)

Okay, I figured out what my mod problem was. I was able to reproduce both tests.


MageKing17 (developer)

I've attached a patch that should fix the remaining issues (since "invisible" support was re-reported as 2340 and fixed by r9444).


Goober5000 (administrator)

Patch looks reasonable, but I merely did a test merge and skimmed it. What tests did you do to verify that this was fixed?


niffiwan (developer)

On IRC I saw Axem report that this patch fixed the issue in the related ticket (0003145)


MageKing17 (developer)

Apparently that particular patch file got made before I'd compiled it, because it was missing a semicolon that is required for it to compile; I must've forgotten to remake the patch file afterwards. Fixed.


Goober5000 (administrator)

Well I don't think we're going to get any additional opinions. :) If you're satisfied the patch fixes the issues you noticed, then go ahead and commit it.


MageKing17 (developer)

Fix committed to trunk@11274.

+Related Changesets

-Issue History
Date Modified Username Field Change
2009-05-22 04:21 FUBAR-BDHR New Issue
2009-05-25 03:08 FUBAR-BDHR File Added: text_replace1.jpg
2009-05-25 03:09 FUBAR-BDHR File Added: text_replace2.jpg
2009-05-25 03:17 FUBAR-BDHR Note Added: 0010918
2009-05-30 00:55 FUBAR-BDHR File Added: texreplace_prob.jpg
2009-05-30 00:59 FUBAR-BDHR Note Added: 0010920
2012-12-17 03:03 Goober5000 Note Added: 0014500
2012-12-17 03:03 Goober5000 Assigned To => Goober5000
2012-12-17 03:03 Goober5000 Status new => feedback
2012-12-17 14:40 FUBAR-BDHR Note Added: 0014503
2012-12-17 14:40 FUBAR-BDHR Status feedback => assigned
2012-12-17 15:49 FUBAR-BDHR Note Added: 0014504
2012-12-19 02:21 Goober5000 Note Added: 0014540
2012-12-19 22:18 FUBAR-BDHR Note Added: 0014543
2012-12-19 22:30 FUBAR-BDHR Note Added: 0014544
2012-12-19 22:55 Goober5000 Note Added: 0014545
2012-12-19 23:33 FUBAR-BDHR Note Added: 0014549
2012-12-20 02:18 Goober5000 Note Added: 0014553
2015-02-22 17:29 MageKing17 Relationship added has duplicate 0003145
2015-02-22 18:02 MageKing17 File Added: 1929.patch
2015-02-22 18:04 MageKing17 Relationship added has duplicate 0002340
2015-02-22 18:17 MageKing17 Note Added: 0016508
2015-02-22 18:17 MageKing17 Assigned To Goober5000 => MageKing17
2015-02-22 18:17 MageKing17 Status assigned => code review
2015-02-23 00:28 Goober5000 Note Added: 0016512
2015-02-23 03:33 niffiwan Note Added: 0016513
2015-02-23 21:58 MageKing17 File Deleted: 1929.patch
2015-02-23 21:58 MageKing17 File Added: 1929.patch
2015-02-23 21:59 MageKing17 Note Added: 0016514
2015-03-02 01:48 Goober5000 Note Added: 0016522
2015-03-03 21:56 MageKing17 Changeset attached => fs2open trunk r11274
2015-03-03 21:56 MageKing17 Note Added: 0016532
2015-03-03 21:56 MageKing17 Status code review => resolved
2015-03-03 21:56 MageKing17 Resolution open => fixed
+Issue History