Skip to content

Commit

Permalink
fix incorrect uv drag&drop speeds on non 2:1 pixel density textures
Browse files Browse the repository at this point in the history
  • Loading branch information
tyronx committed Oct 10, 2021
1 parent d1a70f0 commit 1df5791
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
6 changes: 2 additions & 4 deletions build.xml
Expand Up @@ -6,12 +6,11 @@
<property name="dir.buildfile" value="."/>
<property name="dir.workspace" value="C:/Users/Tyron/eclipse-workspace"/>
<property name="dir.jarfile" value="${dir.buildfile}/output-jar"/>

<target name="create_run_jar">
<jar destfile="${dir.jarfile}/vsmodelcreator.jar">
<manifest>
<attribute name="Main-Class" value="at.vintagestory.modelcreator.Start"/>
<attribute name="Class-Path" value=". vsmodelcreator_lib/gson-2.3.1.jar vsmodelcreator_lib/JTattoo-1.6.11.jar vsmodelcreator_lib/lwjgl_util.jar vsmodelcreator_lib/lwjgl.jar vsmodelcreator_lib/slick-util.jar vsmodelcreator_lib/swt.jar vsmodelcreator_lib/jar-in-jar-loader.jar"/>
<attribute name="Class-Path" value=". vsmodelcreator_lib/gson-2.3.1.jar vsmodelcreator_lib/JTattoo-1.6.11.jar vsmodelcreator_lib/lwjgl_util.jar vsmodelcreator_lib/lwjgl.jar vsmodelcreator_lib/slick-util.jar vsmodelcreator_lib/swt.jar"/>
</manifest>
<fileset dir="${dir.buildfile}/bin"/>
</jar>
Expand All @@ -22,7 +21,6 @@
<copy file="${dir.buildfile}/libs/lwjgl_util.jar" todir="${dir.jarfile}/vsmodelcreator_lib"/>
<copy file="${dir.buildfile}/libs/lwjgl.jar" todir="${dir.jarfile}/vsmodelcreator_lib"/>
<copy file="${dir.buildfile}/libs/slick-util.jar" todir="${dir.jarfile}/vsmodelcreator_lib"/>
<copy file="${dir.buildfile}/natives/windows/swt.jar" todir="${dir.jarfile}/vsmodelcreator_lib"/>
<copy file="${dir.buildfile}/libs/jar-in-jar-loader.jar" todir="${dir.jarfile}/vsmodelcreator_lib"/>
<copy file="${dir.buildfile}/libs/swt.jar" todir="${dir.jarfile}/vsmodelcreator_lib"/>
</target>
</project>
6 changes: 4 additions & 2 deletions src/at/vintagestory/modelcreator/ModelCreator.java
Expand Up @@ -1146,8 +1146,10 @@ public void run() {
}});
} else {

if (FaceTexturePanel.dlg != null && FaceTexturePanel.dlg.IsOpened()) {
FaceTexturePanel.dlg.onTextureLoaded(isNew, errormessage, texture);
if (FaceTexturePanel.dlg != null) {
if (FaceTexturePanel.dlg.IsOpened()) {
FaceTexturePanel.dlg.onTextureLoaded(isNew, errormessage, texture);
}
}

}
Expand Down
7 changes: 4 additions & 3 deletions src/at/vintagestory/modelcreator/gui/left/LeftUVSidebar.java
Expand Up @@ -636,8 +636,11 @@ public void onMouseDownOnPanel()
int yMovement = 0;
TextureEntry texEntry = null;

if (!ModelCreator.currentProject.EntityTextureMode && grabbedFaceIndex >= 0) {
if (grabbedFaceIndex >= 0) {
texEntry = grabbedElement.getAllFaces()[grabbedFaceIndex].getTextureEntry();
}

if (!ModelCreator.currentProject.EntityTextureMode && grabbedFaceIndex >= 0) {
Sized texSize = GetBlockTextureModeTextureSize(texEntry == null ? null : texEntry.code);
texBoxWidth = (int)texSize.W;
texBoxHeight = (int)texSize.H;
Expand Down Expand Up @@ -707,12 +710,10 @@ public void onMouseDownOnPanel()


if (xMovement != 0) {
//this.lastMouseX += (int)((int)(mousedx / sectionWidth) * sectionWidth);
this.lastMouseX += xMovement * sectionWidth; // Add *sectionWidth because otherwise the rect moves too quickly
}

if (yMovement != 0) {
//this.lastMouseY += (int)((int)(mousedy / sectionHeight) * sectionHeight); - why so weird? this causes weird continous sliding effects on a 48x144 texture
this.lastMouseY += yMovement * sectionHeight;
}

Expand Down

0 comments on commit 1df5791

Please sign in to comment.