Assets from other project

Hi!

I have fairly simple project structure. I have 2 different projects (programs) and one library project (both other projects use some code from this project). I use Eclipse, and I set both projects to be dependent on library project and this works. But only for code. I haven’t been able to use any other resources (textures for example) I have in library project in other 2 projects.

So my question: how can I use resources from that library project? Should I register my own asset locator or something?

Just set up your classpath correctly to include those folders.

Are the ressources in the source folder list, because for me that works ( we have a sepearte project for assets, so they don’t have to bloat my svn

Ye, problem solved when I set resources folder like its source folder lol.

Thanks! :slight_smile:

Hey again.

I finally started using jMP. :smiley:

Anyhow, I have the same project structure as described in my first post. The problem is now, that each of the projects has its assets folder (its made by default by jMP). But when I run this, I get following info: Duplicated project name in import. Project assets-impl defined first in D:/MyProject/Editor/nbproject/assets-impl.xml and again in D:/MyProject/Data/nbproject/assets-impl.xml and consequently I cannot reference to assets in Data project. Is there any recommended way of doing this? :slight_smile:

Hm, thats not possible, on Linux or MacOS you could link the file into the other asset folder, I dont know if thats possible on a windows filesystem yet. The logic is that a project has to be released and shared during development along with its assets, so they are in the project folder… For a global “Library” of assets to add to multiple projects, look at AssetPacks, you can create your own.



Edit: Btw, adding other projects (or any folders) to a projects library will not allow you to create a distribution, only add libraries and jar files.

Ok, just found out that it actually works. What it doesn’t work are my functions to list all files in some asset folder (I use [java]new File(MyApp.class.getResource("/Textures/").toURI())[/java]. I checked and found out that there are no similar functions in assetManager. Are there any plans to add such functionality?

What are you doing there?? You shouldn’t have to handle with File objects in jME3 ever. You need to assign AssetLocators…

Ok I checked AssetLocators but it didn’t help me. Probably you didn’t understand me. :slight_smile:

I am using assetManager and locators for locating my assets and this works just fine. I just want to show my users for example all textures which he/she can apply. And for this I need file.listFiles(). And I can only get it this way. So I am curious if there are any plans to add such functionality to assetManager directly?

The AssetManager does not provide this functionality since not all file systems support a file list query (HTTP for example).

You have to take into account that the assets you’re trying to list might not be files, they could be entries inside a jar file.

Yeah, you could maybe create an AssetManager with that folder as locator and scan the contents of the folder elsewise.