Monkey World 3D forum
Welcome, Guest. Please login or register.
September 07, 2010, 02:44:03 AM

Login with username, password and session length
Search:     Advanced search
Monkey World 3D forum created
535 Posts in 128 Topics by 165 Members
Latest Member: ken_chief_engineer
* Home Help Login Register
+  Monkey World 3D forum
|-+  Partners
| |-+  General
| | |-+  MonkeyWorld3D 4.2
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: MonkeyWorld3D 4.2  (Read 1407 times)
njd5475
Newbie
*
Posts: 7


Email
« on: November 14, 2008, 02:04:00 AM »

Works fine for me running WindowsXP.

Found a bug with resizing the application window. It looks like the jME view doesn't resize, that and you can't seem to make terrains larger than 128x128, although I'll have to expirement.
Logged
kine
Newbie
*
Posts: 5


« Reply #1 on: November 14, 2008, 03:40:14 PM »

I don't acheive to load my models, as 3ds, obj or dae with 4.2 neither with 4.1 ... They are exported from blender correctly I think, and well imported in jme ??!!!

They are approx 20000 triangles models.

I would be very happy to use monkeyWorld3D, it would allow me to make a big jump in my scene editing ...

I'm a little bit sorry ...  :-[

Kine  :)

PS: I succed for sure at importing some other models
Logged
Vardamir
Developers
Full Member
*******
Posts: 178



WWW Email
« Reply #2 on: November 15, 2008, 01:38:35 PM »

Can you attach such a model?
Logged

Denny Crane!
kine
Newbie
*
Posts: 5


« Reply #3 on: November 15, 2008, 06:05:45 PM »

Here it is !

http://www.2shared.com/fadmin/4287178/4d77447c/deco.dae
Logged
Vardamir
Developers
Full Member
*******
Posts: 178



WWW Email
« Reply #4 on: November 16, 2008, 04:28:15 PM »

For the import in the workspace, this method is used: ColladaImporter.load(new FileInputStream(srcFile), "model");
I don't know, what this class does, but it seems that it does not, what you expect.
« Last Edit: November 16, 2008, 04:38:57 PM by Vardamir » Logged

Denny Crane!
kine
Newbie
*
Posts: 5


« Reply #5 on: November 16, 2008, 05:22:53 PM »

Here is mine:

Code: [Select]
public static Node loadColladaModel(String ModelFile) {

InputStream mobboss = UseFul.class.getClassLoader()
.getResourceAsStream(ModelFile);
if (mobboss == null) {
System.out
.println("Unable to find file, did you include jme-test.jar in classpath?");
System.exit(0);
}

// tell the importer to load the mob boss
ColladaImporter.squelchErrors(false);
ColladaImporter.load(mobboss, "model");

Node ff = ColladaImporter.getModel();
ColladaImporter.cleanUp();

return (ff);

}

the line :
Quote
ColladaImporter.squelchErrors(false);
is not necessary
Logged
Vardamir
Developers
Full Member
*******
Posts: 178



WWW Email
« Reply #6 on: November 17, 2008, 07:50:09 AM »

Ok, here is the complete method:
Code: [Select]
public static void convertCollada(File srcFile, File anim, File outputPath) {
// url to the location of the model's textures
try {
Node modelNode = new Node("Collada Node");
// this stream points to the model itself.
InputStream mod = new FileInputStream(srcFile);
// tell the importer to load the mob boss
ColladaImporter.load(mod, "model");
// we can then retrieve the skin from the importer as well as the
// skeleton
SkinNode skinNode = null;
ArrayList<String> skinNodeNames = ColladaImporter
.getSkinNodeNames();
if (skinNodeNames != null) {
String skinNodeName = skinNodeNames.get(0);
skinNode = ColladaImporter.getSkinNode(skinNodeName);
}

Bone skel = null;
ArrayList<String> skeletonNames = ColladaImporter
.getSkeletonNames();
if (skeletonNames != null) {
String skeletonName = skeletonNames.get(0);
skel = ColladaImporter.getSkeleton(skeletonName);
}
// clean up the importer as we are about to use it again.
ColladaImporter.cleanUp();

// this stream points to the animation file. Note: You don't
// necessarily
// have to split animations out into separate files, this just
// helps.
if (anim != null) {
InputStream animation = new FileInputStream(anim);
// load the animation file.
ColladaImporter.load(animation, "anim");
// this file might contain multiple animations, (in our case
// it's one)
ArrayList<String> animations = ColladaImporter
.getControllerNames();
System.out
.println("Number of animations: " + animations.size());
for (int i = 0; i < animations.size(); i++) {
System.out.println(animations.get(i));
}
// Obtain the animation from the file by name
BoneAnimation anim1 = ColladaImporter
.getAnimationController(animations.get(0));
AnimationController ac = new AnimationController();
ac.addAnimation(anim1);
ac.setRepeatType(Controller.RT_WRAP);
ac.setActive(true);
ac.setActiveAnimation(anim1);

// assign the animation controller to our skeleton
if (skel != null)
skel.addController(ac);
}
// attach the skeleton and the skin to the rootnode. Skeletons could
// possibly
// be used to update multiple skins, so they are seperate objects.
if (skinNode != null)
modelNode.attachChild(skinNode);
if (skel != null)
modelNode.attachChild(skel);

modelNode.updateGeometricState(0, true);
// all done clean up.
ColladaImporter.cleanUp();

JMEHelperFactory.save(modelNode, outputPath);

} catch (Exception e) {
Runtime.handleException(e);
}
}

Looking at th comment
Code: [Select]
// tell the importer to load the mob boss

it seems, the source for this code is somewaht the same ;-)
But i see one difference, in our code, there is no ColladaImporter.getModel();

Can this be the reason, that it does not work?
Logged

Denny Crane!
Vardamir
Developers
Full Member
*******
Posts: 178



WWW Email
« Reply #7 on: November 17, 2008, 07:57:16 AM »

After adding these lines, it worked:
Code: [Select]
Node model = ColladaImporter.getModel();
if( model != null)
    modelNode.attachChild(model);

Thanks.
Logged

Denny Crane!
Pages: [1] Print 
« previous next »
 

Powered by MySQL Powered by PHP Powered by SMF 2.0 Beta 3.1 Public | SMF © 2006–2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!