[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21027] branches/blender2.5/blender: game logic UI script, physics could be broken up into more panels.

Campbell Barton ideasman42 at gmail.com
Sat Jun 20 08:06:16 CEST 2009


Revision: 21027
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21027
Author:   campbellbarton
Date:     2009-06-20 08:06:13 +0200 (Sat, 20 Jun 2009)

Log Message:
-----------
game logic UI script, physics could be broken up into more panels.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c

Added Paths:
-----------
    branches/blender2.5/blender/release/ui/space_logic.py

Added: branches/blender2.5/blender/release/ui/space_logic.py
===================================================================
--- branches/blender2.5/blender/release/ui/space_logic.py	                        (rev 0)
+++ branches/blender2.5/blender/release/ui/space_logic.py	2009-06-20 06:06:13 UTC (rev 21027)
@@ -0,0 +1,80 @@
+import bpy
+
+class LOGIC_PT_physics(bpy.types.Panel):
+	__space_type__ = "LOGIC_EDITOR"
+	__region_type__ = "UI"
+	__label__ = "Physics"
+
+	def draw(self, context):
+		layout = self.layout
+		ob = context.active_object
+		
+		game = ob.game
+
+		flow = layout.column_flow()
+		flow.active = True
+		flow.itemR(game, "physics_type")
+		flow.itemR(game, "actor")
+		
+		row = layout.row()
+		row.itemR(game, "ghost")
+		row.itemR(ob, "restrict_render", text="Invisible") # out of place but useful
+		
+		flow = layout.column_flow()
+		flow.itemR(game, "mass")
+		flow.itemR(game, "radius")
+		flow.itemR(game, "no_sleeping")
+		flow.itemR(game, "damping")
+		flow.itemR(game, "rotation_damping")
+		flow.itemR(game, "minimum_velocity")
+		flow.itemR(game, "maximum_velocity")
+		
+		row = layout.row()
+		row.itemR(game, "do_fh")
+		row.itemR(game, "rotation_fh")
+		
+		flow = layout.column_flow()
+		flow.itemR(game, "form_factor")
+		flow.itemR(game, "anisotropic_friction")
+		
+		flow = layout.column_flow()
+		flow.active = game.anisotropic_friction
+		flow.itemR(game, "friction_coefficients")
+		
+		split = layout.split()
+		sub = split.column()
+		sub.itemR(game, "lock_x_axis")
+		sub.itemR(game, "lock_y_axis")
+		sub.itemR(game, "lock_z_axis")
+		sub = split.column()
+		sub.itemR(game, "lock_x_rot_axis")
+		sub.itemR(game, "lock_y_rot_axis")
+		sub.itemR(game, "lock_z_rot_axis")
+
+
+class LOGIC_PT_collision_bounds(bpy.types.Panel):
+	__space_type__ = "LOGIC_EDITOR"
+	__region_type__ = "UI"
+	__label__ = "Collision Bounds"
+	
+	def draw_header(self, context):
+		layout = self.layout
+		ob = context.active_object
+		game = ob.game
+
+		layout.itemR(game, "use_collision_bounds", text="")
+	
+	def draw(self, context):
+		layout = self.layout
+		
+		ob = context.scene.objects[0]
+		game = ob.game
+		
+		flow = layout.column_flow()
+		flow.active = game.use_collision_bounds
+		flow.itemR(game, "collision_bounds")
+		flow.itemR(game, "collision_compound")
+		flow.itemR(game, "collision_margin")
+
+bpy.types.register(LOGIC_PT_physics)
+bpy.types.register(LOGIC_PT_collision_bounds)

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c	2009-06-20 05:52:19 UTC (rev 21026)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c	2009-06-20 06:06:13 UTC (rev 21027)
@@ -522,6 +522,49 @@
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Rotation Damping", "General rotation damping.");
 
+	prop= RNA_def_property(srna, "minimum_velocity", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "min_vel");
+	RNA_def_property_range(prop, 0.0, 1000.0);
+	RNA_def_property_ui_text(prop, "Velocity Min", "Clamp velocity to this minimum speed (except when totally still).");
+
+	prop= RNA_def_property(srna, "maximum_velocity", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "max_vel");
+	RNA_def_property_range(prop, 0.0, 1000.0);
+	RNA_def_property_ui_text(prop, "Velocity Max", "Clamp velocity to this maximum speed.");
+
+	/* lock position */
+	prop= RNA_def_property(srna, "lock_x_axis", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_AXIS);
+	RNA_def_property_ui_text(prop, "Lock X Axis", "Disable simulation of linear motion along the X axis.");
+	
+	prop= RNA_def_property(srna, "lock_y_axis", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_AXIS);
+	RNA_def_property_ui_text(prop, "Lock Y Axis", "Disable simulation of linear motion along the Y axis.");
+	
+	prop= RNA_def_property(srna, "lock_z_axis", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_AXIS);
+	RNA_def_property_ui_text(prop, "Lock Z Axis", "Disable simulation of linear motion along the Z axis.");
+	
+	
+	/* lock rotation */
+	prop= RNA_def_property(srna, "lock_x_rot_axis", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_ROT_AXIS);
+	RNA_def_property_ui_text(prop, "Lock X Rotation Axis", "Disable simulation of angular  motion along the X axis.");
+	
+	prop= RNA_def_property(srna, "lock_y_rot_axis", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_ROT_AXIS);
+	RNA_def_property_ui_text(prop, "Lock Y Rotation Axis", "Disable simulation of angular  motion along the Y axis.");
+	
+	prop= RNA_def_property(srna, "lock_z_rot_axis", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_ROT_AXIS);
+	RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular  motion along the Z axis.");
+	
+	/* is this used anywhere ? */
+	prop= RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflag2", OB_NEVER_DO_ACTIVITY_CULLING);
+	RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular  motion along the Z axis.");	
+	
+
 	prop= RNA_def_property(srna, "do_fh", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_DO_FH);
 	RNA_def_property_ui_text(prop, "Do Fh", "Use Fh settings in materials.");





More information about the Bf-blender-cvs mailing list