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

Implement cuboid variable! #1475

Merged
merged 1 commit into from
Jan 6, 2025
Merged

Implement cuboid variable! #1475

merged 1 commit into from
Jan 6, 2025

Conversation

Pablete1234
Copy link
Member

@Pablete1234 Pablete1234 commented Jan 5, 2025

Is it a region? is it a variable? is it a filter?
It's all of them!

This pr introduces a cuboid variable type:

<variables>
  <cuboid id="your_cuboid" min="1,1,1" max="2,2,2"/>
</variables>

This variable can be used in most places that accept a region or filter, but it is also mutable via actions just like other variables.

<set var="your_cuboid.min_x" value="-5"/>

Additionally these can be be used as an indexed variable (ie: like arrays):

<set var="your_cuboid" index="0" value="-5"/>

the "indexes" would be min_x = 0, min_y = 1, min_z = 2, max_x = 3, max_y =4, max_z = 5, but generally speaking you're better off just using the sub-variables ie your_cuboid.min_x instead.

One such of a time when addressing with indexes could be used would be copying, eg:

<variables>
  <cuboid id="idx" scope="match"/>
  <cuboid id="cuboid_a" min="1,1,1" max="2,2,2"/>
  <cuboid id="cuboid_b" min="1,1,1" max="2,2,2"/>
</variables>
<actions>
  <action id="copy-a-into-b">
    <set var="idx" value="0"/>
    <repeat times="6">
      <set var="cuboid_b" index="idx" value="cuboid_a[idx]"/>
    </repeat>
  </action>
</actions>

Signed-off-by: Pablo Herrera <[email protected]>
@Pablete1234 Pablete1234 merged commit 625c0f4 into dev Jan 6, 2025
2 checks passed
@Pablete1234 Pablete1234 deleted the region-variables branch January 6, 2025 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants