Skip to content

Commit

Permalink
Update path connected renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperHackio committed Feb 17, 2024
1 parent e7fd65d commit 3807273
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/whitehole/editor/GalaxyEditorForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -2438,6 +2438,7 @@ private void offsetSelectionBy(Vec3f delta, boolean isShiftKey) {
pnlObjectSettings.repaint();
rerenderTasks.add(String.format("path:%1$d", selectedPathPoint.path.uniqueID));
rerenderTasks.add("zone:"+selectedPathPoint.path.stage.stageName);
rerenderPathOwners(selectedPathPoint.path);
} else {
//if(selectedObj instanceof StageObj)
// return;
Expand Down Expand Up @@ -4474,4 +4475,21 @@ public int getValidSwitchInGalaxy() {
public Set<Integer> getUniqueSwitchesInZone() {
return curZoneArc.getUniqueSwitchesInZone();
}

public void rerenderPathOwners(PathObj path)
{
for (AbstractObj obj : globalObjList.values())
{
if (obj.renderer == null)
continue;

if (!obj.renderer.hasPathConnection())
continue;

if (AbstractObj.isUsingPath(obj, path))
{
addRerenderTask("object:"+Integer.toString(obj.uniqueID));
}
}
}
}
1 change: 1 addition & 0 deletions src/whitehole/rendering/GLRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public void render(RenderInfo info) throws GLException {}
public boolean hasSpecialPosition() { return false; }
public boolean hasSpecialRotation() { return false; }
public boolean hasSpecialScaling() { return false; }
public boolean hasPathConnection() { return false; }
public boolean boundToPathId() { return false; }
public boolean boundToObjArg(int arg) { return false; }
public boolean boundToProperty() { return false; }
Expand Down
2 changes: 2 additions & 0 deletions src/whitehole/rendering/GravityShapeRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ public boolean isScaled() {
@Override
public boolean hasSpecialScaling() { return true; }
@Override
public boolean hasPathConnection() { return shape == Shape.WIRE_RANGE; }
@Override
public boolean boundToPathId() { return shape == Shape.WIRE_RANGE; }
@Override
public boolean boundToObjArg(int arg) { return true; }
Expand Down
12 changes: 12 additions & 0 deletions src/whitehole/smg/object/AbstractObj.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,4 +371,16 @@ else if(obj.data.containsKey("CommonPath_ID"))
}
return null; //Path not found!
}

public static boolean isUsingPath(AbstractObj obj, PathObj path)
{
if (obj == null || path == null)
return false;
if (obj instanceof PathPointObj)
return ((PathPointObj)obj).path == path; //We want a reference comparison
if(!obj.data.containsKey("CommonPath_ID"))
return false;
int pathid = (short)obj.data.get("CommonPath_ID");
return obj.stage == path.stage && pathid == path.pathID;
}
}

0 comments on commit 3807273

Please sign in to comment.