Jump to content

[SOLVED] texture tag not working in MODEL section


Recommended Posts

I'm trying to be clever with asset use (trying to be clever is how most issues start).  

I have a set of parts that all use the same mesh, and mostly the same texture, so I'm trying to use all the same model, except for different versions, apply a different transparent texture as a label.  This should be stock behaviour when using the MODEL{model=, texture=} mesh references.  And for the life of me, I cannot spot why it's not working for me.

Example part snippet;

PART
{
    name = USAFOrionMag012kt920kN
    module = OrionMagazine
    author = WinchellChung
 
MODEL
{
    model = USAFOrionTD/Parts/Orion/Magazines/USAFStackable/Magazine
    scale = 1.0,1.0,1.0
    texture = baselabel, USAFOrionTD/Parts/Orion/Magazines/Labels/r1ktlabels
}

The intention being that I change the texture = line to point at a new label for each new edition of the part.  So far I'm just messing with two of them.

Dir listings;

 Directory of G:\NothaSteam\Kerbal Space Program\GameData\USAFOrionTD\Parts\Orion\Magazines\USAFStackable

2017-03-18  11:33 AM    <DIR>          .
2017-03-18  11:33 AM    <DIR>          ..
2017-03-18  11:33 AM            16,512 baselabel.dds
2017-03-18  11:30 AM            42,598 Magazine.mu
2017-03-18  11:15 AM         1,398,256 NewMagazine.dds
2017-03-18  11:15 AM         1,398,256 NewMagazineNRML_NRM.dds
2017-03-18  11:41 AM             5,466 part.cfg
               5 File(s)      2,861,088 bytes
               2 Dir(s)  447,172,456,448 bytes free

 Directory of G:\NothaSteam\Kerbal Space Program\GameData\USAFOrionTD\Parts\Orion\Magazines\Labels

2017-03-18  11:46 AM    <DIR>          .
2017-03-18  11:46 AM    <DIR>          ..
2017-03-18  11:46 AM            87,486 r09ktlabels.tga
2017-03-18  10:55 AM            87,568 r1ktlabels.dds
               2 File(s)        175,054 bytes
               2 Dir(s)  447,172,456,448 bytes free

I've copy/pasted the paths, switching \ for /, copy pasted file names without extensions.  I've moved the replacement textures to a different folder, converted their names to all lower-case, starting with a letter, tried square textures (it started as 512x128), tried dds vs tga vs png.  If the place-holder texture is dds, game loads, no errors in the output_log.  But the part just has a blank texture where the replacement should be;

jAVPQnD.png

If the placeholder isn't dds, then I get errors about null references;
 

PartLoader: Compiling Part 'USAFOrionTD/Parts/Orion/Magazines/USAFStackable/part/USAFOrionMag012kt920kN'
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

PartLoader: Encountered exception during compilation. System.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, .AvailablePart partInfo) [0x00000] in <filename unknown>:0 
  at PartLoader.ParsePart (.UrlConfig urlConfig, .ConfigNode node) [0x00000] in <filename unknown>:0 
  at PartLoader+<CompileParts>c__Iterator65.MoveNext () [0x00000] in <filename unknown>:0 
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

PartCompiler: Cannot compile part

And the part doesn't load (Cannot compile part seems fairly clear on that).  

If I skip the texture = (or comment it out) then the part loads with the placeholder texture.  

If I apply one of the label textures in unity and compile the mu that way, it also loads fine.  Or just substitute the placeholder with one of the actual textures, it also loads fine.

So, what I know is it's definitely reading the texture = line, and doing something with the named texture.  That bit is working.  It just never seems to find the replacement texture.  Which suggests there's something wrong in the paths.  But I've checked that so many times I can't see there being any typos or what have you there.

I'm at the "try stupid things" stage.

One thing I do like to do for sticky issues, is write a big long post about the issue so I have to get it clear in my head, on the hope that the process of explaining it, solves the issue.  And so far that hasn't helped, except I ran a few extra tests to get the post more complete, but with no greater success than my other attempts.

So, gonna step away from the 'puter for a bit.  Clean my head with a wee bit of dilute WWII German rocket fuel, and come back to this later.

Edited by TiktaalikDreaming
Link to comment
Share on other sites

Hiya, I have to say your experience of the texture tag is  very similar to mine, whatever I tried it simply refused to find the texture, I tried as you have literally everything I and anyone one else who had a clue could think of and it never worked for me, admittedly I've not retried for a long time,,  "know when you're beat" :)  I'll take another look and see if it works now

Link to comment
Share on other sites

23 minutes ago, SpannerMonkey(smce) said:

Hiya, I have to say your experience of the texture tag is  very similar to mine, whatever I tried it simply refused to find the texture, I tried as you have literally everything I and anyone one else who had a clue could think of and it never worked for me, admittedly I've not retried for a long time,,  "know when you're beat" :)  I'll take another look and see if it works now

Thanks, that makes me feel less deranged.  :confused:  I found some old threads on this you'd commented on, and wondered if you ever got it working.

I have plenty mods using this, and copying their config with the names changed to protect the innocent got me no-where as well.  I feel it's something simple that I just can't see because I'm too close to it.  This query is pretty much me giving up trying everything I can think of.  Because I've got through everything I can think of.  It's still cycling through my head, but I'm not going to waste lots of time trying things I've already tried.

I know when I'm beat (for now).  :(

 

Link to comment
Share on other sites

2 hours ago, TiktaalikDreaming said:

Thanks, that makes me feel less deranged.  :confused:  I found some old threads on this you'd commented on, and wondered if you ever got it working.

I have plenty mods using this, and copying their config with the names changed to protect the innocent got me no-where as well.  I feel it's something simple that I just can't see because I'm too close to it.  This query is pretty much me giving up trying everything I can think of.  Because I've got through everything I can think of.  It's still cycling through my head, but I'm not going to waste lots of time trying things I've already tried.

I know when I'm beat (for now).  :(

 

would it be like this

Spoiler

PART
{
    name = USAFOrionMag012kt920kN
    module = Part   //OrionMagazine
    author = WinchellChung
 
MODEL
{
    model = USAFOrionTD/Parts/Orion/Magazines/USAFStackable/Magazine      // not sure how OrionMagazine fits in here ?
    scale = 1.0,1.0,1.0
    texture = baselabel, USAFOrionTD/Parts/Orion/Magazines/Labels/r1ktlabels
}

Are you using 1.2.2 ?  

And sounds like you are trying something like Ven  with VenStockRevamp  you might take a look at how he is changing models and textures

 

EDIT - again and some mods that change model and textures in VAB are using a plugin one of ASET rover mods used it and KermangeddonIndustries

 

Think it was JSIPartUtilities  but it needs fixed but think

 

 

Edited by Mecripp2
Side note
Link to comment
Share on other sites

1 hour ago, MeCripp said:

would it be like this

  Hide contents


PART
{
    name = USAFOrionMag012kt920kN
    module = Part   //OrionMagazine
    author = WinchellChung
 
MODEL
{
    model = USAFOrionTD/Parts/Orion/Magazines/USAFStackable/Magazine      // not sure how OrionMagazine fits in here ?
    scale = 1.0,1.0,1.0
    texture = baselabel, USAFOrionTD/Parts/Orion/Magazines/Labels/r1ktlabels
}

Are you using 1.2.2 ?  

And sounds like you are trying something like Ven  with VenStockRevamp  you might take a look at how he is changing models and textures

 

EDIT - again and some mods that change model and textures in VAB are using a plugin one of ASET rover mods used it and KermangeddonIndustries

 

Think it was JSIPartUtilities  but it needs fixed but think

 

 

Not aiming at changing the textures in the VAB. Just setting the texture for the part. I know I'd  need a module (usually firespitter of b9) to have it switchable. 

Link to comment
Share on other sites

@MeCripp you do make a good point about the PART module though.  When I spotted what you meant there (read it on mobile and just didn't read it properly) I had sudden high hopes.  That config has been like that forever.  Presumably that was a 0.25- style config style or something.  But it's been working, and I never even noticed until you pointed it out.  I fixed it up (the MODEL section with model= and texture= etc is a "recent" config thing after all) and got exactly the same behaviour as before.  :-(

But, I will fix up the part configs.  Because there's a reasonable chance the answer is this PLUS something else.

eg;

PART
{
    name = USAFOrionMag012kt920kN
    module = Part
    author = WinchellChung
 
    MODEL
    {
        model = USAFOrionTD/Parts/Orion/Magazines/USAFStackable/Magazine
        scale = 1.0,1.0,1.0
        texture = baselabel, USAFOrionTD/Labels/r1ktlabels
    }
   ------ USUAL PART VARIABLES -----

   MODULE
   {

        name = OrionMagazine

------etc -----

 

PS: Your spoiler section has eaten the rest of your post.  I find all sorts of craziness goes on with quotes/spoilers/code section when using mobile, so presumably some browsers hate it.

Edited by TiktaalikDreaming
Link to comment
Share on other sites

56 minutes ago, blowfish said:

Did you ensure that the texture is loading correctly?  In the log you should see a line like


Load(Texture): USAFOrionTD/Labels/r1ktlabels

 

Yep, all the textures load in, even the ones not in use...

but...

My placeholder is misbehaving.  Which is odd, seeing as when I comment out the texture line, it shows just fine;

Texture load error in 'C:\Steam\steamapps\common\Kerbal Space Program\GameData\USAFOrionTD\Parts\Orion\Magazines\USAFStackable\baselabel.dds'
 

I'll see what I can do to tidy that up.

Link to comment
Share on other sites

OK, fixed that error, now I'm back to the parts not loading, and popping out the following error during part loading (no errors now on texture or model loading);

PartLoader: Encountered exception during compilation. System.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, .AvailablePart partInfo) [0x00000] in <filename unknown>:0 
  at PartLoader.ParsePart (.UrlConfig urlConfig, .ConfigNode node) [0x00000] in <filename unknown>:0 
  at PartLoader+<CompileParts>c__Iterator65.MoveNext () [0x00000] in <filename unknown>:0 

Going to try a blank placeholder

 

Link to comment
Share on other sites

Looks like I have a choice of "Texture load error" on the placeholder, or "exception during compilation" on PartLoader.

The part loads when it can't load the placeholder because it seems to skip trying to replace textures due to missing the texture it would replace;

PartCompiler: Cannot replace texture as cannot find texture 'baselabel' to replace

I'm going to try weird silly ideas next.

Link to comment
Share on other sites

I've seen the NullRef in ReplaceTextures before when the main texture on the flag transform renderer material wasn't set to anything (ex: mk1pod). Any unset material texture on any renderer in the part would theoretically [haven't tested it, but logically] cause that method to throw if you attempted to replace any of the part's textures, unwinding all the way back to PartLoader and causing the part to fail to compile.

If you have a zip of this particular part somewhere, it would be helpful to track down whatever the problem is if it isn't the unset texture thing

Link to comment
Share on other sites

7 hours ago, xEvilReeperx said:

I've seen the NullRef in ReplaceTextures before when the main texture on the flag transform renderer material wasn't set to anything (ex: mk1pod). Any unset material texture on any renderer in the part would theoretically [haven't tested it, but logically] cause that method to throw if you attempted to replace any of the part's textures, unwinding all the way back to PartLoader and causing the part to fail to compile.

If you have a zip of this particular part somewhere, it would be helpful to track down whatever the problem is if it isn't the unset texture thing

Um... Like a flag  transform? I'll have to try switching it. I'm not at my pc for about twelve hours, but I'll check then. 

And pack up an example. 

Link to comment
Share on other sites

19 hours ago, xEvilReeperx said:

I've seen the NullRef in ReplaceTextures before when the main texture on the flag transform renderer material wasn't set to anything (ex: mk1pod). Any unset material texture on any renderer in the part would theoretically [haven't tested it, but logically] cause that method to throw if you attempted to replace any of the part's textures, unwinding all the way back to PartLoader and causing the part to fail to compile.

If you have a zip of this particular part somewhere, it would be helpful to track down whatever the problem is if it isn't the unset texture thing

You sir, get the cake (or cigar if you prefer that colloquialism).

Added a copy of the same 32x32 transparent image I'd been using as a placeholder to the flag transform, and it all works just fine.

R4ApQ9Y.png

If I hadn't thought "hey, I could add a little flag to these and partly ruin people's frame rate" then I wouldn't have gone through this rather frustrating, but educational experience.

So, that's an image assigned to the flag transform in unity and exported with the model, even though it too gets overwritten.

SOLVED!

PS: the items are different sizes because one thing I was testing was messing with the various scale options.

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