Open vvoovv opened 3 years ago
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.
Is it important to restrict variable to count and other identifiers to be introduced later, or could it be just a free name?
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?
Sorry, I didn't understand what you meant by the arithmetic expression.
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.
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?
Yes. Any name would be accepted by the translator and not just predefined names like count.
Something like
levels: height * style.count
Expressions for attributes could be a useful feature. It deserves a separate issue for discussions. I'll create one. It can be translated to something like: levels = Value(Expression(lambda item: ...)),
Don't know if such constructions could make sense somewhere, but it would be easier not to restrict it to conditions.
Ok, let's not restrict item.variable and style.variable to conditions.
Yes. Any name would be accepted by the translator and not just predefined names like count.
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.
Style attributes in a condition implemented and commited.
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.