Skip to content

Commit

Permalink
Merge pull request #22 from Fexcraft/texture-groups
Browse files Browse the repository at this point in the history
Texture groups
  • Loading branch information
Fexcraft authored Apr 22, 2020
2 parents 03d211c + fd09f8a commit 12c8e6c
Show file tree
Hide file tree
Showing 45 changed files with 2,179 additions and 1,169 deletions.
Binary file added logs/2020-04/legui-04-04-2020-1.log.gz
Binary file not shown.
Binary file added logs/2020-04/legui-04-04-2020-2.log.gz
Binary file not shown.
39 changes: 27 additions & 12 deletions resources/lang/default.lang
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ toolbar.utils.mirror_sel=Mir.Sel. (ONE-TIME)
toolbar.utils.controls=Controls
toolbar.editor=Editors
toolbar.editor.hide_all=Hide All
toolbar.editor.general=General Editor
toolbar.editor.model_group=Model/Group
toolbar.editor.general=Polygon Editor
toolbar.editor.group=Group Editor
toolbar.editor.model=Model Editor
toolbar.editor.texture=Texture Editor
toolbar.editor.preview=Preview/Helper
toolbar.shapelist=Polygons
Expand All @@ -48,15 +49,10 @@ toolbar.shapelist.add_group=Add Group
toolbar.shapelist.add_marker=Add Marker
toolbar.shapelist.add_voxel=Add Voxel(16)
toolbar.textures=Texture
toolbar.textures.select=Select
toolbar.textures.select.dialog=Select a Texture File.
toolbar.textures.edit=Edit (External)
toolbar.textures.texture_map=Tex. Map (WIP)
toolbar.textures.remove=Remove/Unload
toolbar.textures.texpos_reset=Reset Tex.Pos.
toolbar.textures.texpos_reset.done=Texture Positions Reset.
toolbar.textures.auto_position=Auto Tex.Pos.
toolbar.textures.generate=Generate New
toolbar.textures.manage=Manage Textures
toolbar.textures.addnew=Add New TexGroup
toolbar.textures.texpos_reset=Reset U/V
toolbar.textures.auto_position=Auto Pos. U/V
toolbar.helpers=Helpers
toolbar.helpers.view=View Loaded
toolbar.helpers.load_fmtb=Load FMTB
Expand Down Expand Up @@ -84,7 +80,7 @@ editor.general.attributes.new_group.cancel=Cancel
editor.general.attributes.type=Polygon Type
editor.general.attributes.painttotexture=Burn to Texture
editor.general.attributes.painttotexture.notex=There is no texture loaded.
editor.general.attributes.painttotexture.tex_not_found=Texture not found in Memory. This rather bad.
editor.general.attributes.painttotexture.tex_not_found=Texture not found in Memory. This is rather bad.
editor.general.shape=General Shape
editor.general.shape.size=Measurements / Size
editor.general.shape.position=Position (x/y/z)
Expand Down Expand Up @@ -140,6 +136,11 @@ editor.model_group.group.add_animator=Add Animator
editor.model_group.group.animator_settings=Animator Settings
editor.model_group.group.export_offset=Export Offset/Translation
editor.model_group.animations=Animations in first selected Group
editor.model_group.authors=Authors/Creators List
editor.model_group.authors.add=Add Author/Creator
editor.model_group.authors.add.dialog=Enter Name of the Author/Creator
editor.model_group.authors.add_self=Add Self to List
editor.model_group.authors.error_locked=Only one of the "locked" Authors can edit the List.
editor.preview.container=General Settings
editor.preview.container.position_full=Position (full units)
editor.preview.container.position_sixteenth=Position (1/16th)
Expand Down Expand Up @@ -214,6 +215,15 @@ tree.polygon.remove_polygon=Remove this polygon?
tree.helper.counter=Helpers/Previews:
tree.fvtm.counter=Groups in Model:
tree.fvtm.remove_animation=Remove this Animation?
tree.textures.counter=Active Texture Groups:
tree.textures.select=Select Texture File
tree.textures.select.dialog=Select a Texture File.
tree.textures.generate=Generate Texture Template
tree.textures.rename=Rename Texture Group
tree.textures.rename.dialog=Set new Texture Group Name/ID
tree.textures.remove_default=Default Model Texture Group can not be removed.
tree.textures.remove_in_use=Texture Group is still in use!
tree.textures.group_added=New Texture group added!

# Profile Box / Login Box
profile.title=Profile Overview
Expand Down Expand Up @@ -266,13 +276,18 @@ helper_collector.load_frame.errors=Errors occured while creating frame.
# Texture Updater / Util
texture_update.autopos.title=Texture Auto Positioner
texture_update.autopos.info=This process may mark FMT as not responding.
texture_update.autopos.polygroup=Polygon Group to process:
texture_update.autopos.savespace=Use save-space mode? (may reduce readability)
texture_update.autopos.process_all=Only process polygons with 0, 0 texture pos?
texture_update.autopos.start=Start
texture_update.autopos.processing=Processing: %s:%s
texture_update.autopos.complete=Auto texture positioning Complete!
texture_update.resize.exceeding_4096=Exceeding 4096 pixel! Exceeding 4096 pixel!
texture_update.resize.success=Resized!
texture_update.texpos_reset.title=Texture Position Resetter
texture_update.texpos_reset.info=This resets polygon U/V values to 0, 0 !
texture_update.texpos_reset.polygroup=Polygon Group to process:
texture_update.texpos_reset.done=Texture Positions Reset Successfully.

# Errors
error.dialog_title=Error
Expand Down
Binary file removed resources/textures/icons/arrow_decrease.png
Binary file not shown.
Binary file removed resources/textures/icons/arrow_increase.png
Binary file not shown.
Binary file removed resources/textures/icons/editors/expanded.png
Binary file not shown.
Binary file removed resources/textures/icons/editors/minimized.png
Binary file not shown.
Binary file removed resources/textures/icons/editors/shapebox_editor.png
Binary file not shown.
Binary file modified resources/textures/icons/editors/texture/pixel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed resources/textures/icons/fileselector_next.png
Binary file not shown.
Binary file removed resources/textures/icons/fileselector_prev.png
Binary file not shown.
Binary file added resources/textures/icons/locked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed resources/textures/icons/pencil.png
Binary file not shown.
Binary file added resources/textures/icons/unlocked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 55 additions & 23 deletions src/net/fexcraft/app/fmt/FMTB.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
import net.fexcraft.app.fmt.porters.PorterManager;
import net.fexcraft.app.fmt.ui.UserInterfaceUtils;
import net.fexcraft.app.fmt.ui.editor.Editors;
import net.fexcraft.app.fmt.ui.editor.ModelEditor;
import net.fexcraft.app.fmt.ui.editor.TextureEditor;
import net.fexcraft.app.fmt.ui.field.Field;
import net.fexcraft.app.fmt.ui.field.TextField;
import net.fexcraft.app.fmt.ui.tree.Trees;
Expand Down Expand Up @@ -269,10 +271,17 @@ public void invoke(long window, double xoffset, double yoffset){
renderer = new NvgRenderer();
renderer.initialize();
Settings.updateTheme();
ModelEditor.creators.refresh();
//
PorterManager.load(); HelperCollector.reload(loadedold);
SessionHandler.checkIfLoggedIn(true, true); checkForUpdates();
KeyCompound.init(); KeyCompound.load(); FMTB.MODEL.updateFields();
PorterManager.load();
HelperCollector.reload(loadedold);
SessionHandler.checkIfLoggedIn(true, true);
checkForUpdates();
KeyCompound.init();
KeyCompound.load();
if(!loadedold){
FMTB.MODEL.updateFields();
}
//
LocalDateTime midnight = LocalDateTime.of(LocalDate.now(ZoneOffset.systemDefault()), LocalTime.MIDNIGHT);
long mid = midnight.toInstant(ZoneOffset.UTC).toEpochMilli(); long date = Time.getDate(); while((mid += Time.MIN_MS * 5) < date);
Expand All @@ -299,6 +308,7 @@ public void invoke(long window, double xoffset, double yoffset){
loop(); timer.updateUPS();
accumulator -= interval;
Trees.updateCounters();
RayCoastAway.UNLOCKED = true;
}
render(alpha = accumulator / interval);
if(!RayCoastAway.PICKING){
Expand Down Expand Up @@ -365,6 +375,10 @@ public long getTime(){
}

private void render(float alpha){
render(alpha, false);
}

private void render(float alpha, boolean pixelpass){
context.updateGlfwWindow();
Vector2i size = context.getFramebufferSize();
GL11.glClearColor(0.5f, 0.5f, 0.5f, 1);
Expand All @@ -374,28 +388,45 @@ private void render(float alpha){
//
if(Settings.oldrot()) GL11.glRotatef(180, 1, 0, 0);
GL11.glPushMatrix();
RGB.WHITE.glColorApply();
RGB.glColorReset();
if(ImageHelper.HASTASK && ImageHelper.getTaskId() == 2){
GL11.glRotatef((ImageHelper.getStage() - 20) * 10, 0, 1, 0);
}
//
if(RayCoastAway.PICKING){
MODEL.render(); GL11.glPopMatrix(); render(alpha);
if(RayCoastAway.PICKING && RayCoastAway.UNLOCKED){
if(pixelpass){
TextureManager.bindTexture(MODEL.getTempTex(RayCoastAway.lastsel));
TurboList list = RayCoastAway.lastsel.getTurboList();
RayCoastAway.lastsel.render(list.rotXb, list.rotYb, list.rotZb);
RayCoastAway.doTest(false, null, true);
}
else MODEL.render();
RayCoastAway.UNLOCKED = TextureEditor.pixelMode() ? !pixelpass : false;
GL11.glPopMatrix();
render(alpha, TextureEditor.pixelMode());
}
else{
if(Settings.floor()){
TextureManager.bindTexture("floor");
GL11.glRotatef(-90, 0, 1, 0);
GL11.glPushMatrix();
//GL11.glCullFace(GL11.GL_BACK); GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glBegin(GL11.GL_QUADS); float cs = 16, mid = Settings.oldrot() ? 1f / 16 * 10 : 1 - 0.001f;
GL11.glTexCoord2f(0, 1); GL11.glVertex3f( cs, mid, cs);
GL11.glTexCoord2f(1, 1); GL11.glVertex3f(-cs, mid, cs);
GL11.glTexCoord2f(1, 0); GL11.glVertex3f(-cs, mid, -cs);
GL11.glTexCoord2f(0, 0); GL11.glVertex3f( cs, mid, -cs);
//GL11.glCullFace(GL11.GL_FRONT_AND_BACK); GL11.glDisable(GL11.GL_CULL_FACE); //apparently the front renderer doesn't like this.
GL11.glEnd(); GL11.glPopMatrix();
GL11.glRotatef( 90, 0, 1, 0);
TextureManager.bindTexture("floor");
GL11.glRotatef(-90, 0, 1, 0);
GL11.glPushMatrix();
// GL11.glCullFace(GL11.GL_BACK);
//GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glBegin(GL11.GL_QUADS);
float cs = 16, mid = Settings.oldrot() ? 1f / 16 * 10 : 1 - 0.001f;
GL11.glTexCoord2f(0, 1);
GL11.glVertex3f(cs, mid, cs);
GL11.glTexCoord2f(1, 1);
GL11.glVertex3f(-cs, mid, cs);
GL11.glTexCoord2f(1, 0);
GL11.glVertex3f(-cs, mid, -cs);
GL11.glTexCoord2f(0, 0);
GL11.glVertex3f(cs, mid, -cs);
// GL11.glCullFace(GL11.GL_FRONT_AND_BACK);
// GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glEnd();
GL11.glPopMatrix();
GL11.glRotatef(90, 0, 1, 0);
}
if(Settings.lighting()) GL11.glEnable(GL11.GL_LIGHTING);
if(Settings.cube()){
Expand Down Expand Up @@ -479,23 +510,23 @@ private void initScreenshotFrame(){
ss_frame.getContainer().add(ss_credits);
}
ss_title.getTextState().setText((Time.getDay() % 2 == 0 ? "FMT - Fexcraft Modelling Toolbox" : "FMT - Fex's Modelling Toolbox") + " [" + SessionHandler.getLicenseName() + "]");
switch(FMTB.MODEL.creators.size()){
switch(FMTB.MODEL.getAuthors().size()){
case 0: {
ss_credits.getTextState().setText(FMTB.MODEL.name + " - " + (SessionHandler.isLoggedIn() ? SessionHandler.getUserName() : "Guest User"));
break;
}
case 1: {
if(FMTB.MODEL.creators.get(0).equals(SessionHandler.getUserName())){
if(FMTB.MODEL.getAuthors().get(0).equals(SessionHandler.getUserName())){
ss_credits.getTextState().setText(FMTB.MODEL.name + " - by " + SessionHandler.getUserName());
}
else{
ss_credits.getTextState().setText(FMTB.MODEL.name + " - by " + String.format("%s (logged:%s)", FMTB.MODEL.creators.get(0), SessionHandler.getUserName()));
ss_credits.getTextState().setText(FMTB.MODEL.name + " - by " + String.format("%s (logged:%s)", FMTB.MODEL.getAuthors().get(0), SessionHandler.getUserName()));
}
break;
}
default: {
if(FMTB.MODEL.creators.contains(SessionHandler.getUserName())){
ss_credits.getTextState().setText(FMTB.MODEL.name + " - by " + SessionHandler.getUserName() + " (and " + (FMTB.MODEL.creators.size() - 1) + " others)");
if(FMTB.MODEL.getAuthors().contains(SessionHandler.getUserName())){
ss_credits.getTextState().setText(FMTB.MODEL.name + " - by " + SessionHandler.getUserName() + " (and " + (FMTB.MODEL.getAuthors().size() - 1) + " others)");
}
else{
ss_credits.getTextState().setText(FMTB.MODEL.name + " - " + String.format("(logged:%s)", SessionHandler.getUserName()));
Expand Down Expand Up @@ -637,6 +668,7 @@ public static void setModel(GroupCompound compound, boolean clearhelpers){
Trees.fvtm.reOrderGroups();
Trees.helper.reOrderGroups();
Editors.general.refreshGroups();
ModelEditor.creators.refresh();
}

}
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/porters/DFMExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public String exportModel(GroupCompound compound, File file, Map<String, Setting
pergroupinit = settings.get("per_group_init").getBooleanValue();
StringBuffer buffer = new StringBuffer();
buffer.append("//FMT-Marker DFM-" + VERSION + "\n");
for(String cr : compound.creators){
for(String cr : compound.getAuthors()){
buffer.append("//Creator: " + cr + "\n");
} buffer.append("\n");
if(settings.get("per_group_init").getBooleanValue()) buffer.append("//Using PER-GROUP-INIT mode with limit '" + settings.get("max_pg_init_count").getValue() + "'!\n");
Expand Down
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/porters/DFMImporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public GroupCompound importModel(File file, Map<String, Setting> settings){
}
matcher = creator.matcher(line);
if(matcher.matches()){
compound.creators.add(matcher.group(1));
compound.addAuthor(matcher.group(1), false, true);
continue;
}
matcher = declaration.matcher(line);
Expand Down
6 changes: 3 additions & 3 deletions src/net/fexcraft/app/fmt/porters/FVTMFormatBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public String exportModel(GroupCompound compound, File file, Map<String, Setting
}
buffer.append(tab + "public " + modelname + "(){\n");
buffer.append(tab2 + "super(); textureX = " + compound.tx(null) + "; textureY = " + compound.ty(null) + ";\n");
for(String cr : compound.creators){
for(String cr : compound.getAuthors()){
buffer.append(tab2 + "this.addToCreators(\"" + cr + "\");\n");//TODO add "uuid" of logged in users if available;
} buffer.append(tab2 + "//\n");
if(pergroupinit){
Expand Down Expand Up @@ -266,8 +266,8 @@ else if(cyl.radius2 != 0f){
shape.append("\n" + tab3 + ".setMirrored(" + wrapper.mirror + ").setFlipped(" + wrapper.flip + ")");
extended = true;
}
if(this.extended && (compound.texture != null || !wrapper.visible)){
shape.append("\n" + tab3 + ".setTextured(" + (compound.texture != null) + ").setLines(" + !wrapper.visible + ")");
if(this.extended && (compound.texgroup != null || !wrapper.visible)){
shape.append("\n" + tab3 + ".setTextured(" + (compound.texgroup != null) + ").setLines(" + !wrapper.visible + ")");
extended = true;
}
if(wrapper.name != null){ shape.append(".setName(\"" + wrapper.name + "\")"); }
Expand Down
Loading

0 comments on commit 12c8e6c

Please sign in to comment.