Skip to content

Conversation

@thecozies
Copy link
Contributor

This system allows you to select certain objects to render with an sm64 room. It shows up as a UI list on room empties! I've created an example/demo blend file on how its used and I'll show some screenshots of the UI.

Test level:
image

Here I have room 2 inside of room 1:
image
The Room1 empty is the first item, which renders all of the children of room1, then the room3 exterior is rendered as well.

Room1 renders the outer box of room 2 and room 3:
image

Since room 3 is transitional, it renders the entirety of room 1 and room 4
image

Room 4 just renders the outer box of room 3
image

Its pretty simple to set this up, and requires you to use zero duplicates, and also lets you decide on how things should be ordered.

A more complex example of this would be the level I was working on that has 11 different rooms, and runs well on console. I was developing this feature alongside of this level so it is pretty well-tested as is.
image

Also:
image

@thecozies
Copy link
Contributor Author

@thecozies thecozies changed the title Created new room system for exporting with additional objects [SM64] Created new room system for exporting with additional objects Oct 13, 2022
@thecozies thecozies added the sm64 Has to do with the Super Mario 64 side label Oct 13, 2022
return obj


def get_collection_props_from_context(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what this does
Looks recursive?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah its using period separated props to grab a nested property that has to do with the collection in the list.
base_path - path to where the collection property is
collection_name - name of the collection property
index_name - name of an additional property you need to add that tracks the index of the currently selected item (for reordering, deleting, etc)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copying from discord so it doesn't get lost

collection_name: tuple[str], # from base path, collection prop
the comment is only for collection_name[0]

collection_name -> collection_paths
index_name -> index_paths
would also be clearer imo

and the function needs an explanation of what it's doing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@thecozies thecozies requested a review from Dragorn421 November 1, 2022 13:20
return f"{base_list_name}.move_item"

def move_index(self):
"""Move index of an item render queue while clamping it."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

item render queue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i just rewrote that, my brain must have broke when originally writing that comment

"""Move index of an item render queue while clamping it."""
collection_base, collection, index = self.get_collection()

list_length = len(collection) - 1 # (index starts at 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what?
maybe this should be named max_index or last_index ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah makes much more sense. done


list_length = len(collection) - 1 # (index starts at 0)
new_index = index + (-1 if self.direction == "UP" else 1)
setattr(collection_base, self.index_name[-1], max(0, min(new_index, list_length)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this assumes index_name[-1] is not a dot_path like get_collection_props_from_context suggests it is?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in a7fc76b

@thecozies thecozies requested a review from Dragorn421 November 4, 2022 13:45
Copy link
Contributor

@Dragorn421 Dragorn421 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test this, just looked at the code. This has been tested by others and is said to work well

@Dragorn421 Dragorn421 added the merge soon Will be merged in a few days at most if nothing else comes up label Nov 14, 2022
@kurethedead
Copy link
Contributor

If the room empties are not at the same location, then the additional object transforms are incorrect in a room. Otherwise, the code itself seems to be good.

@Dragorn421 Dragorn421 added waiting for author Waiting for the author to answer questions, do changes, ... and removed merge soon Will be merged in a few days at most if nothing else comes up labels Nov 16, 2022
@jesusyoshi54
Copy link
Collaborator

jesusyoshi54 commented May 8, 2023

Hello great cozies.
In regards to potential bleed conflicts, please see this line in the geo layout bleed class: https://github.com/Fast-64/fast64/blob/main/fast64_internal/sm64/sm64_geolayout_classes.py#L470
There is already a check for if rooms are used or not going into this that can be substituted with an updated check for shared rooms. In the bleed behavior, if there is any conflict with how things work due to shared rooms, please remove lastMat from the referenced line if use_rooms is true. This will make all geo calls work independently, and thus make all meshes draw properly in any order.

@Dragorn421
Copy link
Contributor

Hasty merge of fast64/main into this branch for reference https://github.com/Dragorn421/fast64/tree/sm64/room_improvements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sm64 Has to do with the Super Mario 64 side waiting for author Waiting for the author to answer questions, do changes, ...

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants