Modded Leafless Tree Images not Loading [SOLVED]

Started by Pajama Zach, November 14, 2016, 12:19:46 AM

Previous topic - Next topic

Pajama Zach

I've been spending the past couple hours trying to figure this out, but can't quite get there.



I found this old post that seemed to have the same issue but the fix - Which was as simple as creating a folder for the leafless plants - Doesn't seem to work. I downloaded the most recent version of the mod and it doesn't have the same errors. Adding a new option (Such as "C") creates a new line, so it's detecting the textures but I'm still getting this strange error. Removing the leafless textures gives the error of "no textures found at path". Using the base game textures works but I'd much rather have my own textures in place.

Here's the relevant code for one of the plants:

    <plant>
      <leaflessGraphicPath>Things/Plant/Trees/TreeRocket_Leafless</leaflessGraphicPath>
      <growDays>60</growDays>
      <harvestWork>2000</harvestWork>
  <harvestMinGrowth>0.75</harvestMinGrowth>
  <harvestedThingDef>SyntheticFuel</harvestedThingDef>
      <harvestYield>100</harvestYield>
  <sowMinSkill>14</sowMinSkill>
      <visualSizeRange>
        <min>0.6</min>
        <max>3</max>
      </visualSizeRange>
  <wildClusterSizeRange>
        <min>4</min>
        <max>20</max>
      </wildClusterSizeRange>
      <wildClusterRadius>6</wildClusterRadius>
  <sowResearchPrerequisites>
        <li>GeneticPlants</li>
      </sowResearchPrerequisites>
    </plant>


TreeRocket_Leafless is a folder with the options for the game to pull from inside, so my file path is as follows: Things/Plant/Trees/TreeRocket_Leafless/TreeRocket_LeaflessA.png

I'm rather at a loss here. Any help would be appreciated.

RawCode


Pajama Zach

Sure thing. Here are the relevant bits.

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Non platform assembly: data-17DCC030 (this message is harmless)
Fallback handler could not load library F:/SteamLibrary/steamapps/common/RimWorld/RimWorldWin_Data/Mono/data-17DCC030.dll
Could not load UnityEngine.Texture2D at Things/Plant/MulchBush/MulchBush_LeaflessA in any active mod or in base resources.

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

MatFrom with null sourceTex.

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Could not load UnityEngine.Texture2D at Things/Plant/MulchBush/MulchBush_LeaflessB in any active mod or in base resources.

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

MatFrom with null sourceTex.

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Could not load UnityEngine.Texture2D at Things/Plant/Trees/TreeRocket/TreeRocket_LeaflessA in any active mod or in base resources.

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

MatFrom with null sourceTex.

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Could not load UnityEngine.Texture2D at Things/Plant/Trees/TreeRocket/TreeRocket_LeaflessB in any active mod or in base resources.

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

MatFrom with null sourceTex.

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

kaptain_kavern

i'm trying to help a bit too.

In your thingdef, which <Graphicclass> value have you choose?

I'm a bit "surprised" the error message specifically mention "path/to/plant/textures/xxxxxxxx_xxxxxxA" AND "path/to/plant/textures/xxxxxxxx_xxxxxxB" as well at the same time.

AFAIK in some occasion path need to point to a folder and in other to a direct file (hence my question ;) )

Pajama Zach

GraphicClass is Graphic_Random.

    <graphicData>
      <texPath>Things/Plant/Trees/TreeRocket</texPath>
      <graphicClass>Graphic_Random</graphicClass>
    </graphicData>


From what I can tell in the old post I linked Graphic_Random should always point to a folder with at least one option instead of a specific file. I tried specifying the file as well, but I got the error where it couldn't find the texture path at all. I did do some experimentation by commenting out the leaflessGraphicPath line and got the same error as I'm getting when I do specify it. If I try to specify the file itself I get twice as many of the same errors, as if it were looking for an extra folder that doesn't exist as well as finding textures that aren't used anywhere.

I've downloaded a few mods for examples and looked at the core files but I can't find anything conclusive. The Vegetable Garden mod, which the old post is about, now has its own folder for leafless trees but if I try the same thing it gives me this error, while loading the Vegetable Garden mod in RimWorld does not give me the error my mod does. Vegetable Garden also uses Graphic_Random.

Oddly, and I think completely unrelated, Vegetable Garden calls up leaflessGraphicPath twice under Plant, once for the custom model and another for one of the default ones. Removing the second call loads the proper custom texture without any problems. I'm actually going to post in their thread as well and see if I can't get help while helping them out.

dismar

#5
Hi! If you send me your def file or just paste the whole plant def here I can see what's going on. The code you are looking at is a bit old in my mod. I have fixed the double def as it was an error from a vanilla plant that was copied over. lol

Easiest way I can help is to look at the whole mod and go from there :) Structure of the folders is important as well

kaptain_kavern

Hey thanks Dismar buddy.
I was about to send you a pm to ask if you can help. Many thanks

Pajama Zach

Sure thing. You can download the version with the issue here. Thanks!

dismar

#8
Quote from: Pajama Zach on November 14, 2016, 08:12:58 PM
Sure thing. You can download the version with the issue here. Thanks!

Just glancing over it :

Your leafless plants shouldn't be graphic random style, they should have a folder like you have...
Even tho it looks like it should be looking for the A,B,C,etc..  the texture only looks for one piece of artwork.
Look through my mod the leafless tree, only I have one peice of artowrk for each tree and it's the same name as the folder.

so rename MulchBush_LeaflessA to MulchBush_Leafless and it should work. You don't need the B art.
same for the TreeRocket_LeaflessA make it TreeRocket_Leafless and it should all be ok!

Hope that all makes sense!


ps the code is fine!

Pajama Zach

I figured it out! It was a problem with how the game looks for folders to pull graphics from.

As far as I can tell when the game's looking for a texture it checks everything before the underscore first, so if you have a "blahblah" folder and a "blahblah_leafless" folder in the same folder, or nested within each other, or anywhere that the game will find the "blahblah" folder before the "blahblah_leafless" folder it'll load the "blahblah" folder and try to load that first regardless of what's behind the underscore. Then it'll see the "blahblah_leafless" folder that isn't being used and throw up an error.

The solution was to follow the same folder nesting that you'd created, dismar, and simply move the leafless folder somewhere that it won't confuse the different folders. I just created a "Leafless" folder inside my plants folder for it to dive into before looking for anything else. By all appearances the multiple graphics will still work, too!

Thanks for all the help everyone!

kaptain_kavern

Awesome, thanks Dismar.

I'm glad it's solved. I had not understand it was a mod I "know" from the [WIP] section   ;D
I will also bookmark the thread because I know I will need this knowledge soon  ^^