diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-07-27 08:19:56 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-07-27 08:19:56 +0400 |
commit | b24485ab9249d66f787d0b567b80e1727555072e (patch) | |
tree | 15c86cc749cc516b32e32cf19706c5b94be2a19d /source/blender/python | |
parent | b4fc80eb3d918f16e33a5d8838981cf638f426c0 (diff) |
Patch #17336: Lock bones in edit mode
Submitted by: Lorenzo Pierfederici (lento)
This patch adds the ability to lock transformation on bones in edit mode, to protect them from accidental editing.
Bones can be locked from the editing buttons, the transform property panel, the specials popup menu or the python api.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/api2_2x/Armature.c | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Bone.c | 10 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Armature.py | 3 |
3 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/Armature.c b/source/blender/python/api2_2x/Armature.c index e9dff098773..0db87c00dd2 100644 --- a/source/blender/python/api2_2x/Armature.c +++ b/source/blender/python/api2_2x/Armature.c @@ -1469,6 +1469,8 @@ PyObject *Armature_Init(void) PyConstant_NewInt("BONE_SELECTED", BONE_SELECTED)); PyModule_AddObject(module, "TIP_SELECTED", PyConstant_NewInt("TIP_SELECTED", BONE_TIPSEL)); + PyModule_AddObject(module, "LOCKED_EDIT", + PyConstant_NewInt("LOCKED_EDIT", BONE_EDITMODE_LOCKED)); PyModule_AddObject(module, "OCTAHEDRON", PyConstant_NewInt("OCTAHEDRON", ARM_OCTA)); diff --git a/source/blender/python/api2_2x/Bone.c b/source/blender/python/api2_2x/Bone.c index 84faf416c5f..948eb007803 100644 --- a/source/blender/python/api2_2x/Bone.c +++ b/source/blender/python/api2_2x/Bone.c @@ -368,6 +368,10 @@ static PyObject *EditBone_getOptions(BPy_EditBone *self, void *closure) if (PyList_Append(list, EXPP_GetModuleConstant("Blender.Armature", "TIP_SELECTED")) == -1) goto RuntimeError; + if(self->editbone->flag & BONE_EDITMODE_LOCKED) + if (PyList_Append(list, + EXPP_GetModuleConstant("Blender.Armature", "LOCKED_EDIT")) == -1) + goto RuntimeError; }else{ if(self->flag & BONE_CONNECTED) if (PyList_Append(list, @@ -401,6 +405,10 @@ static PyObject *EditBone_getOptions(BPy_EditBone *self, void *closure) if (PyList_Append(list, EXPP_GetModuleConstant("Blender.Armature", "TIP_SELECTED")) == -1) goto RuntimeError; + if(self->flag & BONE_EDITMODE_LOCKED) + if (PyList_Append(list, + EXPP_GetModuleConstant("Blender.Armature", "LOCKED_EDIT")) == -1) + goto RuntimeError; } return list; @@ -422,7 +430,7 @@ static int EditBone_CheckValidConstant(PyObject *constant) return 0; if (!STREQ3(PyString_AsString(name), "CONNECTED", "HINGE", "NO_DEFORM") && !STREQ3(PyString_AsString(name), "ROOT_SELECTED", "BONE_SELECTED", "TIP_SELECTED") && - !STREQ2(PyString_AsString(name), "MULTIPLY", "HIDDEN_EDIT")) + !STREQ3(PyString_AsString(name), "MULTIPLY", "HIDDEN_EDIT", "LOCKED_EDIT")) return 0; else return 1; diff --git a/source/blender/python/api2_2x/doc/Armature.py b/source/blender/python/api2_2x/doc/Armature.py index 68916af6166..9aceb0105e3 100644 --- a/source/blender/python/api2_2x/doc/Armature.py +++ b/source/blender/python/api2_2x/doc/Armature.py @@ -89,6 +89,8 @@ Example:: @type BONE_SELECTED: Constant @var TIP_SELECTED: Tip of the Bone is selected @type TIP_SELECTED: Constant +@var LOCKED_EDIT: Prevents the bone from being transformed in editmode +@type LOCKED_EDIT: Constant @var OCTAHEDRON: Bones drawn as octahedrons @type OCTAHEDRON: Constant @var STICK: Bones drawn as a line @@ -286,6 +288,7 @@ class Bone: - Armature.ROOT_SELECTED: Selection of root ball of bone - Armature.BONE_SELECTED: Selection of bone - Armature.TIP_SELECTED: Selection of tip ball of bone + - Armature.LOCKED_EDIT: Prevents the bone from being transformed in editmode @type options: List of Constants @ivar subdivision: The number of bone subdivisions. @type subdivision: Int |