【MotionBuilder】ArrowButtonについて
2021-02-24
FBVisualComponentのArrowButtonについて
Env.
MotionBuilder2019
Memo
FBArrowButton
レイアウト(要素)をしまうことのできるボタン
とりあえずArrowButtonを追加してみる
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# -*- coding: utf-8 -*- from pyfbsdk import * from pyfbsdk_additions import * def Layout(mainLyt): anchor = FBAttachType.kFBAttachTop anchorRegion = "" lytName = "List" lyt = FBLayout() # ArrowButtonをクリックすると現れる枠の領域設定 x = FBAddRegionParam(10, FBAttachType.kFBAttachLeft, "") y = FBAddRegionParam(10, FBAttachType.kFBAttachTop, "") w = FBAddRegionParam(200, FBAttachType.kFBAttachNone, "") h = FBAddRegionParam(200, FBAttachType.kFBAttachNone, "") # TITLEは枠に表示されるテキスト lyt.AddRegion(lytName, "TITLE", x, y, w, h) # ボーダーのスタイル設定 lyt.SetBorder(lytName, FBBorderStyle.kFBStandardBorder, True, True, 1, 0, 90, 0) arrowName = "ButtonArrow" # ArrowButtonを接地するための領域設定 # w,hは0固定 x = FBAddRegionParam(10, FBAttachType.kFBAttachLeft, "") y = FBAddRegionParam(10, anchor, anchorRegion) w = FBAddRegionParam(0, FBAttachType.kFBAttachNone, "") h = FBAddRegionParam(0, FBAttachType.kFBAttachNone, "") mainLyt.AddRegion(arrowName, arrowName, x, y, w, h) # ArrowButton作成 b = FBArrowButton() # メインのレイアウトに領域ArrowNameにArrowButtonのUIを設定 mainLyt.SetControl(arrowName, b) # ArrowButtonの親のサイズの設定 b.SetContent("Arrow Button", lyt, 250, 250) def CreateTool(): t = FBCreateUniqueTool("Arrow Button") Layout(t) ShowTool(t) CreateTool() |
ArrowButtonの隠す要素内にラベルを入れる
上のコードに少し追加した
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# -*- coding: utf-8 -*- from pyfbsdk import * from pyfbsdk_additions import * def Layout(mainLyt): anchor = FBAttachType.kFBAttachTop anchorRegion = "" lytName = "List" lyt = FBLayout() # ArrowButtonをクリックすると現れる枠の領域設定 x = FBAddRegionParam(10, FBAttachType.kFBAttachLeft, "") y = FBAddRegionParam(10, FBAttachType.kFBAttachTop, "") w = FBAddRegionParam(200, FBAttachType.kFBAttachNone, "") h = FBAddRegionParam(200, FBAttachType.kFBAttachNone, "") # TITLEは枠に表示されるテキスト lyt.AddRegion(lytName, "TITLE", x, y, w, h) # ボーダーのスタイル設定 lyt.SetBorder(lytName, FBBorderStyle.kFBStandardBorder, True, True, 1, 0, 90, 0) name = "label" x = FBAddRegionParam(20, FBAttachType.kFBAttachLeft, "") y = FBAddRegionParam(20, FBAttachType.kFBAttachTop, "") w = FBAddRegionParam(180, FBAttachType.kFBAttachNone, "") h = FBAddRegionParam(180, FBAttachType.kFBAttachNone, "") lyt.AddRegion(name, name, x, y, w, h) l = FBLabel() l.FBTextJustify = FBTextJustify.kFBTextJustifyLeft l.Caption = 'This is testmessag\nこれはArrowButtonの中身\nここに何かしら追加する' lyt.SetControl(name, l) arrowName = "ButtonArrow" # ArrowButtonを接地するための領域設定 # w,hは0固定 x = FBAddRegionParam(10, FBAttachType.kFBAttachLeft, "") y = FBAddRegionParam(10, anchor, anchorRegion) w = FBAddRegionParam(0, FBAttachType.kFBAttachNone, "") h = FBAddRegionParam(0, FBAttachType.kFBAttachNone, "") mainLyt.AddRegion(arrowName, arrowName, x, y, w, h) # ArrowButton作成 b = FBArrowButton() # メインのレイアウトに領域ArrowNameにArrowButtonのUIを設定 mainLyt.SetControl(arrowName, b) # ArrowButtonの親のサイズの設定 b.SetContent("Arrow Button", lyt, 250, 250) def CreateTool(): t = FBCreateUniqueTool("Arrow Button") Layout(t) ShowTool(t) CreateTool() |