Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed nil behavior with setVisible #258

Open
wants to merge 1 commit into
base: 1.20
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ public FiguraModelPart matrix(@LuaNotNil FiguraMat4 matrix) {
@LuaMethodDoc("model_part.get_visible")
public boolean getVisible() {
FiguraModelPart part = this;
while (part != null && part.customization.visible == null)
while (part != null && part.customization.visible == true)
part = part.parent;
return part == null || part.customization.visible;
}
Expand All @@ -636,13 +636,13 @@ public boolean getVisible() {
aliases = "visible",
value = "model_part.set_visible"
)
public FiguraModelPart setVisible(Boolean bool) {
public FiguraModelPart setVisible(boolean bool) {
this.customization.visible = bool;
return this;
}

@LuaWhitelist
public FiguraModelPart visible(Boolean bool) {
public FiguraModelPart visible(boolean bool) {
return setVisible(bool);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class PartCustomization {
public final FiguraMat3 normalMatrix = FiguraMat3.of();

public boolean needsMatrixRecalculation = false;
public Boolean visible = null;
public boolean visible = true;
public Boolean vanillaVisible = null;

private final FiguraVec3 position = FiguraVec3.of();
Expand Down Expand Up @@ -351,7 +351,7 @@ public void modify(PartCustomization other) {
if (other.secondaryRenderType != null)
setSecondaryRenderType(other.secondaryRenderType);

if (other.visible != null)
// if (other.visible != null)
visible = other.visible;

if (other.vanillaVisible != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected int commonRender(double vertOffset) {
int[] remainingComplexity = new int[] {prev};

// render all model parts
if (root.customization.visible == null || root.customization.visible) {
if (root.customization.visible) {
if (currentFilterScheme.parentType.isSeparate) {
List<FiguraModelPart> parts = separatedParts.get(currentFilterScheme.parentType);
if (parts != null) {
Expand Down Expand Up @@ -208,7 +208,7 @@ protected boolean renderPart(FiguraModelPart part, int[] remainingComplexity, bo
// test the current filter scheme
FiguraMod.pushProfiler("predicate");
Boolean thisPassedPredicate = currentFilterScheme.test(part.parentType, prevPredicate);
if (thisPassedPredicate == null || (custom.visible != null && !custom.visible)) {
if (thisPassedPredicate == null || (!custom.visible)) {
if (part.parentType.isRenderLayer)
part.savedCustomization = customizationStack.peek();
FiguraMod.popProfiler(2);
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/resources/assets/figura/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -1245,8 +1245,8 @@
"figura.docs.model_part.get_normal_matrix": "Recalculates the normal matrix for this model part, based on its current position, rotation, scale, and pivot, then returns this matrix",
"figura.docs.model_part.get_normal_matrix_raw": "Returns the normal matrix for this model part\nThe Raw version of the function is different in that it doesn't recalculate the matrix before returning it",
"figura.docs.model_part.set_matrix": "Sets the given matrix as the position matrix for this model part\nThe normal matrix is automatically calculated as the inverse transpose of this matrix\nCalling this DOES NOT CHANGE the values of position, rot, or scale in the model part\nIf you call setPos() or a similar function, the effects of setMatrix() will be overwritten",
"figura.docs.model_part.get_visible": "Gets whether or not this model part is visible\nThe default value is nil, meaning it copies the visibility of its parent part during rendering",
"figura.docs.model_part.set_visible": "Sets this part to be visible or invisible\nThe default value is nil, meaning the part copies its visibility from its parent part",
"figura.docs.model_part.get_visible": "Gets whether or not this model part is visible\nWorks recursivly. If a parent of this part is invisible, this part will also return false",
"figura.docs.model_part.set_visible": "Sets this part to be visible or invisible\nChildren of invisible parts are also not visible and will not be processed",
"figura.docs.model_part.get_primary_render_type": "Gets the current primary render type of this model part\nNil by default, meaning the part copies the primary render type of its parent",
"figura.docs.model_part.get_secondary_render_type": "Gets the current secondary render type of this model part\nNil by default, meaning the part copies the secondary render type of its parent",
"figura.docs.model_part.set_primary_render_type": "Sets the current primary render type of this model part\nNil by default, meaning the part copies the primary render type of its parent during rendering\nCheck the docs enum command for all render types",
Expand Down
Loading