potential window fix
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2025-05-29 18:57:00 -04:00
parent bc29ea728e
commit 557b6da7de
3 changed files with 24 additions and 12 deletions

View File

@ -2068,6 +2068,7 @@ Fix string carousels
Fix sprint animation data
Color uniform on meshes
Fall and gravity tree fixes
Potential window fix

View File

@ -94,13 +94,24 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
* NOTE: It should always be set to the current size of the window (width, height)
* NOTE: It is updated every time the applyYoga function is called
*/
long parentWindowYogaNode = -1;
long parentWindowYogaNode = Element.UNINITIALIZED_ID;
/**
* The frame decoration texture path
*/
String frameDecoration = AssetDataStrings.UI_FRAME_TEXTURE_DEFAULT_1;
public int width = 1;
public int height = 1;
public int absoluteX = 0;
public int absoluteY = 0;
public boolean visible = false;
//the yoga node id
long yogaNode = Element.UNINITIALIZED_ID;
/**
* Constructor
* @param showDecorations
@ -376,14 +387,6 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
Yoga.YGNodeStyleSetMinHeightPercent(yogaNode, percent);
}
public int width = 1;
public int height = 1;
public int absoluteX = 0;
public int absoluteY = 0;
public boolean visible = false;
public int getWidth() {
return width;
}
@ -432,9 +435,6 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
Yoga.YGNodeStyleSetMargin(this.yogaNode, Yoga.YGEdgeLeft, marginLeft);
}
//the yoga node id
long yogaNode = -1;
@Override
public long getYogaNode() {
return yogaNode;
@ -634,6 +634,12 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
if(child.getParent() != null){
throw new Error("Child has a parent!");
}
if(parentWindowYogaNode == Element.UNINITIALIZED_ID){
throw new Error("parent id undefined! " + parentWindowYogaNode);
}
if(yogaNode == Element.UNINITIALIZED_ID){
throw new Error("window yoga id undefined! " + yogaNode);
}
childList.add(child);
child.setParent(this);
if(child instanceof DrawableElement){

View File

@ -6,6 +6,11 @@ import electrosphere.renderer.ui.events.Event;
public interface Element {
/**
* An uninitialized yoga node
*/
public static final long UNINITIALIZED_ID = -1;
/**
* A yoga element that either hasn't been created or has already been destroyed
*/