Inspector

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. See Map Layers for more information.

Work with object attributes

To use the Inspector to add an attribute, do the following:

  1. Click Add new object attribute.
  2. 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
    Note:
    • 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 :
      • 1,2,3,4,NaN,6
      • a,b,c,d,e,f,NULL,h,i,j
      • true,false,true,false
    • 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"]
      • [a,b,c]

Edit with the List Editor

You can use the List Editor to edit array attributes in the Object Attributes section.

  1. Click Edit List... from the drop-down menu.
  2. Modify the values by editing the second column cells.

    You can replicate the elements, add, duplicate, and delete elements using the toolbar.

  3. 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:

  1. Click Edit List... from drop-down menu of one of the attributes.

    This opens a table of array attributes for editing.

  2. Modify the values in each column.
  3. 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.

  1. Click the Expand menu button to expand the array attributes.

    Array indices are displayed in grey.

    Array attributes
  2. 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).

  3. Click on an element to edit it.
  4. 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:

Default

The default value used. For rule attributes, this is the initial attribute value. For parameters, this is the algorithm specific default.

User

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.

Object

The value is taken from the corresponding object attribute. The value is displayed in italic, and marked with (Object).

Shape

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).

Layer

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.

Note:

  • 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

Street parameters
Street parameters in Inspector

shapeCreation

default value

streetWidth

connected to layer Streetnetwork

streetOffset

user specified value

sidewalkWidthLeft

connected to object attribute (below)

sidewalkWidthRight

connected to layer Meshes

precision

default value

laneWidth

user specified value

Example rule attributes

Rule attributes
Rule attributes in Inspector

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:

  1. Click the drop-down menu of the attribute.
  2. Click Connect Attribute... to open the Attribute Connection Editor.
  3. Set the attribute connection.
  4. Click OK.

In the Attribute Connection Editor menu you have the following options:

Object attribute

Connect your attribute to an object attribute. This option is only available if:

  • the scene object has an object attribute with a matching name.
  • the type of the object attribute matches the required type of the attribute.

Shape parameter

Connect your attribute to the parent shape parameter. This option is only available if:

  • it is a rule attribute
  • the rule file is attached to a shape of an intersection, street, or block (a lot)
  • the attribute has the same name as a shape parameter
  • the type of the shape parameter matches the required type of the attribute

Layer Attribute

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:

  • Channel attributes for Map Layers: the color channels (red, blue, green, alpha, brightness, ...) of the layers image. Marked as (Map Channel).
  • Object attributes: Object attributes of objects in the source layer. Marked as (Object attribute).
  • Other attributes: Existing expressions or mappings. Marked as (Layer attribute) or (Expression).

Note:
If a layer attribute with the same name as your attribute already exists the new attribute might override the existing one.

Reset attributes

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) :

  • Reset user attributes — Reset all user-set attributes of this rule file to its default (Rule) values.
  • Reset all attributes — Reset all user-set and mapped attributes of this rule file to its default (Rule) values.

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.

Note:

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 parameter dependent on other attributes
streetWidth parameter dependent on other 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.

Note:

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.

Reports

The Reports section lists all reported variables for selected models. The following table illustrates an example:

Reports table in Inspector
Reports table in the Inspector

Report

The name of the report variable calculated.

N

The number of occurrences of the report variable.

% (N)

The percentage the variable occurs in a group.

Sum

The sum of variable values.

% (Sum)

The percentage of the sum of variable values in a group.

Avg

The average of the variable values.

Min

The minimum of the variable values.

Max

The maximum of the variable values.

NaNs

The number of occurrences with values that are not a number. For example, string variables, such as Retail or Office, don' t have numeric values.

Note:

Report variables may contain a dot (.) that separates a common group name and a variable name, such as FAR.Office or FAR.Retail. The variables are combined in the FAR group.

See Tutorial 11: Reporting for more information. Also, the report operation has further details about reporting with CGA rules.