• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
I've attached an image of what happens whenever I enable a mod (green graphics on portraits). Does anyone know why this might be happening?

I also see entries in the log file such as:

016-10-07 14:38:17,862 ERROR PortraitReader - Could not parse portraitType in file C:\Users\Jeff\Documents\Paradox Interactive\Crusader Kings II\mod\\Historical Immersion Project\interface\portraits\portraits_siberian.gfx
System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at PortraitBuilder.Parser.PortraitReader.ParseLayer(ASTNode node, String filename) in c:\Users\Romain\git\PortraitBuilder\PortraitBuilder\Parser\PortraitReader.cs:line 268
at PortraitBuilder.Parser.PortraitReader.ParseLayers(ASTNode node, String filename) in c:\Users\Romain\git\PortraitBuilder\PortraitBuilder\Parser\PortraitReader.cs:line 255
at PortraitBuilder.Parser.PortraitReader.ParsePortraitType(ASTNode node, String filename) in c:\Users\Romain\git\PortraitBuilder\PortraitBuilder\Parser\PortraitReader.cs:line 185
at PortraitBuilder.Parser.PortraitReader.ParsePortraits(ASTNode node, String filename, PortraitData data) in c:\Users\Romain\git\PortraitBuilder\PortraitBuilder\Parser\PortraitReader.cs:line 134

What's interesting is that enabling the mod adds the new cultures to the dropdown but, as in this example, only the male Siberians appear and not the females, even though they are both part of portraits.siberian.gfx.

For the green bars it may be an issue with the DDS image lib, but I can't reproduce on Windows 10.
- Which version of Windows do you use ?
- Did you have the same issue with Portrait Builder 2.1.0, which was using a different lib ?
- Could you send me the full log.txt in PM ?

About portraits_siberian.gfx there's some unexpected syntax in female portraitTypes like:
Code:
"GFX_ugric_female_cheeks:o-1x0:d4"
is expected to be:
Code:
"GFX_ugric_female_cheeks:d4:o-1x0"
Can you confirm that the first version works in game, and should be supported as well ?
 
For the green bars it may be an issue with the DDS image lib, but I can't reproduce on Windows 10.
- Which version of Windows do you use ?

I'm using Windows 7.

- Did you have the same issue with Portrait Builder 2.1.0, which was using a different lib ?

I only discovered the tool with 2.3 but I will try 2.1 and see what happens.

- Could you send me the full log.txt in PM ?

Absolutely. I will forward it.

About portraits_siberian.gfx there's some unexpected syntax in female portraitTypes like:
Code:
"GFX_ugric_female_cheeks:o-1x0:d4"
is expected to be:
Code:
"GFX_ugric_female_cheeks:d4:o-1x0"
Can you confirm that the first version works in game, and should be supported as well ?

I'm attaching a screen shot of a character that is using the Siberian culture. According to the Portrait Builder the cheeks value is #8 on the list from 0-9, so I'm assuming that this means it's the ninth in the mod's DDS file. Is that correct? It looks very accurate to what I'm seeing in the modded game and the attached image.

Thanks for taking a look at this!
 

Attachments

  • Capture07OCT16a.PNG
    Capture07OCT16a.PNG
    72,4 KB · Views: 49
For the green bars it may be an issue with the DDS image lib, but I can't reproduce on Windows 10.
- Which version of Windows do you use ?
- Did you have the same issue with Portrait Builder 2.1.0, which was using a different lib ?

I don't get the green bars when enabling the mod in 2.1.0, but I also do not get the extra cultures from the mod added to the utility. I don't know if that makes a difference.
 
@Finarfin Thanks, I've reported some errors in CPRPlus thread. I'll make the parsing a bit more robust / better error reporting in next PortraitBuilder version, in particular the portraits_siberian.gfx order thing.

About the green bars, 2.1.0 doesn't help because of the errors causing the mod data to be ignored.
However in the logs there are errors about rendering layer GFX_byzantine_male_eyes2:eyes (d6). The corresponding vanilla sprite is gfx\\characters\\western_male\\western_male_eyes2.dds
I think it's somehow corrupted because it's not opening well with DDS viewers (or its format is different from the others).
Can you try renaming/remove the .dds, to see if it's the cause of the green bars ?
 
@Finarfin
However in the logs there are errors about rendering layer GFX_byzantine_male_eyes2:eyes (d6). The corresponding vanilla sprite is gfx\\characters\\western_male\\western_male_eyes2.dds
I think it's somehow corrupted because it's not opening well with DDS viewers (or its format is different from the others).
Can you try renaming/remove the .dds, to see if it's the cause of the green bars ?

@Romulien, I don't know if this makes any difference but I can successfully open byzantine_male_eyes_2.dds from location C:\Users\Jeff\Documents\Paradox Interactive\Crusader Kings II\mod\Historical Immersion Project\gfx\characters\byzantine_male in Paint.NET. Removing that file did not remove the green lines in PB 2.3. Or was it the vanilla file that you wanted me to remove? I wish I had C# skills so I could help you with this!
 
I've attached an image of what happens whenever I enable a mod (green graphics on portraits). Does anyone know why this might be happening?

I also see entries in the log file such as:

016-10-07 14:38:17,862 ERROR PortraitReader - Could not parse portraitType in file C:\Users\Jeff\Documents\Paradox Interactive\Crusader Kings II\mod\\Historical Immersion Project\interface\portraits\portraits_siberian.gfx
System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at PortraitBuilder.Parser.PortraitReader.ParseLayer(ASTNode node, String filename) in c:\Users\Romain\git\PortraitBuilder\PortraitBuilder\Parser\PortraitReader.cs:line 268
at PortraitBuilder.Parser.PortraitReader.ParseLayers(ASTNode node, String filename) in c:\Users\Romain\git\PortraitBuilder\PortraitBuilder\Parser\PortraitReader.cs:line 255
at PortraitBuilder.Parser.PortraitReader.ParsePortraitType(ASTNode node, String filename) in c:\Users\Romain\git\PortraitBuilder\PortraitBuilder\Parser\PortraitReader.cs:line 185
at PortraitBuilder.Parser.PortraitReader.ParsePortraits(ASTNode node, String filename, PortraitData data) in c:\Users\Romain\git\PortraitBuilder\PortraitBuilder\Parser\PortraitReader.cs:line 134

What's interesting is that enabling the mod adds the new cultures to the dropdown but, as in this example, only the male Siberians appear and not the females, even though they are both part of portraits.siberian.gfx.

I had a similar issue, not exactly the same, but similar. I found that you need to match the culture you use for the portrait and the culture in the save file found for the character.. So, you need to change one or the other so that they do match. Keep in mind if you do change the character's culture in your save file, you might change other things within the game. I'm not really aware of what it could be (I'm new to CK2, not new to modding).
There is one other issue that I haven't had the time to look into. You might have other conflicting things. Check through the portrait_properties.txt. If none of this helps, then you will need to contact the author of the Historical Immersion Projects.
 
I had a similar issue, not exactly the same, but similar. I found that you need to match the culture you use for the portrait and the culture in the save file found for the character.. So, you need to change one or the other so that they do match. Keep in mind if you do change the character's culture in your save file, you might change other things within the game. I'm not really aware of what it could be (I'm new to CK2, not new to modding).
There is one other issue that I haven't had the time to look into. You might have other conflicting things. Check through the portrait_properties.txt. If none of this helps, then you will need to contact the author of the Historical Immersion Projects.

The latest version of this tool allows you to check which mods you are using and it incorporates any custom cultures, graphic assets, etc. that might be used. However, when you choose to do so you get the green lines in the portraits. You could change a character's culture in the save file and use one of the non-mod cultures in this tool, but you are right in that you then are changing that game character completely.
 
@Romulien I'm using 2.3.0, and for some reason, eye colors are not showing up properly in the preview for most portraits gfx (westerngfx, norsegfx). The blonde/brown/blue eye colors are only appearing properly for certain DLC gfx like celticgfx, easternslavicgfx, and ugricgfx. Is something amiss?
 
@Romulien I'm using 2.3.0, and for some reason, eye colors are not showing up properly in the preview for most portraits gfx (westerngfx, norsegfx). The blonde/brown/blue eye colors are only appearing properly for certain DLC gfx like celticgfx, easternslavicgfx, and ugricgfx. Is something amiss?

Yes ! There's always been an error in PortraitBuilder when rendering \common\Crusader Kings II\gfx\characters\western_male\western_male_eyes2.dds
I have no clue what's happening with this sprite, and the exception message is not very talkative...
2016-12-01 23:20:45,935 ERROR PortraitRenderer - Could not render layer GFX_western_male_eyes2:eyes (d6) from C:\Program Files (x86)\Steam\SteamApps\common\Crusader Kings II\\\interface\portraits\portraits.gfx
System.ArgumentException: Le paramètre n'est pas valide.
à System.Drawing.Bitmap.LockBits(Rectangle rect, ImageLockMode flags, PixelFormat format, BitmapData bitmapData)
à System.Drawing.Bitmap.LockBits(Rectangle rect, ImageLockMode flags, PixelFormat format)
à PortraitBuilder.Engine.PortraitRenderer.DrawEye(Bitmap source, Colour eyeColour)
à PortraitBuilder.Engine.PortraitRenderer.DrawTile(Portrait portrait, Graphics g, Sprite sprite, Layer layer, Int32 tileIndex)
à PortraitBuilder.Engine.PortraitRenderer.DrawLayer(Layer layer, Graphics g, Portrait portrait, List`1 activeContents, Dictionary`2 sprites)
 
  • 1
Reactions:
2.4.0
PortraitBuilder 2.4.0 is now released (see the first post for download and installation instructions).

It brings support for the new societies clothing override mechanism, and some bugfixes !

Changelog:
Version 2.4.0 - 2017-04-07

- Support for clothing propertyType override, replacing sprites used by culture-indexed layers (c0->c5)
- Support for a variable number of properties, with dynamic creation of characteristic comboboxes in the UI
- Improve error reporting when parsing portraits.gfx when parsing string into integer or byte
- Allow non-ordered flags in propertyType layers
- Fix randomization that was never using the last frame
- Solve some eye-related rendering issues caused by attempting to read pixels outside of the width/height of the source image

PortraitBuilder-2.4.0.jpg



@Romulien I'm using 2.3.0, and for some reason, eye colors are not showing up properly in the preview for most portraits gfx (westerngfx, norsegfx). The blonde/brown/blue eye colors are only appearing properly for certain DLC gfx like celticgfx, easternslavicgfx, and ugricgfx. Is something amiss?

This is now fixed !

The latest version of this tool allows you to check which mods you are using and it incorporates any custom cultures, graphic assets, etc. that might be used. However, when you choose to do so you get the green lines in the portraits.

Could you please check if things have improved on Win7 with this new version ? It may have had the same cause as the eye colors frame issue (at least I hope) !
 
Hey mate, this seems useful, but I tried loading CPRplus using the method on the first page but can't get it to work. My mods pane in the program is empty. Can you toss in a step-by-step?

In the log it says:

Loader - Loading mods from C:\Users\XXXX\Documents\Paradox Interactive\Crusader Kings II\mod\

but it it doesn't actually load anything.
 
Last edited:
Hey mate, this seems useful, but I tried loading CPRplus using the method on the first page but can't get it to work. My mods pane in the program is empty. Can you toss in a step-by-step?

In the log it says:

Loader - Loading mods from C:\Users\XXXX\Documents\Paradox Interactive\Crusader Kings II\mod\

but it it doesn't actually load anything.

The thing is it should work out of the box :/ Note that it doesn't support overriding the user mod folder location via userdir.txt in Steam directory, it'll look for the standard folder ~\Documents\Paradox Interactive\Crusader Kings II\mod\ where there are the .mod files and associated mod data folders.

Maybe there's a special character in XXXX that is causing trouble - could you send me the full log.txt via PM ?
 
Last edited:
It would be great to have the ability to combine portrait gfx's into one distinct gfx.
 
Hey there, I have a question. I'm using this tool for troubleshooting my new portrait sets, and I've run into the problem that two of my most recent ones won't show up in Portrait Builder. Any ideas what could be the problem? They work perfectly fine in game.
 
Hey there, I have a question. I'm using this tool for troubleshooting my new portrait sets, and I've run into the problem that two of my most recent ones won't show up in Portrait Builder. Any ideas what could be the problem? They work perfectly fine in game.

Could you check for some errors in the log.txt next to the .exe (by searching for your mod/file names) and copy them here ?
That's maybe something unexpected when parsing the .gfx files, that the game silently ignores.
 
Could you check for some errors in the log.txt next to the .exe (by searching for your mod/file names) and copy them here ?
That's maybe something unexpected when parsing the .gfx files, that the game silently ignores.
Code:
2017-03-28 02:31:22,401 FATAL Program - Unhandled UI thread exception
System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei PortraitBuilder.Model.Portrait.Portrait.SetPortraitType(PortraitType portraitType) in c:\Users\Romain\git\PortraitBuilder\PortraitBuilder\Model\Portrait\Portrait.cs:Zeile 98.
   bei PortraitBuilder.UI.PortraitBuilderForm.onChangePortraitType(Object sender, EventArgs e) in c:\Users\Romain\git\PortraitBuilder\PortraitBuilder\UI\PortraitBuilderForm.cs:Zeile 573.
   bei System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
   bei System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
   bei System.Windows.Forms.ComboBox.WndProc(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
2017-03-28 02:31:34,102 INFO  Program - Closing application
Those are the last few lines of the log.txt file and as far as I can tell what happened when I tried to open one of these two portrait sets.

Edit: Sorry, just realised it's in German... I don't think I can translate it properly...