Jump to content

Uncooperative models in model nodes


somnambulist

Recommended Posts

I'm running into what might be a bug when trying to swap textures on the Mk1 Pod's internal using model nodes.


@INTERNAL[mk1PodCockpit]
{
MODEL {
model = Squad/Spaces/mk1PodCockpit/model
texture = model000 , aaa/model000
}

Throws the following error


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.LoadInternalSpace (.UrlConfig urlConf) [0x00000] in <filename unknown>:0
at PartLoader+.MoveNext () [0x00000] in <filename unknown>:0
UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
:MoveNext()

This happens when you try to replace *any* texture associated with that mu. It's not the texture or the load order as the same texture loads fine for the Mk 1-2 pod interior. The mu won't let you replace a texture with itself ('texture = model000 , Squad/Spaces/mk1PodCockpit/model000'). It's perfectly content loaded with a model node as long a you leave the textures alone.

Has anyone run across this problem before? Or is there some part loader arcana that I'm missing here?

Link to comment
Share on other sites

I do recall something about Internals being more limited with MODEL support, but nothing specific, sorry. :(

I thought of that too but tried loading the interior as a part model. While the cutaway effect looks *very* cool in the VAB it still won't remap the textures.

I think you need to specify every textures associated with mk1PodCockpit in order for that to work. as you have right now, MODEL{} is only replacing 1 texture on mk1PodCockpit while the MU is asking for 7.

Haven't tried that yet. If that's the case it's weird that internals require every texture to be spec'd for model nodes but part models only require the changed textures.

Worst comes to worst I'll just dump the mu into a new folder and hex edit the texture names. :(

Link to comment
Share on other sites

Edit: I see the problem. I tend to specify all textures when I use MODEL{} so never encountered this issue before.

I changed the Internal cfg with model{} like in your OP. the error occurs,

Edited by nli2work
Link to comment
Share on other sites

I changed the Internal cfg with model{} like in your OP. the error occurs, but the Internal still compiles and game loads as if nothing is wrong. no texture missing in game, no missing internals.

Are you pointing at new textures or the internal's existing textures? (Sorry I'd check myself but am stuck at work on a Saturday.)

Link to comment
Share on other sites

I'm pointing at a texture from a different location

texture = model000, RetroFuture/Textures/rectFuselage_DIF

I get the same error about not able to replace texture at internal compile and internal is broken. (it appeared loading before because it was loading the JSI alternate Internal)

Edited by nli2work
Link to comment
Share on other sites

I'm pointing at a texture from a different location

texture = model000, RetroFuture/Textures/rectFuselage_DIF

I get the same error about not able to replace texture at internal compile; but mk1PodCockpit loads fine in game, correct internal with original textures.

Sounds like it's just failing over to the textures specified in the mu :(

Link to comment
Share on other sites

it's a bit odd though, I think the MU itself may be a little messed up.

I tried specifying all the textures

MODEL{
model = Squad/Spaces/mk1PodCockpit/model
texture = model000, Squad/Parts/Command/probeStackSphere/model000
texture = model001, Squad/Parts/Command/probeStackSphere/model000
texture = model002, Squad/Parts/Command/probeStackSphere/model000
texture = model003, Squad/Parts/Command/probeStackSphere/model000
texture = model004, Squad/Parts/Command/probeStackSphere/model000
texture = model005, Squad/Parts/Command/probeStackSphere/model000
texture = model006, Squad/Parts/Command/probeStackSphere/model000
texture = model007, Squad/Parts/Command/probeStackSphere/model000
}

and I still the same NullRef error as your OP.

I use MODEL{} for pretty much everything, except some small props. don't recall running into this issue with any Internals I made so far.

Edited by nli2work
Link to comment
Share on other sites

  • 3 weeks later...
I'm running into what might be a bug when trying to swap textures on the Mk1 Pod's internal using model nodes.


@INTERNAL[mk1PodCockpit]
{
MODEL {
model = Squad/Spaces/mk1PodCockpit/model
texture = model000 , aaa/model000
}

Throws the following error


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.LoadInternalSpace (.UrlConfig urlConf) [0x00000] in <filename unknown>:0
at PartLoader+.MoveNext () [0x00000] in <filename unknown>:0
UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
:MoveNext()

This happens when you try to replace *any* texture associated with that mu. It's not the texture or the load order as the same texture loads fine for the Mk 1-2 pod interior. The mu won't let you replace a texture with itself ('texture = model000 , Squad/Spaces/mk1PodCockpit/model000'). It's perfectly content loaded with a model node as long a you leave the textures alone.

Has anyone run across this problem before? Or is there some part loader arcana that I'm missing here?

I have done this before, experimentally as a proof of concept (because someone was saying it couldn't be done) and did successfully replace the Mk1 internal texture with something else. I think I used the same syntax you're trying there but I dont have that file anymore so can't double check. Maybe this is a new error in 0.25....

Link to comment
Share on other sites

I have done this before, experimentally as a proof of concept (because someone was saying it couldn't be done) and did successfully replace the Mk1 internal texture with something else. I think I used the same syntax you're trying there but I dont have that file anymore so can't double check. Maybe this is a new error in 0.25....

I honestly gave up on it -- it simply refused to work no matter the load order, texture format, etc. Hitchiker interior behaves the same way. :P

Link to comment
Share on other sites

  • 4 months later...

I'll throw in my two cents on how I was able to fix this issue for myself.

I was trying to make it so that KSP didn't have to load a texture that I made for multiple models multiple times.

First of all, the part I was having trouble with had two materials:

Material: One with the texture I didn't want to need to reload (ModelTexture)

Variable: One without an assigned texture because the texture is just replaced in game anyways with a custom PartModule.

Here is the MODEL node I had for the part:

MODEL{
model = ModelRocketry/Parts/Structural/ModelTubeSmall/NewModel
position = 0.0, 0.0, 0.0
scale = 1.0, 1.0, 1.0
rotation = 0, 0, 0
texture = ModelTexture , ModelRocketry/Parts/Aero/ModelFin/ModelTexture
}

With just this I was getting that annoying null reference error.

How I was able to fix this is giving the Variable material its own texture (just a small 1 x 1 white texture). I didn't actually need to put a "texture =" for both of the textures and it compiled without any problems in KSP.

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...