Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(495)

Unified Diff: source/blender/makesrna/intern/rna_object.c

Issue 4961053: Blender Cucumber to Trunk Base URL: https://svn.blender.org/svnroot/bf-blender/trunk/blender/
Patch Set: Fixes to crashing DDS mipmaps, leaking dyn lights, and some review comments. Created 12 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: source/blender/makesrna/intern/rna_object.c
===================================================================
--- source/blender/makesrna/intern/rna_object.c (revision 40024)
+++ source/blender/makesrna/intern/rna_object.c (working copy)
@@ -1010,6 +1010,64 @@
}
}
+static void rna_GameObjectSettings_col_group_get(PointerRNA *ptr, int *values)
+{
+ Object *ob= (Object*)ptr->data;
+ int i;
+
+ memset(values, 0, sizeof(short)*OB_MAX_COL_MASKS);
+ for(i=0; i<OB_MAX_COL_MASKS; i++)
+ values[i] = (ob->col_group & (1<<i));
+}
+
+static void rna_GameObjectSettings_col_group_set(PointerRNA *ptr, const int *values)
+{
+ Object *ob= (Object*)ptr->data;
+ int i, tot= 0;
+
+ /* ensure we always have some group selected */
+ for(i=0; i<OB_MAX_COL_MASKS; i++)
+ if(values[i])
+ tot++;
+
+ if(tot==0)
+ return;
+
+ for(i=0; i<OB_MAX_COL_MASKS; i++) {
+ if(values[i]) ob->col_group |= (1<<i);
+ else ob->col_group &= ~(1<<i);
+ }
+}
+
+static void rna_GameObjectSettings_col_mask_get(PointerRNA *ptr, int *values)
+{
+ Object *ob= (Object*)ptr->data;
+ int i;
+
+ memset(values, 0, sizeof(short)*OB_MAX_COL_MASKS);
+ for(i=0; i<OB_MAX_COL_MASKS; i++)
+ values[i] = (ob->col_mask & (1<<i));
+}
+
+static void rna_GameObjectSettings_col_mask_set(PointerRNA *ptr, const int *values)
+{
+ Object *ob= (Object*)ptr->data;
+ int i, tot= 0;
+
+ /* ensure we always have some mask selected */
+ for(i=0; i<OB_MAX_COL_MASKS; i++)
+ if(values[i])
+ tot++;
+
+ if(tot==0)
+ return;
+
+ for(i=0; i<OB_MAX_COL_MASKS; i++) {
+ if(values[i]) ob->col_mask |= (1<<i);
+ else ob->col_mask &= ~(1<<i);
+ }
+}
+
static void rna_GameObjectSettings_used_state_get(PointerRNA *ptr, int *values)
{
Object *ob= (Object*)ptr->data;
@@ -1335,6 +1393,8 @@
StructRNA *srna;
PropertyRNA *prop;
+ int default_col_mask[8] = {1,0,0,0, 0,0,0,0};
+
static EnumPropertyItem body_type_items[] = {
{OB_BODY_TYPE_NO_COLLISION, "NO_COLLISION", 0, "No Collision", "Disable collision for this object"},
{OB_BODY_TYPE_STATIC, "STATIC", 0, "Static", "Stationary object"},
@@ -1433,6 +1493,18 @@
RNA_def_property_range(prop, 0.0, 1000.0);
RNA_def_property_ui_text(prop, "Velocity Max", "Clamp velocity to this maximum speed");
+ prop= RNA_def_property(srna, "collision_group", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+ RNA_def_property_boolean_sdna(prop, NULL, "col_group", 1);
+ RNA_def_property_array(prop, OB_MAX_COL_MASKS);
+ RNA_def_property_ui_text(prop, "Collision Group", "The collision group of the object");
+ RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_col_group_get", "rna_GameObjectSettings_col_group_set");
+
+ prop= RNA_def_property(srna, "collision_mask", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+ RNA_def_property_boolean_sdna(prop, NULL, "col_mask", 1);
+ RNA_def_property_array(prop, OB_MAX_COL_MASKS);
+ RNA_def_property_ui_text(prop, "Collision Mask", "The groups this object can collide with");
+ RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_col_mask_get", "rna_GameObjectSettings_col_mask_set");
+
/* lock position */
prop= RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_AXIS);

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b