diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/collada/DocumentImporter.cpp | 5 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 4 | ||||
-rw-r--r-- | source/blender/editors/armature/armature_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 34 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature_generate.c | 4 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature_sketch.c | 2 | ||||
-rw-r--r-- | source/blender/editors/include/ED_anim_api.h | 2 | ||||
-rw-r--r-- | source/blender/editors/include/ED_armature.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 29 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fcurve.c | 10 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_pose.c | 2 |
11 files changed, 55 insertions, 41 deletions
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index b844f74ff44..f50df355a82 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -94,9 +94,6 @@ extern "C" char *CustomData_get_layer_name(const struct CustomData *data, int type, int n); -// armature module internal func, it's not good to use it here? (Arystan) -struct EditBone *addEditBone(struct bArmature *arm, char *name); - const char *primTypeToStr(COLLADAFW::MeshPrimitive::PrimitiveType type) { using namespace COLLADAFW; @@ -592,7 +589,7 @@ private: } // TODO rename from Node "name" attrs later - EditBone *bone = addEditBone(arm, (char*)get_joint_name(node)); + EditBone *bone = ED_armature_edit_bone_add(arm, (char*)get_joint_name(node)); totbone++; if (parent) bone->parent = parent; diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 46da5babf1e..e8d78d2ea8e 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -502,7 +502,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop) /* get first constraint and determine type of keyframe constraints to check for * - constraints can be on either Objects or PoseChannels, so we only check if the - * ptr->type is RNA_Object or RNA_PoseChannel, which are the RNA wrapping-info for + * ptr->type is RNA_Object or RNA_PoseBone, which are the RNA wrapping-info for * those structs, allowing us to identify the owner of the data */ if (ptr->type == &RNA_Object) { @@ -600,7 +600,7 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_ /* handle for Objects or PoseChannels only * - constraints can be on either Objects or PoseChannels, so we only check if the - * ptr->type is RNA_Object or RNA_PoseChannel, which are the RNA wrapping-info for + * ptr->type is RNA_Object or RNA_PoseBone, which are the RNA wrapping-info for * those structs, allowing us to identify the owner of the data * - assume that array_index will be sane */ diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 012610bfd25..f53b70120d5 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -137,7 +137,6 @@ struct EditBone; struct ListBase; EditBone *make_boneList(struct ListBase *edbo, struct ListBase *bones, struct EditBone *parent, struct Bone *actBone); -struct EditBone *addEditBone(struct bArmature *arm, char *name); void BIF_sk_selectStroke(struct bContext *C, short mval[2], short extend); /* duplicate method */ diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index ce3e4cc8f8d..ebb9848baf4 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -141,7 +141,7 @@ void ED_armature_validate_active(struct bArmature *arm) } } -void free_edit_bone(bArmature *arm, EditBone *bone) +void ED_armature_edit_bone_remove(bArmature *arm, EditBone *bone) { if(arm->act_edbone==bone) arm->act_edbone= NULL; @@ -305,7 +305,7 @@ void ED_armature_from_edit(Object *obedit) fBone->parent= eBone->parent; } printf("Warning: removed zero sized bone: %s\n", eBone->name); - free_edit_bone(arm, eBone); + ED_armature_edit_bone_remove(arm, eBone); } } @@ -1035,7 +1035,7 @@ static void separate_armature_bones (Scene *scene, Object *ob, short sel) free_pose_channel(pchan); /* get rid of unneeded bone */ - free_edit_bone(arm, curbone); + ED_armature_edit_bone_remove(arm, curbone); BLI_freelinkN(&ob->pose->chanbase, pchan); } } @@ -1684,7 +1684,7 @@ static void delete_bone(bArmature *arm, EditBone* exBone) } } - free_edit_bone(arm, exBone); + ED_armature_edit_bone_remove(arm, exBone); } /* context: editmode armature */ @@ -2245,7 +2245,7 @@ void undo_push_armature(bContext *C, char *name) /* *************** Adding stuff in editmode *************** */ /* default bone add, returns it selected, but without tail set */ -EditBone *addEditBone(bArmature *arm, char *name) +EditBone *ED_armature_edit_bone_add(bArmature *arm, char *name) { EditBone *bone= MEM_callocN(sizeof(EditBone), "eBone"); @@ -2269,14 +2269,6 @@ EditBone *addEditBone(bArmature *arm, char *name) return bone; } -/* default bone add, returns it selected, but without tail set */ -static EditBone *add_editbone(Object *obedit, char *name) -{ - bArmature *arm= obedit->data; - - return addEditBone(arm, name); -} - /* v3d and rv3d are allowed to be NULL */ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d) { @@ -2301,7 +2293,7 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d) ED_armature_deselectall(obedit, 0, 0); /* Create a bone */ - bone= add_editbone(obedit, "Bone"); + bone= ED_armature_edit_bone_add(obedit->data, "Bone"); VECCOPY(bone->head, curs); @@ -2367,7 +2359,7 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *op) } } - newbone= add_editbone(obedit, ebone->name); + newbone= ED_armature_edit_bone_add(arm, ebone->name); arm->act_edbone= newbone; if (to_root) { @@ -2484,7 +2476,7 @@ static EditBone *add_points_bone (Object *obedit, float head[], float tail[]) { EditBone *ebo; - ebo= add_editbone(obedit, "Bone"); + ebo= ED_armature_edit_bone_add(obedit->data, "Bone"); VECCOPY(ebo->head, head); VECCOPY(ebo->tail, tail); @@ -3110,7 +3102,7 @@ static void bones_merge(Object *obedit, EditBone *start, EditBone *end, EditBone /* step 3: delete all bones between and including start and end */ for (ebo= end; ebo; ebo= ebone) { ebone= (ebo == start) ? (NULL) : (ebo->parent); - free_edit_bone(arm, ebo); + ED_armature_edit_bone_remove(arm, ebo); } } @@ -3465,7 +3457,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op) ED_armature_deselectall(obedit, 0, 0); /* Create a bone */ - bone= add_editbone(obedit, name); + bone= ED_armature_edit_bone_add(obedit->data, name); VECCOPY(bone->head, curs); @@ -5623,7 +5615,7 @@ EditBone * subdivideByAngle(Scene *scene, Object *obedit, ReebArc *arc, ReebNode EditBone *root = NULL; float angleLimit = (float)cos(scene->toolsettings->skgen_angle_limit * M_PI / 180.0f); - parent = add_editbone(obedit, "Bone"); + parent = ED_armature_edit_bone_add(arm, "Bone"); parent->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL; VECCOPY(parent->head, head->p); @@ -5652,7 +5644,7 @@ EditBone * subdivideByAngle(Scene *scene, Object *obedit, ReebArc *arc, ReebNode { VECCOPY(parent->tail, previous); - child = add_editbone(obedit, "Bone"); + child = ED_armature_edit_bone_add(arm, "Bone"); VECCOPY(child->head, parent->tail); child->parent = parent; child->flag |= BONE_CONNECTED|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL; @@ -5858,7 +5850,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg) if (lastBone == NULL) { EditBone *bone; - bone = add_editbone(obedit, "Bone"); + bone = ED_armature_edit_bone_add(obedit->data, "Bone"); bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL; VECCOPY(bone->head, head->p); diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c index 124528811c7..41907cf06a3 100644 --- a/source/blender/editors/armature/editarmature_generate.c +++ b/source/blender/editors/armature/editarmature_generate.c @@ -294,7 +294,7 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase * IT_head(iter); - parent = addEditBone(arm, "Bone"); + parent = ED_armature_edit_bone_add(arm, "Bone"); VECCOPY(parent->head, iter->p); if (iter->size > 0) @@ -309,7 +309,7 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase * { IT_peek(iter, index); - child = addEditBone(arm, "Bone"); + child = ED_armature_edit_bone_add(arm, "Bone"); VECCOPY(child->head, parent->tail); child->parent = parent; child->flag |= BONE_CONNECTED; diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 7bb2fa9009d..eee56070e91 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -1538,7 +1538,7 @@ void sk_convertStroke(bContext *C, SK_Stroke *stk) if (bone == NULL) { - bone = addEditBone(arm, "Bone"); + bone = ED_armature_edit_bone_add(arm, "Bone"); VECCOPY(bone->head, head->p); VECCOPY(bone->tail, pt->p); diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index af24402f3ca..59efa01cc35 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -311,7 +311,7 @@ typedef enum eAnimChannels_SetFlag { ACHANNEL_SETFLAG_TOGGLE } eAnimChannels_SetFlag; -/* types of settings for AnimChanels */ +/* types of settings for AnimChannels */ typedef enum eAnimChannel_Settings { ACHANNEL_SETTING_SELECT = 0, ACHANNEL_SETTING_PROTECT, // warning: for drawing UI's, need to check if this is off (maybe inverse this later) diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 2aa47311515..cbc86e58233 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -116,7 +116,8 @@ void ED_armature_sync_selection(struct ListBase *edbo); void ED_armature_validate_active(struct bArmature *arm); void add_primitive_bone(struct Scene *scene, struct View3D *v3d, struct RegionView3D *rv3d); -EditBone *addEditBone(struct bArmature *arm, char *name); /* used by COLLADA importer */ +struct EditBone *ED_armature_edit_bone_add(struct bArmature *arm, char *name); +void ED_armature_edit_bone_remove(struct bArmature *arm, EditBone *bone); void transform_armature_mirror_update(struct Object *obedit); void clear_armature(struct Scene *scene, struct Object *ob, char mode); diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 8d84257e219..36fd457e173 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -93,6 +93,15 @@ static void rna_Armature_act_edit_bone_set(PointerRNA *ptr, PointerRNA value) } } +EditBone *rna_Armature_edit_bone_new(bArmature *arm, char *name) +{ + return ED_armature_edit_bone_add(arm, name); +} + +void rna_Armature_edit_bone_remove(bArmature *arm, EditBone *ebone) +{ + ED_armature_edit_bone_remove(arm, ebone); +} static void rna_Armature_redraw_data(bContext *C, PointerRNA *ptr) { @@ -661,8 +670,8 @@ static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; PropertyRNA *prop; -// FunctionRNA *func; -// PropertyRNA *parm; + FunctionRNA *func; + PropertyRNA *parm; RNA_def_property_srna(cprop, "ArmatureEditBones"); srna= RNA_def_struct(brna, "ArmatureEditBones", NULL); @@ -679,6 +688,22 @@ static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop) /* todo, redraw */ // RNA_def_property_collection_active(prop, prop_act); + + /* add target */ + func= RNA_def_function(srna, "new", "rna_Armature_edit_bone_new"); + RNA_def_function_ui_description(func, "Add a new bone."); + parm= RNA_def_string(func, "name", "Object", 0, "", "New name for the bone."); + RNA_def_property_flag(parm, PROP_REQUIRED); + /* return type */ + parm= RNA_def_pointer(func, "bone", "EditBone", "", "Newly created edit bone."); + RNA_def_function_return(func, parm); + + /* remove target */ + func= RNA_def_function(srna, "remove", "rna_Armature_edit_bone_remove"); + RNA_def_function_ui_description(func, "Remove an existing bone from the armature."); + /* target to remove*/ + parm= RNA_def_pointer(func, "bone", "EditBone", "", "EditBone to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED); } static void rna_def_armature(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 8d6a91191f4..da14d937e6c 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -276,7 +276,7 @@ static void rna_Fmodifier_active_update(bContext *C, PointerRNA *ptr) } -static int rna_FM_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) +static int rna_FModifierGenerator_coefficients_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) { FModifier *fm= (FModifier*)ptr->data; FMod_Generator *gen= fm->data; @@ -289,14 +289,14 @@ static int rna_FM_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION return length[0]; } -static void rna_FM_get(PointerRNA *ptr, float *values) +static void rna_FModifierGenerator_coefficients_get(PointerRNA *ptr, float *values) { FModifier *fm= (FModifier*)ptr->data; FMod_Generator *gen= fm->data; memcpy(values, gen->coefficients, gen->arraysize * sizeof(float)); } -static void rna_FM_set(PointerRNA *ptr, const float *values) +static void rna_FModifierGenerator_coefficients_set(PointerRNA *ptr, const float *values) { FModifier *fm= (FModifier*)ptr->data; FMod_Generator *gen= fm->data; @@ -342,8 +342,8 @@ static void rna_def_fmodifier_generator(BlenderRNA *brna) prop= RNA_def_property(srna, "coefficients", PROP_FLOAT, PROP_NONE); RNA_def_property_array(prop, 32); RNA_def_property_flag(prop, PROP_DYNAMIC); - RNA_def_property_dynamic_array_funcs(prop, "rna_FM_get_length"); - RNA_def_property_float_funcs(prop, "rna_FM_get", "rna_FM_set", NULL); + RNA_def_property_dynamic_array_funcs(prop, "rna_FModifierGenerator_coefficients_get_length"); + RNA_def_property_float_funcs(prop, "rna_FModifierGenerator_coefficients_get", "rna_FModifierGenerator_coefficients_set", NULL); RNA_def_property_ui_text(prop, "Coefficients", "Coefficients for 'x' (starting from lowest power of x^0)."); /* coefficients array */ diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 5b1f4dc42ed..ed1bb373b6e 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -120,7 +120,7 @@ static IDProperty *rna_PoseBone_idproperties(PointerRNA *ptr, int create) if(create && !pchan->prop) { IDPropertyTemplate val = {0}; - pchan->prop= IDP_New(IDP_GROUP, val, "RNA_PoseChannel group"); + pchan->prop= IDP_New(IDP_GROUP, val, "RNA_PoseBone group"); } return pchan->prop; |