Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/editors/interface/interface.c17
-rw-r--r--source/blender/editors/interface/interface_handlers.c14
-rw-r--r--source/blender/editors/space_outliner/outliner.c4
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h1
-rw-r--r--source/blender/makesrna/RNA_access.h1
-rw-r--r--source/blender/makesrna/intern/rna_access.c46
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c4
-rw-r--r--source/blender/makesrna/intern/rna_internal.h2
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c2
-rw-r--r--source/blender/makesrna/intern/rna_object.c283
-rw-r--r--source/blender/makesrna/intern/rna_rna.c2
-rw-r--r--source/blender/makesrna/intern/rna_scene.c20
-rw-r--r--source/blender/makesrna/intern/rna_wm.c4
-rw-r--r--source/blender/python/intern/bpy_operator.c11
-rw-r--r--source/blender/windowmanager/WM_api.h6
-rw-r--r--source/blender/windowmanager/intern/wm.c24
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c15
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c10
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c20
19 files changed, 378 insertions, 108 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 51cc89505b9..b72cdb17ec4 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1371,11 +1371,10 @@ static void ui_free_link(uiLink *link)
static void ui_free_but(const bContext *C, uiBut *but)
{
- if(but->opproperties) {
- IDP_FreeProperty(but->opproperties);
- MEM_freeN(but->opproperties);
+ if(but->opptr) {
+ WM_operator_properties_free(but->opptr);
+ MEM_freeN(but->opptr);
}
- if(but->opptr) MEM_freeN(but->opptr);
if(but->active) ui_button_active_cancel(C, but);
if(but->str && but->str != but->strdata) MEM_freeN(but->str);
ui_free_link(but->link);
@@ -2610,15 +2609,9 @@ int uiButGetRetVal(uiBut *but)
PointerRNA *uiButGetOperatorPtrRNA(uiBut *but)
{
- wmOperatorType *ot;
-
if(but->opname && !but->opptr) {
- ot= WM_operatortype_find(but->opname);
-
- if(ot) {
- but->opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
- RNA_pointer_create(NULL, NULL, ot->srna, &but->opproperties, but->opptr);
- }
+ but->opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
+ WM_operator_properties_create(but->opptr, but->opname);
}
return but->opptr;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index c1b795f48f1..55e7e297b3f 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -147,7 +147,7 @@ typedef struct uiAfterFunc {
const char *opname;
int opcontext;
- IDProperty *opproperties;
+ PointerRNA *opptr;
PointerRNA rnapoin;
PropertyRNA *rnaprop;
@@ -190,14 +190,14 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
after->opname= but->opname;
after->opcontext= but->opcontext;
- after->opproperties= but->opproperties;
+ after->opptr= but->opptr;
after->rnapoin= but->rnapoin;
after->rnaprop= but->rnaprop;
but->opname= NULL;
but->opcontext= 0;
- but->opproperties= NULL;
+ but->opptr= NULL;
BLI_addtail(&UIAfterFuncs, after);
}
@@ -222,10 +222,10 @@ static void ui_apply_but_funcs_after(bContext *C)
after->butm_func(C, after->butm_func_arg, after->a2);
if(after->opname)
- WM_operator_name_call(C, after->opname, after->opcontext, after->opproperties);
- if(after->opproperties) {
- IDP_FreeProperty(after->opproperties);
- MEM_freeN(after->opproperties);
+ WM_operator_name_call(C, after->opname, after->opcontext, after->opptr);
+ if(after->opptr) {
+ WM_operator_properties_free(after->opptr);
+ MEM_freeN(after->opptr);
}
if(after->rnapoin.data)
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 1e2035906a4..bbf08b6de18 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -1096,7 +1096,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
te->name= coloritem[index];
else {
te->name= MEM_callocN(sizeof(char)*20, "OutlinerRNAArrayName");
- sprintf(te->name, " %d", index);
+ sprintf(te->name, " %d", index+1);
te->flag |= TE_FREE_NAME;
}
}
@@ -3227,6 +3227,8 @@ static int tselem_rna_icon(PointerRNA *ptr)
return ICON_RNA;
else if(rnatype == &RNA_CollectionProperty)
return ICON_RNA;
+ else if(rnatype == &RNA_ObjectGameSettings)
+ return ICON_GAME;
else
return ICON_DOT;
}
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index d4d54195146..a563e2af210 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -151,7 +151,6 @@ typedef struct wmKeymapItem {
struct wmKeymapItem *next, *prev;
char idname[64]; /* used to retrieve operator type pointer */
- IDProperty *properties; /* default operator properties */
struct PointerRNA *ptr; /* rna pointer to access properties */
short type; /* event code itself */
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 29739b62615..a10405770ce 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -143,6 +143,7 @@ extern StructRNA RNA_Node;
extern StructRNA RNA_NodeTree;
extern StructRNA RNA_NorController;
extern StructRNA RNA_Object;
+extern StructRNA RNA_ObjectGameSettings;
extern StructRNA RNA_ObstacleFluidSettings;
extern StructRNA RNA_Operator;
extern StructRNA RNA_OperatorMousePath;
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index c8c3a8605a8..55d3cde4af7 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -99,22 +99,20 @@ void RNA_blender_rna_pointer_create(PointerRNA *r_ptr)
/* ID Properties */
-IDProperty *rna_idproperties_get(StructRNA *type, void *data, int create)
-{
- if(type->flag & STRUCT_ID)
- return IDP_GetProperties(data, create);
- else if(type == &RNA_IDPropertyGroup || type->from == &RNA_IDPropertyGroup)
- return data;
- else if(type->from == &RNA_OperatorProperties) {
- IDProperty **properties= (IDProperty**)data;
-
- if(create && !*properties) {
+IDProperty *rna_idproperties_get(PointerRNA *ptr, int create)
+{
+ if(ptr->type->flag & STRUCT_ID)
+ return IDP_GetProperties(ptr->data, create);
+ else if(ptr->type == &RNA_IDPropertyGroup || ptr->type->from == &RNA_IDPropertyGroup)
+ return ptr->data;
+ else if(ptr->type->from == &RNA_OperatorProperties) {
+ if(create && !ptr->data) {
IDPropertyTemplate val;
val.i = 0; /* silence MSVC warning about uninitialized var when debugging */
- *properties= IDP_New(IDP_GROUP, val, "RNA_OperatorProperties group");
+ ptr->data= IDP_New(IDP_GROUP, val, "RNA_OperatorProperties group");
}
- return *properties;
+ return ptr->data;
}
else
return NULL;
@@ -122,7 +120,7 @@ IDProperty *rna_idproperties_get(StructRNA *type, void *data, int create)
static IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name)
{
- IDProperty *group= rna_idproperties_get(ptr->type, ptr->data, 0);
+ IDProperty *group= rna_idproperties_get(ptr, 0);
IDProperty *idprop;
if(group) {
@@ -194,7 +192,7 @@ IDProperty *rna_idproperty_check(PropertyRNA **prop, PointerRNA *ptr)
IDProperty *idprop= rna_idproperty_find(ptr, (*prop)->identifier);
if(idprop && !rna_idproperty_verify_valid(*prop, idprop)) {
- IDProperty *group= rna_idproperties_get(ptr->type, ptr->data, 0);
+ IDProperty *group= rna_idproperties_get(ptr, 0);
IDP_RemFromGroup(group, idprop);
IDP_FreeProperty(idprop);
@@ -549,7 +547,7 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value)
val.i= value;
- group= rna_idproperties_get(ptr->type, ptr->data, 1);
+ group= rna_idproperties_get(ptr, 1);
if(group)
IDP_AddToGroup(group, IDP_New(IDP_INT, val, (char*)prop->identifier));
}
@@ -584,7 +582,7 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, int inde
val.array.len= prop->arraylength;
val.array.type= IDP_INT;
- group= rna_idproperties_get(ptr->type, ptr->data, 1);
+ group= rna_idproperties_get(ptr, 1);
if(group) {
idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier);
IDP_AddToGroup(group, idprop);
@@ -622,7 +620,7 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
val.i= value;
- group= rna_idproperties_get(ptr->type, ptr->data, 1);
+ group= rna_idproperties_get(ptr, 1);
if(group)
IDP_AddToGroup(group, IDP_New(IDP_INT, val, (char*)prop->identifier));
}
@@ -657,7 +655,7 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, i
val.array.len= prop->arraylength;
val.array.type= IDP_INT;
- group= rna_idproperties_get(ptr->type, ptr->data, 1);
+ group= rna_idproperties_get(ptr, 1);
if(group) {
idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier);
IDP_AddToGroup(group, idprop);
@@ -704,7 +702,7 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
val.f= value;
- group= rna_idproperties_get(ptr->type, ptr->data, 1);
+ group= rna_idproperties_get(ptr, 1);
if(group)
IDP_AddToGroup(group, IDP_New(IDP_FLOAT, val, (char*)prop->identifier));
}
@@ -748,7 +746,7 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, int index,
val.array.len= prop->arraylength;
val.array.type= IDP_FLOAT;
- group= rna_idproperties_get(ptr->type, ptr->data, 1);
+ group= rna_idproperties_get(ptr, 1);
if(group) {
idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier);
IDP_AddToGroup(group, idprop);
@@ -816,7 +814,7 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val
val.str= (char*)value;
- group= rna_idproperties_get(ptr->type, ptr->data, 1);
+ group= rna_idproperties_get(ptr, 1);
if(group)
IDP_AddToGroup(group, IDP_New(IDP_STRING, val, (char*)prop->identifier));
}
@@ -852,7 +850,7 @@ void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
val.i= value;
- group= rna_idproperties_get(ptr->type, ptr->data, 1);
+ group= rna_idproperties_get(ptr, 1);
if(group)
IDP_AddToGroup(group, IDP_New(IDP_INT, val, (char*)prop->identifier));
}
@@ -916,7 +914,7 @@ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop)
val.i= 0;
- group= rna_idproperties_get(ptr->type, ptr->data, 1);
+ group= rna_idproperties_get(ptr, 1);
if(group)
IDP_AddToGroup(group, IDP_New(IDP_GROUP, val, (char*)prop->identifier));
}
@@ -1078,7 +1076,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
IDPropertyTemplate val;
val.i= 0;
- group= rna_idproperties_get(ptr->type, ptr->data, 1);
+ group= rna_idproperties_get(ptr, 1);
if(group) {
idprop= IDP_NewIDPArray(prop->identifier);
IDP_AddToGroup(group, idprop);
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 7ced246fa98..4d800e36887 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -63,12 +63,12 @@ void rna_def_constraint_basedata(BlenderRNA *brna)
{CONSTRAINT_TYPE_CLAMPTO, "CLAMPTO", "Clamp To", ""},
{CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", "Transformation", ""},
{0, NULL, NULL, NULL}};
- static EnumPropertyItem space_items[] ={
+ /*static EnumPropertyItem space_items[] ={
{CONSTRAINT_SPACE_WORLD, "WORLD", "World Space", "World/Global space."},
{CONSTRAINT_SPACE_LOCAL, "LOCAL", "Local", "For objects (relative to parent/without parent influence). | For bones (along normals of bone, without parent/restpositions)."},
{CONSTRAINT_SPACE_POSE, "POSE", "Pose", "Pose/Armature space (only for Pose Channels)."},
{CONSTRAINT_SPACE_PARLOCAL, "PARLOCAL", "Local With Parent", "'Local' space with Parent transform taken into account (only for Pose Channels)."},
- {0, NULL, NULL, NULL}};
+ {0, NULL, NULL, NULL}};*/
/* data */
srna= RNA_def_struct(brna, "Constraint", NULL );
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index e1df48ecff6..e5c9fa35847 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -149,7 +149,7 @@ extern FloatPropertyRNA rna_IDProperty_doublearray;
extern StructRNA RNA_IDProperty;
extern StructRNA RNA_IDPropertyGroup;
-struct IDProperty *rna_idproperties_get(struct StructRNA *type, void *data, int create);
+struct IDProperty *rna_idproperties_get(struct PointerRNA *ptr, int create);
struct IDProperty *rna_idproperty_check(struct PropertyRNA **prop, struct PointerRNA *ptr);
/* Builtin Property Callbacks */
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index cf7a2c4ffbf..3d51780abc0 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -403,7 +403,7 @@ void RNA_def_modifier(BlenderRNA *brna)
/* strings */
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "");
+ RNA_def_property_ui_text(prop, "Name", "Modifier name.");
RNA_def_struct_name_property(srna, prop);
/* enums */
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index ead4b1162ee..d1a91e200d9 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -45,9 +45,203 @@ static void rna_Object_update(bContext *C, PointerRNA *ptr)
DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB);
}
+static int rna_VertexGroup_index_get(PointerRNA *ptr)
+{
+ Object *ob= ptr->id.data;
+
+ return BLI_findindex(&ob->defbase, ptr->data);
+}
+
+static void *rna_Object_active_vertex_group_get(PointerRNA *ptr)
+{
+ Object *ob= ptr->id.data;
+ return BLI_findlink(&ob->defbase, ob->actdef);
+}
+
+static void *rna_Object_game_settings_get(PointerRNA *ptr)
+{
+ return ptr->id.data;
+}
+
+static void rna_Object_layer_set(PointerRNA *ptr, int index, int value)
+{
+ Object *ob= (Object*)ptr->data;
+
+ if(value) ob->lay |= (1<<index);
+ else {
+ ob->lay &= ~(1<<index);
+ if(ob->lay == 0)
+ ob->lay |= (1<<index);
+ }
+}
+
+static void rna_ObjectGameSettings_state_set(PointerRNA *ptr, int index, int value)
+{
+ Object *ob= (Object*)ptr->data;
+
+ if(value) ob->state |= (1<<index);
+ else {
+ ob->state &= ~(1<<index);
+ if(ob->state == 0)
+ ob->state |= (1<<index);
+ }
+}
+
#else
-void RNA_def_object(BlenderRNA *brna)
+static void rna_def_vertex_group(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "VertexGroup", NULL);
+ RNA_def_struct_sdna(srna, "bDeformGroup");
+ RNA_def_struct_ui_text(srna, "Vertex Group", "Group of vertices, used for armature deform and other purposes.");
+
+ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Vertex group name.");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_VertexGroup_index_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Index", "Index number of the vertex group.");
+}
+
+static void rna_def_object_game_settings(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem body_type_items[] = {
+ {OB_BODY_TYPE_NO_COLLISION, "NO_COLLISION", "No Collision", ""},
+ {OB_BODY_TYPE_STATIC, "STATIC", "Static", ""},
+ {OB_BODY_TYPE_DYNAMIC, "DYNAMIC", "Dynamic", ""},
+ {OB_BODY_TYPE_RIGID, "RIGID_BODY", "Rigid Body", ""},
+ {OB_BODY_TYPE_SOFT, "SOFT_BODY", "Soft Body", ""},
+ {0, NULL, NULL, NULL}};
+
+ static EnumPropertyItem collision_bounds_items[] = {
+ {OB_BOUND_BOX, "BOX", "Box", ""},
+ {OB_BOUND_SPHERE, "SPHERE", "Sphere", ""},
+ {OB_BOUND_CYLINDER, "CYLINDER", "Cylinder", ""},
+ {OB_BOUND_CONE, "CONE", "Cone", ""},
+ {OB_BOUND_POLYH, "CONVEX_HULL", "Convex Hull", ""},
+ {OB_BOUND_POLYT, "TRIANGLE_MESH", "Triangle Mesh", ""},
+ //{OB_DYN_MESH, "DYNAMIC_MESH", "Dynamic Mesh", ""},
+ {0, NULL, NULL, NULL}};
+
+ srna= RNA_def_struct(brna, "ObjectGameSettings", NULL);
+ RNA_def_struct_sdna(srna, "Object");
+ RNA_def_struct_ui_text(srna, "Object Game Settings", "Game engine related settings for the object.");
+
+ prop= RNA_def_property(srna, "sensors", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Sensor");
+ RNA_def_property_ui_text(prop, "Sensors", "DOC_BROKEN");
+
+ prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Controller");
+ RNA_def_property_ui_text(prop, "Controllers", "DOC_BROKEN");
+
+ prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Actuator");
+ RNA_def_property_ui_text(prop, "Actuators", "DOC_BROKEN");
+
+ prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "prop", NULL);
+ RNA_def_property_struct_type(prop, "GameProperty");
+ RNA_def_property_ui_text(prop, "Properties", "Game engine properties.");
+
+ prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "body_type");
+ RNA_def_property_enum_items(prop, body_type_items);
+ RNA_def_property_flag(prop, PROP_NOT_EDITABLE); // this controls various gameflags
+ RNA_def_property_ui_text(prop, "Physics Type", "Selects the type of physical representation.");
+
+ prop= RNA_def_property(srna, "actor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ACTOR);
+ RNA_def_property_ui_text(prop, "Actor", "Object is detected by the Near and Radar sensor.");
+
+ prop= RNA_def_property(srna, "ghost", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_GHOST);
+ RNA_def_property_ui_text(prop, "Ghost", "Object does not restitute collisions, like a ghost.");
+
+ prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.01, 10000.0);
+ RNA_def_property_ui_text(prop, "Mass", "Mass of the object.");
+
+ prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "inertia");
+ RNA_def_property_range(prop, 0.01, 10.0);
+ RNA_def_property_ui_text(prop, "Radius", "Radius for Bounding sphere and Fh/Fh Rot.");
+
+ prop= RNA_def_property(srna, "no_sleeping", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_COLLISION_RESPONSE);
+ RNA_def_property_ui_text(prop, "No Sleeping", "Disable auto (de)activation in physics simulation.");
+
+ prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "damping");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Damping", "General movement damping.");
+
+ prop= RNA_def_property(srna, "rotation_damping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rdamping");
+ 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, "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.");
+
+ prop= RNA_def_property(srna, "rotation_fh", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ROT_FH);
+ RNA_def_property_ui_text(prop, "Rotation Fh", "Use face normal to rotate Object");
+
+ prop= RNA_def_property(srna, "form_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "formfactor");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Form Factor", "Form factor scales the inertia tensor.");
+
+ prop= RNA_def_property(srna, "anisotropic_friction", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ANISOTROPIC_FRICTION);
+ RNA_def_property_ui_text(prop, "Anisotropic Friction", "Enable anisotropic friction.");
+
+ prop= RNA_def_property(srna, "friction_coefficients", PROP_FLOAT, PROP_VECTOR);
+ RNA_def_property_float_sdna(prop, NULL, "anisotropicFriction");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Friction Coefficients", "Relative friction coefficient in the in the X, Y and Z directions, when anisotropic friction is enabled.");
+
+ prop= RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_BOUNDS);
+ RNA_def_property_ui_text(prop, "Use Collision Bounds", "Specify a collision bounds type other than the default.");
+
+ prop= RNA_def_property(srna, "collision_bounds", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "boundtype");
+ RNA_def_property_enum_items(prop, collision_bounds_items);
+ RNA_def_property_ui_text(prop, "Collision Bounds", "Selects the collision type.");
+
+ prop= RNA_def_property(srna, "collision_compound", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_CHILD);
+ RNA_def_property_ui_text(prop, "Collison Compound", "Add children to form a compound collision object.");
+
+ prop= RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "margin");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Collision Margin", "Extra margin around object for collision detection, small amount required for stability.");
+
+ prop= RNA_def_property(srna, "state", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "state", 1);
+ RNA_def_property_array(prop, 30);
+ RNA_def_property_ui_text(prop, "State", "State determining which controllers are displayed.");
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_ObjectGameSettings_state_set");
+
+ prop= RNA_def_property(srna, "initial_state", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "init_state", 1);
+ RNA_def_property_array(prop, 30);
+ RNA_def_property_ui_text(prop, "Initial State", "Initial state when the game starts.");
+}
+
+static void rna_def_object(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
@@ -59,24 +253,54 @@ void RNA_def_object(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "ID");
RNA_def_property_ui_text(prop, "Data", "Object data.");
+ prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
+ RNA_def_property_array(prop, 20);
+ RNA_def_property_ui_text(prop, "Layers", "Layers the object is on.");
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_Object_layer_set");
+
+ /* parent and track */
+
prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Parent", "Parent Object");
prop= RNA_def_property(srna, "track", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Track", "Object being tracked to define the rotation (Old Track).");
- prop= RNA_def_property(srna, "loc", PROP_FLOAT, PROP_VECTOR);
- RNA_def_property_ui_text(prop, "Location", "DOC_BROKEN");
+ /* transform */
+
+ prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_VECTOR);
+ RNA_def_property_float_sdna(prop, NULL, "loc");
+ RNA_def_property_ui_text(prop, "Location", "Location of the object.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
+
+ prop= RNA_def_property(srna, "delta_location", PROP_FLOAT, PROP_VECTOR);
+ RNA_def_property_float_sdna(prop, NULL, "dloc");
+ RNA_def_property_ui_text(prop, "Delta Location", "Extra added translation to object location.");
RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
- prop= RNA_def_property(srna, "rot", PROP_FLOAT, PROP_ROTATION);
- RNA_def_property_ui_text(prop, "Rotation", "");
+ prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ROTATION);
+ RNA_def_property_float_sdna(prop, NULL, "rot");
+ RNA_def_property_ui_text(prop, "Rotation", "Rotation of the object.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
+
+ prop= RNA_def_property(srna, "delta_rotation", PROP_FLOAT, PROP_ROTATION);
+ RNA_def_property_float_sdna(prop, NULL, "drot");
+ RNA_def_property_ui_text(prop, "Delta Rotation", "Extra added rotation to the rotation of the object.");
RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
- prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_VECTOR);
- RNA_def_property_ui_text(prop, "Scale", "DOC_BROKEN");
+ prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_VECTOR);
+ RNA_def_property_float_sdna(prop, NULL, "size");
+ RNA_def_property_ui_text(prop, "Scale", "Scaling of the object.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
+
+ prop= RNA_def_property(srna, "delta_scale", PROP_FLOAT, PROP_VECTOR);
+ RNA_def_property_float_sdna(prop, NULL, "dsize");
+ RNA_def_property_ui_text(prop, "Delta Scale", "Extra added scaling to the scale of the object.");
RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
+ /* collections */
+
prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Ipo");
RNA_def_property_ui_text(prop, "Ipo", "DOC_BROKEN");
@@ -89,22 +313,41 @@ void RNA_def_object(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "Modifier");
RNA_def_property_ui_text(prop, "Modifiers", "DOC_BROKEN");
- prop= RNA_def_property(srna, "sensors", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "Sensor");
- RNA_def_property_ui_text(prop, "Sensors", "DOC_BROKEN");
+ /* game engine */
- prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "Controller");
- RNA_def_property_ui_text(prop, "Controllers", "DOC_BROKEN");
+ prop= RNA_def_property(srna, "game_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ObjectGameSettings");
+ RNA_def_property_pointer_funcs(prop, "rna_Object_game_settings_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Game Settings", "Game engine related settings for the object.");
- prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "Actuator");
- RNA_def_property_ui_text(prop, "Actuators", "DOC_BROKEN");
+ /* vertex groups */
- prop= RNA_def_property(srna, "game_properties", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "prop", NULL);
- RNA_def_property_struct_type(prop, "GameProperty");
- RNA_def_property_ui_text(prop, "Game Properties", "Game engine properties.");
+ prop= RNA_def_property(srna, "vertex_groups", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "defbase", NULL);
+ RNA_def_property_struct_type(prop, "VertexGroup");
+ RNA_def_property_ui_text(prop, "Vertex Groups", "Vertex groups of the object.");
+
+ prop= RNA_def_property(srna, "active_vertex_group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "VertexGroup");
+ RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object.");
+
+ /* various */
+
+ prop= RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "index");
+ RNA_def_property_ui_text(prop, "Pass Index", "Index # for the IndexOB render pass.");
+
+ prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "col");
+ RNA_def_property_ui_text(prop, "Color", "Object color and alpha, used when faces have the ObColor mode enabled.");
+}
+
+void RNA_def_object(BlenderRNA *brna)
+{
+ rna_def_vertex_group(brna);
+ rna_def_object_game_settings(brna);
+ rna_def_object(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index f43d864ea5b..b4d414c727d 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -105,7 +105,7 @@ static void rna_Struct_properties_next(CollectionPropertyIterator *iter)
/* try id properties */
if(!iter->valid) {
- group= rna_idproperties_get(iter->parent.type, iter->parent.data, 0);
+ group= rna_idproperties_get(&iter->parent, 0);
if(group) {
rna_iterator_listbase_end(iter);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index dc2eff673ec..353db5248d9 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -31,6 +31,8 @@
#include "DNA_scene_types.h"
+#include "WM_types.h"
+
#ifdef RNA_RUNTIME
#include "BKE_global.h"
@@ -69,6 +71,12 @@ static void rna_Scene_end_frame_set(PointerRNA *ptr, int value)
data->r.efra= value;
}
+static void rna_Scene_frame_update(bContext *C, PointerRNA *ptr)
+{
+ //Scene *scene= ptr->id.data;
+ //update_for_newframe();
+}
+
#else
void RNA_def_scene(BlenderRNA *brna)
@@ -95,7 +103,8 @@ void RNA_def_scene(BlenderRNA *brna)
prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Active Camera", "Active camera used for rendering the scene.");
- prop= RNA_def_property(srna, "cursor", PROP_FLOAT, PROP_VECTOR);
+ prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_VECTOR);
+ RNA_def_property_float_sdna(prop, NULL, "cursor");
RNA_def_property_ui_text(prop, "Cursor Location", "3D cursor location.");
RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
@@ -105,13 +114,14 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Objects", "");
RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Scene_objects_get", 0, 0, 0, 0);
- prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "visible_layers", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
RNA_def_property_array(prop, 20);
RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible when rendering the scene.");
RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_layer_set");
- prop= RNA_def_property(srna, "prop_mode", PROP_ENUM, PROP_NONE);
+ prop= RNA_def_property(srna, "proportional_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
RNA_def_property_enum_items(prop, prop_mode_items);
RNA_def_property_ui_text(prop, "Proportional Mode", "Proportional editing mode.");
@@ -120,22 +130,26 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "r.cfra");
RNA_def_property_range(prop, MINFRAME, MAXFRAME);
RNA_def_property_ui_text(prop, "Current Frame", "");
+ RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_frame_update");
prop= RNA_def_property(srna, "start_frame", PROP_INT, PROP_NONE);
RNA_def_property_flag(prop, PROP_NOT_DRIVEABLE);
RNA_def_property_int_sdna(prop, NULL, "r.sfra");
RNA_def_property_int_funcs(prop, NULL, "rna_Scene_start_frame_set", NULL);
RNA_def_property_ui_text(prop, "Start Frame", "");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
prop= RNA_def_property(srna, "end_frame", PROP_INT, PROP_NONE);
RNA_def_property_flag(prop, PROP_NOT_DRIVEABLE);
RNA_def_property_int_sdna(prop, NULL, "r.efra");
RNA_def_property_int_funcs(prop, NULL, "rna_Scene_end_frame_set", NULL);
RNA_def_property_ui_text(prop, "End Frame", "");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
prop= RNA_def_property(srna, "stamp_note", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "r.stamp_udata");
RNA_def_property_ui_text(prop, "Stamp Note", "User define note for the render stamping.");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
prop= RNA_def_property(srna, "unwrapper", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "toolsettings->unwrapper");
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index fe809a18d4d..c4a4780cb1d 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -36,7 +36,7 @@
static wmOperator *rna_OperatorProperties_find_operator(PointerRNA *ptr)
{
wmWindowManager *wm= ptr->id.data;
- IDProperty *properties= *(IDProperty**)ptr->data;
+ IDProperty *properties= (IDProperty*)ptr->data;
wmOperator *op;
if(wm)
@@ -72,7 +72,7 @@ static int rna_Operator_name_length(PointerRNA *ptr)
static void *rna_Operator_properties_get(PointerRNA *ptr)
{
wmOperator *op= (wmOperator*)ptr->data;
- return &op->properties;
+ return op->properties;
}
#else
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index acc4d03db50..cc87fd0704e 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -174,7 +174,6 @@ static PyGetSetDef pyop_func_getseters[] = {
static PyObject * pyop_func_call(BPy_OperatorFunc * self, PyObject *args, PyObject *kw)
{
- IDProperty *properties = NULL;
wmOperatorType *ot;
int error_val = 0;
@@ -191,18 +190,16 @@ static PyObject * pyop_func_call(BPy_OperatorFunc * self, PyObject *args, PyObje
return NULL;
}
- RNA_pointer_create(NULL, NULL, ot->srna, &properties, &ptr);
+ WM_operator_properties_create(&ptr, self->name);
error_val= PYOP_props_from_dict(&ptr, kw);
if (error_val==0) {
- WM_operator_name_call(self->C, self->name, WM_OP_EXEC_DEFAULT, properties);
+ WM_operator_name_call(self->C, self->name, WM_OP_EXEC_DEFAULT, &ptr);
}
- if (properties) {
- IDP_FreeProperty(properties);
- MEM_freeN(properties);
- }
+ WM_operator_properties_free(&ptr);
+
#if 0
/* if there is some way to know an operator takes args we should use this */
{
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 3125a21bbd2..8ec6078e1d9 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -37,6 +37,7 @@ struct wmEvent;
struct wmEventHandler;
struct wmGesture;
struct rcti;
+struct PointerRNA;
/* general API */
void WM_setprefsize (int stax, int stay, int sizx, int sizy);
@@ -122,7 +123,10 @@ void WM_operatortype_append_ptr (void (*opfunc)(wmOperatorType*, void *), void
int WM_operatortype_remove(const char *idname);
int WM_operator_call (struct bContext *C, struct wmOperator *op);
-int WM_operator_name_call (struct bContext *C, const char *opstring, int context, struct IDProperty *properties);
+int WM_operator_name_call (struct bContext *C, const char *opstring, int context, struct PointerRNA *properties);
+
+void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring);
+void WM_operator_properties_free(struct PointerRNA *ptr);
/* operator as a python command (resultuing string must be free'd) */
char *WM_operator_pystring(struct wmOperator *op);
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 62cf31b5ffc..2008c3c1c6f 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -48,21 +48,24 @@
#include "ED_screen.h"
+#include "RNA_types.h"
+
/* ****************************************************** */
#define MAX_OP_REGISTERED 32
void WM_operator_free(wmOperator *op)
{
+ if(op->ptr) {
+ op->properties= op->ptr->data;
+ MEM_freeN(op->ptr);
+ }
+
if(op->properties) {
IDP_FreeProperty(op->properties);
MEM_freeN(op->properties);
- op->properties= NULL;
}
- if(op->ptr)
- MEM_freeN(op->ptr);
-
if(op->reports) {
BKE_reports_clear(op->reports);
MEM_freeN(op->reports);
@@ -77,6 +80,12 @@ void wm_operator_register(wmWindowManager *wm, wmOperator *op)
{
int tot;
+ if(op->ptr) {
+ op->properties= op->ptr->data;
+ MEM_freeN(op->ptr);
+ op->ptr= NULL;
+ }
+
BLI_addtail(&wm->operators, op);
tot= BLI_countlist(&wm->operators);
@@ -152,12 +161,9 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
while((km= wm->keymaps.first)) {
for(kmi=km->keymap.first; kmi; kmi=kmi->next) {
- if(kmi->ptr)
+ if(kmi->ptr) {
+ WM_operator_properties_free(kmi->ptr);
MEM_freeN(kmi->ptr);
-
- if(kmi->properties) {
- IDP_FreeProperty(kmi->properties);
- MEM_freeN(kmi->properties);
}
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 96a97e95bd7..6dffc0ff29e 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -355,7 +355,7 @@ int WM_operator_call(bContext *C, wmOperator *op)
return retval;
}
-static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, IDProperty *properties)
+static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, PointerRNA *properties)
{
wmWindowManager *wm= CTX_wm_manager(C);
int retval= OPERATOR_PASS_THROUGH;
@@ -363,15 +363,14 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, I
if(ot->poll==NULL || ot->poll(C)) {
wmOperator *op= MEM_callocN(sizeof(wmOperator), ot->idname); /* XXX operatortype names are static still. for debug */
- if(properties)
- op->properties= IDP_CopyProperty(properties);
-
/* XXX adding new operator could be function, only happens here now */
op->type= ot;
BLI_strncpy(op->idname, ot->idname, OP_MAX_TYPENAME);
op->ptr= MEM_callocN(sizeof(PointerRNA), "wmOperatorPtrRNA");
- RNA_pointer_create(&RNA_WindowManager, &wm->id, ot->srna, &op->properties, op->ptr);
+ if(properties && properties->data)
+ op->ptr->data= IDP_CopyProperty(properties->data);
+ RNA_pointer_create(&RNA_WindowManager, &wm->id, ot->srna, op->ptr->data, op->ptr);
op->reports= MEM_callocN(sizeof(ReportList), "wmOperatorReportList");
BKE_reports_init(op->reports, RPT_STORE);
@@ -402,7 +401,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, I
}
/* invokes operator in context */
-int WM_operator_name_call(bContext *C, const char *opstring, int context, IDProperty *properties)
+int WM_operator_name_call(bContext *C, const char *opstring, int context, PointerRNA *properties)
{
wmOperatorType *ot= WM_operatortype_find(opstring);
wmWindow *window= CTX_wm_window(C);
@@ -605,7 +604,7 @@ static int wm_event_always_pass(wmEvent *event)
}
/* Warning: this function removes a modal handler, when finished */
-static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHandler *handler, wmEvent *event, IDProperty *properties)
+static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHandler *handler, wmEvent *event, PointerRNA *properties)
{
int retval= OPERATOR_PASS_THROUGH;
@@ -746,7 +745,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
event->keymap_idname= kmi->idname; /* weak, but allows interactive callback to not use rawkey */
- action= wm_handler_operator_call(C, handlers, handler, event, kmi->properties);
+ action= wm_handler_operator_call(C, handlers, handler, event, kmi->ptr);
if(action==WM_HANDLER_BREAK) /* not wm_event_always_pass(event) here, it denotes removed handler */
break;
}
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index eac51559269..3a05a319e8a 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -84,15 +84,9 @@ static void keymap_event_set(wmKeymapItem *kmi, short type, short val, int modif
static void keymap_properties_set(wmKeymapItem *kmi)
{
- wmOperatorType *ot;
-
if(!kmi->ptr) {
- ot= WM_operatortype_find(kmi->idname);
-
- if(ot) {
- kmi->ptr= MEM_callocN(sizeof(PointerRNA), "wmKeymapItemPtr");
- RNA_pointer_create(NULL, NULL, ot->srna, &kmi->properties, kmi->ptr);
- }
+ kmi->ptr= MEM_callocN(sizeof(PointerRNA), "wmKeymapItemPtr");
+ WM_operator_properties_create(kmi->ptr, kmi->idname);
}
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 7d2c4a12ef4..f099122096d 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -164,6 +164,26 @@ char *WM_operator_pystring(wmOperator *op)
return cstring;
}
+void WM_operator_properties_create(PointerRNA *ptr, const char *opstring)
+{
+ wmOperatorType *ot= WM_operatortype_find(opstring);
+
+ if(ot)
+ RNA_pointer_create(NULL, NULL, ot->srna, NULL, ptr);
+ else
+ memset(ptr, 0, sizeof(*ptr));
+}
+
+void WM_operator_properties_free(PointerRNA *ptr)
+{
+ IDProperty *properties= ptr->data;
+
+ if(properties) {
+ IDP_FreeProperty(properties);
+ MEM_freeN(properties);
+ }
+}
+
/* ************ default op callbacks, exported *********** */
/* invoke callback, uses enum property named "type" */