Jump to content

model{} pretty random if it works or not?


K3-Chris

Recommended Posts

I can't find any good documentation on it, but even so I'm pretty sure I'm doing it right, and, it's not working most of the time.

Log:


PartLoader: Compiling Part 'B9_Aerospace/Parts/Cockpit_MK1/part/B9_Cockpit_MK1'

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

NullReferenceException: Object reference not set to an instance of an object
at PartLoader.ReplaceTextures (UnityEngine.GameObject model, System.Collections.Generic.List`1 textureNames, System.Collections.Generic.List`1 newTextures) [0x00000] in <filename unknown>:0

at PartLoader.CompileModel (.UrlConfig cfg, .ConfigNode partCfg, Single scaleFactor) [0x00000] in <filename unknown>:0

at PartLoader.ParsePart (.UrlConfig urlConfig, .ConfigNode node) [0x00000] in <filename unknown>:0

at PartLoader+
.MoveNext () [0x00000] in <filename unknown>:0

(Filename: Line: -1)

relevant part of .cfg:


MODEL
{
model = B9_Aerospace/Parts/Cockpit_MK1/model
texture = model_cockpit_mk2 , B9_Aerospace/Parts/Cockpit_MK2/model_cockpit_mk2
texture = model_cockpit_mk2_emissive , B9_Aerospace/Parts/Cockpit_MK2/model_cockpit_mk2_emissive
}

The paths are correct, the filenames are correct both sides the , the model works, I get a white part if the game loads which it does if I don't have the textures unity puts in the folder, if they're there game crashes on loading the part.

I don't get it, and I'm not sure how much longer I want to bash my skull against this brick wall. This isn't the first time I've had completely unexplained to me failure of MODEL{texture}

Link to comment
Share on other sites

there's a texture name mismatch somewhere. check extention case and file name case. dummy textures need to named same as the texture the MU is referring to. I get this pretty often because I have dozens of models referring to single set of textures, and always fixed when I made sure the texture names matched up 100%

Link to comment
Share on other sites

is the model line referring to the correct model? I use MODEL{} for just about everything: Props, IVA, Externals, and with textures I didn't create. every time there was a problem it was a mistake I made.

Edited by nli2work
Link to comment
Share on other sites

I've found that at times I had to put "dummy" textures in the same file as the model. A 1x1 pixel works, I'm not sure why it seems to need this but it does usually work when I have issues. Something to try at least :)

Edit: This is of course if you're not keeping the models and textures all in one file like Kerbin Shuttle Orbiter does.

Link to comment
Share on other sites

relevant part of .cfg:


MODEL
{
model = B9_Aerospace/Parts/Cockpit_MK1/model
texture = model_cockpit_mk2 , B9_Aerospace/Parts/Cockpit_MK2/model_cockpit_mk2
texture = model_cockpit_mk2_emissive , B9_Aerospace/Parts/Cockpit_MK2/model_cockpit_mk2_emissive
}

Stupid question, maybe, but are the spaces before the comma present in the CFG? I recall seeing something like that happen in one of the reskins I did locally, and I am pretty sure it's because I had spaces before the comma / after the first texture name.

Link to comment
Share on other sites

... No, I obviously put in the wrong model expecting it to work.

Seriously, or are you messing with us? I have experienced a few limited cases of this model reference not working, but it's been a long time since that happened last. I did notice something however... the textures you are trying to replace have the same name as the textures you are trying to replace them with. however, the model you are referencing is a MK1 model, and the textures you are replacing are named as if the MK1 model was referencing MK2 textures originally. My thought would be that the model was originally trying to use MK1 textures, and thus those are the texture names which should be in the first part of the "texture =" line. I'm too lazy right now to check this out myself, but that's my only bit of advice right now.

Stupid question, maybe, but are the spaces before the comma present in the CFG? I recall seeing something like that happen in one of the reskins I did locally, and I am pretty sure it's because I had spaces before the comma / after the first texture name.

That actually isn't an issue as far as I am aware, and from my own experience of taking un-optimized mods I have downloaded and giving them common-texture swaps to help my memory load.

Edited by Gaalidas
Link to comment
Share on other sites

I've found that at times I had to put "dummy" textures in the same file as the model. A 1x1 pixel works, I'm not sure why it seems to need this but it does usually work when I have issues. Something to try at least :)

Yeah, this is what I had to do; very occasionally it still doesn't work, then I use a 5x5 and that seems to solve it.

Link to comment
Share on other sites

I'm giving up, this makes no sense what so ever:


MODEL
{
model = B9_Aerospace/Parts/Cockpit_MK1/model
texture = model_cockpit_mk2, B9_Aerospace/Parts/Cockpit_MK2/model_cockpit_mk2
texture = model_cockpit_mk2_emissive, B9_Aerospace/Parts/Cockpit_MK2/model_cockpit_mk2_emissive
}

If I have that in the .cfg I get a nullref that stops KSP from loading, remove it and replace with model = model.mu and copy the textures over from the mk2 folder and tada, it loads.

I have dummy files, or even the proper files, the paths and names are copied from the system, they can't have typos, they exist, KSP still does this:


PartLoader: Compiling Part 'B9_Aerospace/Parts/Cockpit_MK1/part/B9_Cockpit_MK1'

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

NullReferenceException: Object reference not set to an instance of an object
at PartLoader.ReplaceTextures (UnityEngine.GameObject model, System.Collections.Generic.List`1 textureNames, System.Collections.Generic.List`1 newTextures) [0x00000] in <filename unknown>:0

at PartLoader.CompileModel (.UrlConfig cfg, .ConfigNode partCfg, Single scaleFactor) [0x00000] in <filename unknown>:0

at PartLoader.ParsePart (.UrlConfig urlConfig, .ConfigNode node) [0x00000] in <filename unknown>:0

at PartLoader+
.MoveNext () [0x00000] in <filename unknown>:0

(Filename: Line: -1)

Edited by K3|Chris
Link to comment
Share on other sites

*facedesk* really? REALLY? :mad: that would be an excellent explanation for the problem, all textures I've ever had problems with had _s in them because that's how B9 textures are named, oh god, so many hours and so much cranium lost to that brick wall...

Link to comment
Share on other sites

I don't think underscore is the problem. FS docs says it only matters if the MU name has underscore. I use underscore in texture names and never had this issue.

My MODEL{} blocks look like this

MODEL
{
model = NohArksPnP/Parts/Engines/jeyTew/jeyTew
texture = UHB_props_DIF, NohArksPnP/Parts/Engines/noseMountUHB/UHB_props_DIF
texture = UHB_props_EMI, NohArksPnP/Parts/Engines/noseMountUHB/UHB_props_EMI
texture = UHB_props_NRM, NohArksPnP/Parts/Engines/noseMountUHB/UHB_props_NRM
texture = rectFuselage_NRM, NohArksPnP/Parts/rectFuel/rectFuselage_NRM
texture = rectFuselage_DIF, NohArksPnP/Parts/rectFuel/rectFuselage_DIF
texture = rotorDisc, NohArksPnP/Parts/Engines/noseMountUHB/rotorDisc
}

is there a flag transform? does it have a dummy texture assigned?

Edited by nli2work
Link to comment
Share on other sites

Actually, I'm a bit worried that this is more serious than we're all seeing here. If he's getting nullrefs from a model not finding its textures, then there's more going on here than a problematic configuration. Usually if a model cannot find a texture, the game simply doesn't use that texture and instead displays the white layer for whatever use that texture was intended for. For a diffuse, that means a while model... for a normal that would simply mean a non-functioning normal map. In the most extreme case, the part will simply not compile properly and the part will be absent from the list. Critical errors do not occur for this kind of configuration issue.

As to the underscores, I have not experienced any issues with textures containing them.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...