-
Notifications
You must be signed in to change notification settings - Fork 0
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
Style attributes in a condition #7
Comments
Other style variables may be introduced later. They should be also accessed in the similar way: style.variable. |
style.count should be translated to self.count. |
I see. It would be less complicated to implement, when style.variable could appear in both, in a condition and in an arithemtic expression. Would that be OK? Is it important to restrict variable to count and other identifiers to be introduced later, or could it be just a free name? |
Sorry, I didn't understand what you meant by the arithmetic expression. |
I thought it should be implemented in the same way as item.variable. As far as I can see a variable for the item can be any name. Is it correct? |
Something like levels: height * style.count Don't know if such constructions could make sense somewhere, but it would be easier not to restrict it to conditions.
Yes. Any name would be accepted by the translator and not just predefined names like count. |
Expressions for attributes could be a useful feature. It deserves a separate issue for discussions. I'll create one.
Ok, let's not restrict item.variable and style.variable to conditions.
Let's do the same for style.variable. |
Style attributes in a condition implemented and commited. The example facade[item.front and style.count<=1] {
class: facade_with_door;
} translates to Facade(
condition = lambda item : item.front and self.count <= 1,
cl = "facade_with_door"
) Any name behind style gets accepted. Usage in expressions will be a separate issue for discussions, as proposed. |
Thanks! Now I'll have to introduce style.count in the code of the addon. |
It's desirable to access some variables in the condition of a style block.
Example. A small building can have only one entrance. A larger building can have exactly two entrances.
That can be realized by using the style variable count in the condition. It's proposed to prefix it with the style namespace.
The text was updated successfully, but these errors were encountered: