8000 Use EL for model properties in FGD and DEF files · Issue #1440 · TrenchBroom/TrenchBroom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

Use EL for model properties in FGD and DEF files #1440

Closed
7 tasks done
kduske opened this issue Sep 15, 2016 · 1 comment
Closed
7 tasks done

Use EL for model properties in FGD and DEF files #1440

kduske opened this issue Sep 15, 2016 · 1 comment
Labels
Prio:1 Highest priority: Crash or crippling bugs, features that enable new ways of working Type:Enhancement New features

Comments

@kduske
Copy link
Collaborator
kduske commented Sep 15, 2016

When specifying models for entities in FGD or DEF files, TB should use its EL. For this, a new switch / case expression must be added with the following syntax:

SWITCH ::= '{{ CASE { ',' CASE } '}}'
CASE   ::= EXPRESSION '->' EXPRESSION

The case conditions are evaluated in sequence until a match is found, then the case expression is evaluated to determine the value of the entire switch expression. If no case condition matches, then the value of the switch expression is null. Example:

model({{spawnflags == 1 -> { path: ":maps/b_batt1.bsp" }, { path: ":maps/b_batt0.bsp", frame: 3} }})

Thereby, spawnflags is treated as a variable whose value is read from the entity. This allows total flexibility and it also works for entities where the model is determined from a property itself:

The case expressions are maps with the structure

{
    path: "...",
    frame: 3,
    skin: 3
}

Where path, frame, and skin determine the respective values for the model. frame and skin are optional and default to 0.

model({path: path, frame: frame, skin: skin})

Here, there is no switch / case, and the values of the map entries are themselves variables whose values are read from the entity properties of the same names.

If no frame and key need to be specified, a single string can also be given and will be used as the model path, so no map must be created:

model(":maps/b_batt0.bsp")

is therefore also valid. This provides backward compatibility with the old syntax and with FGD and DEF files from other editors. Finally, the name studio can also be used instead of model to provide compatibility with J.A.C.K. and Hammer.

  • Add case expression to EL.
  • Add bitwise operators and bit shift operators for easier specification of spawnflags.
  • Add switch expression to EL.
  • Add documentation for bitwise, case, switch operators.
  • Replace current model syntax with EL expressions.
  • Update FGD and DEF files.
  • Revise documentation for new model syntax.
@kduske kduske added Type:Enhancement New features Platform:All Prio:1 Highest priority: Crash or crippling bugs, features that enable new ways of working labels Sep 15, 2016
@kduske kduske added this to the TrenchBroom 2.0.0 milestone Sep 15, 2016
kduske added a commit that referenced this issue Sep 16, 2016
kduske added a commit that referenced this issue Sep 16, 2016
…lue undefined instead of throwing an exception.
kduske added a commit that referenced this issue Sep 17, 2016
kduske added a commit that referenced this issue Sep 17, 2016
kduske added a commit that referenced this issue Sep 17, 2016
kduske added a commit that referenced this issue Sep 18, 2016
kduske added a commit that referenced this issue Sep 18, 2016
kduske added a commit that referenced this issue Sep 18, 2016
@kduske
Copy link
Collaborator Author
kduske commented Sep 19, 2016

Sub tasks for introducing the new model syntax:

  • Store EL::Expressions instead of ModelDefinitions within the EntityDefinitions.
  • Factor out code to parse old model expressions in a sub parser.
  • Add code to convert old model expressions to the appropriate EL::Expressions.
  • Add support for parsing the new syntax using the ELParser. Find a general method for nesting tokenizers.

kduske added a commit that referenced this issue Sep 22, 2016
kduske added a commit that referenced this issue Sep 26, 2016
kduske added a commit that referenced this issue Sep 26, 2016
kduske added a commit that referenced this issue Sep 26, 2016
kduske added a commit that referenced this issue Sep 28, 2016
kduske added a commit that referenced this issue Sep 28, 2016
…rs. Use EL expressions to store model information.
kduske added a commit that referenced this issue Oct 1, 2016
kduske added a commit that referenced this issue Oct 1, 2016
kduske added a commit that referenced this issue Oct 1, 2016
kduske added a commit that referenced this issue Oct 1, 2016
kduske added a commit that referenced this issue Oct 1, 2016
kduske added a commit that referenced this issue Oct 1, 2016
@kduske kduske closed this as completed Oct 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Prio:1 Highest priority: Crash or crippling bugs, features that enable new ways of working Type:Enhancement New features
Projects
None yet
Development

No branches or pull requests

1 participant
0