diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-09-20 00:41:38 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-09-20 00:41:38 +0400 |
commit | a44177a4019536871da8c976fd4bbf38a30fd766 (patch) | |
tree | 6c9a1fbff425ac16eb2ce5e01ba380bd00381ffb /source/blender/src/buttons_logic.c | |
parent | 00ed5a2cc9de18549e7872175a0514b55822815a (diff) |
BGE patch: new 'Advanced Settings' button to keep special Bullet options away from main UI.
Three features that were on the main UI interface are now
moved to the Advanced Settings panel:
Margin, Actor (that becomes Sensor Actor) and No sleeping.
Sensor Actor is now a feature: it can be turned on and off
for all types of objects, and not just static objects.
Select the Sensor Actor button to make the object visible
to Near and Radar sensor.
The button is selected by default for dynamic objects
and unselected by default for static objects, to match
previous behavior.
Diffstat (limited to 'source/blender/src/buttons_logic.c')
-rw-r--r-- | source/blender/src/buttons_logic.c | 95 |
1 files changed, 62 insertions, 33 deletions
diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c index e16443460a1..45974e5704c 100644 --- a/source/blender/src/buttons_logic.c +++ b/source/blender/src/buttons_logic.c @@ -2969,6 +2969,45 @@ static void check_body_type(void *arg1_but, void *arg2_object) } } +static uiBlock *advanced_bullet_menu(void *arg_ob) +{ + uiBlock *block; + Object *ob = arg_ob; + short yco = 65, xco = 0; + + block= uiNewBlock(&curarea->uiblocks, "advanced_bullet_options", UI_EMBOSS, UI_HELV, curarea->win); + /* use this for a fake extra empy space around the buttons */ + uiDefBut(block, LABEL, 0, "", -5, -10, 255, 100, NULL, 0, 0, 0, 0, ""); + + uiDefButBitI(block, TOG, OB_ACTOR, 0, "Sensor actor", + xco, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0, + "Objects that are detected by the Near and Radar sensor"); + + if (ob->gameflag & OB_DYNAMIC) { + uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, 0, "No sleeping", + xco+=120, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0, + "Disable auto (de)activation"); + } + + yco -= 25; + xco = 0; + if (ob->gameflag & OB_DYNAMIC) { + if (ob->margin < 0.001f) + ob->margin = 0.06f; + uiDefButF(block, NUM, 0, "Margin", + xco, yco, 118, 19, &ob->margin, 0.001, 1.0, 1, 0, + "Collision margin"); + } else { + uiDefButF(block, NUM, 0, "Margin", + xco, yco, 118, 19, &ob->margin, 0.0, 1.0, 1, 0, + "Collision margin"); + } + + uiBlockSetDirection(block, UI_TOP); + + return block; +} + void buttons_bullet(uiBlock *block, Object *ob) { uiBut *but; @@ -2976,7 +3015,7 @@ void buttons_bullet(uiBlock *block, Object *ob) /* determine the body_type setting based on flags */ if (!(ob->gameflag & OB_COLLISION)) ob->body_type = OB_BODY_TYPE_NO_COLLISION; - else if (!(ob->gameflag & OB_DYNAMIC) || !(ob->gameflag & OB_DYNAMIC)) + else if (!(ob->gameflag & OB_DYNAMIC)) ob->body_type = OB_BODY_TYPE_STATIC; else if (!(ob->gameflag & (OB_RIGID_BODY|OB_SOFT_BODY))) ob->body_type = OB_BODY_TYPE_DYNAMIC; @@ -2985,61 +3024,51 @@ void buttons_bullet(uiBlock *block, Object *ob) else ob->body_type = OB_BODY_TYPE_SOFT; - uiBlockBeginAlign(block); but = uiDefButS(block, MENU, REDRAWVIEW3D, "Object type%t|No collision%x0|Static%x1|Dynamic%x2|Rigid body%x3|Soft body%x4", - 10, 205, 150, 19, &ob->body_type, 0, 0, 0, 0, "Selects the type of physical representation of the object"); + 10, 205, 120, 19, &ob->body_type, 0, 0, 0, 0, "Selects the type of physical representation"); uiButSetFunc(but, check_body_type, but, ob); if (ob->gameflag & OB_COLLISION) { - but = uiDefButBitI(block, TOG, OB_ACTOR, B_REDR, "Actor", - 160,205,55,19, &ob->gameflag, 0, 0, 0, 0, - "Objects that are detected by the Near and Radar sensor"); - uiButSetFunc(but, check_actor, but, &ob->gameflag); - - uiDefButBitI(block, TOG, OB_GHOST, B_REDR, "Ghost", 215,205,55,19, + + uiBlockSetCol(block, TH_BUT_SETTING1); + uiDefBlockBut(block, advanced_bullet_menu, ob, + "Advanced Settings", + 200, 205, 150, 20, "Display collision advanced settings"); + uiBlockSetCol(block, TH_BUT_SETTING2); + + uiBlockBeginAlign(block); + uiDefButBitI(block, TOG, OB_GHOST, 0, "Ghost", 10, 182, 60, 19, &ob->gameflag, 0, 0, 0, 0, "Objects that don't restitute collisions (like a ghost)"); + if ((ob->gameflag & OB_DYNAMIC) || ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) { + uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 70, 182, 140, 19, + &ob->inertia, 0.01, 10.0, 10, 2, + "Bounding sphere radius, not used for other bounding shapes"); + } if(ob->gameflag & OB_DYNAMIC) { - uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, B_REDR, "No sleeping", 270,205,80,19, - &ob->gameflag, 0, 0, 0, 0, - "Disable auto (de)activation"); - uiDefButF(block, NUM, B_DIFF, "Mass:", 10, 185, 170, 19, + uiDefButF(block, NUM, B_DIFF, "Mass:", 210, 182, 140, 19, &ob->mass, 0.01, 10000.0, 10, 2, "The mass of the Object"); - uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 180, 185, 170, 19, - &ob->inertia, 0.01, 10.0, 10, 2, - "Bounding sphere radius, not used for other bounding shapes"); - uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 165, 150, 19, + uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 162, 150, 19, &ob->damping, 0.0, 1.0, 10, 0, "General movement damping"); - uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 165, 190, 19, + uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 162, 190, 19, &ob->rdamping, 0.0, 1.0, 10, 0, "General rotation damping"); } uiBlockEndAlign(block); uiBlockBeginAlign(block); - if ((ob->gameflag & (OB_ACTOR|OB_DYNAMIC)) == (OB_ACTOR|OB_DYNAMIC)) { - if (ob->margin < 0.001f) - ob->margin = 0.06f; - uiDefButF(block, NUM, B_DIFF, "Margin", 10, 105, 105, 19, - &ob->margin, 0.001, 1.0, 1, 0, - "Collision margin"); - } else { - uiDefButF(block, NUM, B_DIFF, "Margin", 10, 105, 105, 19, - &ob->margin, 0.0, 1.0, 1, 0, - "Collision margin"); - } - uiDefButBitI(block, TOG, OB_BOUNDS, B_REDR, "Bounds", 115, 105, 55, 19, - &ob->gameflag, 0, 0,0, 0, + uiDefButBitI(block, TOG, OB_BOUNDS, B_REDR, "Bounds", 10, 105, 80, 19, + &ob->gameflag, 0, 0, 0, 0, "Specify a bounds object for physics"); if (ob->gameflag & OB_BOUNDS) { uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull%x5|Static Mesh%x4", //almost ready to enable this one: uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull Polytope%x5|Static TriangleMesh %x4|Dynamic Mesh %x5|", - 170, 105, 105, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type"); - uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 275,105,75,19, + 90, 105, 150, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type"); + uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 240,105,110,19, &ob->gameflag, 0, 0, 0, 0, "Add Children"); } |