Constantly seeing the following

Feb 1, 2012 9:52:26 AM com.jme3.texture.Texture read

SEVERE: Cannot load embedded image Texture2D[name=null]




Does this mean anything to anyone? Doesn’t happen in Alpha 4… only when running project in Beta.



I also constantly see (when adding a node to the scene graph):



This control has already been added to a Spatial.



To be totally honest, I am not event sure what “control” this may be referring to.



I get no stack trace… it doesn’t bomb out the application… however, nothing loads.



Wish I had a little more to go on, but…

Uh, when and how? :slight_smile:

Sorry… I know this is vague.



During the process of build a scene. Let me paste a bit of code to try and help narrow it down.



[java]

Texture tex = assetManager.loadTexture(imgPath);

tex.setMinFilter(MinFilter.BilinearNoMipMaps);

tex.setMagFilter(MagFilter.Bilinear);

tex.setWrap(WrapMode.Repeat);



Material mat = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);

mat.setBoolean(“UseMaterialColors”, true);

mat.setBoolean(“VertexLighting”, true);

mat.setBoolean(“HighQuality”, true);

mat.setFloat(“Shininess”, .5f);

mat.setColor(“Ambient”, ColorRGBA.White);

mat.setColor(“Diffuse”, ColorRGBA.White);

mat.setTexture(“DiffuseMap”, tex);

mat.getAdditionalRenderState().setFaceCullMode(cull);

[/java]



No problem here. I get no error, all seems to be working as it should.



However, when I do the following:



[java]rootNode.attachChild(node);[/java] OR

[java]sceneGraph.get(type).attachChild(node);[/java]



I see the following:



Feb 1, 2012 9:52:26 AM com.jme3.texture.Texture read

SEVERE: Cannot load embedded image Texture2D[name=null]




/boggle



As for the the other…



This control has already been added to a Spatial.



This happens at the same time. Let me grab the code used to load geometries.



[java]public void addBaseGeometry() {

Node n = app.geoms.createGeometry(baseGeom);

n.setMaterial(app.mats.getMaterial(baseMat));

AnimControl control = n.getControl(AnimControl.class);

AnimChannel channel = control.createChannel();

anis.add(channel);

this.charRootNode.attachChild(n);

}



public void addGeometry(String geomName, String matName) {

Node n = app.geoms.createGeometry(geomName);

n.setName(geomName);

n.setMaterial(app.mats.getMaterial(matName));

AnimControl control = n.getControl(AnimControl.class);

AnimChannel channel = control.createChannel();

anis.add(channel);

this.charRootNode.attachChild(n);

}

// In another class used for reading in config files. n is returned and added to the specified node

n = (com.jme3.scene.Node)assetManager.loadModel(GEOM_PATHS[index]);

n.setName(GEOM_NAMES[index]);

[/java]



I’m completely unsure as to what “control” it is referring to…

How does app.geoms.createGeometry(); look?

Ooops… sorry.



The method checks against a list of defined core geoms, zone specific geoms, etc… and then either returns the following (n):



[java]

n = (com.jme3.scene.Node)assetManager.loadModel(GEOM_PATHS[index]);

n.setName(GEOM_NAMES[index]);[/java]



or returns a placeholder geom, if the specified key pair isn’t found.



It Literally does NOTHING other than this.



I haven’t really done much in the way of graphics for this project, I have been pushing it off until functionality is complete. So objects in game use nothing outside the standard textures, materials and geometries. Either adding to or removing from the rootNode or a sub-node used for dividing colidables, water, etc, etc.



In case this is contributing to the problem, I remove nodes like this:



[java]node.removeFromParent();[/java]



I’m at a complete loss here, because I can’t really think of a way of narrowing down the issue with such generic console output :frowning:

Okay, is this nightly or stable?

Unfortunately nightly, due to some other issues (of mine, of course), however, I spend a bit of time each day trying to narrow down problems with my code and using Beta, then document any issues I am able to fix so when I finally port over I can take care of them.



I did have one thought…



Does JME force unique names for geometries now? I was using duplicated naming and determining what was what depending on the parent node. Example… I am wearing a steel helm. You are wearing the same helm. You remove the helm from your inventory… I know to remove the geometry owned by your character node… not mine. This had not been a problem prior, but /shrug… maybe this is the issue. I’ll try commenting out the .setName() call and see if the scene at least loads.

@Momoko_Fan, any recent changes in the loaders causing this?

Well… I was able to narrow down the “control” issue… to EVERY control I am using.



Billboards, skybox, all of them report the following when added to a scene graph:



This control has already been added to a Spatial.



If I remove them, the game sorta loads, however, a bunch of other stuff isn’t quite working. Here are few examples:



[java]BoundingVolume bv = node.getWorldBound();

if (bv.contains(xNode.getLocalTranslation().clone())) { … }[/java]



Errors and crashes the game. This is certainly due to the models not loading because of the texture2D error.



[java]chaseCam.setZoomOutTrigger(new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));

chaseCam.setZoomInTrigger(new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));[/java]



Errors and crashes the game. Actually, this probably is as well. The chase cam can’t be created properly if the model it is using for lookAt isn’t loaded properly due to the texture2D issue.



The stack trace ends at these lines of code. I spent a little time checking to make sure my implementation of the chase camera was still in line with the documentation. As far as I can tell it is. Here is implementation:



[java]flyCam.setEnabled(false);

chaseCam = new ChaseCamera(cam, model, inputManager);

chaseCam.setDefaultDistance(.005f);

chaseCam.setMaxDistance(10f);

chaseCam.setDefaultHorizontalRotation(0f);

chaseCam.setDefaultVerticalRotation(0f);

chaseCam.setZoomSensitivity(20);

cam.setFrustumFar(85f);

float aspect = (float)cam.getWidth() / (float)cam.getHeight();

cam.setFrustumPerspective( 45f, aspect, 0.1f, cam.getFrustumFar() );

chaseCam.setMinDistance(.005f);

chaseCam.setToggleRotationTrigger(new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));[/java]



Sorry for being a bother, it’s just that I seem to finally making some headway towards porting the app (which I am pretty excited about with all the updates available) and am hoping to figure out the remaining issues today.

Nightly is broken at the moment, so I cannot safely say which issues are “normal” when using nightly and which are new.

@normen This is good to know :slight_smile:



Out of curiosity, where can I look to keep track of the current state of the nightly build? Once I am able to grab a mostly stable version, I’ll shut off nightly updates and start trying to narrow down the issues then.

Thats what the stable releases are for really ^^ They only contain the changes that are finished/working. branches/3.0beta or simply not enabling the nightly update center (though you cannot go back easily from nightly, you have to delete the SDK and settings).

I’ll reinstall and use a local copy of the Lighting vert/frag/j3md and see if I can narrow some of this down a little more.



Thanks a ton for the help so far :slight_smile:

@normen Ok… did this, and nothing has changed. I think I may know what the issue is with the texture2d error, though, I am not sure how to fix it. The models I am using have materials associated with them. I convert them to j3o’s and then move the textures images and rename them, as I am applying the texture via code… I just need the UV mapping coords. Seeeeeeew… to make a longer than long story short, the error is being reported when I load the model, not when I apply the texture. As a matter of fact, it never gets to the point where it applies the texture, it just doesn’t load the model, or ever attach the node to the scene graph. This used to not happen, it (of course) couldn’t find the texture, but it would default to a shaded, un-textured material, keeping the UV coords, allowing me to apply a texture before adding the geom to a node/to the scene.



You wouldn’t by chance know how I could fix the issues with the models, would you? I want to keep the UV mapping, but not export the actual material.



I think this will fix the texture2d issue and allow me to actually run the project.



As for the control issue… I may not be removing the controls, only removing the associate nodes/geometries. I’ll take a look at this and verify that it is the case. Since I wasn’t having any issues before doing it this way (aside from a potentially nasty memory issue), I may have just overlooked this.



Do you know if the controls associated with a particular node have to be explicitly removed? Or are they removed when you remove the geometry they are associated with? Like in the case of a Billboard control…



Thanks!

Well you cannot add a control to two spatials, you have to remove it from the old one first… Any chance you can provoke this in a test case?

Trying to understand why you would want to move a BillboardControl from one spatial to another instead of just creating a new one…

@pspeed I’m not moving it from one node to another. I’m removing the old node (containing a geometry that has an instance of a billboard control attached to it). I’m creating a new node with a new instance of a billboard control, and it is returning this error.



@normen It was the models after all, though I am still not sure I am exporting them correctly from blender to do what I want to.



The models that are loading now only show from certain camera rotations… not sure why this is happening. However, it is not just simply not showing, if the geometry isn’t displaying, collision detection doesn’t happen.



On the other hand, projected textures are still rendering as if the geometry is still there. (I turned off gravity to test this)



so confused



Exactly what would you like in the test case? (i.e. what am I trying to repro? The control issue? or the geometry issue?)

@t0neg0d said:
@pspeed I'm not moving it from one node to another. I'm removing the old node (containing a geometry that has an instance of a billboard control attached to it). I'm creating a new node with a new instance of a billboard control, and it is returning this error.


You are mistaken. The error is somewhere else.

@pspeed Actually, we are both correct. And this did help point out the issue. Thanks. The actual node may be being removed from the scene graph, but it is never being deleted. It is being reattached and it seems that I an attempting to add another Billboard control (new instance of one) and this is causing the error (which is an issue I didn’t see, but not one that would cause this error). Here is the code:



[java]

Node model = c.getCharRootNode();



BillboardControl bb = new BillboardControl();

BitmapFont fnt = assetManager.loadFont(“Interface/font-ingame-label.fnt”);

fnt.getCharSet().setRenderedSize(35);

BitmapText txt = new BitmapText(fnt, false);



Rectangle rect = new Rectangle(-3, 2.1f, 6, 3);

txt.setBox(rect);

txt.setAlignment(BitmapFont.Align.Center);

txt.setVerticalAlignment(BitmapFont.VAlign.Center);

txt.setQueueBucket(Bucket.Transparent);

txt.setSize( 0.5f );

txt.setText(xObj.getName());



bb.setSpatial(txt);

bb.setEnabled(true);

txt.addControl(bb);



model.attachChild(txt);[/java]



Soooo… model is a node owned by the character class. But the billboard control/Rectangle are new instances and this is where the error is generated. If I don’t attach the the control, I get no error… so specifically the line of code that generates it is:



[java]txt.addControl(bb);[/java]

So, just to confirm (because it’s a bit unbelievable so it’s important to be sure). If nothing else changes at all in the code except that one line being commented out then it works. And then if nothing else changes at all (not the slightest thing) except that one line is being uncommented then it stops working?



If true, please repost the exception from that exact series of events.