Add context menu item for exporting OBJ
This commit is contained in:
parent
cb41a0ae85
commit
2eb9b039e9
@ -47,6 +47,8 @@ RocketActions.MoveUpAct.Moveup = Move up
|
|||||||
RocketActions.MoveUpAct.ttip.Moveup = Move this component upwards.
|
RocketActions.MoveUpAct.ttip.Moveup = Move this component upwards.
|
||||||
RocketActions.MoveDownAct.Movedown = Move down
|
RocketActions.MoveDownAct.Movedown = Move down
|
||||||
RocketActions.MoveDownAct.ttip.Movedown = Move this component downwards.
|
RocketActions.MoveDownAct.ttip.Movedown = Move this component downwards.
|
||||||
|
RocketActions.ExportOBJAct.ExportOBJ = Export as OBJ (.obj)
|
||||||
|
RocketActions.ExportOBJAct.ttip.ExportOBJ = Export the selected components as a Wavefront OBJ 3D file.
|
||||||
|
|
||||||
! RocketPanel
|
! RocketPanel
|
||||||
RocketPanel.FigTypeAct.SideView = Side view
|
RocketPanel.FigTypeAct.SideView = Side view
|
||||||
|
@ -255,6 +255,9 @@ public class BasicFrame extends JFrame {
|
|||||||
|
|
||||||
popupMenu.addSeparator();
|
popupMenu.addSeparator();
|
||||||
popupMenu.add(actions.getScaleAction());
|
popupMenu.add(actions.getScaleAction());
|
||||||
|
|
||||||
|
popupMenu.addSeparator();
|
||||||
|
popupMenu.add(actions.getExportOBJAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
createMenu();
|
createMenu();
|
||||||
@ -1647,7 +1650,7 @@ public class BasicFrame extends JFrame {
|
|||||||
*
|
*
|
||||||
* @return true if the file was saved, false otherwise
|
* @return true if the file was saved, false otherwise
|
||||||
*/
|
*/
|
||||||
private boolean exportWavefrontOBJAction() {
|
public boolean exportWavefrontOBJAction() {
|
||||||
File file = openFileSaveAsDialog(FileType.WAVEFRONT_OBJ, getSelectedComponents());
|
File file = openFileSaveAsDialog(FileType.WAVEFRONT_OBJ, getSelectedComponents());
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -77,6 +77,7 @@ public class RocketActions {
|
|||||||
private final RocketAction scaleAction;
|
private final RocketAction scaleAction;
|
||||||
private final RocketAction moveUpAction;
|
private final RocketAction moveUpAction;
|
||||||
private final RocketAction moveDownAction;
|
private final RocketAction moveDownAction;
|
||||||
|
private final RocketAction exportOBJAction;
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
private static final Logger log = LoggerFactory.getLogger(RocketActions.class);
|
private static final Logger log = LoggerFactory.getLogger(RocketActions.class);
|
||||||
|
|
||||||
@ -101,6 +102,7 @@ public class RocketActions {
|
|||||||
this.scaleAction = new ScaleAction();
|
this.scaleAction = new ScaleAction();
|
||||||
this.moveUpAction = new MoveUpAction();
|
this.moveUpAction = new MoveUpAction();
|
||||||
this.moveDownAction = new MoveDownAction();
|
this.moveDownAction = new MoveDownAction();
|
||||||
|
this.exportOBJAction = new ExportOBJAction();
|
||||||
|
|
||||||
OpenRocketClipboard.addClipboardListener(new ClipboardListener() {
|
OpenRocketClipboard.addClipboardListener(new ClipboardListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -148,6 +150,7 @@ public class RocketActions {
|
|||||||
scaleAction.clipboardChanged();
|
scaleAction.clipboardChanged();
|
||||||
moveUpAction.clipboardChanged();
|
moveUpAction.clipboardChanged();
|
||||||
moveDownAction.clipboardChanged();
|
moveDownAction.clipboardChanged();
|
||||||
|
exportOBJAction.clipboardChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -197,6 +200,10 @@ public class RocketActions {
|
|||||||
return moveDownAction;
|
return moveDownAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action getExportOBJAction() {
|
||||||
|
return exportOBJAction;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tie an action to a JButton, without using the icon or text of the action for the button.
|
* Tie an action to a JButton, without using the icon or text of the action for the button.
|
||||||
*
|
*
|
||||||
@ -1205,5 +1212,32 @@ public class RocketActions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private class ExportOBJAction extends RocketAction {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public ExportOBJAction() {
|
||||||
|
this.putValue(NAME, trans.get("RocketActions.ExportOBJAct.ExportOBJ"));
|
||||||
|
this.putValue(SMALL_ICON, Icons.EXPORT_3D);
|
||||||
|
this.putValue(SHORT_DESCRIPTION, trans.get("RocketActions.ExportOBJAct.ttip.ExportOBJ"));
|
||||||
|
clipboardChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
List<RocketComponent> components = selectionModel.getSelectedComponents();
|
||||||
|
if (components.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ComponentConfigDialog.disposeDialog();
|
||||||
|
parentFrame.exportWavefrontOBJAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clipboardChanged() {
|
||||||
|
List<RocketComponent> components = selectionModel.getSelectedComponents();
|
||||||
|
this.setEnabled(!components.isEmpty());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user