-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Previews for matparams #334
Conversation
AssetManager static hack to load textures in preview...
Updatable floats and colors
Updatable floats and colors (SDK Core project)
jme3-materialeditor/src/com/jme3/gde/materialdefinition/EditableMatDefFile.java
Outdated
Show resolved
Hide resolved
private MatDefBlock matDefStructure; | ||
private TechniqueBlock currentTechnique; | ||
private MaterialDef materialDef; | ||
private static ProjectAssetManager assetManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this was the best I could do at the time. Will try to find a better way
@@ -721,6 +728,9 @@ private void initData(TechniqueBlock technique, ProjectAssetManager manager, Lis | |||
|
|||
for (MatParamBlock matParamBlock : matDef.getMatParams()) { | |||
ShaderNodeVariable var = new ShaderNodeVariable("", "MatParam", matParamBlock.getName()); | |||
if(matParamBlock.getDefaultValue() != null){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows for the creation of previews for the nodes
break; | ||
case MatParam: | ||
header.setIcon(Icons.mat); | ||
setNameAndTitle("MatParam"); | ||
name = "MatParam"; | ||
setTitle(outputLabels.get(0).getText()); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separating name and title for single output nodes. It allows for having the param name in the header.
# Conflicts: # jme3-core/src/com/jme3/gde/core/editor/nodes/NodePanel.java
# Conflicts: # jme3-core/src/com/jme3/gde/core/editor/nodes/NodePanel.java
This PR adds both previews and editors for values for the shader nodes. I'd still like to explore it a bit further and see if i can pass down MatParams all the way to the nodes, that would make some things easier to formalize. |
if (evt.getPropertyName().equals("name")) { | ||
if(evt.getSource() instanceof BasePreview && evt.getNewValue() instanceof String){ | ||
diagram.updateDefaultValue(evt.getPropertyName(), (String) evt.getNewValue()); | ||
} else if (evt.getPropertyName().equals("name")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block listens for changes to default values and passes them on.
…n preview..." This reverts commit d08c87f.
I tried breaking out the live updates for materials into its own, but it's too nestled in with the rest. |
/** | ||
* The NodePanel is the actual implementation of a Node. | ||
* @author Nehon | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All changes to this class are about making nodes more compact and work better with the preview/editor panels. I made them opaque for that reason
this.loaded = loaded; | ||
} | ||
|
||
private class MatStructChangeListener implements PropertyChangeListener { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this to its own class
} | ||
return 0; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handled by Comparator in ShaderNodesBlock now
@@ -42,6 +42,7 @@ | |||
import javax.swing.JList; | |||
import javax.swing.JOptionPane; | |||
import javax.swing.JPanel; | |||
import javax.swing.JToggleButton; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a new button for toggling live updates. Should find an icon for that..
# Conflicts: # jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/ShaderNodePanel.java
Conflicts: jme3-materialeditor/src/com/jme3/gde/materialdefinition/EditableMatDefFile.java
# Conflicts: # jme3-core/src/com/jme3/gde/core/editor/nodes/Diagram.java # jme3-materialeditor/src/com/jme3/gde/materialdefinition/EditableMatDefFile.java # jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Bundle.properties # jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorToolBar.form # jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorToolBar.java # jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/ShaderNodeDiagram.java # jme3-materialeditor/src/com/jme3/gde/materials/MaterialPreviewRenderer.java
Getting there... This last merge was really messy. Cause: Line endings updated on other PR's but not this one. One more "lesser" pr to go before i'll finish this one up. |
Note to self: Still line ending issue with MatDefNode https://github.com/jMonkeyEngine/sdk/pull/334/files#diff-8a908aef5dc64b9e3bf08da756c62262ce21cc6bc19307bce81d0261cf22ca58 |
# Conflicts: # jme3-materialeditor/src/com/jme3/gde/materialdefinition/fileStructure/ShaderNodesBlock.java
…eviews_for_matparams
I think this PR deserves a squash commit. |
This is both preview of shader node outputs, editing them and some general refactoring and fixes made along the way.
I'm afraid this is going to be a big one, so I'm creating a draft in case anyone wants to tag along :)
Edit: I'm unsure as to why it replaces some whole files. Because line endings were wrong?