From 779368fd4524d35e9b1802a0e720ced3df059ada Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Thu, 8 Jul 2010 06:49:08 +0000 Subject: Logic UI: fix for #Motion Actuator Dynamic options not showing for Soft Body and Rigid Body (reported by Mal Duffin (malCanDo) over email) Originally (2.49) we were testing for ob->game_flag to see if the object is dynamic. That could work here (it would require a new rna prop for the object (a read-only is_dynamic) or similar. However using ob.game.physics_type is more explicit, therefore may be more interesting. I have no strong opinions on that... --- source/blender/editors/space_logic/logic_window.c | 55 ++++++++++++----------- 1 file changed, 28 insertions(+), 27 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 26b4b6fc08c..9f6fafb1053 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -3966,9 +3966,11 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) Object *ob; PointerRNA settings_ptr; uiLayout *split, *row, *col, *subcol; + int physics_type; ob = (Object *)ptr->id.data; RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); + physics_type = RNA_enum_get(&settings_ptr, "physics_type"); uiItemR(layout, ptr, "mode", 0, NULL, 0); @@ -3984,33 +3986,32 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) uiItemR(row, ptr, "rot", 0, NULL, 0); uiItemR(split, ptr, "local_rotation", UI_ITEM_R_TOGGLE, NULL, 0); - if (RNA_enum_get(&settings_ptr, "physics_type") != OB_BODY_TYPE_DYNAMIC) - break; - - uiItemL(layout, "Dynamic Object Settings:", 0); - split = uiLayoutSplit(layout, 0.9, 0); - row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "force", 0, NULL, 0); - uiItemR(split, ptr, "local_force", UI_ITEM_R_TOGGLE, NULL, 0); - - split = uiLayoutSplit(layout, 0.9, 0); - row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "torque", 0, NULL, 0); - uiItemR(split, ptr, "local_torque", UI_ITEM_R_TOGGLE, NULL, 0); - - split = uiLayoutSplit(layout, 0.9, 0); - row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "linear_velocity", 0, NULL, 0); - row = uiLayoutRow(split, 1); - uiItemR(row, ptr, "local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, 0); - uiItemR(row, ptr, "add_linear_velocity", UI_ITEM_R_TOGGLE, NULL, 0); - - split = uiLayoutSplit(layout, 0.9, 0); - row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "angular_velocity", 0, NULL, 0); - uiItemR(split, ptr, "local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, 0); - - uiItemR(layout, ptr, "damping", 0, NULL, 0); + if (ELEM3(physics_type, OB_BODY_TYPE_DYNAMIC, OB_BODY_TYPE_RIGID, OB_BODY_TYPE_SOFT)) { + uiItemL(layout, "Dynamic Object Settings:", 0); + split = uiLayoutSplit(layout, 0.9, 0); + row = uiLayoutRow(split, 0); + uiItemR(row, ptr, "force", 0, NULL, 0); + uiItemR(split, ptr, "local_force", UI_ITEM_R_TOGGLE, NULL, 0); + + split = uiLayoutSplit(layout, 0.9, 0); + row = uiLayoutRow(split, 0); + uiItemR(row, ptr, "torque", 0, NULL, 0); + uiItemR(split, ptr, "local_torque", UI_ITEM_R_TOGGLE, NULL, 0); + + split = uiLayoutSplit(layout, 0.9, 0); + row = uiLayoutRow(split, 0); + uiItemR(row, ptr, "linear_velocity", 0, NULL, 0); + row = uiLayoutRow(split, 1); + uiItemR(row, ptr, "local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "add_linear_velocity", UI_ITEM_R_TOGGLE, NULL, 0); + + split = uiLayoutSplit(layout, 0.9, 0); + row = uiLayoutRow(split, 0); + uiItemR(row, ptr, "angular_velocity", 0, NULL, 0); + uiItemR(split, ptr, "local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, 0); + + uiItemR(layout, ptr, "damping", 0, NULL, 0); + } break; case ACT_OBJECT_SERVO: uiItemR(layout, ptr, "reference_object", 0, NULL, 0); -- cgit v1.2.3