diff options
30 files changed, 303 insertions, 74 deletions
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 74db2082a00..ddc05b57e62 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -341,7 +341,7 @@ void ArmatureImporter::create_armature_bones( ) if (!ob_arm) continue; - ED_armature_to_edit(ob_arm); + ED_armature_to_edit(ob_arm->data); /* * TODO: @@ -356,12 +356,12 @@ void ArmatureImporter::create_armature_bones( ) // exit armature edit mode unskinned_armature_map[(*ri)->getUniqueId()] = ob_arm; - ED_armature_from_edit(ob_arm); + ED_armature_from_edit(ob_arm->data); //This serves no purpose, as pose is automatically reset later, in BKE_where_is_bone() //set_pose(ob_arm, *ri, NULL, NULL); - ED_armature_edit_free(ob_arm); + ED_armature_edit_free(ob_arm->data); DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB | OB_RECALC_DATA); } } @@ -454,7 +454,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin) } // enter armature edit mode - ED_armature_to_edit(ob_arm); + ED_armature_to_edit(ob_arm->data); leaf_bones.clear(); totbone = 0; @@ -485,8 +485,8 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin) fix_leaf_bones(); // exit armature edit mode - ED_armature_from_edit(ob_arm); - ED_armature_edit_free(ob_arm); + ED_armature_from_edit(ob_arm->data); + ED_armature_edit_free(ob_arm->data); DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB | OB_RECALC_DATA); } diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index c284769ff5c..9bc94e01085 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -65,17 +65,27 @@ void ED_armature_apply_transform(Object *ob, float mat[4][4]) { - EditBone *ebone; bArmature *arm = ob->data; + + /* Put the armature into editmode */ + ED_armature_to_edit(arm); + + /* Transform the bones*/ + ED_armature_transform_bones(arm, mat); + + /* Turn the list into an armature */ + ED_armature_from_edit(arm); + ED_armature_edit_free(arm); +} + +void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4]) +{ + EditBone *ebone; float scale = mat4_to_scale(mat); /* store the scale of the matrix here to use on envelopes */ float mat3[3][3]; - + copy_m3_m4(mat3, mat); normalize_m3(mat3); - - /* Put the armature into editmode */ - ED_armature_to_edit(ob); - /* Do the rotations */ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { float tmat[3][3]; @@ -89,7 +99,7 @@ void ED_armature_apply_transform(Object *ob, float mat[4][4]) /* transform the bone */ mul_m4_v3(mat, ebone->head); mul_m4_v3(mat, ebone->tail); - + /* apply the transfiormed roll back */ mat3_to_vec_roll(tmat, NULL, &ebone->roll); @@ -101,10 +111,24 @@ void ED_armature_apply_transform(Object *ob, float mat[4][4]) ebone->xwidth *= scale; ebone->zwidth *= scale; } - - /* Turn the list into an armature */ - ED_armature_from_edit(ob); - ED_armature_edit_free(ob); +} + +void ED_armature_transform(struct bArmature *arm, float mat[4][4]) +{ + if (arm->edbo) { + ED_armature_transform_bones(arm, mat); + } + else { + /* Put the armature into editmode */ + ED_armature_to_edit(arm); + + /* Transform the bones */ + ED_armature_transform_bones(arm, mat); + + /* Go back to object mode*/ + ED_armature_from_edit(arm); + ED_armature_edit_free(arm); + } } /* exported for use in editors/object/ */ @@ -118,7 +142,7 @@ void ED_armature_origin_set(Scene *scene, Object *ob, float cursor[3], int cente /* Put the armature into editmode */ if (ob != obedit) { - ED_armature_to_edit(ob); + ED_armature_to_edit(arm); obedit = NULL; /* we cant use this so behave as if there is no obedit */ } @@ -160,8 +184,8 @@ void ED_armature_origin_set(Scene *scene, Object *ob, float cursor[3], int cente /* Turn the list into an armature */ if (obedit == NULL) { - ED_armature_from_edit(ob); - ED_armature_edit_free(ob); + ED_armature_from_edit(arm); + ED_armature_edit_free(arm); } /* Adjust object location for new centerpoint */ diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index 087e9a86241..7a5d43acf9c 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -204,7 +204,7 @@ int join_armature_exec(bContext *C, wmOperator *op) } /* Get editbones of active armature to add editbones to */ - ED_armature_to_edit(ob); + ED_armature_to_edit(arm); /* get pose of active object and move it out of posemode */ pose = ob->pose; @@ -216,7 +216,7 @@ int join_armature_exec(bContext *C, wmOperator *op) bArmature *curarm = base->object->data; /* Make a list of editbones in current armature */ - ED_armature_to_edit(base->object); + ED_armature_to_edit(base->object->data); /* Get Pose of current armature */ opose = base->object->pose; @@ -286,8 +286,8 @@ int join_armature_exec(bContext *C, wmOperator *op) DAG_relations_tag_update(bmain); /* because we removed object(s) */ - ED_armature_from_edit(ob); - ED_armature_edit_free(ob); + ED_armature_from_edit(arm); + ED_armature_edit_free(arm); WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); @@ -409,7 +409,7 @@ static void separate_armature_bones(Object *ob, short sel) EditBone *curbone; /* make local set of editbones to manipulate here */ - ED_armature_to_edit(ob); + ED_armature_to_edit(arm); /* go through pose-channels, checking if a bone should be removed */ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchann) { @@ -449,8 +449,8 @@ static void separate_armature_bones(Object *ob, short sel) } /* exit editmode (recalculates pchans too) */ - ED_armature_from_edit(ob); - ED_armature_edit_free(ob); + ED_armature_from_edit(ob->data); + ED_armature_edit_free(ob->data); } /* separate selected bones into their armature */ @@ -492,8 +492,8 @@ static int separate_armature_exec(bContext *C, wmOperator *op) oldob->mode &= ~OB_MODE_POSE; //oldbase->flag &= ~OB_POSEMODE; - ED_armature_from_edit(obedit); - ED_armature_edit_free(obedit); + ED_armature_from_edit(obedit->data); + ED_armature_edit_free(obedit->data); /* 2) duplicate base */ newbase = ED_object_add_duplicate(bmain, scene, oldbase, USER_DUP_ARM); /* only duplicate linked armature */ @@ -518,7 +518,7 @@ static int separate_armature_exec(bContext *C, wmOperator *op) /* 5) restore original conditions */ obedit = oldob; - ED_armature_to_edit(obedit); + ED_armature_to_edit(obedit->data); BKE_report(op->reports, RPT_INFO, "Separated bones"); diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c index 7d6b3710a38..7c7027641d7 100644 --- a/source/blender/editors/armature/armature_utils.c +++ b/source/blender/editors/armature/armature_utils.c @@ -492,9 +492,8 @@ static void fix_bonelist_roll(ListBase *bonelist, ListBase *editbonelist) } /* put EditMode back in Object */ -void ED_armature_from_edit(Object *obedit) +void ED_armature_from_edit(bArmature *arm) { - bArmature *arm = obedit->data; EditBone *eBone, *neBone; Bone *newBone; Object *obt; @@ -601,12 +600,11 @@ void ED_armature_from_edit(Object *obedit) BKE_pose_rebuild(obt, arm); } - DAG_id_tag_update(&obedit->id, OB_RECALC_DATA); + DAG_id_tag_update(&arm->id, 0); } -void ED_armature_edit_free(struct Object *ob) +void ED_armature_edit_free(struct bArmature *arm) { - bArmature *arm = ob->data; EditBone *eBone; /* Clear the editbones list */ @@ -628,11 +626,9 @@ void ED_armature_edit_free(struct Object *ob) } /* Put armature in EditMode */ -void ED_armature_to_edit(Object *ob) +void ED_armature_to_edit(bArmature *arm) { - bArmature *arm = ob->data; - - ED_armature_edit_free(ob); + ED_armature_edit_free(arm); arm->edbo = MEM_callocN(sizeof(ListBase), "edbo armature"); arm->act_edbone = make_boneList(arm->edbo, &arm->bonebase, NULL, arm->act_bone); diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index 2c00c5e646c..4ea564b46ce 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -2416,7 +2416,7 @@ static void adjustGraphs(bContext *C, RigGraph *rigg) /* Turn the list into an armature */ arm->edbo = rigg->editbones; - ED_armature_from_edit(rigg->ob); + ED_armature_from_edit(arm); ED_undo_push(C, "Retarget Skeleton"); } @@ -2443,7 +2443,7 @@ static void retargetGraphs(bContext *C, RigGraph *rigg) /* Turn the list into an armature */ arm->edbo = rigg->editbones; - ED_armature_from_edit(rigg->ob); + ED_armature_from_edit(arm); } const char *RIG_nameBone(RigGraph *rg, int arc_index, int bone_index) diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index 578f048cb15..993b0cc5e05 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -112,7 +112,7 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op) "transforms stored are relative to the old rest pose"); /* Get editbones of active armature to alter */ - ED_armature_to_edit(ob); + ED_armature_to_edit(arm); /* get pose of active object and move it out of posemode */ pose = ob->pose; @@ -160,8 +160,8 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op) } /* convert editbones back to bones, and then free the edit-data */ - ED_armature_from_edit(ob); - ED_armature_edit_free(ob); + ED_armature_from_edit(arm); + ED_armature_edit_free(arm); /* flush positions of posebones */ BKE_pose_where_is(scene, ob); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index e6ea74b380b..bc97515f055 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1370,6 +1370,37 @@ void CU_select_swap(Object *obedit) } } +/******************** transform operator **********************/ + +void ED_curve_transform(Curve *cu, float mat[4][4]) +{ + Nurb *nu; + BPoint *bp; + BezTriple *bezt; + int a; + + float scale = mat4_to_scale(mat); + + for (nu = cu->nurb.first; nu; nu = nu->next) { + if (nu->type == CU_BEZIER) { + a = nu->pntsu; + for (bezt = nu->bezt; a--; bezt++) { + mul_m4_v3(mat, bezt->vec[0]); + mul_m4_v3(mat, bezt->vec[1]); + mul_m4_v3(mat, bezt->vec[2]); + bezt->radius *= scale; + } + BKE_nurb_handles_calc(nu); + } + else { + a = nu->pntsu * nu->pntsv; + for (bp = nu->bp; a--; bp++) + mul_m4_v3(mat, bp->vec); + } + } + DAG_id_tag_update(&cu->id, 0); +} + /******************** separate operator ***********************/ static int separate_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index e9caf89d9da..61fcdc86d58 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -116,9 +116,9 @@ void ED_operatormacros_armature(void); void ED_keymap_armature(struct wmKeyConfig *keyconf); /* editarmature.c */ -void ED_armature_from_edit(struct Object *obedit); -void ED_armature_to_edit(struct Object *ob); -void ED_armature_edit_free(struct Object *ob); +void ED_armature_from_edit(struct bArmature *arm); +void ED_armature_to_edit(struct bArmature *arm); +void ED_armature_edit_free(struct bArmature *arm); void ED_armature_deselect_all(struct Object *obedit, int toggle); void ED_armature_deselect_all_visible(struct Object *obedit); @@ -146,7 +146,9 @@ void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4]); void transform_armature_mirror_update(struct Object *obedit); void ED_armature_origin_set(struct Scene *scene, struct Object *ob, float cursor[3], int centermode, int around); +void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4]); void ED_armature_apply_transform(struct Object *ob, float mat[4][4]); +void ED_armature_transform(struct bArmature *arm, float mat[4][4]); #define ARM_GROUPS_NAME 1 #define ARM_GROUPS_ENVELOPE 2 diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index 571788f4f8f..ce6c8f8354b 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -51,6 +51,7 @@ void ED_operatormacros_curve(void); void ED_keymap_curve(struct wmKeyConfig *keyconf); /* editcurve.c */ +void ED_curve_transform(struct Curve *cv, float mat[4][4]); void CU_deselect_all(struct Object *obedit); void CU_select_all(struct Object *obedit); void CU_select_swap(struct Object *obedit); diff --git a/source/blender/editors/include/ED_lattice.h b/source/blender/editors/include/ED_lattice.h index 6fe1524cb6d..4d19b6d5548 100644 --- a/source/blender/editors/include/ED_lattice.h +++ b/source/blender/editors/include/ED_lattice.h @@ -32,9 +32,11 @@ #define __ED_LATTICE_H__ struct Object; +struct Lattice; void free_editLatt(struct Object *ob); void make_editLatt(struct Object *obedit); void load_editLatt(struct Object *obedit); +void ED_lattice_transform(struct Lattice *lt, float mat[4][4]); #endif /* __ED_LATTICE_H__ */ diff --git a/source/blender/editors/include/ED_mball.h b/source/blender/editors/include/ED_mball.h index 22aec69838b..680e9d79109 100644 --- a/source/blender/editors/include/ED_mball.h +++ b/source/blender/editors/include/ED_mball.h @@ -50,6 +50,6 @@ void load_editMball(struct Object *obedit); void undo_push_mball(struct bContext *C, const char *name); -void ED_mball_transform(struct MetaBall *mb, float *mat); +void ED_mball_transform(struct MetaBall *mb, float mat[4][4]); #endif /* __ED_MBALL_H__ */ diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 9d3404aa29b..6d9a0578007 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -269,7 +269,7 @@ void ED_mesh_faces_remove(struct Mesh *mesh, struct ReportList *reports, int cou void ED_mesh_edges_remove(struct Mesh *mesh, struct ReportList *reports, int count); void ED_mesh_vertices_remove(struct Mesh *mesh, struct ReportList *reports, int count); -void ED_mesh_transform(struct Mesh *me, float *mat); +void ED_mesh_transform(struct Mesh *me, float mat[4][4]); void ED_mesh_calc_tessface(struct Mesh *mesh); void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges, int calc_tessface); diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index f35a46b50d3..6decec75de4 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -880,13 +880,13 @@ static void mesh_add_verts(Mesh *mesh, int len) mesh->totvert = totvert; } -void ED_mesh_transform(Mesh *me, float *mat) +void ED_mesh_transform(Mesh *me, float mat[4][4]) { int i; MVert *mvert = me->mvert; for (i = 0; i < me->totvert; i++, mvert++) - mul_m4_v3((float (*)[4])mat, mvert->co); + mul_m4_v3(mat, mvert->co); /* don't update normals, caller can do this explicitly */ } diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index 3daffe9bb37..26008694b3c 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -751,18 +751,17 @@ void undo_push_mball(bContext *C, const char *name) undo_editmode_push(C, name, get_data, free_undoMball, undoMball_to_editMball, editMball_to_undoMball, NULL); } -/* matrix is 4x4 */ -void ED_mball_transform(MetaBall *mb, float *mat) +void ED_mball_transform(MetaBall *mb, float mat[4][4]) { MetaElem *me; float quat[4]; - const float scale = mat4_to_scale((float (*)[4])mat); + const float scale = mat4_to_scale(mat); const float scale_sqrt = sqrtf(scale); - mat4_to_quat(quat, (float (*)[4])mat); + mat4_to_quat(quat, mat); for (me = mb->elems.first; me; me = me->next) { - mul_m4_v3((float (*)[4])mat, &me->x); + mul_m4_v3(mat, &me->x); mul_qt_qtqt(me->quat, quat, me->quat); me->rad *= scale; /* hrmf, probably elems shouldn't be @@ -774,4 +773,5 @@ void ED_mball_transform(MetaBall *mb, float *mat) mul_v3_fl(&me->expx, scale_sqrt); } } + DAG_id_tag_update(&mb->id, 0); } diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 465eb07f993..dc641dbe765 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -343,9 +343,9 @@ static bool ED_object_editmode_load_ex(Object *obedit, const bool freedata) } } else if (obedit->type == OB_ARMATURE) { - ED_armature_from_edit(obedit); + ED_armature_from_edit(obedit->data); if (freedata) - ED_armature_edit_free(obedit); + ED_armature_edit_free(obedit->data); } else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) { load_editNurb(obedit); @@ -493,7 +493,7 @@ void ED_object_editmode_enter(bContext *C, int flag) WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_MESH, scene); } else if (ob->type == OB_ARMATURE) { - bArmature *arm = base->object->data; + bArmature *arm = ob->data; if (!arm) return; /* * The function BKE_object_obdata_is_libdata make a problem here, the @@ -509,7 +509,7 @@ void ED_object_editmode_enter(bContext *C, int flag) } ok = 1; scene->obedit = ob; - ED_armature_to_edit(ob); + ED_armature_to_edit(arm); /* to ensure all goes in restposition and without striding */ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); /* XXX: should this be OB_RECALC_DATA? */ diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index fdc9a604c07..c5e2aff0bc2 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -174,6 +174,21 @@ void load_editLatt(Object *obedit) } } +/*************************** Transform Operator ************************/ + +void ED_lattice_transform(Lattice *lt, float mat[4][4]) +{ + BPoint *bp = lt->def; + int a = lt->pntsu * lt->pntsv * lt->pntsw; + + while (a--) { + mul_m4_v3(mat, bp->vec); + bp++; + } + + DAG_id_tag_update(<->id, 0); +} + /************************** Select Random Operator **********************/ static int lattice_select_random_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 16b54b4f4b4..c06164203b6 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1787,8 +1787,8 @@ static Object *modifier_skin_armature_create(Main *bmain, Scene *scene, Object * MEM_freeN(emap); MEM_freeN(emap_mem); - ED_armature_from_edit(arm_ob); - ED_armature_edit_free(arm_ob); + ED_armature_from_edit(arm); + ED_armature_edit_free(arm); return arm_ob; } diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 63388600398..d40d239319c 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -512,7 +512,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo } else if (ob->type == OB_MBALL) { MetaBall *mb = ob->data; - ED_mball_transform(mb, (float *)mat); + ED_mball_transform(mb, mat); } else if (ELEM(ob->type, OB_CURVE, OB_SURF)) { Curve *cu = ob->data; diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 0e357dc53c1..df1dad69db0 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -128,7 +128,7 @@ void ED_editors_exit(bContext *C) } } else if (ob->type == OB_ARMATURE) { - ED_armature_edit_free(ob); + ED_armature_edit_free(ob->data); } } } diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 9b2fc2c3c4d..a4deee5a2c3 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -103,8 +103,10 @@ set(APISRC rna_armature_api.c rna_camera_api.c rna_controller_api.c + rna_curve_api.c rna_fcurve_api.c rna_image_api.c + rna_lattice_api.c rna_main_api.c rna_material_api.c rna_mesh_api.c diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 8070ef1d814..6a25b97f4cd 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -3244,7 +3244,7 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_constraint.c", NULL, RNA_def_constraint}, {"rna_context.c", NULL, RNA_def_context}, {"rna_controller.c", "rna_controller_api.c", RNA_def_controller}, - {"rna_curve.c", NULL, RNA_def_curve}, + {"rna_curve.c", "rna_curve_api.c", RNA_def_curve}, {"rna_dynamicpaint.c", NULL, RNA_def_dynamic_paint}, {"rna_fcurve.c", "rna_fcurve_api.c", RNA_def_fcurve}, {"rna_fluidsim.c", NULL, RNA_def_fluidsim}, @@ -3253,7 +3253,7 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_image.c", "rna_image_api.c", RNA_def_image}, {"rna_key.c", NULL, RNA_def_key}, {"rna_lamp.c", NULL, RNA_def_lamp}, - {"rna_lattice.c", NULL, RNA_def_lattice}, + {"rna_lattice.c", "rna_lattice_api.c", RNA_def_lattice}, {"rna_linestyle.c", NULL, RNA_def_linestyle}, {"rna_main.c", "rna_main_api.c", RNA_def_main}, {"rna_material.c", "rna_material_api.c", RNA_def_material}, diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 4b9f7ea32f6..9d4e7a1da04 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -469,6 +469,11 @@ static int rna_Armature_is_editmode_get(PointerRNA *ptr) return (arm->edbo != NULL); } +void rna_Armature_transform(struct bArmature *arm, float *mat) +{ + ED_armature_transform(arm, (float (*)[4])mat); +} + #else static void rna_def_bone_common(StructRNA *srna, int editbone) @@ -877,6 +882,7 @@ static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop) static void rna_def_armature(BlenderRNA *brna) { StructRNA *srna; + FunctionRNA *func; PropertyRNA *prop; static EnumPropertyItem prop_drawtype_items[] = { @@ -911,7 +917,12 @@ static void rna_def_armature(BlenderRNA *brna) "Armature datablock containing a hierarchy of bones, usually used for rigging characters"); RNA_def_struct_ui_icon(srna, ICON_ARMATURE_DATA); RNA_def_struct_sdna(srna, "bArmature"); - + + func = RNA_def_function(srna, "transform", "rna_Armature_transform"); + RNA_def_function_ui_description(func, "Transform armature bones by a matrix"); + prop = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f); + RNA_def_property_flag(prop, PROP_REQUIRED); + /* Animation Data */ rna_def_animdata_common(srna); diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 74fe3c145f1..da5b6676cb9 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -1292,8 +1292,7 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Curve", "Curve datablock storing curves, splines and NURBS"); RNA_def_struct_ui_icon(srna, ICON_CURVE_DATA); RNA_def_struct_refine_func(srna, "rna_Curve_refine"); - - rna_def_animdata_common(srna); + prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "key"); @@ -1513,6 +1512,10 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_Curve_is_editmode_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode"); + + rna_def_animdata_common(srna); + + RNA_api_curve(srna); } static void rna_def_curve_nurb(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_curve_api.c b/source/blender/makesrna/intern/rna_curve_api.c new file mode 100644 index 00000000000..b689242f68f --- /dev/null +++ b/source/blender/makesrna/intern/rna_curve_api.c @@ -0,0 +1,63 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2009 Blender Foundation. + * All rights reserved. + * + * + * Contributor(s): Blender Foundation + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/makesrna/intern/rna_curve_api.c + * \ingroup RNA + */ + + +#include <stdlib.h> +#include <stdio.h> + +#include "RNA_define.h" + +#include "BLI_sys_types.h" + +#include "BLI_utildefines.h" + +#include "ED_curve.h" + +#include "rna_internal.h" /* own include */ + +#ifdef RNA_RUNTIME +void rna_Curve_transform(Curve *cu, float *mat) +{ + ED_curve_transform(cu, (float (*)[4])mat); +} +#else + +void RNA_api_curve(StructRNA *srna) +{ + FunctionRNA *func; + PropertyRNA *parm; + + func = RNA_def_function(srna, "transform", "rna_Curve_transform"); + RNA_def_function_ui_description(func, "Transform curve by a matrix"); + parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f); + RNA_def_property_flag(parm, PROP_REQUIRED); +} + +#endif diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 807fad41373..0ba30d438e9 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -256,8 +256,10 @@ void RNA_api_action(StructRNA *srna); void RNA_api_armature_edit_bone(StructRNA *srna); void RNA_api_bone(StructRNA *srna); void RNA_api_camera(StructRNA *srna); +void RNA_api_curve(StructRNA *srna); void RNA_api_drivers(StructRNA *srna); void RNA_api_image(struct StructRNA *srna); +void RNA_api_lattice(struct StructRNA *srna); void RNA_api_operator(struct StructRNA *srna); void RNA_api_macro(struct StructRNA *srna); void RNA_api_keyconfig(struct StructRNA *srna); diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index 3bb00716302..2580cd9cff8 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -50,6 +50,7 @@ #include "WM_api.h" #include "WM_types.h" +#include "ED_lattice.h" static void rna_LatticePoint_co_get(PointerRNA *ptr, float *values) { @@ -362,6 +363,8 @@ static void rna_def_lattice(BlenderRNA *brna) /* pointers */ rna_def_animdata_common(srna); + + RNA_api_lattice(srna); } void RNA_def_lattice(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_lattice_api.c b/source/blender/makesrna/intern/rna_lattice_api.c new file mode 100644 index 00000000000..acb71b29ea8 --- /dev/null +++ b/source/blender/makesrna/intern/rna_lattice_api.c @@ -0,0 +1,63 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2009 Blender Foundation. + * All rights reserved. + * + * + * Contributor(s): Blender Foundation + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/makesrna/intern/rna_lattice_api.c + * \ingroup RNA + */ + + +#include <stdlib.h> +#include <stdio.h> + +#include "RNA_define.h" + +#include "BLI_sys_types.h" + +#include "BLI_utildefines.h" + +#include "ED_lattice.h" + +#include "rna_internal.h" /* own include */ + +#ifdef RNA_RUNTIME +void rna_Lattice_transform(Lattice *lt, float *mat) +{ + ED_lattice_transform(lt, (float (*)[4])mat); +} +#else + +void RNA_api_lattice(StructRNA *srna) +{ + FunctionRNA *func; + PropertyRNA *parm; + + func = RNA_def_function(srna, "transform", "rna_Lattice_transform"); + RNA_def_function_ui_description(func, "Transform lattice by a matrix"); + parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f); + RNA_def_property_flag(parm, PROP_REQUIRED); +} + +#endif diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index fe4226839d0..34f21046a92 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -111,6 +111,11 @@ static void rna_Mesh_calc_smooth_groups(Mesh *mesh, int use_bitflags, int *r_pol r_group_total, use_bitflags); } +static void rna_Mesh_transform(Mesh *mesh, float *mat) +{ + ED_mesh_transform(mesh, (float (*)[4])mat); +} + #else void RNA_api_mesh(StructRNA *srna) @@ -118,7 +123,7 @@ void RNA_api_mesh(StructRNA *srna) FunctionRNA *func; PropertyRNA *parm; - func = RNA_def_function(srna, "transform", "ED_mesh_transform"); + func = RNA_def_function(srna, "transform", "rna_Mesh_transform"); RNA_def_function_ui_description(func, "Transform mesh vertices by a matrix"); parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f); RNA_def_property_flag(parm, PROP_REQUIRED); diff --git a/source/blender/makesrna/intern/rna_meta_api.c b/source/blender/makesrna/intern/rna_meta_api.c index abf3de02aa0..7fe59bc5be6 100644 --- a/source/blender/makesrna/intern/rna_meta_api.c +++ b/source/blender/makesrna/intern/rna_meta_api.c @@ -43,7 +43,10 @@ #include "rna_internal.h" /* own include */ #ifdef RNA_RUNTIME -/* none */ +void rna_Meta_transform(struct MetaBall *mb, float *mat) +{ + ED_mball_transform(mb, (float (*)[4])mat); +} #else void RNA_api_meta(StructRNA *srna) @@ -51,7 +54,7 @@ void RNA_api_meta(StructRNA *srna) FunctionRNA *func; PropertyRNA *parm; - func = RNA_def_function(srna, "transform", "ED_mball_transform"); + func = RNA_def_function(srna, "transform", "rna_Meta_transform"); RNA_def_function_ui_description(func, "Transform meta elements by a matrix"); parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f); RNA_def_property_flag(parm, PROP_REQUIRED); diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 3111cb5edfa..8250a4f3298 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -229,6 +229,7 @@ int WM_enum_search_invoke(struct bContext *C, struct wmOperator *op, struct wmEv void WM_event_add_notifier(const struct bContext *C, unsigned int type, void *reference) {STUB_ASSERT(0);} void WM_main_add_notifier(unsigned int type, void *reference) {STUB_ASSERT(0);} void ED_armature_bone_rename(struct bArmature *arm, char *oldnamep, char *newnamep) {STUB_ASSERT(0);} +void ED_armature_transform(struct bArmature *arm, float mat[4][4]) {STUB_ASSERT(0);} struct wmEventHandler *WM_event_add_modal_handler(struct bContext *C, struct wmOperator *op) {STUB_ASSERT(0); return (struct wmEventHandler *)NULL;} struct wmTimer *WM_event_add_timer(struct wmWindowManager *wm, struct wmWindow *win, int event_type, double timestep) {STUB_ASSERT(0); return (struct wmTimer *)NULL;} void WM_event_remove_timer(struct wmWindowManager *wm, struct wmWindow *win, struct wmTimer *timer) {STUB_ASSERT(0);} @@ -315,6 +316,7 @@ void ED_area_tag_redraw(struct ScrArea *sa) {STUB_ASSERT(0);} void ED_area_tag_refresh(struct ScrArea *sa) {STUB_ASSERT(0);} void ED_area_newspace(struct bContext *C, struct ScrArea *sa, int type) {STUB_ASSERT(0);} void ED_region_tag_redraw(struct ARegion *ar) {STUB_ASSERT(0);} +void ED_curve_transform(struct Curve *cv, float mat[4][4]) {STUB_ASSERT(0);} void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op) {STUB_ASSERT(0);} void WM_cursor_wait(int val) {STUB_ASSERT(0);} void ED_node_texture_default(struct bContext *C, struct Tex *tx) {STUB_ASSERT(0);} @@ -371,7 +373,7 @@ void uiTemplateIconView(struct uiLayout *layout, struct PointerRNA *ptr, const c void ED_base_object_free_and_unlink(struct Scene *scene, struct Base *base) {STUB_ASSERT(0);} void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces) {STUB_ASSERT(0);} void ED_mesh_material_add(struct Mesh *me, struct Material *ma) {STUB_ASSERT(0);} -void ED_mesh_transform(struct Mesh *me, float *mat) {STUB_ASSERT(0);} +void ED_mesh_transform(struct Mesh *me, float mat[4][4]) {STUB_ASSERT(0);} void ED_mesh_update(struct Mesh *mesh, struct bContext *C) {STUB_ASSERT(0);} void ED_mesh_vertices_add(struct Mesh *mesh, struct ReportList *reports, int count) {STUB_ASSERT(0);} void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count) {STUB_ASSERT(0);} @@ -411,12 +413,13 @@ bool ED_texture_context_check_others(struct bContext *C) {STUB_ASSERT(0); return void ED_nurb_set_spline_type(struct Nurb *nu, int type) {STUB_ASSERT(0);} -void ED_mball_transform(struct MetaBall *mb, float *mat) {STUB_ASSERT(0);} +void ED_mball_transform(struct MetaBall *mb, float mat[4][4]) {STUB_ASSERT(0);} bool snapObjectsRayEx(struct Scene *scene, struct Base *base_act) {STUB_ASSERT(0); return 0;} void make_editLatt(struct Object *obedit) {STUB_ASSERT(0);} void load_editLatt(struct Object *obedit) {STUB_ASSERT(0);} +void ED_lattice_transform(struct Lattice *lt, float mat[4][4]) {STUB_ASSERT(0);} void load_editNurb(struct Object *obedit) {STUB_ASSERT(0);} void make_editNurb(struct Object *obedit) {STUB_ASSERT(0);} |