Skip to content

Commit

Permalink
Merge pull request #280 from simlu/develop
Browse files Browse the repository at this point in the history
Fixes for Chinese Translation, Added Object Origin
  • Loading branch information
simlu authored Feb 28, 2018
2 parents 2addd5f + 6d0c625 commit e490c2d
Show file tree
Hide file tree
Showing 19 changed files with 409 additions and 259 deletions.
1 change: 0 additions & 1 deletion .idea/libraries/apachehttp.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/libraries/render.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/libraries/spring.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions resource/bundle/LangBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -471,21 +471,23 @@ help_overlay_window_shortcutManager = Shortcut Manager||\
This sub-window allows you to freely bind all your shortcuts. It is organized by sub-window. Shortcuts that always work are listed in the "Global" tab. Shortcuts that only work when the corresponding sub-window is active are listed in their separate tabs.||\
The shortcuts are not restricted to include modifies, so you can even bind single letters. Shortcuts can be easily changed by double clicking them and then pressing the desired, available shortcut.

help_overlay_window_shortcutManager_tab_texture_manager = Bind-able shortcuts for the Texture Manager sub-window.
help_overlay_window_shortcutManager_tab_texturemanager = Bind-able shortcuts for the Texture Manager sub-window.

help_overlay_window_shortcutManager_tab_3d_view = Bind-able shortcuts for the 3D View sub-window.
help_overlay_window_shortcutManager_tab_mainview = Bind-able shortcuts for the 3D View sub-window.

help_overlay_window_shortcutManager_tab_layer = Bind-able shortcuts for the Layer sub-window.

help_overlay_window_shortcutManager_tab_console = Bind-able shortcuts for the Console sub-window.

help_overlay_window_shortcutManager_tab_global = Bind-able shortcuts shortcuts that are always active.

help_overlay_window_shortcutManager_tab_left_/_yz_view = Bind-able shortcuts for the YZ View sub-window.
help_overlay_window_shortcutManager_tab_yzview = Bind-able shortcuts for the YZ View sub-window.

help_overlay_window_shortcutManager_tab_top_/_xz_view = Bind-able shortcuts for the XZ View sub-window.
help_overlay_window_shortcutManager_tab_xzview = Bind-able shortcuts for the XZ View sub-window.

help_overlay_window_shortcutManager_tab_front_/_xy_view = Bind-able shortcuts for the XY View sub-window.
help_overlay_window_shortcutManager_tab_xyview = Bind-able shortcuts for the XY View sub-window.

help_overlay_window_shortcutManager_tab_mouse = Bind-able mouse actions for Views.

# layer window

Expand Down
302 changes: 152 additions & 150 deletions resource/bundle/LangBundle_zh_CN.properties

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,21 @@ public void setFixTJunctions(boolean fixTJunctions) {

// the origin mode
public static final int ORIGIN_CROSS = 0;
public static final int ORIGIN_CENTER = 1;
public static final int ORIGIN_GLOBAL_CENTER = 1;
public static final int ORIGIN_PLANE_CENTER = 2;
public static final int ORIGIN_BOX_CENTER = 3;
public static final int ORIGIN_BOX_PLANE_CENTER = 4;
public static final int ORIGIN_LOCAL_CENTER = 5;
// setter for origin mode
private int originMode = ORIGIN_CROSS;
public final void setOriginMode(int originMode) {
this.originMode = originMode;
}
// setter for object center
private int objectCenter = ORIGIN_LOCAL_CENTER;
public final void setObjectCenter(int objectCenter) {
this.objectCenter = objectCenter;
}

// do the exporting
public final boolean export(Data data, ErrorHandlerInterface errorHandler, File colladaFile) {
Expand All @@ -138,7 +144,7 @@ public final boolean export(Data data, ErrorHandlerInterface errorHandler, File

// create data export objects
ExportDataManager exportDataManager = new ExportDataManager(
getProgressDialog(), getConsole(), data, padTextures, removeHoles, algorithm, useYUP, originMode,
getProgressDialog(), getConsole(), data, padTextures, removeHoles, algorithm, useYUP, originMode, objectCenter,
forcePOT, separationMode, triangulateByColor, useVertexColoring, fixTJunctions, exportTexturedVoxels, useOverlappingUvs,
useSkewedUvs);
ColladaFileExporter colladaFileExporter = new ColladaFileExporter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ColladaFileExporter(ProgressDialog dialog, ConsoleInterface console, Expo
initXmlFile(useYUP, useVertexColoring);
// create the object in the scene
setActivity("Creating Objects...", true);
writeObjects(name);
writeObjects(name, useYUP);
if (!useVertexColoring) {
// write the texture information
setActivity("Creating Textures...", true);
Expand All @@ -70,7 +70,7 @@ public ColladaFileExporter(ProgressDialog dialog, ConsoleInterface console, Expo
}

// create the object in the scene
private void writeObjects(String name) {
private void writeObjects(String name, boolean useYUP) {
String cleanName = name.replace(" ", "_").replaceAll("[^a-zA-Z0-9_\\-\\.]", "");
String[] layerNames = exportDataManager.getLayerNames();
HashSet<String> knownObjectIds = new HashSet<>();
Expand All @@ -94,7 +94,9 @@ private void writeObjects(String name) {
"type=NODE"
});
xmlFile.addAttrAndTextContent("translate", new String[]{"sid=location"},
(-objectScale * offset[0] * 2) + " " + (-objectScale * offset[2] * 2) + " " + (-objectScale * offset[1] * 2));
(-objectScale * offset[0] * 2) + " " +
(-objectScale * (useYUP ? offset[1] : offset[2]) * 2) + " " +
(-objectScale * (useYUP ? -offset[2] : offset[1]) * 2));
xmlFile.addAttrAndTextContent("rotate[-1]", new String[]{"sid=rotationZ"}, "0 0 1 0");
xmlFile.addAttrAndTextContent("rotate[-1]", new String[]{"sid=rotationY"}, "0 1 0 0");
xmlFile.addAttrAndTextContent("rotate[-1]", new String[]{"sid=rotationX"}, "1 0 0 0");
Expand Down
55 changes: 53 additions & 2 deletions src/main/java/com/vitco/app/export/generic/ExportDataManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public class ExportDataManager extends ProgressReporter {
// the origin mode
private final int originMode;

// the object center
private final int objectCenter;

// whether to export textured voxels
private final boolean exportTexturedVoxels;

Expand All @@ -73,7 +76,7 @@ public final float[][] getOffsets() {
result[i] = centers.get(i).clone();
float[] entry = result[i];
switch (originMode) {
case ColladaExportWrapper.ORIGIN_CENTER:
case ColladaExportWrapper.ORIGIN_GLOBAL_CENTER:
entry[0] -= center[0];
entry[1] -= center[1];
entry[2] -= center[2];
Expand Down Expand Up @@ -140,7 +143,7 @@ public final TriTextureManager getTextureManager() {

// constructor
public ExportDataManager(ProgressDialog dialog, ConsoleInterface console, Data data, boolean usePadding, boolean removeHoles, int algorithm, boolean useYUP,
int originMode, boolean forcePOT, int separationMode, boolean triangulateByColor, boolean useVertexColoring, boolean fixTJunctions,
int originMode, int objectCenter, boolean forcePOT, int separationMode, boolean triangulateByColor, boolean useVertexColoring, boolean fixTJunctions,
boolean exportTexturedVoxels, boolean useOverlappingUvs, boolean useSkewedUvs) {
super(dialog, console);

Expand Down Expand Up @@ -241,11 +244,15 @@ public ExportDataManager(ProgressDialog dialog, ConsoleInterface console, Data d
this.removeHoles = removeHoles;
this.useYUP = useYUP;
this.originMode = originMode;
this.objectCenter = objectCenter;
this.triangulateByColor = triangulateByColor;
this.fixTJunctions = fixTJunctions;
this.exportTexturedVoxels = exportTexturedVoxels;
this.useSkewedUvs = useSkewedUvs;

// rewrite centers for different modes
rewriteCenters();

// pre-compute exterior hole if necessary
if (removeHoles) {
for (HullManagerExt<Voxel> hullManager : hullManagers) {
Expand Down Expand Up @@ -274,6 +281,50 @@ public ExportDataManager(ProgressDialog dialog, ConsoleInterface console, Data d
}
}

private void rewriteCenters() {
switch (objectCenter) {
case ColladaExportWrapper.ORIGIN_GLOBAL_CENTER:
for (float[] c : centers) {
c[0] = center[0];
c[1] = center[1];
c[2] = center[2];
}
break;
case ColladaExportWrapper.ORIGIN_PLANE_CENTER:
for (float[] c : centers) {
c[0] = center[0];
c[1] = 0.5f;
c[2] = center[2];
}
break;
case ColladaExportWrapper.ORIGIN_BOX_CENTER:
for (float[] c : centers) {
c[0] = DynamicSettings.VOXEL_PLANE_SIZE_X % 2 == 0 ? -0.5f : 0f;
c[1] = 0.5f - DynamicSettings.VOXEL_PLANE_RANGE_Y;
c[2] = DynamicSettings.VOXEL_PLANE_SIZE_Z % 2 == 0 ? -0.5f : 0f;
}
break;
case ColladaExportWrapper.ORIGIN_BOX_PLANE_CENTER:
for (float[] c : centers) {
c[0] = DynamicSettings.VOXEL_PLANE_SIZE_X % 2 == 0 ? -0.5f : 0f;
c[1] = 0.5f;
c[2] = DynamicSettings.VOXEL_PLANE_SIZE_Z % 2 == 0 ? -0.5f : 0f;
}
break;
case ColladaExportWrapper.ORIGIN_CROSS:
for (float[] c : centers) {
c[0] = 0;
c[1] = 0;
c[2] = 0;
}
break;
case ColladaExportWrapper.ORIGIN_LOCAL_CENTER:
break;
default:
break;
}
}

// make sure that the polygon has no 3D t-junction problems
private short[][][] fix3DTJunctionProblems(HullManagerExt<Voxel> hullManager, short[][][] polys, short plane, short planeAbove, int id1, int id2, int id3, int minA, int minB) {
// result array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ public JCustomScrollPane(Component view, int vsbPolicy, int hsbPolicy) {
init();
}

public JCustomScrollPane(Component view) {
public JCustomScrollPane(String name, Component view) {
super(view);
init();
this.setName(name);
}

public JCustomScrollPane(int vsbPolicy, int hsbPolicy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ public void colorChanged(float[] hsb) {
cmykTab.addColorChangeListener(ccl);

// add the tabs
JCustomScrollPane RGBscrollPane = new JCustomScrollPane(rgbTab);
JCustomScrollPane RGBscrollPane = new JCustomScrollPane("rgb", rgbTab);
RGBscrollPane.setHorizontalScrollBarPolicy(JCustomScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
RGBscrollPane.setVerticalScrollBarPolicy(JCustomScrollPane.VERTICAL_SCROLLBAR_NEVER);
tabbedPane.addTab("RGB", RGBscrollPane);

JCustomScrollPane HSBscrollPane = new JCustomScrollPane(hsbTab);
JCustomScrollPane HSBscrollPane = new JCustomScrollPane("hsb", hsbTab);
HSBscrollPane.setHorizontalScrollBarPolicy(JCustomScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
HSBscrollPane.setVerticalScrollBarPolicy(JCustomScrollPane.VERTICAL_SCROLLBAR_NEVER);
tabbedPane.addTab("HSB", HSBscrollPane);

JCustomScrollPane CMYKscrollPane = new JCustomScrollPane(cmykTab);
JCustomScrollPane CMYKscrollPane = new JCustomScrollPane("cmyk", cmykTab);
CMYKscrollPane.setHorizontalScrollBarPolicy(JCustomScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
CMYKscrollPane.setVerticalScrollBarPolicy(JCustomScrollPane.VERTICAL_SCROLLBAR_NEVER);
tabbedPane.addTab("CMYK", CMYKscrollPane);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ScrollPane extends JCustomScrollPane {
public boolean autoShow = true; // true iff auto showing is enabled
public boolean tempScrollStop = false; // true iff user scrolls (disable auto scroll!)
public ScrollPane(JComponent component) {
super(component);
super("console", component);
}
}
final ScrollPane scrollPane = new ScrollPane(textArea);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ public void performAction() {
table.getColumnModel().getColumn(0).setCellEditor(cellEditor);

// container for table
JCustomScrollPane pane = new JCustomScrollPane(table);
JCustomScrollPane pane = new JCustomScrollPane("layers", table);
pane.setBorder(BorderFactory.createMatteBorder(1,1,0,1,VitcoSettings.DEFAULT_BORDER_COLOR));
result.add(pane, BorderLayout.CENTER);

Expand Down
Loading

0 comments on commit e490c2d

Please sign in to comment.