Add material to mesh

It’s better way to add material to mesh? Now I have been doing this:
open old file → find mesh → copy material → close file → open new file → find mesh → paste material.
It’s possible to add material like j3o files (right click in Project explorer and select Add in SceneCompositor? Its someone able to write plugin for something like this?

I don’t entirely understand what you are triying to say/do but:
A) I wouldn’t write a Plugin but rather add a pull request to the SDK
B) It is not possible like this because you can have multiple meshes and so it is unclear to which the material should be added

C) The proper way is: Generate a j3m Material file (e.g. by generating one out of the Mesh using the Properties Window of that Geometry). If you have one you add it exactly the same way to other Geometries.
Click on a Geometry in the Graph and then in the Properties Window just select it from the Dropdown List and it is attached.
It can’t be more prominently, maybe using Drag and Drop also works, but the problem is always which Geometry to take in a j3o (since a j3o could be your entire Game Scene)

1 Like

Drag&drop is not working. :frowning:
To “generate” new material I just copy&paste old one and I change paths in notepad++ :stuck_out_tongue:

If you open j3o file you can select node in Scene Explorer and use Add to SceneComposer option in Project Explorer. I want to achieve something similar with material files: select mesh (so program know what mesh I want to modify) and add material from Project Explorer.

*I use 3.0 SDK

Dropdown list its a mistake…

you can use my editor :wink:

1 Like

Nice try but:

opening material:

java.lang.UnsupportedOperationException
	at com.jme3.material.plugins.J3MLoader.readTechnique(J3MLoader.java:655)
	at com.jme3.material.plugins.J3MLoader.loadFromRoot(J3MLoader.java:777)
	at com.jme3.material.plugins.J3MLoader.load(J3MLoader.java:798)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:259)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:373)
	at com.jme3.material.plugins.J3MLoader.loadFromRoot(J3MLoader.java:744)
	at com.jme3.material.plugins.J3MLoader.load(J3MLoader.java:798)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:259)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:373)
	at com.ss.editor.ui.component.editor.impl.material.MaterialFileEditor.openFile(Unknown Source)
	at com.ss.editor.ui.component.editor.area.EditorAreaComponent.processOpenFileImpl(Unknown Source)
	at com.ss.editor.ui.component.editor.area.EditorAreaComponent.lambda$processOpenFile$11(Unknown Source)
	at com.ss.editor.executor.impl.BackgroundEditorTaskExecutor.doExecute(Unknown Source)
	at com.ss.editor.executor.impl.AbstractEditorTaskExecutor.run(Unknown Source)

opening j3o file:

java.lang.UnsupportedOperationException
	at com.jme3.material.plugins.J3MLoader.readTechnique(J3MLoader.java:655)
	at com.jme3.material.plugins.J3MLoader.loadFromRoot(J3MLoader.java:777)
	at com.jme3.material.plugins.J3MLoader.load(J3MLoader.java:798)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:259)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:373)
	at com.jme3.material.plugins.J3MLoader.loadFromRoot(J3MLoader.java:744)
	at com.jme3.material.plugins.J3MLoader.load(J3MLoader.java:798)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:259)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:373)
	at com.jme3.asset.DesktopAssetManager.loadMaterial(DesktopAssetManager.java:394)
	at com.jme3.scene.Geometry.read(Geometry.java:629)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:342)
	at com.jme3.export.binary.BinaryInputCapsule.resolveIDs(BinaryInputCapsule.java:483)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArray(BinaryInputCapsule.java:471)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArrayList(BinaryInputCapsule.java:587)
	at com.jme3.scene.Node.read(Node.java:744)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:342)
	at com.jme3.export.binary.BinaryInputCapsule.resolveIDs(BinaryInputCapsule.java:483)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArray(BinaryInputCapsule.java:471)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArrayList(BinaryInputCapsule.java:587)
	at com.jme3.scene.Node.read(Node.java:744)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:342)
	at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:242)
	at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:125)
	at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:109)
	at com.ss.extension.loader.SceneLoader.load(SceneLoader.java:69)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:259)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:373)
	at com.ss.editor.ui.component.editor.impl.model.ModelFileEditor.openFile(Unknown Source)
	at com.ss.editor.ui.component.editor.area.EditorAreaComponent.processOpenFileImpl(Unknown Source)
	at com.ss.editor.ui.component.editor.area.EditorAreaComponent.lambda$processOpenFile$11(Unknown Source)
	at com.ss.editor.executor.impl.BackgroundEditorTaskExecutor.doExecute(Unknown Source)
	at com.ss.editor.executor.impl.AbstractEditorTaskExecutor.run(Unknown Source)

which version of jME do you use in your project?

*I use 3.0 SDK

wow, yes, you can’t use my editor :frowning:

:frowning: So I’m keep going with this what I have.

can you provide me this j3o file? I want to understand why you can’t open this file.

from what I remember the first entry in the combo box generates a material and put it in a “generated” folder in your assets

Why? Isn’t it compatible with basic Lighting material? As far as I know there was no changes in j3o, j3m and other file’s structure.

I also want to understand why :slight_smile: I need this j3o file to test it

Give me second…

What with this, @javasabr?

So, it seems that jME 3.2 doesn’t have it.

WARNING 13:57:09:754 EditorAreaComponent: com.jme3.asset.AssetNotFoundException: MatDefs/Light/LightingMS.j3md
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:370)
	at com.jme3.material.Material.read(Material.java:1052)

LightingMS is our own material. Basically it is an ‘extended’ Lighting. It have the same default technique, so for test purpose you can replace it with standard JME’s material.

This material is included in the j3o file, I can replace it :frowning:

So, you have an situation where user want to load j3o file and does not have j3m/j3md file. I think you should allow him to load it, just handle an exception and remove an existing material.
Is it possible?

It happens on core side, I can’t handle it :frowning:

Can’t you provide a default material and warn the user? E.g. set it to default unshaded in bright yellow.