From e6e4c7ef8bd53b06c879302bbfd3d6a00c6c48af Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 5 Aug 2011 20:45:26 +0000 Subject: KEYMAP REFACTORING Diff Keymaps User edited keymaps now no longer override the builtin keymaps entirely, but rather save only the difference and reapply those changes. This means they can stay better in sync when the builtin keymaps change. The diff/patch algorithm is not perfect, but better for the common case where only a few items are changed rather than entire keymaps The main weakness is that if a builtin keymap item changes, user modification of that item may need to be redone in some cases. Keymap Editor The most noticeable change here is that there is no longer an "Edit" button for keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps and items that have been edited. Shortcuts for addons can also be edited in the keymap editor. Addons Addons now should only modify the new addon keyconfiguration, the keymap items there will be added to the builtin ones for handling events, and not get lost when starting new files. Example code of register/unregister: km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D") km.keymap_items.new('my.operator', 'ESC', 'PRESS') km = wm.keyconfigs.addon.keymaps["3D View"] km.keymap_items.remove(km.keymap_items["my.operator"]) Compatibility The changes made are not forward compatible, i.e. if you save user preferences with newer versions, older versions will not have key configuration changes that were made. --- source/blender/makesrna/intern/rna_internal.h | 3 + source/blender/makesrna/intern/rna_scene.c | 2 +- source/blender/makesrna/intern/rna_userdef.c | 6 - source/blender/makesrna/intern/rna_wm.c | 247 +++++--------------------- source/blender/makesrna/intern/rna_wm_api.c | 183 ++++++++++++++++++- 5 files changed, 227 insertions(+), 214 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 9175806e2bb..c0ae7b02b1a 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -238,9 +238,12 @@ void RNA_api_image(struct StructRNA *srna); void RNA_api_operator(struct StructRNA *srna); void RNA_api_macro(struct StructRNA *srna); void RNA_api_keyconfig(struct StructRNA *srna); +void RNA_api_keyconfigs(struct StructRNA *srna); void RNA_api_keyingset(struct StructRNA *srna); void RNA_api_keymap(struct StructRNA *srna); +void RNA_api_keymaps(struct StructRNA *srna); void RNA_api_keymapitem(struct StructRNA *srna); +void RNA_api_keymapitems(struct StructRNA *srna); void RNA_api_area(struct StructRNA *srna); void RNA_api_main(struct StructRNA *srna); void RNA_api_material(StructRNA *srna); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index b3d8bc8ea18..29cfc695911 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1409,7 +1409,7 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) prop= RNA_def_property(srna, "layers_zmask", PROP_BOOLEAN, PROP_LAYER); RNA_def_property_boolean_sdna(prop, NULL, "lay_zmask", 1); RNA_def_property_array(prop, 20); - RNA_def_property_ui_text(prop, "Zmask Layers", "Zmask scene layers"); + RNA_def_property_ui_text(prop, "Zmask Layers", "Zmask scene layers for solid faces"); if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index a1a99c34e70..b3dbafeab7d 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2795,12 +2795,6 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_range(prop, 0, 32); RNA_def_property_ui_text(prop, "Wheel Scroll Lines", "The number of lines scrolled at a time with the mouse wheel"); - /* U.keymaps - custom keymaps that have been edited from default configs */ - prop= RNA_def_property(srna, "edited_keymaps", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "keymaps", NULL); - RNA_def_property_struct_type(prop, "KeyMap"); - RNA_def_property_ui_text(prop, "Edited Keymaps", ""); - prop= RNA_def_property(srna, "active_keyconfig", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "keyconfigstr"); RNA_def_property_ui_text(prop, "Key Config", "The name of the active key configuration"); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index a046be59ab5..307cf0e175a 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -578,22 +578,6 @@ static EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C, PointerRNA wmKeyConfig *kc; wmKeyMap *km; - /* check user keymaps */ - for(km=U.keymaps.first; km; km=km->next) { - wmKeyMapItem *kmi; - for (kmi=km->items.first; kmi; kmi=kmi->next) { - if (kmi == ptr->data) { - if (!km->modal_items) { - if (!WM_keymap_user_init(wm, km)) { - return keymap_propvalue_items; /* ERROR */ - } - } - - return km->modal_items; - } - } - } - for(kc=wm->keyconfigs.first; kc; kc=kc->next) { for(km=kc->keymaps.first; km; km=km->next) { /* only check if it's a modal keymap */ @@ -654,12 +638,13 @@ static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_KeyConfig, kc); } -static void rna_WindowManager_active_keyconfig_set(PointerRNA *UNUSED(ptr), PointerRNA value) +static void rna_WindowManager_active_keyconfig_set(PointerRNA *ptr, PointerRNA value) { + wmWindowManager *wm= ptr->data; wmKeyConfig *kc= value.data; if(kc) - BLI_strncpy(U.keyconfigstr, kc->idname, sizeof(U.keyconfigstr)); + WM_keyconfig_set_active(wm, kc->idname); } static void rna_wmKeyMapItem_idname_get(PointerRNA *ptr, char *value) @@ -1130,93 +1115,6 @@ static StructRNA* rna_MacroOperator_refine(PointerRNA *opr) return (op->type && op->type->ext.srna)? op->type->ext.srna: &RNA_Macro; } -static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, const char *idname, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier) -{ -// wmWindowManager *wm = CTX_wm_manager(C); - char idname_bl[OP_MAX_TYPENAME]; - int modifier= 0; - - /* only on non-modal maps */ - if (km->flag & KEYMAP_MODAL) { - BKE_report(reports, RPT_ERROR, "Not a non-modal keymap."); - return NULL; - } - - WM_operator_bl_idname(idname_bl, idname); - - if(shift) modifier |= KM_SHIFT; - if(ctrl) modifier |= KM_CTRL; - if(alt) modifier |= KM_ALT; - if(oskey) modifier |= KM_OSKEY; - - if(any) modifier = KM_ANY; - - return WM_keymap_add_item(km, idname_bl, type, value, modifier, keymodifier); -} - -static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, bContext *C, ReportList *reports, const char *propvalue_str, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier) -{ - wmWindowManager *wm = CTX_wm_manager(C); - int modifier= 0; - int propvalue = 0; - - /* only modal maps */ - if ((km->flag & KEYMAP_MODAL) == 0) { - BKE_report(reports, RPT_ERROR, "Not a modal keymap."); - return NULL; - } - - if (!km->modal_items) { - if(!WM_keymap_user_init(wm, km)) { - BKE_report(reports, RPT_ERROR, "User defined keymap doesn't correspond to a system keymap."); - return NULL; - } - } - - if (!km->modal_items) { - BKE_report(reports, RPT_ERROR, "No property values defined."); - return NULL; - } - - - if(RNA_enum_value_from_id(km->modal_items, propvalue_str, &propvalue)==0) { - BKE_report(reports, RPT_WARNING, "Property value not in enumeration."); - } - - if(shift) modifier |= KM_SHIFT; - if(ctrl) modifier |= KM_CTRL; - if(alt) modifier |= KM_ALT; - if(oskey) modifier |= KM_OSKEY; - - if(any) modifier = KM_ANY; - - return WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, propvalue); -} - -static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, int modal) -{ - if (modal == 0) { - return WM_keymap_find(keyconf, idname, spaceid, regionid); - } else { - return WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */ - } -} - -static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid) -{ - return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid); -} - -static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *UNUSED(keyconf), const char *idname) -{ - wmOperatorType *ot = WM_operatortype_find(idname, 0); - - if (!ot) - return NULL; - else - return ot->modalkeymap; -} - /* just to work around 'const char *' warning and to ensure this is a python op */ static void rna_Operator_bl_idname_set(PointerRNA *ptr, const char *value) { @@ -1242,6 +1140,12 @@ static void rna_Operator_bl_description_set(PointerRNA *ptr, const char *value) else assert(!"setting the bl_description on a non-builtin operator"); } +static void rna_KeyMapItem_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + wmKeyMapItem *kmi= ptr->data; + WM_keyconfig_update_tag(NULL, kmi); +} + #else /* RNA_RUNTIME */ static void rna_def_operator(BlenderRNA *brna) @@ -1566,9 +1470,6 @@ static void rna_def_wm_keyconfigs(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; PropertyRNA *prop; - FunctionRNA *func; - PropertyRNA *parm; - RNA_def_property_srna(cprop, "KeyConfigurations"); srna= RNA_def_struct(brna, "KeyConfigurations", NULL); RNA_def_struct_sdna(srna, "wmWindowManager"); @@ -1578,23 +1479,24 @@ static void rna_def_wm_keyconfigs(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_struct_type(prop, "KeyConfig"); RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get", "rna_WindowManager_active_keyconfig_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Active KeyConfig", "Active wm KeyConfig"); + RNA_def_property_ui_text(prop, "Active KeyConfig", "Active key configuration (preset)"); prop= RNA_def_property(srna, "default", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "defaultconf"); RNA_def_property_struct_type(prop, "KeyConfig"); - RNA_def_property_ui_text(prop, "Default Key Configuration", ""); + RNA_def_property_ui_text(prop, "Default Key Configuration", "Default builtin key configuration"); + + prop= RNA_def_property(srna, "addon", PROP_POINTER, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "addonconf"); + RNA_def_property_struct_type(prop, "KeyConfig"); + RNA_def_property_ui_text(prop, "Addon Key Configuration", "Key configuration that can be extended by addons, and is added to the active configuration when handling events"); + + prop= RNA_def_property(srna, "user", PROP_POINTER, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "userconf"); + RNA_def_property_struct_type(prop, "KeyConfig"); + RNA_def_property_ui_text(prop, "User Key Configuration", "Final key configuration that combines keymaps from the active and addon configurations, and can be edited by the user"); - /* funcs */ - func= RNA_def_function(srna, "new", "WM_keyconfig_new_user"); // add_keyconfig - parm= RNA_def_string(func, "name", "", 0, "Name", ""); - RNA_def_property_flag(parm, PROP_REQUIRED); - parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration."); - RNA_def_function_return(func, parm); - - func= RNA_def_function(srna, "remove", "WM_keyconfig_remove"); // remove_keyconfig - parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Removed key configuration."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_api_keyconfigs(srna); } static void rna_def_windowmanager(BlenderRNA *brna) @@ -1631,107 +1533,30 @@ static void rna_def_windowmanager(BlenderRNA *brna) static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; -// PropertyRNA *prop; - - FunctionRNA *func; - PropertyRNA *parm; RNA_def_property_srna(cprop, "KeyMapItems"); srna= RNA_def_struct(brna, "KeyMapItems", NULL); RNA_def_struct_sdna(srna, "wmKeyMap"); RNA_def_struct_ui_text(srna, "KeyMap Items", "Collection of keymap items"); - func= RNA_def_function(srna, "new", "rna_KeyMap_item_new"); - RNA_def_function_flag(func, FUNC_USE_REPORTS); - parm= RNA_def_string(func, "idname", "", 0, "Operator Identifier", ""); - RNA_def_property_flag(parm, PROP_REQUIRED); - parm= RNA_def_enum(func, "type", event_type_items, 0, "Type", ""); - RNA_def_property_flag(parm, PROP_REQUIRED); - parm= RNA_def_enum(func, "value", event_value_items, 0, "Value", ""); - RNA_def_property_flag(parm, PROP_REQUIRED); - RNA_def_boolean(func, "any", 0, "Any", ""); - RNA_def_boolean(func, "shift", 0, "Shift", ""); - RNA_def_boolean(func, "ctrl", 0, "Ctrl", ""); - RNA_def_boolean(func, "alt", 0, "Alt", ""); - RNA_def_boolean(func, "oskey", 0, "OS Key", ""); - RNA_def_enum(func, "key_modifier", event_type_items, 0, "Key Modifier", ""); - parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item."); - RNA_def_function_return(func, parm); - - func= RNA_def_function(srna, "new_modal", "rna_KeyMap_item_new_modal"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); - parm= RNA_def_string(func, "propvalue", "", 0, "Property Value", ""); - RNA_def_property_flag(parm, PROP_REQUIRED); - parm= RNA_def_enum(func, "type", event_type_items, 0, "Type", ""); - RNA_def_property_flag(parm, PROP_REQUIRED); - parm= RNA_def_enum(func, "value", event_value_items, 0, "Value", ""); - RNA_def_property_flag(parm, PROP_REQUIRED); - RNA_def_boolean(func, "any", 0, "Any", ""); - RNA_def_boolean(func, "shift", 0, "Shift", ""); - RNA_def_boolean(func, "ctrl", 0, "Ctrl", ""); - RNA_def_boolean(func, "alt", 0, "Alt", ""); - RNA_def_boolean(func, "oskey", 0, "OS Key", ""); - RNA_def_enum(func, "key_modifier", event_type_items, 0, "Key Modifier", ""); - parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item."); - RNA_def_function_return(func, parm); - - func= RNA_def_function(srna, "remove", "WM_keymap_remove_item"); - parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", ""); - RNA_def_property_flag(parm, PROP_REQUIRED); - - func= RNA_def_function(srna, "from_id", "WM_keymap_item_find_id"); - parm= RNA_def_property(func, "id", PROP_INT, PROP_NONE); - RNA_def_property_flag(parm, PROP_REQUIRED); - RNA_def_property_ui_text(parm, "id", "ID of the item"); - parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", ""); - RNA_def_function_return(func, parm); - + RNA_api_keymapitems(srna); } static void rna_def_wm_keymaps(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; - //PropertyRNA *prop; - - FunctionRNA *func; - PropertyRNA *parm; - RNA_def_property_srna(cprop, "KeyMaps"); srna= RNA_def_struct(brna, "KeyMaps", NULL); RNA_def_struct_sdna(srna, "wmKeyConfig"); RNA_def_struct_ui_text(srna, "Key Maps", "Collection of keymaps"); - func= RNA_def_function(srna, "new", "rna_keymap_new"); // add_keymap - parm= RNA_def_string(func, "name", "", 0, "Name", ""); - RNA_def_property_flag(parm, PROP_REQUIRED); - RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", ""); - RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", ""); - RNA_def_boolean(func, "modal", 0, "Modal", ""); - parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map."); - RNA_def_function_return(func, parm); - - func= RNA_def_function(srna, "find", "rna_keymap_find"); // find_keymap - parm= RNA_def_string(func, "name", "", 0, "Name", ""); - RNA_def_property_flag(parm, PROP_REQUIRED); - RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", ""); - RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", ""); - parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map."); - RNA_def_function_return(func, parm); - - func= RNA_def_function(srna, "find_modal", "rna_keymap_find_modal"); // find_keymap_modal - parm= RNA_def_string(func, "name", "", 0, "Operator Name", ""); - RNA_def_property_flag(parm, PROP_REQUIRED); - parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map."); - RNA_def_function_return(func, parm); - + RNA_api_keymaps(srna); } static void rna_def_keyconfig(BlenderRNA *brna) { StructRNA *srna; - // FunctionRNA *func; - // PropertyRNA *parm; PropertyRNA *prop; static EnumPropertyItem map_type_items[] = { @@ -1794,8 +1619,8 @@ static void rna_def_keyconfig(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Items", "Items in the keymap, linking an operator to an input event"); rna_def_keymap_items(brna, prop); - prop= RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NEVER_NULL); - RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_USER); + prop= RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NEVER_NULL); + RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_USER_MODIFIED); RNA_def_property_ui_text(prop, "User Defined", "Keymap is defined by the user"); prop= RNA_def_property(srna, "is_modal", PROP_BOOLEAN, PROP_NONE); @@ -1826,6 +1651,7 @@ static void rna_def_keyconfig(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Identifier", "Identifier of operator to call on input event"); RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_idname_get", "rna_wmKeyMapItem_idname_length", "rna_wmKeyMapItem_idname_set"); RNA_def_struct_name_property(srna, prop); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -1836,62 +1662,73 @@ static void rna_def_keyconfig(BlenderRNA *brna) RNA_def_property_struct_type(prop, "OperatorProperties"); RNA_def_property_pointer_funcs(prop, "rna_KeyMapItem_properties_get", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Properties", "Properties to set when the operator is called"); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "map_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "maptype"); RNA_def_property_enum_items(prop, map_type_items); RNA_def_property_enum_funcs(prop, "rna_wmKeyMapItem_map_type_get", "rna_wmKeyMapItem_map_type_set", NULL); RNA_def_property_ui_text(prop, "Map Type", "Type of event mapping"); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, event_type_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_type_itemf"); RNA_def_property_ui_text(prop, "Type", "Type of event"); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "val"); RNA_def_property_enum_items(prop, event_value_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_value_itemf"); RNA_def_property_ui_text(prop, "Value", ""); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "id", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "id"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "id", "ID of the item"); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "any", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_any_getf", "rna_KeyMapItem_any_setf"); RNA_def_property_ui_text(prop, "Any", "Any modifier keys pressed"); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "shift", 0); // RNA_def_property_enum_sdna(prop, NULL, "shift"); // RNA_def_property_enum_items(prop, keymap_modifiers_items); RNA_def_property_ui_text(prop, "Shift", "Shift key pressed"); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 0); // RNA_def_property_enum_sdna(prop, NULL, "ctrl"); // RNA_def_property_enum_items(prop, keymap_modifiers_items); RNA_def_property_ui_text(prop, "Ctrl", "Control key pressed"); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "alt", 0); // RNA_def_property_enum_sdna(prop, NULL, "alt"); // RNA_def_property_enum_items(prop, keymap_modifiers_items); RNA_def_property_ui_text(prop, "Alt", "Alt key pressed"); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "oskey", 0); // RNA_def_property_enum_sdna(prop, NULL, "oskey"); // RNA_def_property_enum_items(prop, keymap_modifiers_items); RNA_def_property_ui_text(prop, "OS Key", "Operating system key pressed"); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "key_modifier", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "keymodifier"); RNA_def_property_enum_items(prop, event_type_items); RNA_def_property_ui_text(prop, "Key Modifier", "Regular key pressed as a modifier"); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_EXPANDED); @@ -1903,15 +1740,21 @@ static void rna_def_keyconfig(BlenderRNA *brna) RNA_def_property_enum_items(prop, keymap_propvalue_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_propvalue_itemf"); RNA_def_property_ui_text(prop, "Property Value", "The value this event translates to in a modal keymap"); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", KMI_INACTIVE); RNA_def_property_ui_text(prop, "Active", "Activate or deactivate item"); RNA_def_property_ui_icon(prop, ICON_CHECKBOX_DEHLT, 1); + prop= RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_USER_MODIFIED); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "User Modified", "Is this keymap item modified by the user"); + prop= RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "User Defined", "Is this keymap item user defined (doesn't just override a builtin item)"); + RNA_def_property_ui_text(prop, "User Defined", "Is this keymap item user defined (doesn't just replace a builtin item)"); RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_userdefined_get", NULL); RNA_api_keymapitem(srna); diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index d44b68950f7..89e946f498a 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -84,6 +84,85 @@ void rna_event_timer_remove(struct wmWindowManager *wm, wmTimer *timer) WM_event_remove_timer(wm, timer->win, timer); } +static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, const char *idname, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier) +{ +// wmWindowManager *wm = CTX_wm_manager(C); + char idname_bl[OP_MAX_TYPENAME]; + int modifier= 0; + + /* only on non-modal maps */ + if (km->flag & KEYMAP_MODAL) { + BKE_report(reports, RPT_ERROR, "Not a non-modal keymap."); + return NULL; + } + + WM_operator_bl_idname(idname_bl, idname); + + if(shift) modifier |= KM_SHIFT; + if(ctrl) modifier |= KM_CTRL; + if(alt) modifier |= KM_ALT; + if(oskey) modifier |= KM_OSKEY; + + if(any) modifier = KM_ANY; + + return WM_keymap_add_item(km, idname_bl, type, value, modifier, keymodifier); +} + +static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, ReportList *reports, const char *propvalue_str, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier) +{ + int modifier= 0; + int propvalue = 0; + + /* only modal maps */ + if ((km->flag & KEYMAP_MODAL) == 0) { + BKE_report(reports, RPT_ERROR, "Not a modal keymap."); + return NULL; + } + + if (!km->modal_items) { + BKE_report(reports, RPT_ERROR, "No property values defined."); + return NULL; + } + + + if(RNA_enum_value_from_id(km->modal_items, propvalue_str, &propvalue)==0) { + BKE_report(reports, RPT_WARNING, "Property value not in enumeration."); + } + + if(shift) modifier |= KM_SHIFT; + if(ctrl) modifier |= KM_CTRL; + if(alt) modifier |= KM_ALT; + if(oskey) modifier |= KM_OSKEY; + + if(any) modifier = KM_ANY; + + return WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, propvalue); +} + +static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, int modal) +{ + if (modal == 0) { + return WM_keymap_find(keyconf, idname, spaceid, regionid); + } else { + return WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */ + } +} + +static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid) +{ + return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid); +} + +static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *UNUSED(keyconf), const char *idname) +{ + wmOperatorType *ot = WM_operatortype_find(idname, 0); + + if (!ot) + return NULL; + else + return ot->modalkeymap; +} + #else #define WM_GEN_INVOKE_EVENT (1<<0) @@ -301,11 +380,8 @@ void RNA_api_keymap(StructRNA *srna) parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map."); RNA_def_function_return(func, parm); - func= RNA_def_function(srna, "copy_to_user", "WM_keymap_copy_to_user"); - parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "User editable key map."); - RNA_def_function_return(func, parm); - - RNA_def_function(srna, "restore_to_default", "WM_keymap_restore_to_default"); + func= RNA_def_function(srna, "restore_to_default", "WM_keymap_restore_to_default"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); func= RNA_def_function(srna, "restore_item_to_default", "rna_keymap_restore_item_to_default"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); @@ -324,5 +400,102 @@ void RNA_api_keymapitem(StructRNA *srna) parm= RNA_def_boolean(func, "result", 0, "Comparison result", ""); RNA_def_function_return(func, parm); } + +void RNA_api_keymapitems(StructRNA *srna) +{ + FunctionRNA *func; + PropertyRNA *parm; + + func= RNA_def_function(srna, "new", "rna_KeyMap_item_new"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm= RNA_def_string(func, "idname", "", 0, "Operator Identifier", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_enum(func, "type", event_type_items, 0, "Type", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_enum(func, "value", event_value_items, 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_boolean(func, "any", 0, "Any", ""); + RNA_def_boolean(func, "shift", 0, "Shift", ""); + RNA_def_boolean(func, "ctrl", 0, "Ctrl", ""); + RNA_def_boolean(func, "alt", 0, "Alt", ""); + RNA_def_boolean(func, "oskey", 0, "OS Key", ""); + RNA_def_enum(func, "key_modifier", event_type_items, 0, "Key Modifier", ""); + parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item."); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "new_modal", "rna_KeyMap_item_new_modal"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm= RNA_def_string(func, "propvalue", "", 0, "Property Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_enum(func, "type", event_type_items, 0, "Type", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_enum(func, "value", event_value_items, 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_boolean(func, "any", 0, "Any", ""); + RNA_def_boolean(func, "shift", 0, "Shift", ""); + RNA_def_boolean(func, "ctrl", 0, "Ctrl", ""); + RNA_def_boolean(func, "alt", 0, "Alt", ""); + RNA_def_boolean(func, "oskey", 0, "OS Key", ""); + RNA_def_enum(func, "key_modifier", event_type_items, 0, "Key Modifier", ""); + parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item."); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "remove", "WM_keymap_remove_item"); + parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + + func= RNA_def_function(srna, "from_id", "WM_keymap_item_find_id"); + parm= RNA_def_property(func, "id", PROP_INT, PROP_NONE); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_ui_text(parm, "id", "ID of the item"); + parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", ""); + RNA_def_function_return(func, parm); +} + +void RNA_api_keymaps(StructRNA *srna) +{ + FunctionRNA *func; + PropertyRNA *parm; + + func= RNA_def_function(srna, "new", "rna_keymap_new"); // add_keymap + parm= RNA_def_string(func, "name", "", 0, "Name", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", ""); + RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", ""); + RNA_def_boolean(func, "modal", 0, "Modal", ""); + parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map."); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "find", "rna_keymap_find"); // find_keymap + parm= RNA_def_string(func, "name", "", 0, "Name", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", ""); + RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", ""); + parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map."); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "find_modal", "rna_keymap_find_modal"); // find_keymap_modal + parm= RNA_def_string(func, "name", "", 0, "Operator Name", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map."); + RNA_def_function_return(func, parm); +} + +void RNA_api_keyconfigs(StructRNA *srna) +{ + FunctionRNA *func; + PropertyRNA *parm; + + func= RNA_def_function(srna, "new", "WM_keyconfig_new_user"); // add_keyconfig + parm= RNA_def_string(func, "name", "", 0, "Name", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration."); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "remove", "WM_keyconfig_remove"); // remove_keyconfig + parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Removed key configuration."); + RNA_def_property_flag(parm, PROP_REQUIRED); +} + #endif -- cgit v1.2.3 From 6c821f4078414c81128ebf0d35187054df238371 Mon Sep 17 00:00:00 2001 From: Mike Erwin Date: Sat, 6 Aug 2011 23:13:36 +0000 Subject: stricter NDOF guards for Windows (forgot in earlier commit) --- source/blender/makesrna/intern/rna_userdef.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index b3dbafeab7d..57044188dd9 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2746,19 +2746,32 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Drag Threshold", "Amount of pixels you have to drag before dragging UI items happens"); /* 3D mouse settings */ + /* global options */ prop= RNA_def_property(srna, "ndof_sensitivity", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.25f, 4.0f); RNA_def_property_ui_text(prop, "Sensitivity", "Overall sensitivity of the 3D Mouse"); + prop= RNA_def_property(srna, "ndof_zoom_updown", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ZOOM_UPDOWN); + RNA_def_property_ui_text(prop, "Zoom = Up/Down", "Zoom using up/down on the device (otherwise forward/backward)"); + + prop= RNA_def_property(srna, "ndof_zoom_invert", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ZOOM_INVERT); + RNA_def_property_ui_text(prop, "Invert Zoom", "Zoom using opposite direction"); + + /* 3D view */ prop= RNA_def_property(srna, "ndof_show_guide", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_SHOW_GUIDE); RNA_def_property_ui_text(prop, "Show Navigation Guide", "Display the center and axis during rotation"); /* TODO: update description when fly-mode visuals are in place ("projected position in fly mode")*/ + /* 3D view: orbit */ prop= RNA_def_property(srna, "ndof_orbit_invert_axes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ORBIT_INVERT_AXES); RNA_def_property_ui_text(prop, "Invert Axes", "Toggle between moving the viewpoint or moving the scene being viewed"); + /* in 3Dx docs, this is called 'object mode' vs. 'target camera mode' + /* 3D view: fly */ prop= RNA_def_property(srna, "ndof_lock_horizon", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_LOCK_HORIZON); RNA_def_property_ui_text(prop, "Lock Horizon", "Keep horizon level while flying with 3D Mouse"); -- cgit v1.2.3 From 28ae6d85fee9ec32c7a16b9fa004ba6fef3d84f8 Mon Sep 17 00:00:00 2001 From: Mike Erwin Date: Sun, 7 Aug 2011 18:57:39 +0000 Subject: fixed typo --- source/blender/makesrna/intern/rna_userdef.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 57044188dd9..a685c6deb34 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2769,7 +2769,7 @@ static void rna_def_userdef_input(BlenderRNA *brna) prop= RNA_def_property(srna, "ndof_orbit_invert_axes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ORBIT_INVERT_AXES); RNA_def_property_ui_text(prop, "Invert Axes", "Toggle between moving the viewpoint or moving the scene being viewed"); - /* in 3Dx docs, this is called 'object mode' vs. 'target camera mode' + /* in 3Dx docs, this is called 'object mode' vs. 'target camera mode' */ /* 3D view: fly */ prop= RNA_def_property(srna, "ndof_lock_horizon", PROP_BOOLEAN, PROP_NONE); -- cgit v1.2.3 From cc0ec3aa33e09b964cc6f4d0c8d253671ebebf4a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 8 Aug 2011 08:22:01 +0000 Subject: fix [#28178] make single user copy of object data doesn't work --- source/blender/makesrna/RNA_access.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 882fbce9271..0033a1ff437 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -392,6 +392,7 @@ extern StructRNA RNA_Scene; extern StructRNA RNA_SceneGameData; extern StructRNA RNA_SceneRenderLayer; extern StructRNA RNA_SceneSequence; +extern StructRNA RNA_SceneObjects; extern StructRNA RNA_Scopes; extern StructRNA RNA_Screen; extern StructRNA RNA_ScrewModifier; -- cgit v1.2.3 From 22694c993a7e32767db4719e9fa37e93445b66a8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 9 Aug 2011 14:50:40 +0000 Subject: fix [#28186] textboxes properties not animatable --- source/blender/makesrna/intern/rna_curve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 260d483b9d2..599d36ec8b8 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -651,7 +651,7 @@ static char *rna_TextBox_path(PointerRNA *ptr) int index= (int)(tb - cu->tb); if (index >= 0 && index < cu->totbox) - return BLI_sprintfN("textboxes[%d]", index); + return BLI_sprintfN("text_boxes[%d]", index); else return BLI_strdup(""); } -- cgit v1.2.3 From 958c468b07655b83fb4bf884b2e650ab018fe216 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 10 Aug 2011 07:49:18 +0000 Subject: fix [#28203] Misplaced string in bone constraints --- source/blender/makesrna/intern/rna_constraint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 0163dd5db32..8127c180706 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -85,7 +85,7 @@ static EnumPropertyItem target_space_pchan_items[] = { static EnumPropertyItem owner_space_pchan_items[] = { {0, "WORLD", 0, "World Space", "The constraint is applied relative to the world coordinate system"}, {2, "POSE", 0, "Pose Space", "The constraint is applied in Pose Space, the object transformation is ignored"}, - {3, "LOCAL_WITH_PARENT", 0, "The constraint is applied relative to the local coordinate system of the object, with the parent transformation added"}, + {3, "LOCAL_WITH_PARENT", 0, "Local With Parent", "The constraint is applied relative to the local coordinate system of the object, with the parent transformation added"}, {1, "LOCAL", 0, "Local Space", "The constraint is applied relative to the local coordinate sytem of the object"}, {0, NULL, 0, NULL, NULL}}; -- cgit v1.2.3 From 0b23d378fbac8e76d4885c3485a4dbf158aab136 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 14 Aug 2011 06:43:58 +0000 Subject: fix [#28225] Solidify Modifier creates wrong results when vertex group is attached infact this is not really a bug, irrespective zero vertex group weights gave overlapping geometry which isn't useful, add an option to set the thickness factor for zero weighted verts. --- source/blender/makesrna/intern/rna_modifier.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index ba655915fb6..5c5391b0bba 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -2265,6 +2265,13 @@ static void rna_def_modifier_solidify(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Thickness", "Thickness of the shell"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop= RNA_def_property(srna, "thickness_vertex_group", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "offset_fac_vg"); + RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_ui_range(prop, 0, 1, 0.1, 3); + RNA_def_property_ui_text(prop, "Vertex Group Factor", "Thickness factor to use for zero vertex group influence"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "offset_fac"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); -- cgit v1.2.3 From 540f0c64b5d42186119a1e1ccdd9aac7edd13960 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 14 Aug 2011 10:28:18 +0000 Subject: add in asserts for when array/non array RNA funcions are used incorrectly, would have made previous fix a lot easier to find. also remove unused argument from RNA_property_array_check. --- source/blender/makesrna/RNA_access.h | 2 +- source/blender/makesrna/intern/rna_access.c | 31 ++++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 0033a1ff437..81deb0c2796 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -654,7 +654,7 @@ int RNA_property_flag(PropertyRNA *prop); void *RNA_property_py_data_get(PropertyRNA *prop); int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop); -int RNA_property_array_check(PointerRNA *ptr, PropertyRNA *prop); +int RNA_property_array_check(PropertyRNA *prop); int RNA_property_multi_array_length(PointerRNA *ptr, PropertyRNA *prop, int dimension); int RNA_property_array_dimension(PointerRNA *ptr, PropertyRNA *prop, int length[]); char RNA_property_array_item_char(PropertyRNA *prop, int index); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index f1056c86a4c..f100ebd6129 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -288,7 +288,7 @@ static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop) } } -static int rna_ensure_property_array_check(PointerRNA *UNUSED(ptr), PropertyRNA *prop) +static int rna_ensure_property_array_check(PropertyRNA *prop) { if(prop->magic == RNA_MAGIC) { return (prop->getlength || prop->totarraylength) ? 1:0; @@ -765,9 +765,9 @@ int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop) return rna_ensure_property_array_length(ptr, prop); } -int RNA_property_array_check(PointerRNA *ptr, PropertyRNA *prop) +int RNA_property_array_check(PropertyRNA *prop) { - return rna_ensure_property_array_check(ptr, prop); + return rna_ensure_property_array_check(prop); } /* used by BPY to make an array from the python object */ @@ -1399,6 +1399,7 @@ int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) == 0); if((idprop=rna_idproperty_check(&prop, ptr))) return IDP_Int(idprop); @@ -1414,6 +1415,7 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) == 0); /* just incase other values are passed */ if(value) value= 1; @@ -1440,6 +1442,7 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) @@ -1463,6 +1466,7 @@ int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_boolean_get_array(ptr, prop, tmp); @@ -1486,6 +1490,7 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) @@ -1519,6 +1524,7 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_boolean_get_array(ptr, prop, tmp); @@ -1541,6 +1547,7 @@ int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop) BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) == 0); return bprop->defaultvalue; } @@ -1550,6 +1557,7 @@ void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if(prop->arraydimension == 0) values[0]= bprop->defaultvalue; @@ -1565,6 +1573,7 @@ int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_boolean_get_default_array(ptr, prop, tmp); @@ -1588,6 +1597,7 @@ int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) == 0); if((idprop=rna_idproperty_check(&prop, ptr))) return IDP_Int(idprop); @@ -1603,6 +1613,7 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) == 0); /* useful to check on bad values but set function should clamp */ /* BLI_assert(RNA_property_int_clamp(ptr, prop, &value) == 0); */ @@ -1628,6 +1639,7 @@ void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) @@ -1688,6 +1700,7 @@ int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index) int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_int_get_array(ptr, prop, tmp); @@ -1711,6 +1724,7 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) @@ -1744,6 +1758,7 @@ void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, i int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_int_get_array(ptr, prop, tmp); @@ -1772,6 +1787,7 @@ void RNA_property_int_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *pr IntPropertyRNA *iprop= (IntPropertyRNA*)prop; BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != 0); if(prop->arraydimension == 0) values[0]= iprop->defaultvalue; @@ -1808,6 +1824,7 @@ float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) == 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(idprop->type == IDP_FLOAT) @@ -1827,6 +1844,7 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) == 0); /* useful to check on bad values but set function should clamp */ /* BLI_assert(RNA_property_float_clamp(ptr, prop, &value) == 0); */ @@ -1858,6 +1876,7 @@ void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *val int i; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) @@ -1923,6 +1942,7 @@ float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_float_get_array(ptr, prop, tmp); @@ -1948,6 +1968,7 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa int i; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) { @@ -1991,6 +2012,7 @@ void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_float_get_array(ptr, prop, tmp); @@ -2013,6 +2035,7 @@ float RNA_property_float_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop) FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) == 0); return fprop->defaultvalue; } @@ -2022,6 +2045,7 @@ void RNA_property_float_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA * FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if(prop->arraydimension == 0) values[0]= fprop->defaultvalue; @@ -2037,6 +2061,7 @@ float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_float_get_default_array(ptr, prop, tmp); -- cgit v1.2.3 From 2c8e1e633c402e677e3f49e8a9c429f59ef6f239 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 15 Aug 2011 03:41:31 +0000 Subject: comment unused lines. --- source/blender/makesrna/RNA_types.h | 2 +- source/blender/makesrna/intern/rna_access.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index ec213d6a496..f8199074f27 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -281,7 +281,7 @@ typedef struct ParameterList { typedef struct ParameterIterator { struct ParameterList *parms; - PointerRNA funcptr; + /* PointerRNA funcptr; */ /*UNUSED*/ void *data; int size, offset; diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index f100ebd6129..88447f6dd77 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -4509,7 +4509,8 @@ int RNA_parameter_list_ret_count(ParameterList *parms) void RNA_parameter_list_begin(ParameterList *parms, ParameterIterator *iter) { - RNA_pointer_create(NULL, &RNA_Function, parms->func, &iter->funcptr); + /* may be useful but unused now */ + /* RNA_pointer_create(NULL, &RNA_Function, parms->func, &iter->funcptr); */ /*UNUSED*/ iter->parms= parms; iter->parm= parms->func->cont.properties.first; -- cgit v1.2.3 From 270ed82c7b1a6e10f80e00ede354dd16b3dd635d Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 15 Aug 2011 10:03:17 +0000 Subject: Fix #28202: deactivating keymap items not saving properly. --- source/blender/makesrna/intern/rna_wm.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 307cf0e175a..93adf808f83 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1746,6 +1746,7 @@ static void rna_def_keyconfig(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", KMI_INACTIVE); RNA_def_property_ui_text(prop, "Active", "Activate or deactivate item"); RNA_def_property_ui_icon(prop, ICON_CHECKBOX_DEHLT, 1); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_USER_MODIFIED); -- cgit v1.2.3 From cdb5d11c5f29fdb7dd6a5d15a42f395e8194980b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 15 Aug 2011 17:29:07 +0000 Subject: patch [#22523] Expose Object.parentinv matrix via RNA from Balajee R C (balajeerc) --- source/blender/makesrna/intern/rna_object.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 76bbfcbed41..55e1119f58e 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -2025,7 +2025,14 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Input Matrix", "Matrix access to location, rotation and scale (including deltas), before constraints and parenting are applied."); RNA_def_property_float_funcs(prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", NULL); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); - + + /*parent_inverse*/ + prop= RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX); + RNA_def_property_float_sdna(prop, NULL, "parentinv"); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); + RNA_def_property_ui_text(prop, "Matrix", "Inverse of object's parent matrix at time of parenting"); + RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); + /* collections */ prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Constraint"); -- cgit v1.2.3 From b6dcf3b1c24fe43193ae4697b383cf1514a3caff Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 17 Aug 2011 12:52:38 +0000 Subject: Fix #28277: changing smoke border collision type did not reset cache, making it seem like the option wasn't working. --- source/blender/makesrna/intern/rna_smoke.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 43d1aa24229..8abf774ff52 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -247,7 +247,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "border_collisions"); RNA_def_property_enum_items(prop, smoke_domain_colli_items); RNA_def_property_ui_text(prop, "Border Collisions", "Selects which domain border will be treated as collision object."); - RNA_def_property_update(prop, 0, NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "EffectorWeights"); -- cgit v1.2.3 From 853620926019b242dbc34336addcf1c4eaaf7569 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Wed, 17 Aug 2011 13:04:28 +0000 Subject: 2.6 RNA: * Remove some NULL RNA property update calls, they do nothing. --- source/blender/makesrna/intern/rna_object_force.c | 1 - source/blender/makesrna/intern/rna_smoke.c | 7 ------- 2 files changed, 8 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index ca679239dd3..463f65fd3d5 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -770,7 +770,6 @@ static void rna_def_pointcache(BlenderRNA *brna) prop= RNA_def_property(srna, "compression", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, point_cache_compress_items); RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used"); - RNA_def_property_update(prop, 0, NULL); /* flags */ prop= RNA_def_property(srna, "is_baked", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 8abf774ff52..d439c2551f1 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -241,7 +241,6 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "cache_comp"); RNA_def_property_enum_items(prop, smoke_cache_comp_items); RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used"); - RNA_def_property_update(prop, 0, NULL); prop= RNA_def_property(srna, "collision_extents", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "border_collisions"); @@ -290,14 +289,12 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) RNA_def_property_range(prop, 0.001, 1); RNA_def_property_ui_range(prop, 0.001, 1.0, 1.0, 4); RNA_def_property_ui_text(prop, "Density", ""); - RNA_def_property_update(prop, 0, NULL); // NC_OBJECT|ND_MODIFIER prop= RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "temp"); RNA_def_property_range(prop, -10, 10); RNA_def_property_ui_range(prop, -10, 10, 1, 1); RNA_def_property_ui_text(prop, "Temp. Diff.", "Temperature difference to ambient temperature"); - RNA_def_property_update(prop, 0, NULL); prop= RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "psys"); @@ -309,24 +306,20 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_outflow", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type", MOD_SMOKE_FLOW_TYPE_OUTFLOW); RNA_def_property_ui_text(prop, "Outflow", "Deletes smoke from simulation"); - RNA_def_property_update(prop, 0, NULL); prop= RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_ABSOLUTE); RNA_def_property_ui_text(prop, "Absolute Density", "Only allows given density value in emitter area."); - RNA_def_property_update(prop, 0, NULL); prop= RNA_def_property(srna, "initial_velocity", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_INITVELOCITY); RNA_def_property_ui_text(prop, "Initial Velocity", "Smoke inherits it's velocity from the emitter particle"); - RNA_def_property_update(prop, 0, NULL); prop= RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "vel_multi"); RNA_def_property_range(prop, -2.0, 2.0); RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5); RNA_def_property_ui_text(prop, "Multiplier", "Multiplier to adjust velocity passed to smoke"); - RNA_def_property_update(prop, 0, NULL); } static void rna_def_smoke_coll_settings(BlenderRNA *brna) -- cgit v1.2.3 From 1719963a08e9cc470dfaa1dbc87174c9120b59af Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 17 Aug 2011 15:55:42 +0000 Subject: Fix #28207: animating pin option for cloth didn't work, solver doesn't support it, so set the property as not animatable. --- source/blender/makesrna/intern/rna_cloth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index 1ce4108bab2..1b2396a4215 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -294,6 +294,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_GOAL); RNA_def_property_ui_text(prop, "Pin Cloth", "Enable pinning of cloth vertices to other objects/positions"); RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop= RNA_def_property(srna, "pin_stiffness", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "goalspring"); @@ -313,6 +314,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_SCALING); RNA_def_property_ui_text(prop, "Stiffness Scaling", "If enabled, stiffness can be scaled along a weight painted vertex group"); RNA_def_property_update(prop, 0, "rna_cloth_update"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop= RNA_def_property(srna, "spring_damping", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "Cdis"); -- cgit v1.2.3 From 14d2d7c75fcb9a1fd3d82d0434921117f26108e6 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Wed, 17 Aug 2011 20:17:27 +0000 Subject: BGE: Upping the max Axis Number for the Axis event type on joystick sensors from 2 to 4. The BGE supports up to 16 axis. For Axis events (not Single Axis), you get for directions per axis (up, down, left, right). So, the max should be JOYAXIS_MAX/directions = 16/4 = 4. --- source/blender/makesrna/intern/rna_sensor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index 5cc8539f187..5c6a4e889fa 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -803,7 +803,7 @@ static void rna_def_joystick_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "axis_number", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "axis"); RNA_def_property_ui_text(prop, "Axis Number", "Specify which axis pair to use, 1 is usually the main direction input"); - RNA_def_property_range(prop, 1, 2); + RNA_def_property_range(prop, 1, 4); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "axis_threshold", PROP_INT, PROP_NONE); -- cgit v1.2.3 From 5c20bc02ff76a3a72992bc43f414b673e8275866 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Wed, 17 Aug 2011 20:44:15 +0000 Subject: BGE: Upon further investigation this should have been 8 since up/down and left/right both are just one axis each. So, in actuality, the number of directions = 2, not 4, and thus JOYAXIS_MAX/directions = 16/2 = 8. 8 was also the max used in 2.4x. --- source/blender/makesrna/intern/rna_sensor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index 5c6a4e889fa..1f64603d6b4 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -803,7 +803,7 @@ static void rna_def_joystick_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "axis_number", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "axis"); RNA_def_property_ui_text(prop, "Axis Number", "Specify which axis pair to use, 1 is usually the main direction input"); - RNA_def_property_range(prop, 1, 4); + RNA_def_property_range(prop, 1, 8); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "axis_threshold", PROP_INT, PROP_NONE); -- cgit v1.2.3 From 3a81f23e0975ea87ade780965462ad5b15b39d95 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 19 Aug 2011 16:21:29 +0000 Subject: warning cleanup for -Wdouble-promotion --- source/blender/makesrna/intern/rna_sequencer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 8c4e4d9e736..476ac325848 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -1481,7 +1481,7 @@ static void rna_def_wipe(BlenderRNA *brna) #if 1 /* expose as radians */ prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_funcs(prop, "rna_WipeSequence_angle_get", "rna_WipeSequence_angle_set", NULL); - RNA_def_property_range(prop, DEG2RAD(-90.0f), DEG2RAD(90.0f)); + RNA_def_property_range(prop, DEG2RAD(-90.0), DEG2RAD(90.0)); #else prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "angle"); -- cgit v1.2.3 From d4dec1c3bcc8fa85e8f4cf3372efe077648a67bf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 20 Aug 2011 14:23:43 +0000 Subject: use ghash for DNA_struct_find_nr(), gives ~18% speedup on loading sintel lite, will also speedup undo. note: only works with CMake, wasn't able to get this working with scons, complains about same file being built in different environments. --- source/blender/makesrna/intern/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index cb593e7deab..cc7bcf04716 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -243,6 +243,7 @@ blender_include_dirs_sys( add_executable(makesrna ${SRC} ${SRC_RNA_INC} ${SRC_DNA_INC}) target_link_libraries(makesrna bf_dna) +target_link_libraries(makesrna bf_dna_blenlib) # Output rna_*_gen.c # note (linux only): with crashes try add this after COMMAND: valgrind --leak-check=full --track-origins=yes -- cgit v1.2.3 From 36f20f162caf83929e6eb07be6b73eb59740ead4 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 21 Aug 2011 13:31:46 +0000 Subject: Fix #28154: linux3-config.py doesn't exist Change OURPLATFORM from "linux" to simple "linux". Since new policy for linux kernel versions that major version in platform doesn't make much sense for building rules so the same rules could be used for both of linux2 and linux3 now/ Tested on both of linux2 and linux3 systems. --- source/blender/makesrna/SConscript | 2 +- source/blender/makesrna/intern/SConscript | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index b706db5e64c..1cb24630fbe 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -54,7 +54,7 @@ if env['WITH_BF_PYTHON']: if env['WITH_BF_COLLADA']: defs.append('WITH_COLLADA') -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index 5e43ed9b2fb..24c892b96c4 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -91,7 +91,7 @@ if env['WITH_BF_PYTHON']: if env['WITH_BF_COLLADA']: defs.append('WITH_COLLADA') -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' @@ -140,7 +140,7 @@ targetpath = root_build_dir+'/makesrna' if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'): targetpath = '#' + targetpath -if env['OURPLATFORM'] == 'linux2' and root_build_dir[0]==os.sep: +if env['OURPLATFORM'] == 'linux' and root_build_dir[0]==os.sep: makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_dna', 'bf_blenlib']) else: makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_dna', 'bf_blenlib']) -- cgit v1.2.3