ModraUp Ruby API Documentation Ruby API Reference

Class: ModraUp::Behavior

Inherits:
ModraUp::Entity show all

Overview

Controls component behaviors such as gluing, scale handles, and facing the camera. Obtain it from ModraUp::ComponentDefinition#behavior.

Examples:

defn = ModraUp.active_model.definitions.add("Box")
defn.behavior.is2d?

Instance Method Summary # collapse

Inherited from ModraUp::Entity

Instance Method Details

behavior.always_face_camera? ⇒ Boolean

Always face the component towards the camera (-Y face towards the camera).

Returns:

  • (Boolean)

Examples:

ModraUp.active_model.definitions.add("Box").behavior.always_face_camera?

behavior.always_face_camera = setting ⇒ setting

Sets the Face Me. This ensures that the face always faces the camera.

Parameters:

  • setting (Boolean)

Returns:

  • (Boolean)

Examples:

ModraUp.active_model.definitions.add("Box").behavior.always_face_camera = true

behavior.cuts_opening? ⇒ Boolean

Whether to cut an opening when sticking to a face.

Returns:

  • (Boolean)

Examples:

ModraUp.active_model.definitions.add("Box").behavior.cuts_opening?

behavior.cuts_opening = setting ⇒ setting

Set the opening. Typically, #is2d= should also be set.

Parameters:

  • setting (Boolean)

Returns:

  • (Boolean)

Examples:

ModraUp.active_model.definitions.add("Box").behavior.cuts_opening = false

behavior.is2d? ⇒ Boolean

Can be glued to other faces (Glue to).

Returns:

  • (Boolean)

Examples:

ModraUp.active_model.definitions.add("Box").behavior.is2d?

behavior.is2d = is2d ⇒ is2d

Sets whether attachment is allowed.

Parameters:

  • is2d (Boolean)

Returns:

  • (Boolean)

Examples:

ModraUp.active_model.definitions.add("Box").behavior.is2d = true

behavior.shadows_face_sun? ⇒ Boolean

Returns whether shadows are calculated with the face oriented toward the sun.

Returns:

  • (Boolean)

Examples:

ModraUp.active_model.definitions.add("Box").behavior.shadows_face_sun?

behavior.shadows_face_sun = status ⇒ self

Sets the face to cast a shadow towards the sun.

Parameters:

  • status (Boolean)

Returns:

  • (ModraUp::Behavior)

Examples:

ModraUp.active_model.definitions.add("Box").behavior.shadows_face_sun = false

behavior.snapto ⇒ Integer

Returns:

  • (Integer)

Examples:

ModraUp.active_model.definitions.add("Box").behavior.snapto

behavior.snapto = snapto ⇒ snapto

Set the snap plane.

Parameters:

  • snapto (Integer)

Returns:

  • (Integer)

Examples:

b = ModraUp.active_model.definitions.add("Box").behavior
b.is2d = true
b.snapto = SnapTo_Horizontal

behavior.no_scale_mask? ⇒ Integer

Thumb grip hidden bit mask. Note that the method name ends with a question mark and returns an integer.

Returns:

  • (Integer)

Examples:

ModraUp.active_model.definitions.add("Box").behavior.no_scale_mask?  #=> 0

behavior.no_scale_mask = mask ⇒ self

Sets the mask for hiding the scale handles of a single component: bit0=X, bit1=Y, bit2=Z, bit3=XZ, bit4=YZ, bit5=XY, bit6=uniform corner scaling. After setting, re-activate the scale tool. Note that this mask does not restrict direct transformation of the component via the API.

Parameters:

  • mask (Integer)

Returns:

  • (ModraUp::Behavior)

Examples:

ModraUp.active_model.definitions.add("Box").behavior.no_scale_mask = (1 << 1)