No colors when exporting plug-in from Eclipse

Hi folks,



i am a newbie in jmonkey’s world. I am using JME2. I have build an RCP application under Eclipse using monKlypse plugin that displays several .obj files The problem is that under Eclipse IDE everything works fine. I mean my .obj are displayed with their respective colors but when i try to export the created application (as a product), the behavior is not the same. I loose all the color information of each of my .obj! These .obj are just white and transparent.



I don’t understand why…does anyone have a clue or an idea of the possible issue ?



Thanks in advance



Manimal

First of all monKlypse is not supported and its using the old jME2. Second, this sounds like an asset loading problem. I guess the location of the textures is different in the release than during development. This is why jME3 adds the AssetManager, jME2 had only resource locators. Set up one of these so it will find your model data in the release version as well:

[snippet id=“11”]

Hi Normen,



thanks for your quick answer !



Thus, i am not quite sure to understand how to use the source code you posted.

Actually in order to load my .obj files (and the associates .mtl files that contain the texture if i am correct?) i use the following code:



[java]

private Node loadBlenderModel(String cardName, File cardFolder, File cardFile) {

URL cardObj = ModelManager.class.getClassLoader().getResource("SRUs/" + cardFolder.getName());



Node myModel = new Node();

FormatConverter myConverter = new ObjToJme();

URL modelUrl;



try {

modelUrl = cardFile.toURI().toURL();



// Locate texture and other necessary Blender files.

myConverter.setProperty("mtllib", cardObj);

myConverter.setProperty("texdir", cardObj);



ByteArrayOutputStream myByteArrayOutputStream = new ByteArrayOutputStream();



try {

// Convert the .obj file to Blender file.

myConverter.convert(modelUrl.openStream(), myByteArrayOutputStream);



Object myObj = BinaryImporter.getInstance().load(new ByteArrayInputStream(myByteArrayOutputStream.toByteArray()));



if(myObj instanceof TriMesh) {

myModel = new Node(cardName);

myModel.attachChild((TriMesh)myObj);

} else {

myModel = (Node) myObj;

myModel.setName(cardName);

}

}

catch (IOException e) {



}

} catch (MalformedURLException e1) {

}



return myModel;

}



[/java]



Which part of this should i replace by the source code you provided ?



Thanks in advance



Manimal

Somewhere else. Its just supplying an URL for a Texture. I dont know how your textures are stored or why the textures cannot be found but the locator will be supplied some string that is the name of the texture as the model knows it. You have to supply a working URL to that, be it from a classpath or a file.

Normen,



is there a way to use JME3 with Eclipse RCP ? Is there a plugin or classes that are usable to interface with swt ?



Thanks



Manimal

Ok, thanks!



I will try to use the locator you provided.



Manimal

manimal31 said:
is there a way to use JME3 with Eclipse RCP ? Is there a plugin or classes that are usable to interface with swt ?

No, you can use jMonkeyPlatform tho