Skip to content

Commit

Permalink
u1->ut4: wip u1 blueprints
Browse files Browse the repository at this point in the history
  • Loading branch information
xtremexp committed Jan 26, 2023
1 parent 8767ce8 commit 5c9c4c8
Show file tree
Hide file tree
Showing 16 changed files with 159 additions and 176 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/xtx/ut4converter/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void start(Stage primaryStage) throws Exception {
this.useUbClasses = true;
}

this.useUbClasses = true;
//this.useUbClasses = true;

logger.info(PROGRAM_NAME + " " + VERSION + " started");

Expand Down
12 changes: 4 additions & 8 deletions src/main/java/org/xtx/ut4converter/SupportedClasses.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,16 @@ private void initialize() {
/*
registerUClass(T3DDecoration.class, "Seaweed", "Tree1","Tree2","Tree3","Tree4","Tree5","Tree6","Tree7", "Tree8", "Tree9", "Tree10", "Tree11", "Plant1","Plant2","Plant3","Plant4", "Plant5", "Plant6", "Plant7");
registerUClass(Barrel.class, "Barrel");
registerUClass(T3DSpecialEvent.class, "SpecialEvent");
registerUClass(T3DMusicEvent.class, "MusicEvent", "MusicScriptEvent");
registerUClass(T3DTranslatorEvent.class, "TranslatorEvent");
registerUClass(T3DCreatureFactory.class, "CreatureFactory");
registerUClass(T3DThingFactory.class, "ThingFactory");
registerUClass(T3DSpawnPoint.class, "SpawnPoint");
registerUClass(T3DAlarmPoint.class, "AlarmPoint");
registerUClass(BreakingGlass.class, "BreakingGlass");
registerUClass(ExplodingWall.class, "ExplodingWall");
*/
registerUClass(T3DAlarmPoint.class, "AlarmPoint");
registerUClass(T3DSpecialEvent.class, "SpecialEvent");
registerUClass(T3DMusicEvent.class, "MusicEvent", "MusicScriptEvent");
registerUClass(SmokeGenerator.class, "SmokeGenerator");
registerUClass(T3DDispatcher.class, "Dispatcher", "U2Dispatcher");
registerUClass(T3DCounter.class, "Counter");
Expand All @@ -174,7 +174,7 @@ private void initialize() {

if(useUbClasses ){
if(ut99LightActor == T3DLight.UE12_LightActors.TriggerLight) {
//registerUClass(T3DTriggerLight.class, ut99LightActor.name());
registerUClass(T3DTriggerLight.class, ut99LightActor.name());
} else {
registerUClass(UBLight.class, ut99LightActor.name());
}
Expand Down Expand Up @@ -255,10 +255,6 @@ private void initialize() {
uneededActors.add("UTArmorPickupLight"); // ut3
uneededActors.add("UTHealthPickupLight"); // ut3
uneededActors.add("ProscribedReachSpec"); // ut3

if (USE_CUSTOM) {
registerUClass(SpecialEvent.class, "SpecialEvent");
}
}

/**
Expand Down
28 changes: 17 additions & 11 deletions src/main/java/org/xtx/ut4converter/t3d/MoverProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,21 @@ public void writeUE3MoverActor(final StringBuilder sbf) {
* @param sbf String builder
*/
public void writeUT4MoverActor(final StringBuilder sbf) {
// Write the mover as Destination Lift
// TODO write as well matinee actor (once implementation done)
// because it's impossible to know ("guess") if a mover is a lift or
// another kind of mover (button, door, ...)
// TODO use UBMover once UBMover blueprint done
sbf.append(IDT).append("Begin Actor Class=").append(mover.t3dClass).append(" Name=").append(mover.name).append("_Lift\n");

sbf.append(IDT).append("Begin Actor Class=").append(mover.t3dClass).append(" Name=").append(mover.name).append("_Lift");

if (mover.archetype != null) {
sbf.append(" Archetype=").append(mover.archetype);
}

sbf.append("\n");

sbf.append(IDT).append("\tBegin Object Class=SceneComponent Name=\"Scene1\"\n");
sbf.append(IDT).append("\tEnd Object\n");

sbf.append(IDT).append("\tBegin Object Name=\"Scene1\"\n");
mover.writeLocRotAndScale();
sbf.append(IDT).append("\tEnd Object\n");

// if scale 3D set need to use Mesh Scale property and set scale3d to null
// else scale within game is not good at all !
Expand All @@ -330,10 +339,6 @@ public void writeUT4MoverActor(final StringBuilder sbf) {
sbf.append(IDT).append("\tMesh Scale=(X=").append(T3DActor.fmt(mover.scale3d.x)).append(",Y=").append(T3DActor.fmt(mover.scale3d.y)).append(",Z=").append(T3DActor.fmt(mover.scale3d.z)).append(")\n");
mover.scale3d = null;
}

sbf.append(IDT).append("\tBegin Object Name=\"Scene1\"\n");
mover.writeLocRotAndScale();
sbf.append(IDT).append("\tEnd Object\n");
sbf.append(IDT).append("\tScene1=Scene\n");
sbf.append(IDT).append("\tRootComponent=Scene1\n");

Expand Down Expand Up @@ -509,7 +514,8 @@ public void convert() {
}

if(mapConverter.isUseUbClasses()) {
mover.t3dClass = "UE1Mover_C";
mover.t3dClass = "UMover_C";
mover.archetype = "UMover_C'/Game/UEActors/UMover.Default__UMover_C'";
} else {
mover.t3dClass = "Generic_Lift_C";
}
Expand Down
97 changes: 0 additions & 97 deletions src/main/java/org/xtx/ut4converter/t3d/SpecialEvent.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/java/org/xtx/ut4converter/t3d/T3DAlarmPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public T3DAlarmPoint(MapConverter mc, String t3dClass) {
}

public String toT3d() {
return writeSimpleActor("UBAlarmPoint_C");
return writeSimpleActor("UAlarmPoint_C", "SceneComponent", "UAlarmPoint_C'/Game/UEActors/UAlarmPoint.Default__UAlarmPoint_C'");
}
}
4 changes: 0 additions & 4 deletions src/main/java/org/xtx/ut4converter/t3d/T3DLight.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,6 @@ public String toT3d() {
lightComp.addProp("Mobility", mobility.name());
}

// UB custome blueprints
if (this instanceof final T3DTriggerLight t3DTriggerLight && t3DTriggerLight.getInitialState() != null) {
this.addConvProperty("InitialState", "NewEnumerator" + t3DTriggerLight.getInitialState().ordinal());
}

if (this.lightEffect != null) {
this.addConvProperty("LightEffect", "NewEnumerator" + lightEffect.ordinal());
Expand Down
12 changes: 3 additions & 9 deletions src/main/java/org/xtx/ut4converter/t3d/T3DMusicEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public class T3DMusicEvent extends T3DActor {

private UPackageRessource song;

private MTran transition = MTran.MTRAN_Fade;

/**
* How fast music transition is done
Expand All @@ -25,19 +24,18 @@ public T3DMusicEvent(MapConverter mc, String t3dClass) {
registerSimpleProperty("bSilence", Boolean.class);
registerSimpleProperty("CdTrack", Short.class);
registerSimpleProperty("SongSection", Short.class);
registerSimpleProperty("Transition", MTran.class, MTran.MTRAN_Fade);

// for unreal 2 only
registerSimpleProperty("Script", String.class).clonePropertyAs("SongOriginal");
}

@Override
public boolean analyseT3DData(String line) {

if (line.startsWith("Song=")) {
this.song = mapConverter.getUPackageRessource(line.split("'")[1], T3DRessource.Type.MUSIC);
}
else if (line.startsWith("Transition=")) {
this.transition = MTran.valueOf(T3DUtils.getString(line));
}

else {
return super.analyseT3DData(line);
Expand All @@ -58,7 +56,7 @@ public void convert() {

public String toT3d() {

sbf.append(IDT).append("Begin Actor Class=MusicEvent_C \n");
sbf.append(IDT).append("Begin Actor Class=UMusicEvent_C Archetype=UMusicEvent_C'/Game/UEActors/UMusicEvent.Default__UMusicEvent_C'\n");

sbf.append(IDT).append("\tBegin Object Class=AudioComponent Name=\"LevelMusic\"\n");
sbf.append(IDT).append("\tEnd Object\n");
Expand All @@ -77,10 +75,6 @@ public String toT3d() {
sbf.append(IDT).append("\tSongOriginal=\"").append(song.getFullName(true)).append("\"\n");
}

if(transition != null){
sbf.append(IDT).append("\tTransition=NewEnumerator").append(transition.ordinal()).append("\n");
}

writeSimplePropertiesOld();

sbf.append(IDT).append("\tLevelMusic=LevelMusic\n");
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/xtx/ut4converter/t3d/T3DObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ public T3DSimpleProperty registerSimplePropertyRessource(final String propertyNa
return simpleProperty;
}

public T3DSimpleProperty registerSimpleProperty(final String propertyName, final Object classType){
public T3DSimpleProperty registerSimpleProperty(final String propertyName, final Class classType){
return registerSimpleProperty(propertyName, classType, null);
}

public void registerSimpleArrayProperty(final String propertyName, final Object classType){
public void registerSimpleArrayProperty(final String propertyName, final Class classType){
final T3DSimpleProperty simpleProperty = new T3DSimpleProperty(propertyName, classType, null, true);
this.registeredProperties.add(simpleProperty);
}
Expand All @@ -134,7 +134,7 @@ public void registerSimpleArrayProperty(final String propertyName, final Object
* @param propertyName Property name
* @param classType Type of property (String, Float, or other)
*/
public T3DSimpleProperty registerSimpleProperty(final String propertyName, final Object classType, final Object defaultValue){
public T3DSimpleProperty registerSimpleProperty(final String propertyName, final Class classType, final Object defaultValue){
final T3DSimpleProperty simpleProperty = new T3DSimpleProperty(propertyName, classType, defaultValue, false);
this.registeredProperties.add(simpleProperty);
return simpleProperty;
Expand All @@ -143,13 +143,13 @@ public T3DSimpleProperty registerSimpleProperty(final String propertyName, final
@Deprecated
void writeSimplePropertiesOld(){
for(final T3DSimpleProperty simpleProperty : this.registeredProperties){
simpleProperty.writeProperty(sbf, mapConverter);
simpleProperty.writeProperty(sbf);
}
}

void writeSimpleProperties(StringBuilder sb){
for(final T3DSimpleProperty simpleProperty : this.registeredProperties){
simpleProperty.writeProperty(sb, mapConverter);
simpleProperty.writeProperty(sb);
}
}

Expand Down
Loading

0 comments on commit 5c9c4c8

Please sign in to comment.