jme3-blender crashes with current git

Hey Guys,
Hey @Kaelthas,

I finally had the time to try out the recent 3.1 again and I was unable to import my models which work fine with 3.0.

As much as I’d love to contribute to jme3, I am not really familiar with the workflow neither with BlenderLoader’s Interna.

Let’s start with the Exception that I have in netbeans (NOT in the SDK, as the LoggingMethod is crashed :stuck_out_tongue: )

SEVERE [org.openide.util.Exceptions]
java.io.CharConversionException: Invalid XML character �.
    at org.openide.xml.XMLUtil.checkContentCharacters(XMLUtil.java:800)
    at org.openide.xml.XMLUtil.toElementContent(XMLUtil.java:630)
    at org.netbeans.modules.notifications.NotificationImpl.createDetails(NotificationImpl.java:242)
Caused: java.lang.IllegalArgumentException
    at org.netbeans.modules.notifications.NotificationImpl.createDetails(NotificationImpl.java:244)
    at org.netbeans.modules.notifications.NotificationImpl.initDecorations(NotificationImpl.java:173)
    at org.netbeans.modules.notifications.center.NotificationCenterManager$3.run(NotificationCenterManager.java:227)
    at org.netbeans.modules.notifications.center.NotificationCenterManager.firePropertyChange(NotificationCenterManager.java:233)
    at org.netbeans.modules.notifications.center.NotificationCenterManager.add(NotificationCenterManager.java:101)
    at org.netbeans.modules.notifications.NotificationDisplayerImpl.add(NotificationDisplayerImpl.java:111)
    at org.netbeans.modules.notifications.NotificationDisplayerImpl.notify(NotificationDisplayerImpl.java:90)
    at org.netbeans.modules.notifications.NotificationDisplayerImpl.notify(NotificationDisplayerImpl.java:81)
    at org.openide.awt.NotificationDisplayer.notify(NotificationDisplayer.java:222)
    at com.jme3.gde.core.util.notify.NotifyUtil.show(NotifyUtil.java:63)
    at com.jme3.gde.core.scene.ApplicationLogHandler.publish(ApplicationLogHandler.java:123)
    at java.util.logging.Logger.log(Logger.java:738)
    at java.util.logging.Logger.doLog(Logger.java:765)
    at java.util.logging.Logger.log(Logger.java:788)
    at java.util.logging.Logger.warning(Logger.java:1476)
    at com.jme3.scene.plugins.blender.file.FileBlockHeader$BlockCode.valueOf(FileBlockHeader.java:190)
    at com.jme3.scene.plugins.blender.file.FileBlockHeader.<init>(FileBlockHeader.java:73)
    at com.jme3.scene.plugins.blender.BlenderLoader.setup(BlenderLoader.java:308)
    at com.jme3.scene.plugins.blender.BlenderLoader.load(BlenderLoader.java:92)
Caused: java.io.IOException: Unexpected importer exception occured: java.io.CharConversionException: Invalid XML character &#0;.
    at com.jme3.scene.plugins.blender.BlenderLoader.load(BlenderLoader.java:221)
    at com.jme3.scene.plugins.blender.BlenderLoader.load(BlenderLoader.java:81)
    at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:262)
Caused: com.jme3.asset.AssetLoadException: An exception has occured while loading asset: Mr_Chan.blend
    at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:264)
    at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:376)
    at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:419)
[catch] at com.jme3.gde.core.assets.SpatialAssetDataObject.loadAsset(SpatialAssetDataObject.java:95)
    at com.jme3.gde.core.assets.SpatialAssetDataObject.loadAsset(SpatialAssetDataObject.java:54)
    at com.jme3.gde.core.assets.AssetData.loadAsset(AssetData.java:130)
    at com.jme3.gde.modelimporter.ModelImporterVisualPanel3.loadModel(ModelImporterVisualPanel3.java:92)
    at com.jme3.gde.modelimporter.ModelImporterVisualPanel3.loadSettings(ModelImporterVisualPanel3.java:61)
    at com.jme3.gde.modelimporter.ModelImporterWizardPanel3.readSettings(ModelImporterWizardPanel3.java:82)
    at org.openide.WizardDescriptor.updateStateOpen(WizardDescriptor.java:867)
    at org.openide.WizardDescriptor.updateState(WizardDescriptor.java:822)
    at org.openide.WizardDescriptor._updateState(WizardDescriptor.java:800)
    at org.openide.WizardDescriptor.goToNextStep(WizardDescriptor.java:1065)
    at org.openide.WizardDescriptor.access$1900(WizardDescriptor.java:92)
    at org.openide.WizardDescriptor$Listener$1.run(WizardDescriptor.java:2208)
    at org.openide.WizardDescriptor.lazyValidate(WizardDescriptor.java:1516)
    at org.openide.WizardDescriptor.access$2000(WizardDescriptor.java:92)
    at org.openide.WizardDescriptor$Listener.actionPerformed(WizardDescriptor.java:2227)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.openide.util.WeakListenerImpl$ProxyListener.invoke(WeakListenerImpl.java:461)
    at com.sun.proxy.$Proxy32.actionPerformed(Unknown Source)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6525)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6290)
    at java.awt.Container.processEvent(Container.java:2234)
    at java.awt.Component.dispatchEventImpl(Component.java:4881)
    at java.awt.Container.dispatchEventImpl(Container.java:2292)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
    at java.awt.Container.dispatchEventImpl(Container.java:2278)
    at java.awt.Window.dispatchEventImpl(Window.java:2750)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:751)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:702)
    at java.awt.EventQueue$3.run(EventQueue.java:696)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:724)
    at java.awt.EventQueue$4.run(EventQueue.java:722)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:721)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
    at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:184)
    at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:229)
    at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:227)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:227)
    at java.awt.Dialog.show(Dialog.java:1084)
    at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:1065)
    at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:1115)
    at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:1087)
    at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:128)
    at org.openide.util.Mutex.doEventAccess(Mutex.java:1376)
    at org.openide.util.Mutex.readAccess(Mutex.java:278)
    at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:1072)
    at java.awt.Component.show(Component.java:1654)
    at java.awt.Component.setVisible(Component.java:1606)
    at java.awt.Window.setVisible(Window.java:1014)
    at java.awt.Dialog.setVisible(Dialog.java:1005)
    at com.jme3.gde.modelimporter.ImportModel.actionPerformed(ImportModel.java:94)
    at org.openide.awt.AlwaysEnabledAction$1.run(AlwaysEnabledAction.java:199)
    at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:95)
    at org.openide.util.actions.ActionInvoker.doPerformAction(ActionInvoker.java:116)
    at org.openide.util.actions.ActionInvoker.invokeAction(ActionInvoker.java:99)
    at org.openide.awt.AlwaysEnabledAction.actionPerformed(AlwaysEnabledAction.java:202)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
    at java.awt.Component.processMouseEvent(Component.java:6525)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6290)
    at java.awt.Container.processEvent(Container.java:2234)
    at java.awt.Component.dispatchEventImpl(Component.java:4881)
    at java.awt.Container.dispatchEventImpl(Container.java:2292)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
    at java.awt.Container.dispatchEventImpl(Container.java:2278)
    at java.awt.Window.dispatchEventImpl(Window.java:2750)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:751)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:702)
    at java.awt.EventQueue$3.run(EventQueue.java:696)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:724)
    at java.awt.EventQueue$4.run(EventQueue.java:722)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:721)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

It all comes down to jmonkeyengine/FileBlockHeader.java at eb767e75802cab5ae20597fee7fb6fa40ac55d45 · jMonkeyEngine/jmonkeyengine · GitHub (simply handling a (unknown) block).

Furthermore, I’d suggesting removing String casting here: jmonkeyengine/FileBlockHeader.java at eb767e75802cab5ae20597fee7fb6fa40ac55d45 · jMonkeyEngine/jmonkeyengine · GitHub and simply output the two hexaValues. (possibly check if both are in alphabetical range and then cast them, otherwise fall back to bytewise output)

I don’t know if blender now has non-alphabetic-chars, but seeing it’s #0, it rather looks like a bug somewhere else?

I’ll also upload the Model File (if needed), but that will take ages :slight_smile: (I’ll check if it crashes with the texture-less model aswell)

Edit: http://www46.zippyshare.com/v/Nvixn6kq/file.html

1 Like

Hey @Darkchaos
The model you provided loaded fine :smile:
I think you will need to upload the one that crashes.
:wink:

It actually is the one that crashes :smiley:

I am running the sdk through netbeans and it crashes on that model. This looks like a encoding issue possibly?

Problem solved, @Kaelthas.
I can now import the model due to my own changes to the jme3-blender (I feel like a boss after having modded jme3 :stuck_out_tongue: )

Since I am unfamilar with creating git patches and pull requests and such, and don’t have a git account and especially don’t know if that change is wanted, here it is:

in com.jme3.scene.plugins.blender.file.FileBlockHeader, change roughly at line 190:

LOGGER.warning("Unknown block header: " + new String(codeBytes));

to

String sCode = new String(codeBytes);
if (sCode.matches("^[a-zAZ0-9]$"))
   LOGGER.warning("Unknown block header: " + sCode);
else
   LOGGER.warning("Unknown block header: " + String.format("0x%02X", codeBytes[0]) + " " + String.format("0x%02X", codeBytes[1]) + " " + String.format("0x%02X", codeBytes[2]) + " " + String.format("0x%02X", codeBytes[3]));

That produces

Unknown block header: 0x47 0x52 0x00 0x00
Unknown block header: 0x41 0x52 0x00 0x00

as result, that is: GR 0x0 0x0 and AR 0x0 0x0.

BTW: To my understanding that code would crash on any unknown header, because 0x0 isn’t really 0 (0x30 in hex)

Edit: Unfortunately I was unable to find some explanation for GR and AR in Blender Sourcecode, no clue where you had your initial information from :stuck_out_tongue:

1 Like

I did some more research.
@Kaelthas, I don’t know why the model loads fine for your.

I guess the exception isn’t thrown because it’s actually netbeans incapability to display 0x0 as a debug output.
The model itself looks totally crazy, due to the lack of those Blocks.

I can see its “collision shape” being somewhat correct but what’s displayed is simply a “meat loaf”.

Considering my fix: If every Blender Block stops with 0x0 0x0 then the whole matching is senceless, you’d rather need some:

Logger.... new String(codeBytes[0]) + new String(codeBytes[1]) + String.format("0x%02X", codeBytes[2]) + " " + String.format("0x%02X", codeBytes[3]);

On the other hand: who knows how they will name their blocks in the future, and translating two hex bytes into chars isn’t that much of a job either.

Edit: That actually only happens to mhx imported models into blender. If I check my others who worked fine with 3.0, they work fine with 3.1 aswell. Collada is broken blender wise, though.

It is strange that it crashed for you. What Java version do you use ? Because it is hard to belive it depends on the IDE.

Anyway I have made a commit today with 2 changes to that file.

  1. I added those two blocks to the list - so they are not unknown any more :smile:
  2. I replaced every 0x00 in the block code with char ‘0’. The log is for the information which block is unknown (blender adds new blocks in newer versions) so it is a good idea to see its full name with zeros at the end if they are there :smile:

Hope this will help. If not - then tell me and I will search further for better solution.
:wink:

I can have a look for you, but it still depends on the IDE :wink:

SEVERE [org.openide.util.Exceptions]
java.io.CharConversionException: Invalid XML character &#0;.
    at org.openide.xml.XMLUtil.checkContentCharacters(XMLUtil.java:800)
    /* snip */
    at org.netbeans.modules.notifications.NotificationDisplayerImpl.notify(NotificationDisplayerImpl.java:81)
    at org.openide.awt.NotificationDisplayer.notify(NotificationDisplayer.java:222)
    at java.util.logging.Logger.log(Logger.java:738)

It’s just netbeans (openIde)'s incapability of displaying or correctly encoding all characters.

Two seems like a good solution yep, I only don’t know what will happen if they start to increase the numbers like GR00 GR01 GR02?

Did you take a look at what those blocks define? As the imported model looks crap, I can give it a try with a fresh build and then upload the .j3o or screenshot it, along with the blend.

Edit: I have no clue what’s wrong, but as I did my third character (Mr Chang), I encounter problems.
He’s linked above and lead to such a .j3o file:

btw: Why is it 65MiB big compared to the tiny blend files?

Note: The upper j3o is generated with makehuman->blender using collada, which used to work, somehow.
Edit2: SDK 3.0 loads him without troubles.

Note: in case it clears up any mysteries about why this error might occur for some and not others; presuming that codeBytes is a byte array then the above is potentially going to produce different results depending on the default encoding for the platform.

You could get consistent results on all platforms if a specific character encoding was passed… which might still produce bad results but it would produce them consistently. new String(byte) is almost always the “wrong answer”.

1 Like

It’s crazy, in 3.0 it works and the file is 20MiB smaller :open_mouth:
I wonder why it didn’t crash there either?

3.1 has many rewrites and improvement, but is not that battle tested :wink:

I do not think this will happen. The two zeros at the end are there just to fill the space up to four bytes for a header name. There are some special headers that have the full 4-byte name but they are not changed since the version 2.49 (and probebly earlier versions as well). If any data block was added since then - it always had the two zeros at the end.

Can you upload your last character ? I will take a look at it.

Well it’s already uploaded above, only with textures and as unionmesh.
The latter cannot be the Problem as it didn’t work with seperate meshes aswell.

I 'll upload it though

Edit: http://www11.zippyshare.com/v/dMyq5aNi/file.html