Prof. Monster's Frame

Hi,

A new group is ready:FRAME



With that you can easily create resizable frames in your game. You can apply different styles. Even custom styles are no problem. And they are 3D as expected.

What is it good for?

I thought about using it for dialog boxes etc., but it can be anything.

How to install it?

  • Download the file Frame.blend (61.7 KB)
  • Link shift+F1 the group Frame
  • Add an instance of Frame to your scene
  • Add to the instance:
    • property Frame
    • property width - with the initial width (float in BU)
    • property height - with the initial height (float in BU)

How to resize in-game?

Add following logic to the Frame instance:

  • property sensor True pulse, “changed” prop: width
  • property sensor True pulse, “changed” prop: height
  • both connected to Python controller Module: LinkLib.copyPropsToBase

How to change the frames style?
Make sure you have the new style available in your scene (e.g. at an inactive layer).

  • Download the file FrameStyles.blend (45.1 KB)
  • Link a style group or group AllStyles
  • create an instance of the group on an hidden layer
  • switch back to the frame instance and
  • add a property style as string with the name of the style (currently: Hard, RoundThin, Simple, Borderless)
  • the default style is Default

in-game

  • property sensor True pulse, “changed” prop: style
  • connected to Python controller Module: LinkLib.copyPropsToBase

Frame.blend (61.7 KB)
FrameStyles.blend (45.1 KB)

I hope you find it usefull
Monster

How to create customized styles?

Styles are meshes. That means they need game objects to be assigned to. The names of the game objects do not matter, but the names of the meshes are important.
Attention: Only the display meshes are changed when changing the style.

The name of a style mesh consists of <prefix>.<suffix>

  • prefix = style name (e.g. Simple)
  • suffix = the part of the frame

Frame parts


The suffix simply tells where the part should be:

  • M = middle
  • T = top
  • B = Bottom
  • L = left
  • R = right

A combination of two letters means it is a corner.
You do not need to create all parts for a style. If a mesh can’t be found the mesh of another mesh is used.
So you can create a style with just one mesh (e.g. Simple).
The order how to copy the meshes is as follow:
M ->T
T -> B,LT,L
L -> R
LT -> RT,LB
LB -> RB

How to create customized style meshes?


There are some rules:

  • The center of the mesh is always right below
    [LIST]

  • regardless where the part should be placed

  • the part will be rotated automatically to fit the frame

  • The X and Y size of the middle (.M) is always 1.0

  • The X size of an edge (.T,.B,.R,.L) is always 1.0

  • All other dimensons doesn’t matter, but determine to overall size of the frame and its border
    [/LIST]

Now that’s useful, I’ll see if I can use it!
Thanks for this great resource Monster Sensei, you came through once again!

That is cool