The Inspector is the main tool for viewing and modifying attributes of objects, such as shapes, map layers, and models. Depending on the type of object selected, the Inspector adapts its user interface to provide full access to the object's attributes. You can open the Inspector by clicking Window > Inspector in the main-menu, or by pressing Alt+I.
The Inspector not only supports editing of single objects but also a collection of objects. Attributes that are unique across all objects are shown as-is. If an attribute has different values in the object collection, the attribute is marked as non-unique with the "?" symbol. The Inspector shows the attributes of the lead object when multiple objects are selected. The lead object is always the most recent individually selected object.
For map layers, the Inspector lets you change the map files, modify the bounds, and adjust the display offset (how much the rendering of the map is displaced regarding the actual map values). In addition, an overlay color and alpha value for the map can be specified.
Work with object attributes
To add an attribute, do the following:
- Click Add new object attribute.
- Enter information for the Attribute Name, Value, and Type.
City Engine has the following types of object attributes:
- BOOL : boolean
- FLOAT : floating point value (double precision)
- STR : character string (UTF-16 encoded)
- BOOL[ ] : array of boolean values
- FLOAT[ ] : array of floating point values
- STR[ ] : array of character string
- When entering the value of an attribute, the user can enter a "NaN" value for a float (Not a Number), or a "NULL" value for a String.
- When entering the value for attributes arrays, separate the values with a , (comma). For example :
- Array values can also be formatted with square brackets for the ease of copying from CGA code or from the console output:
- ["a", "b", "c"]
Edit with the List Editor
You can use the List Editor to edit array attributes in the Object Attributes section.
- Click Edit List... from the drop-down menu.
- Modify the values by editing the second column cells.
You can replicate the elements, add, duplicate, and delete elements using the toolbar.
- Click OK.
The new values are added to the data model and scene.
Edit with the Table Editor
If an object has many attribute arrays which follow the prefix_... syntax, you can edit the attribute values from the drop-down menu and select Edit Table... for each of the attributes.
To edit the multiple array attributes, do the following:
- Click Edit List... from drop-down menu of one of the attributes.
This opens a table of array attributes for editing.
- Modify the values in each column.
- Click OK.
Work with array attributes
CityEngine supports float, string, and bool arrays. The Inspector displays arrays for rule and object attributes and allows for editing.
- Click the button to expand the array attributes.
Array indices are displayed in grey.
- Click the + icon to add a new row to the end of the array.
The added element is set to the default value for each type (i.e. 0 for floats, "" for strings, false for bools).
- Click on an element to edit it.
- Right-click on a row to delete or insert rows.
Attributes, sources, and connections
Attributes and parameters can have different sources, that allow fine grained control over the values. The following is a list of possible of sources:
The default value used. For rule attributes, this is the initial attribute value. For parameters, this is the algorithm specific default.
A value that is entered by the user. Whenever the user sets a value (also by Python), uses a slider, or handle the source is set to User defined.
The value is taken from the corresponding object attribute. The value is displayed in italic, and marked with (Object).
A rule attribute can use the value from the parent shape. For example a street shape may sample the street segment's streetWidth. The value is displayed in italic, and marked with (Shape).
The value is connected to a layer attribute. The value is displayed in italic, and marked with the source layer in brackets. See Layer Attributes for details.
- The easiest way to create connections and set sources is using the Connection Editor.
- During rule assignment, object attributes with names that match a rule attribute get connected automatically. During rule assignment, object attributes with names that match a rule attribute get connected automatically.
- Whenever you enter a value to a parameter or attribute, it will automatically change to user source.
Inspector attribute options
Depending on the type of the selected object, there are different options available for modifying objects.
Example street parameters
connected to layer Streetnetwork
user specified value
connected to object attribute (below)
connected to layer Meshes
user specified value
Example rule attributes
Map attributes with Connection Editor
Attributes and object parameters in CityEngine can be controlled from various sources. The Connection Editor helps to create these attribute connections.
To edit the connection of a specific attribute, do the following:
- Click the drop-down menu of the attribute.
- Click Connect Attribute... to open the Attribute Connection Editor.
- Set the attribute connection.
- Click OK.
In the Attribute Connection Editor menu you have the following options:
Connect your attribute to an object attribute. This option is only available if:
Connect your attribute to the parent shape parameter. This option is only available if:
Connect your attribute to Layer Attributes from arbitrary layers. Choose the source layer from the drop-down menu, and the desired Layer Attribute from the drop-down menu.
Each layer will provide a list of its available layer attributes, consisting of the following:
Note:If a layer attribute with the same name as your attribute already exists the new attribute might override the existing one.
You can reset a specific attribute through the Rule default option in the attribute drop-down menu. Depending on the attribute's type this resets to the default value of the algorithm (e.g. Street Shape creation) or to the default value from the rule file (rule attribute). Additional options are available as well from the attribute context menu (open by right click) :
Map object attributes with Layer Attribute
Every layer can have an arbitrary set of layer attributes defined. Whereas, map layers normally use their image data as source for layer attributes, graph and shape data layers can query their vector objects to layer attributes.
Object attribute mapping and sampling
Layer attributes can be used to map object attributes of its scene objects to attributes with different names, or to objects on other layers.
For simple cases, use Connection Editor to perform attribute mapping.
Object attributes of nodes, segments and shapes can be mapped or sampled with layer attributes using one of the following commands:
getFloatObjectAttr(name) getFloatObjectAttr(name, sample) getStringObjectAttr(name) getStringObjectAttr(name, sample) getBoolObjectAttr(name) getBoolObjectAttr(name, sample) getFloatArrayObjectAttr(name) getFloatArrayObjectAttr(name, sample) getStringArrayObjectAttr(name) getStringArrayObjectAttr(name, sample) getBoolArrayObjectAttr(name) getBoolArrayObjectAttr(name, sample)
These commands search object attributes with matching name within the layer that the object attribute was created.
If the sample argument is false, only the shape's object attributes are examined. If sample is true (the default value), and the shape has no such object attribute, overlapping shapes in the attribute layer are sampled for the specified name.
If you use the object attribute width on street segments to control the width of created street shapes (the street parameter streetWidth), getFloatObjectAttr allows the attribute layer to obtain the value from other objects.
attr streetWidth = getFloatObjectAttr("width")
To use this layer attribute set the source of the streetWidth parameter in the Street Parameters pane to its own layer. Below is an example with the streetWidth parameter dependent on the attributes:
streetWidth attribute is mapped from object attribute width. The layer attribute streetWidth can now be used to control the street width of street shapes.
When importing OSM, shape or GDB data, a predefined set of layer attributes is automatically created on the imported layers. Select the new layers and show or modify the created layer attributes in the Inspector.