▲ 14 r/bevy

To &query or not the &query?

Hey! I'm very new to Rust and Bevy, so following along with the Bevy quickstart and taking time to learn when I see something new. I'm at the step where I'm making one of the first systems:

fn greet_people(query: Query<&Name, With<Person>>) {
    for name in &query {
        println!("hello {}!", name.0);
    }
}

Here I took the time to learn a bit about &, how &Name is a reference to the Name component, and &query borrows it. I did a bit of web searching to learn, and I learned that if I didn't use the & on an iterator like that, it would be consumed, so I tried it out:

fn greet_people(query: Query<&Name, With<Person>>) {
    for name in query {
        println!("hello {}!", name.0);
    }
    for name in query {
        println!("hello {}!", name.0);
    }
}

To my surprise this does still work... But my understanding is that this is a special case to Bevy. Because for example if I did something similar with a vector, it does not compile:

let vec = vec![1, 2, 3];
for x in vec {} // moves vec
for x in vec {} // error: value used after move

The compiler tells me in the second use of vec it has been moved.

So I have a few questions:

  1. Can you confirm, this is a special case in Bevy?
  2. What does Bevy do exactly? Does it return a copy or something?
  3. Are there any reasons to use for name in query over for name in &query or visa versa?
reddit.com
u/The_Oddler — 2 months ago

[Japanese > English] Pendant, with paper and plastic bag, and a paper wrapper

I found this pendant when cleaning out, I got it years ago from a friend, but don't remember what it says. It was inside a paper bag, also with writing, and had a green paper wrapper inside as well.

The bag also mentions https://takaosan.or.jp, the website of a Japanese shrine.

u/The_Oddler — 4 months ago
▲ 3 r/krita

PsykoPaint effect in Krita?

PsykoPaint (linking youtube, as the actual website is old, unmaintained and gives a warning) was a website where you give it an image, and you can paint over it, it simulated real paint, but automatically selected the colour from the image. So you could direct the brush strokes, and it would simulate texture, but the colours would be selected automatically.

Is there a way to achieve this in Krita? Natively or with a plugin?

Essentially, what I'd need, is that when painting on a layer with some brush, it automatically selects the colour of a different layer when starting to paint a brush stroke. Maybe optionally instead of only picking the colour at the start of the stroke, it also changed the colour while painting.

u/The_Oddler — 5 months ago