Material editor crashes


#1

Hello,
I don’t know if this is a know bug or not, so I thought I would ask.

I am running into an issue in the SDK (v 3.2.2 stable). I was not able to open any j3md files with the editor or shader tabs. I can open them and get the text view, but that is it. I create a new material file from the template, same issue.

The error I am getting is:

java.lang.IllegalStateException: Cannot instantiate com.jme3.gde.materialdefinition.editor.MatDefEditorlElement
	at org.netbeans.core.spi.multiview.MultiViewFactory$MapMVD.createElement(MultiViewFactory.java:464)
	at org.netbeans.core.multiview.MultiViewModel.getElementForDescription(MultiViewModel.java:222)
	at org.netbeans.core.multiview.MultiViewModel.getActiveElement(MultiViewModel.java:132)
	at org.netbeans.core.multiview.MultiViewModel.getActiveElement(MultiViewModel.java:128)
	at org.netbeans.core.multiview.MultiViewPeer.showCurrentElement(MultiViewPeer.java:470)
	at org.netbeans.core.multiview.MultiViewPeer.showCurrentElement(MultiViewPeer.java:462)
	at org.netbeans.core.multiview.MultiViewPeer$SelectionListener.selectionChanged(MultiViewPeer.java:929)
	at org.netbeans.core.multiview.MultiViewModel.fireSelectionChanged(MultiViewModel.java:259)
	at org.netbeans.core.multiview.MultiViewModel.setActiveDescription(MultiViewModel.java:120)
	at org.netbeans.core.multiview.MultiViewModel$BtnGroup.setSelected(MultiViewModel.java:322)
	at javax.swing.JToggleButton$ToggleButtonModel.setSelected(JToggleButton.java:254)
	at javax.swing.ButtonGroup.setSelected(ButtonGroup.java:165)
	at org.netbeans.core.multiview.MultiViewModel$BtnGroup.setSelected(MultiViewModel.java:318)
	at org.netbeans.core.multiview.TabsComponent$ButtonMouseListener.mousePressed(TabsComponent.java:907)
	at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:280)
	at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:279)
	at java.awt.Component.processMouseEvent(Component.java:6536)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6304)
	at java.awt.Container.processEvent(Container.java:2239)
	at java.awt.Component.dispatchEventImpl(Component.java:4889)
	at java.awt.Container.dispatchEventImpl(Container.java:2297)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4532)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
	at java.awt.Container.dispatchEventImpl(Container.java:2283)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
	at java.awt.EventQueue$4.run(EventQueue.java:733)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	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)
Caused by: java.lang.NoSuchMethodException: com.jme3.gde.materialdefinition.editor.MatDefEditorlElement.<init>()
	at java.lang.Class.getConstructor0(Class.java:3082)
	at java.lang.Class.getConstructor(Class.java:1825)
	at org.netbeans.core.spi.multiview.MultiViewFactory$MapMVD.createElement(MultiViewFactory.java:450)
	... 47 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.netbeans.core.spi.multiview.MultiViewFactory$MapMVD.createElement(MultiViewFactory.java:447)
	... 47 more
Caused by: java.lang.IllegalArgumentException: Cannot build MatDefEditorlElement: Failed at loading the EditableMatDefFile
	at com.jme3.gde.materialdefinition.editor.MatDefEditorlElement.<init>(MatDefEditorlElement.java:134)
	... 52 more

Any thoughts?

Thanks,
Trevor


#2

Looking at the netbeans source, it looks like it is looking for a constructor with a Lookup class, or an empty constructor:

@Override
        public MultiViewElement createElement() {
            String name = get("class", String.class); // NOI18N
            String method = (String)map.get("method"); // NOI18N
            Exception first = null;
            try {
                ClassLoader cl = Lookup.getDefault().lookup(ClassLoader.class);
                if (cl == null) {
                    cl = Thread.currentThread().getContextClassLoader();
                }
                if (cl == null) {
                    cl = MultiViewFactory.class.getClassLoader();
                }
                Class<?> clazz = Class.forName(name, true, cl);
                if (method == null) {
                    try {
                        Constructor<?> lookupC = clazz.getConstructor(Lookup.class);
                        return (MultiViewElement)lookupC.newInstance(context);
                    } catch (Exception ex) {
                        first = ex;
                        Constructor<?> defC = clazz.getConstructor();
                        return (MultiViewElement)defC.newInstance();
                    }
                } else {
                    try {
                        Method m = clazz.getMethod(method, Lookup.class);
                        return (MultiViewElement) m.invoke(null, context);
                    } catch (NoSuchMethodException ex) {
                        first = ex;
                        Method m = clazz.getMethod(method);
                        return (MultiViewElement) m.invoke(null);
                    }
                }
            } catch (Exception ex) {
                IllegalStateException ise = new IllegalStateException("Cannot instantiate " + name, ex);
                Throwable t = ise;
                while (t.getCause() != null) {
                    t = t.getCause();
                }
                t.initCause(first);
                throw ise;
            }
        }

Which is what we have:

@SuppressWarnings("LeakingThisInConstructor")
    public MatDefEditorlElement(final Lookup lkp) {
        initComponents();
        obj = lkp.lookup(MatDefDataObject.class);
        metaData = lkp.lookup(MatDefMetaData.class);
        if (obj == null) { // This happens when there was an error or maybe the object
            // has already been freed
            throw new IllegalArgumentException("Cannot build MatDefEditorlElement: obj null");
        }
        
        final EditableMatDefFile file = obj.getEditableFile();
        shaderEditPanel1.setVisible(false);
        shaderEditPanel1.setParent(this);
        if(!file.isLoaded()){
            file.load(lkp);
        }

        if (!file.isLoaded()) {
            throw new IllegalArgumentException("Cannot build MatDefEditorlElement: Failed at loading the EditableMatDefFile");
        }
        
        reload(file, lkp);        
        toolbar.setParent(this);
        toolbar.addTechnique(lkp.lookup(MatDefBlock.class).getTechniques());
    }

So I am not sure why it cannot find the constructor, but that is what the error looks like it is saying…

EDIT: I should have read further in the stacktrace:

Caused by: java.lang.IllegalArgumentException: Cannot build MatDefEditorlElement: Failed at loading the EditableMatDefFile

I guess the real question is why can it not load the file:

final EditableMatDefFile file = obj.getEditableFile();
        shaderEditPanel1.setVisible(false);
        shaderEditPanel1.setParent(this);
        if(!file.isLoaded()){
            file.load(lkp);
        }

        if (!file.isLoaded()) {
            throw new IllegalArgumentException("Cannot build MatDefEditorlElement: Failed at loading the EditableMatDefFile");
        }

#3

Hey, thanks for taking your time to report and even dig into this issue.
Did you by any chance see an exception before that in the SDK “Ouput/Log” window? (Sometimes exceptions only show up if you launch the SDK from a console window).

It would be very helpful if you could provide such a thing, because otherwise it’s hard to debug. I can only tell you that once loading failed, you may have to restart the SDK because otherwise it fails to load even valid files.

It is “usual” that you have a crash with the shader tabs (because some nodes might not contain shader nodes), but the other views should work fine, especially everything should work for newly created files:

Just to be clear on that: You created a new Material Definition File from the Template, right? (j3md = MatDef, j3m = Mat)


#4

Yes that is correct, I used the template. I already discovered needing to restart the sdk, but thanks for the reminder. I have tested on two different computers now (both running 3.2.2) I did not see any other errors, but I will check again.


#5

Have you tried running the SDK from the command line and check what it outputs there? Because the problem is without an error it’ll be fun to debug why loading failed :smiley:


#6

Launching from the console, this is the only message I get:

OGL: Throttling update loop.

Perhaps I am not launching it correctly from the console?
I am using the command:

.\jmonkeyplatform64.exe --console new

EDIT: I figured I should include my complete output from inside jme3

Running on jMonkeyEngine 3.2-stable
 * Branch: HEAD
 * Git Hash: ea23b6a
 * Build Date: 2019-01-02
LWJGL 2.9.3 context running on thread jME3 Main
 * Graphics Adapter: C:\WINDOWS\System32\DriverStore\FileRepository\nv_ref_pubwu.inf_amd64_f9d8f3d38741881f\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nv_ref_pubwu.inf_amd64_f9d8f3d38741881f\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nv_ref_pubwu.inf_amd64_f9d8f3d38741881f\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nv_ref_pubwu.inf_amd64_f9d8f3d38741881f\nvldumdx.dll
 * Driver Version: null
 * Scaling Factor: 1
OpenGL Renderer Information
 * Vendor: NVIDIA Corporation
 * Renderer: TITAN RTX/PCIe/SSE2
 * OpenGL Version: 4.6.0 NVIDIA 417.71
 * GLSL Version: 4.60 NVIDIA
 * Profile: Compatibility
Audio Renderer Information
 * Device: OpenAL Soft
 * Vendor: OpenAL Community
 * Renderer: OpenAL Soft
 * Version: 1.1 ALSOFT 1.15.1
 * Supported channels: 64
 * ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_loopback
 * AL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
Pausing audio device not supported.
Audio effect extension version: 1.0
Audio max auxiliary sends: 4
Returning hash code of content
Reading welcome page content from web failed!
https://wiki.jmonkeyengine.org/doku.php/sdk:welcome:3_1?do=export_xhtmlbody
Checking page id 0 vs stored id 0
java.lang.IllegalStateException: Cannot instantiate com.jme3.gde.materialdefinition.editor.MatDefEditorlElement
	at org.netbeans.core.spi.multiview.MultiViewFactory$MapMVD.createElement(MultiViewFactory.java:464)
	at org.netbeans.core.multiview.MultiViewModel.getElementForDescription(MultiViewModel.java:222)
	at org.netbeans.core.multiview.MultiViewModel.getActiveElement(MultiViewModel.java:132)
	at org.netbeans.core.multiview.MultiViewModel.getActiveElement(MultiViewModel.java:128)
	at org.netbeans.core.multiview.MultiViewPeer.showCurrentElement(MultiViewPeer.java:470)
	at org.netbeans.core.multiview.MultiViewPeer.showCurrentElement(MultiViewPeer.java:462)
	at org.netbeans.core.multiview.MultiViewPeer$SelectionListener.selectionChanged(MultiViewPeer.java:929)
	at org.netbeans.core.multiview.MultiViewModel.fireSelectionChanged(MultiViewModel.java:259)
	at org.netbeans.core.multiview.MultiViewModel.setActiveDescription(MultiViewModel.java:120)
	at org.netbeans.core.multiview.MultiViewModel$BtnGroup.setSelected(MultiViewModel.java:322)
	at javax.swing.JToggleButton$ToggleButtonModel.setSelected(JToggleButton.java:254)
	at javax.swing.ButtonGroup.setSelected(ButtonGroup.java:165)
	at org.netbeans.core.multiview.MultiViewModel$BtnGroup.setSelected(MultiViewModel.java:318)
	at org.netbeans.core.multiview.TabsComponent$ButtonMouseListener.mousePressed(TabsComponent.java:907)
	at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:280)
	at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:279)
	at java.awt.Component.processMouseEvent(Component.java:6536)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6304)
	at java.awt.Container.processEvent(Container.java:2239)
	at java.awt.Component.dispatchEventImpl(Component.java:4889)
	at java.awt.Container.dispatchEventImpl(Container.java:2297)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4532)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
	at java.awt.Container.dispatchEventImpl(Container.java:2283)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
	at java.awt.EventQueue$4.run(EventQueue.java:733)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	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)
Caused by: java.lang.NoSuchMethodException: com.jme3.gde.materialdefinition.editor.MatDefEditorlElement.<init>()
	at java.lang.Class.getConstructor0(Class.java:3082)
	at java.lang.Class.getConstructor(Class.java:1825)
	at org.netbeans.core.spi.multiview.MultiViewFactory$MapMVD.createElement(MultiViewFactory.java:450)
	... 47 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.netbeans.core.spi.multiview.MultiViewFactory$MapMVD.createElement(MultiViewFactory.java:447)
	... 47 more
Caused by: java.lang.IllegalArgumentException: Cannot build MatDefEditorlElement: Failed at loading the EditableMatDefFile
	at com.jme3.gde.materialdefinition.editor.MatDefEditorlElement.<init>(MatDefEditorlElement.java:134)
	... 52 more

#7

I didn’t know about the --console new, but maybe omit that parameter.
For the installer, there also is --verbose --output log.txt, not sure if that’s of help for the sdk itself.

Apart from that I should have a look at it, but I’m currently studying for an exam so time is very limited unfortunately


#8

Thanks, I’ll look to see if there is anything else, omitting the --console new just returns the same output as with it.

Do well on your test, no rush to get this fixed, school is always more important.

Thank you,
Trevor


#9

OK, so this is interesting. I am only using maven projects, so I had the idea of trying on a normal ant project, and IT WORKED!

So, is this issue just related to maven projects?


#10

For clarity, are you saying that the editor is sensitive to the build system of the project that you are working on? Or have you been building the SDK yourself? Other?


#11

Sensitive to the project build system. I am using the GitHub release of the sdk.


#12

Maybe then “Failed at loading the EditableMatDefFile” is somewhat more precise than we thought, is there still an asset folder when using Maven?
And how do you actually create a maven project and still have the SDK functionalities? I thought this only works when you have a project based on “BasicGameTemplate” (i.e. the SDK ANT Template)


#13

I create a maven project, then add the jme dependencies to the pom, then add the assets as a resource folder under /src/main/resources/assets.

Edit: as far as I can tell, all other sdk features that I use work.


#14

Does this mean you setup your own asset locator or do you have to add (ugly) “assets/” prefixes to all of your asset keys?


#15

Then that’s it, usually the SDK should fall back into “netbeans only” mode there, most things don’t work (no knowledge of the asset folder, iOS Deployment won’t work, etc).

And I know for fact that with a gradle project you have “netbeans only”


#16

i always wonder, if there are so many problems and you want have JME IDE independent, why not just create only tools to be used out of IDE, so we would just use any IDE for code and “JME platform/tools” for everything else. it would be unversal.

tools are really important IMO, so should always work properly.

Trully myself i use just IDE, but i got gradle “code” project and ant “asset” project to manage everything. (because was unable to use SDK tools on gradle project assets)

even now i see lack of functionalities for current IDE tools, the most wanted one would be remember last material image folder or last folders visited, like in blender or other tools.

it slow me down when each new material need enter folder in folder in folder to get texture for albedo, normal, roughness, metalness, glow, etc etc…


#17

For me, editing the material is always faster in regular text editor… you just can’t see it.

It’s really a great idea. I look forward to the tools you create. I would find them very useful.


#18

wait, when i said text editor is faster?
lol?

i say mateial editor can be much faster than it is. :slight_smile:

if it would be slower, then i would not use it.

It’s really a great idea. I look forward to the tools you create. I would find them very useful.

once game will be finished, and none of you will , sure. Most of code is anyway already in IDE sourcecode…

btw. again. when i said i will create this tools? did i said i got enough time? :smiley:
once i had enough time, but its not this time.

Also, why not answer with your opinion instead? i thought its discussion, not “dont give any ideas, only if you will do them alone”. just stop doing it.


#19

…and this is why it hasn’t been done yet.


#20

nah, it slows down only a little.