Put back Armature/Pose code, including 'heat weight'.
I've added reeb.h to get things compile, but Martin will
cleanup files and put back?

Now where to put all vertexgroup code.... I guess mesh?

Note for msvc: yep, another new dir to add! :)
This commit is contained in:
Ton Roosendaal 2009-01-05 15:19:31 +00:00
parent df20a12728
commit 1fe21f7e8f
33 changed files with 9157 additions and 254 deletions

@ -240,6 +240,7 @@ PULIB += $(OCGDIR)/blender/ed_view3d/libed_view3d.a
PULIB += $(OCGDIR)/blender/ed_interface/libed_interface.a
PULIB += $(OCGDIR)/blender/ed_object/libed_object.a
PULIB += $(OCGDIR)/blender/ed_mesh/libed_mesh.a
PULIB += $(OCGDIR)/blender/ed_armature/libed_armature.a
PULIB += $(OCGDIR)/blender/ed_animation/libed_animation.a
PULIB += $(OCGDIR)/blender/ed_transform/libed_transform.a
PULIB += $(OCGDIR)/blender/ed_util/libed_util.a

@ -80,7 +80,6 @@ struct bArmature *copy_armature(struct bArmature *arm);
void bone_flip_name (char *name, int strip_number);
void bone_autoside_name (char *name, int strip_number, short axis, float head, float tail);
struct bArmature *get_armature (struct Object *ob);
struct Bone *get_named_bone (struct bArmature *arm, const char *name);
float distfactor_to_bone (float vec[3], float b1[3], float b2[3], float rad1, float rad2, float rdist);

@ -81,7 +81,6 @@ void *add_wave(void);
struct Object *add_only_object(int type, char *name);
struct Object *add_object(struct Scene *scene, int type);
void base_init_from_view3d(struct Base *base, struct View3D *v3d, struct Scene *scene);
struct Object *copy_object(struct Object *ob);
void expand_local_object(struct Object *ob);

@ -77,13 +77,6 @@
/* **************** Generic Functions, data level *************** */
bArmature *get_armature(Object *ob)
{
if(ob==NULL) return NULL;
if(ob->type==OB_ARMATURE) return ob->data;
else return NULL;
}
bArmature *add_armature(char *name)
{
bArmature *arm;
@ -2275,7 +2268,8 @@ void where_is_pose (Scene *scene, Object *ob)
float imat[4][4];
float ctime;
arm = get_armature(ob);
if(ob->type!=OB_ARMATURE) return;
arm = ob->data;
if(ELEM(NULL, arm, scene)) return;
if((ob->pose==NULL) || (ob->pose->flag & POSE_RECALC))

@ -1009,38 +1009,6 @@ Object *add_object(struct Scene *scene, int type)
return ob;
}
void base_init_from_view3d(Base *base, View3D *v3d, struct Scene *scene)
{
Object *ob= base->object;
if (!v3d) {
/* no 3d view, this wont happen often */
base->lay = 1;
VECCOPY(ob->loc, scene->cursor);
/* return now because v3d->viewquat isnt available */
return;
} else if (v3d->localview) {
base->lay= ob->lay= v3d->layact + v3d->lay;
VECCOPY(ob->loc, v3d->cursor);
} else {
base->lay= ob->lay= v3d->layact;
VECCOPY(ob->loc, scene->cursor);
}
if (U.flag & USER_ADD_VIEWALIGNED) {
v3d->viewquat[0]= -v3d->viewquat[0];
/* Quats arnt used yet */
/*if (ob->transflag & OB_QUAT) {
QUATCOPY(ob->quat, v3d->viewquat);
} else {*/
QuatToEul(v3d->viewquat, ob->rot);
/*}*/
v3d->viewquat[0]= -v3d->viewquat[0];
}
}
SoftBody *copy_softbody(SoftBody *sb)
{
SoftBody *sbn;
@ -1628,11 +1596,9 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
static void ob_parbone(Object *ob, Object *par, float mat[][4])
{
bPoseChannel *pchan;
bArmature *arm;
float vec[3];
arm=get_armature(par);
if (!arm) {
if (ob->type!=OB_ARMATURE) {
Mat4One(mat);
return;
}

@ -29,6 +29,6 @@
# Bounces make to subdirectories.
SOURCEDIR = source/blender/editors
DIRS = mesh animation object datafiles transform screen space_outliner space_time space_view3d interface util space_api space_ipo space_image space_node space_buttons space_info space_file space_sound space_action space_nla space_script space_text space_sequencer
DIRS = armature mesh animation object datafiles transform screen space_outliner space_time space_view3d interface util space_api space_ipo space_image space_node space_buttons space_info space_file space_sound space_action space_nla space_script space_text space_sequencer
include nan_subdirs.mk

@ -7,6 +7,7 @@ SConscript(['datafiles/SConscript',
'util/SConscript',
'interface/SConscript',
'animation/SConscript',
'armature/SConscript',
'mesh/SConscript',
'object/SConscript',
'space_buttons/SConscript',

@ -0,0 +1,59 @@
#
# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
#
# ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# The Original Code is Copyright (C) 2007 Blender Foundation
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): none yet.
#
# ***** END GPL LICENSE BLOCK *****
#
# Makes module object directory and bounces make to subdirectories.
LIBNAME = ed_armature
DIR = $(OCGDIR)/blender/$(LIBNAME)
include nan_compile.mk
CFLAGS += $(LEVEL_1_C_WARNINGS)
CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(OPENGL_HEADERS)
CPPFLAGS += -I$(NAN_BMFONT)/include
CPPFLAGS += -I$(NAN_OPENNL)/include
# not very neat....
CPPFLAGS += -I../../windowmanager
CPPFLAGS += -I../../blenloader
CPPFLAGS += -I../../blenkernel
CPPFLAGS += -I../../blenlib
CPPFLAGS += -I../../makesdna
CPPFLAGS += -I../../imbuf
CPPFLAGS += -I../../python
CPPFLAGS += -I../../gpu
CPPFLAGS += -I../../makesrna
CPPFLAGS += -I../../render/extern/include
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
# own include
CPPFLAGS += -I../include

@ -0,0 +1,11 @@
#!/usr/bin/python
Import ('env')
sources = env.Glob('*.c')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../render/extern/include #/intern/guardedalloc #intern/bmfont'
incs += ' ../../gpu ../../makesrna #/intern/opennl/extern'
env.BlenderLib ( 'bf_editors_armature', sources, Split(incs), [], libtype=['core'], priority=[40] )

@ -0,0 +1,39 @@
/**
* $Id:
*
* ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef ED_ARMATURE_INTERN_H
#define ED_ARMATURE_INTERN_H
/* internal exports only */
void armature_bone_rename(Object *ob, char *oldnamep, char *newnamep);
EditBone *armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo);
#endif /* ED_ARMATURE_INTERN_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,85 @@
/**
* $Id$
*
* ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
* BIF_meshlaplacian.h: Algorithms using the mesh laplacian.
*/
#ifndef BIF_MESHLAPLACIAN_H
#define BIF_MESHLAPLACIAN_H
//#define RIGID_DEFORM
struct Scene;
struct Object;
struct Mesh;
struct bDeformGroup;
struct MeshDeformModifierData;
#ifdef RIGID_DEFORM
struct EditMesh;
#endif
/* Laplacian System */
struct LaplacianSystem;
typedef struct LaplacianSystem LaplacianSystem;
LaplacianSystem *laplacian_construct_begin(int totvert, int totface, int lsq);
void laplacian_add_vertex(LaplacianSystem *sys, float *co, int pinned);
void laplacian_add_triangle(LaplacianSystem *sys, int v1, int v2, int v3);
void laplacian_construct_end(LaplacianSystem *sys);
void laplacian_delete(LaplacianSystem *sys);
void laplacian_begin_solve(LaplacianSystem *sys, int index);
void laplacian_add_right_hand_side(LaplacianSystem *sys, int v, float value);
int laplacian_system_solve(LaplacianSystem *sys);
float laplacian_system_get_solution(int v);
/* Heat Weighting */
void heat_bone_weighting(struct Object *ob, struct Mesh *me, float (*verts)[3],
int numbones, struct bDeformGroup **dgrouplist,
struct bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3],
int *selected);
#ifdef RIGID_DEFORM
/* As-Rigid-As-Possible Deformation */
void rigid_deform_begin(struct EditMesh *em);
void rigid_deform_iteration(void);
void rigid_deform_end(int cancel);
#endif
/* Harmonic Coordinates */
void harmonic_coordinates_bind(struct Scene *scene, struct MeshDeformModifierData *mmd,
float (*vertexcos)[3], int totvert, float cagemat[][4]);
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,189 @@
/**
* $Id:
*
* ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Contributor(s): Martin Poirier
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef REEB_H_
#define REEB_H_
//#define WITH_BF_REEB
#include "DNA_listBase.h"
#include "BLI_graph.h"
struct GHash;
struct EdgeHash;
struct ReebArc;
struct ReebEdge;
struct ReebNode;
typedef struct ReebGraph {
ListBase arcs;
ListBase nodes;
float length;
FreeArc free_arc;
FreeNode free_node;
RadialSymmetry radial_symmetry;
AxialSymmetry axial_symmetry;
/*********************************/
int resolution;
int totnodes;
struct EdgeHash *emap;
int multi_level;
struct ReebGraph *link_up; /* for multi resolution filtering, points to higher levels */
} ReebGraph;
typedef struct EmbedBucket {
float val;
int nv;
float p[3];
} EmbedBucket;
typedef struct ReebNode {
void *next, *prev;
float p[3];
int flag;
int degree;
struct ReebArc **arcs;
int subgraph_index;
int symmetry_level;
int symmetry_flag;
float symmetry_axis[3];
/*********************************/
int index;
float weight;
int multi_level;
struct ReebNode *link_down; /* for multi resolution filtering, points to lower levels, if present */
struct ReebNode *link_up;
} ReebNode;
typedef struct ReebEdge {
struct ReebEdge *next, *prev;
struct ReebArc *arc;
struct ReebNode *v1, *v2;
struct ReebEdge *nextEdge;
int flag;
} ReebEdge;
typedef struct ReebArc {
void *next, *prev;
struct ReebNode *head, *tail;
int flag;
float length;
int symmetry_level;
int symmetry_group;
int symmetry_flag;
/*********************************/
ListBase edges;
int bcount;
struct EmbedBucket *buckets;
struct GHash *faces;
float angle;
struct ReebArc *link_up; /* for multi resolution filtering, points to higher levels */
} ReebArc;
typedef struct ReebArcIterator {
struct ReebArc *arc;
int index;
int start;
int end;
int stride;
int length;
} ReebArcIterator;
struct EditMesh;
struct EdgeIndex;
int weightToHarmonic(struct EditMesh *em, struct EdgeIndex *indexed_edges);
int weightFromDistance(struct EditMesh *em, struct EdgeIndex *indexed_edges);
int weightFromLoc(struct EditMesh *me, int axis);
void weightToVCol(struct EditMesh *em, int index);
void arcToVCol(struct ReebGraph *rg, struct EditMesh *em, int index);
void angleToVCol(struct EditMesh *em, int index);
void renormalizeWeight(struct EditMesh *em, float newmax);
ReebGraph * generateReebGraph(struct EditMesh *me, int subdivisions);
ReebGraph * newReebGraph();
void initArcIterator(struct ReebArcIterator *iter, struct ReebArc *arc, struct ReebNode *head);
void initArcIterator2(struct ReebArcIterator *iter, struct ReebArc *arc, int start, int end);
void initArcIteratorStart(struct ReebArcIterator *iter, struct ReebArc *arc, struct ReebNode *head, int start);
struct EmbedBucket * nextBucket(struct ReebArcIterator *iter);
struct EmbedBucket * nextNBucket(ReebArcIterator *iter, int n);
struct EmbedBucket * peekBucket(ReebArcIterator *iter, int n);
struct EmbedBucket * currentBucket(struct ReebArcIterator *iter);
struct EmbedBucket * previousBucket(struct ReebArcIterator *iter);
int iteratorStopped(struct ReebArcIterator *iter);
/* Filtering */
void filterNullReebGraph(ReebGraph *rg);
int filterSmartReebGraph(ReebGraph *rg, float threshold);
int filterExternalReebGraph(ReebGraph *rg, float threshold);
int filterInternalReebGraph(ReebGraph *rg, float threshold);
/* Post-Build processing */
void repositionNodes(ReebGraph *rg);
void postprocessGraph(ReebGraph *rg, char mode);
void removeNormalNodes(ReebGraph *rg);
void sortNodes(ReebGraph *rg);
void sortArcs(ReebGraph *rg);
/*------------ Sanity check ------------*/
void verifyBuckets(ReebGraph *rg);
void verifyFaces(ReebGraph *rg);
/*********************** PUBLIC *********************************/
#define REEB_MAX_MULTI_LEVEL 10
ReebGraph *BIF_ReebGraphFromEditMesh(void);
ReebGraph *BIF_ReebGraphMultiFromEditMesh(void);
void BIF_flagMultiArcs(ReebGraph *rg, int flag);
void BIF_GlobalReebGraphFromEditMesh(void);
void BIF_GlobalReebFree(void);
ReebNode *BIF_otherNodeFromIndex(ReebArc *arc, ReebNode *node);
ReebNode *BIF_NodeFromIndex(ReebArc *arc, ReebNode *node);
ReebNode *BIF_lowestLevelNode(ReebNode *node);
ReebGraph *BIF_graphForMultiNode(ReebGraph *rg, ReebNode *node);
void REEB_freeGraph(ReebGraph *rg);
void REEB_exportGraph(ReebGraph *rg, int count);
void REEB_draw();
#endif /*REEB_H_*/

@ -1,178 +0,0 @@
/**
* $Id: BIF_editarmature.h 17446 2008-11-13 22:35:40Z theeth $
*
* ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef BIF_EDITARMATURE_H
#define BIF_EDITARMATURE_H
struct Object;
struct Base;
struct Bone;
struct bArmature;
struct ListBase;
typedef struct EditBone
{
struct EditBone *next, *prev;
struct EditBone *parent;/* Editbones have a one-way link (i.e. children refer
to parents. This is converted to a two-way link for
normal bones when leaving editmode. */
void *temp; /* Used to store temporary data */
char name[32];
float roll; /* Roll along axis. We'll ultimately use the axis/angle method
for determining the transformation matrix of the bone. The axis
is tail-head while roll provides the angle. Refer to Graphics
Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/
float head[3]; /* Orientation and length is implicit during editing */
float tail[3];
/* All joints are considered to have zero rotation with respect to
their parents. Therefore any rotations specified during the
animation are automatically relative to the bones' rest positions*/
int flag;
int parNr; /* Used for retrieving values from the menu system */
float dist, weight;
float xwidth, length, zwidth; /* put them in order! transform uses this as scale */
float ease1, ease2;
float rad_head, rad_tail;
short layer, segments;
float oldlength; /* for envelope scaling */
} EditBone;
#define BONESEL_ROOT 0x10000000
#define BONESEL_TIP 0x20000000
#define BONESEL_BONE 0x40000000
#define BONESEL_ANY (BONESEL_TIP|BONESEL_ROOT|BONESEL_BONE)
#define BONESEL_NOSEL 0x80000000 /* Indicates a negative number */
/* useful macros */
#define EBONE_VISIBLE(arm, ebone) ((arm->layer & ebone->layer) && !(ebone->flag & BONE_HIDDEN_A))
#define EBONE_EDITABLE(ebone) ((ebone->flag & BONE_SELECTED) && !(ebone->flag & BONE_EDITMODE_LOCKED))
/* used in bone_select_hierachy() */
#define BONE_SELECT_PARENT 0
#define BONE_SELECT_CHILD 1
/* XXX */
#if 0
float rollBoneToVector(EditBone *bone, float new_up_axis[3]);
void make_boneList(struct ListBase *list, struct ListBase *bones, EditBone *parent);
void editbones_to_armature (struct ListBase *list, struct Object *ob);
void adduplicate_armature(void);
void addvert_armature(void);
void add_primitiveArmature(int type);
void apply_rot_armature (struct Object *ob, float mat[3][3]);
void docenter_armature (struct Object *ob, int centermode);
void clear_armature(struct Object *ob, char mode);
void delete_armature(void);
void deselectall_armature(int toggle, int doundo);
void deselectall_posearmature (struct Object *ob, int test, int doundo);
void extrude_armature(int forked);
void subdivide_armature(int numcuts);
void fill_bones_armature(void);
void merge_armature(void);
void free_editArmature(void);
int join_armature(void);
void separate_armature(void);
void apply_armature_pose2bones(void);
void load_editArmature(void);
void make_bone_parent(void);
void clear_bone_parent(void);
struct Bone *get_indexed_bone (struct Object *ob, int index);
void make_editArmature(void);
void make_trans_bones (char mode);
void remake_editArmature(void);
void editbones_to_armature(struct ListBase *list, struct Object *ob);
int do_pose_selectbuffer(struct Base *base, unsigned int *buffer, short hits);
void generateSkeleton(void);
void mouse_armature(void);
void selectconnected_armature(void);
void selectconnected_posearmature(void);
void armature_select_hierarchy(short direction, short add_to_sel);
void setflag_armature(short mode);
void unique_editbone_name (struct ListBase *ebones, char *name);
void auto_align_armature(short mode);
void switch_direction_armature(void);
void create_vgroups_from_armature(struct Object *ob, struct Object *par);
void add_verts_to_dgroups(struct Object *ob, struct Object *par, int heat, int mirror);
void hide_selected_pose_bones(void);
void hide_unselected_pose_bones(void);
void show_all_pose_bones(void);
int bone_looper(struct Object *ob, struct Bone *bone, void *data,
int (*bone_func)(struct Object *, struct Bone *, void *));
void undo_push_armature(char *name);
void armature_bone_rename(struct bArmature *arm, char *oldname, char *newname);
void armature_flip_names(void);
void armature_autoside_names(short axis);
EditBone *armature_bone_get_mirrored(EditBone *ebo);
void transform_armature_mirror_update(void);
void hide_selected_armature_bones(void);
void hide_unselected_armature_bones(void);
void show_all_armature_bones(void);
void align_selected_bones(void);
/* from autoarmature */
void BIF_retargetArmature();
void BIF_adjustRetarget();
void BIF_freeRetarget();
struct ReebArc;
float calcVariance(struct ReebArc *arc, int start, int end, float v0[3], float n[3]);
float calcDistance(struct ReebArc *arc, int start, int end, float head[3], float tail[3]);
#endif
#endif

@ -0,0 +1,95 @@
/**
* $Id:
*
* ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef ED_ARMATURE_H
#define ED_ARMATURE_H
struct Scene;
struct Object;
struct Base;
struct Bone;
struct bArmature;
struct ListBase;
typedef struct EditBone
{
struct EditBone *next, *prev;
struct EditBone *parent;/* Editbones have a one-way link (i.e. children refer
to parents. This is converted to a two-way link for
normal bones when leaving editmode. */
void *temp; /* Used to store temporary data */
char name[32];
float roll; /* Roll along axis. We'll ultimately use the axis/angle method
for determining the transformation matrix of the bone. The axis
is tail-head while roll provides the angle. Refer to Graphics
Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/
float head[3]; /* Orientation and length is implicit during editing */
float tail[3];
/* All joints are considered to have zero rotation with respect to
their parents. Therefore any rotations specified during the
animation are automatically relative to the bones' rest positions*/
int flag;
int parNr; /* Used for retrieving values from the menu system */
float dist, weight;
float xwidth, length, zwidth; /* put them in order! transform uses this as scale */
float ease1, ease2;
float rad_head, rad_tail;
short layer, segments;
float oldlength; /* for envelope scaling */
} EditBone;
#define BONESEL_ROOT 0x10000000
#define BONESEL_TIP 0x20000000
#define BONESEL_BONE 0x40000000
#define BONESEL_ANY (BONESEL_TIP|BONESEL_ROOT|BONESEL_BONE)
#define BONESEL_NOSEL 0x80000000 /* Indicates a negative number */
/* useful macros */
#define EBONE_VISIBLE(arm, ebone) ((arm->layer & ebone->layer) && !(ebone->flag & BONE_HIDDEN_A))
#define EBONE_EDITABLE(ebone) ((ebone->flag & BONE_SELECTED) && !(ebone->flag & BONE_EDITMODE_LOCKED))
/* used in bone_select_hierachy() */
#define BONE_SELECT_PARENT 0
#define BONE_SELECT_CHILD 1
void ED_pose_deselectall(struct Object *ob, int test, int doundo);
void ED_armature_from_edit(struct Scene *scene, struct Object *obedit);
void ED_armature_to_edit(struct Object *ob);
void ED_armature_edit_free(struct Object *ob);
void ED_armature_edit_remake(struct Object *obedit);
#endif /* ED_ARMATURE_H */

@ -37,6 +37,7 @@ struct EditFace;
struct bContext;
struct wmWindowManager;
struct EditSelection;
struct ViewContext;
// edge and face flag both
#define EM_FGON 2
@ -59,17 +60,6 @@ struct EditSelection;
#define B_JOINTRIA_MAT 0X1000
/* especially for derivedmesh drawing callbacks */
typedef struct ViewContext {
Scene *scene;
Object *obact;
Object *obedit;
struct ARegion *ar;
struct View3D *v3d;
struct EditMesh *em;
short mval[2];
} ViewContext;
/* meshtools.c */
intptr_t mesh_octree_table(Object *ob, struct EditMesh *em, float *co, char mode);

@ -33,6 +33,7 @@ struct Scene;
struct Object;
struct bContext;
struct Base;
struct View3D;
void ED_operatortypes_object(void);
void ED_keymap_object(struct wmWindowManager *wm);
@ -44,6 +45,9 @@ void ED_base_object_activate(struct bContext *C, struct Base *base);
void ED_base_object_free_and_unlink(struct Scene *scene, struct Base *base);
void ED_object_apply_obmat(struct Object *ob);
/* bitflags for enter/exit editmode */
#define EM_FREEDATA 1
#define EM_FREEUNDO 2
@ -51,6 +55,9 @@ void ED_base_object_free_and_unlink(struct Scene *scene, struct Base *base);
void ED_object_exit_editmode(struct bContext *C, int flag);
void ED_object_enter_editmode(struct bContext *C, int flag);
void ED_object_base_init_from_view(struct Scene *scene, struct View3D *v3d, struct Base *base);
/* cleanup */
int object_data_is_libdata(struct Object *ob);
int object_is_libdata(struct Object *ob);

@ -41,7 +41,40 @@ struct EditFace;
struct ImBuf;
struct Scene;
float *give_cursor(struct Scene *scene, View3D *v3d);
/* for derivedmesh drawing callbacks, for view3d_select, .... */
typedef struct ViewContext {
Scene *scene;
Object *obact;
Object *obedit;
struct ARegion *ar;
struct View3D *v3d;
struct EditMesh *em;
short mval[2];
} ViewContext;
typedef struct VPaint {
float r, g, b, a;
float size; /* of brush */
float gamma, mul;
short mode, flag;
int tot, pad; /* allocation size of prev buffers */
unsigned int *vpaint_prev; /* previous mesh colors */
struct MDeformVert *wpaint_prev; /* previous vertex weights */
} VPaint;
/* Gvp.flag and Gwp.flag */
#define VP_COLINDEX 1
#define VP_AREA 2
#define VP_SOFT 4
#define VP_NORMALS 8
#define VP_SPRAY 16
#define VP_MIRROR_X 32
#define VP_HARD 64
#define VP_ONLYVGROUP 128
float *give_cursor(struct Scene *scene, struct View3D *v3d);
void initgrabz(struct View3D *v3d, float x, float y, float z);
void window_to_3d(struct ARegion *ar, struct View3D *v3d, float *vec, short mx, short my);
@ -75,5 +108,10 @@ struct ImBuf *view3d_read_backbuf(struct ViewContext *vc, short xmin, short ymin
unsigned int view3d_sample_backbuf_rect(struct ViewContext *vc, short mval[2], int size, unsigned int min, unsigned int max, int *dist, short strict, unsigned int (*indextest)(unsigned int index));
unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y);
/* select */
#define MAXPICKBUF 10000
short view3d_opengl_select(struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, rcti *input);
#endif /* ED_VIEW3D_H */

@ -74,6 +74,7 @@
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_view3d.h"
#include "WM_api.h"
#include "WM_types.h"
@ -108,7 +109,6 @@ static int sample_backbuf() {return 0;}
static void BIF_undo_push() {}
static void error() {}
static int pupmenu() {return 0;}
static void *give_cursor() {return NULL;}
/* ***************** XXX **************** */

@ -79,6 +79,7 @@
#include "ED_mesh.h"
#include "ED_util.h"
#include "ED_view3d.h"
/* own include */
#include "mesh_intern.h"

@ -55,6 +55,7 @@ editmesh_lib: generic (no UI, no menus) operations/evaluators for editmesh data
#include "BKE_utildefines.h"
#include "ED_mesh.h"
#include "ED_view3d.h"
#include "mesh_intern.h"

@ -55,6 +55,7 @@
#include "ED_screen.h"
#include "ED_mesh.h"
#include "ED_view3d.h"
#include "mesh_intern.h"

@ -82,6 +82,7 @@
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_view3d.h"
/* own include */
#include "mesh_intern.h"

@ -248,6 +248,38 @@ void exit_paint_modes(void)
#endif
}
/* exported */
void ED_object_base_init_from_view(Scene *scene, View3D *v3d, Base *base)
{
Object *ob= base->object;
if (scene==NULL)
return;
if (v3d==NULL) {
base->lay = scene->lay;
VECCOPY(ob->loc, scene->cursor);
}
else {
if (v3d->localview) {
base->lay= ob->lay= v3d->layact | v3d->lay;
VECCOPY(ob->loc, v3d->cursor);
}
else {
base->lay= ob->lay= v3d->layact;
VECCOPY(ob->loc, scene->cursor);
}
if (U.flag & USER_ADD_VIEWALIGNED) {
v3d->viewquat[0]= -v3d->viewquat[0];
QuatToEul(v3d->viewquat, ob->rot);
v3d->viewquat[0]= -v3d->viewquat[0];
}
}
}
void add_object_draw(Scene *scene, View3D *v3d, int type) /* for toolbox or menus, only non-editmode stuff */
{
Object *ob;
@ -257,7 +289,7 @@ void add_object_draw(Scene *scene, View3D *v3d, int type) /* for toolbox or menu
// XXX if (obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* freedata, and undo */
ob= add_object(scene, type);
// ED_base_object_activate(C, BASACT);
base_init_from_view3d(BASACT, v3d, scene);
ED_object_base_init_from_view(scene, v3d, BASACT);
/* only undo pushes on objects without editmode... */
if(type==OB_EMPTY) BIF_undo_push("Add Empty");
@ -287,7 +319,7 @@ void add_objectLamp(Scene *scene, View3D *v3d, short type)
if(scene->obedit==NULL) { // XXX get from context
add_object_draw(scene, v3d, OB_LAMP);
base_init_from_view3d(BASACT, v3d, scene);
ED_object_base_init_from_view(scene, v3d, BASACT);
}
la = BASACT->object->data;
@ -584,7 +616,7 @@ static int return_editcurve_indexar(int *tot, int **indexar, float *cent)
return totvert;
}
static void apply_obmat(Object *ob)
void ED_object_apply_obmat(Object *ob)
{
float mat[3][3], imat[3][3], tmat[3][3];
@ -853,7 +885,7 @@ static void ignore_parent_tx(Scene *scene, Object *ob )
/* a change was made, adjust the children to compensate */
for (ob_child=G.main->object.first; ob_child; ob_child=ob_child->id.next) {
if (ob_child->parent == ob) {
apply_obmat(ob_child);
ED_object_apply_obmat(ob_child);
what_does_parent(scene, ob_child, &workob);
Mat4Invert(ob_child->parentinv, workob.obmat);
}
@ -991,7 +1023,7 @@ static int clear_parent_exec(bContext *C, wmOperator *op)
if(RNA_enum_is_equal(op->ptr, "type", "CLEAR_KEEP_TRANSFORM")) {
ob->parent= NULL;
ob->track= NULL;
apply_obmat(ob);
ED_object_apply_obmat(ob);
}
if(RNA_enum_is_equal(op->ptr, "type", "CLEAR_INVERSE")) {
Mat4One(ob->parentinv);
@ -1047,7 +1079,7 @@ static int object_clear_track_exec(bContext *C, wmOperator *op)
ob->recalc |= OB_RECALC;
if(RNA_enum_is_equal(op->ptr, "type", "CLEAR_KEEP_TRANSFORM")) {
apply_obmat(ob);
ED_object_apply_obmat(ob);
}
/*}*/
}
@ -1996,7 +2028,7 @@ static int make_parent_exec(bContext *C, wmOperator *op)
Object workob;
/* apply transformation of previous parenting */
apply_obmat(ob);
ED_object_apply_obmat(ob);
ob->parent= par;
@ -4831,7 +4863,7 @@ void make_object_duplilist_real(Scene *scene, View3D *v3d, Base *base)
ob->transflag &= ~OB_DUPLI;
Mat4CpyMat4(ob->obmat, dob->mat);
apply_obmat(ob);
ED_object_apply_obmat(ob);
}
copy_object_set_idnew(scene, v3d, 0);

@ -87,7 +87,6 @@
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "BIF_editarmature.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
@ -97,6 +96,7 @@
#include "RNA_access.h"
#include "ED_armature.h"
#include "ED_object.h"
#include "outliner_intern.h"

@ -66,10 +66,10 @@
#include "BKE_ipo.h"
#include "BKE_utildefines.h"
#include "BIF_editarmature.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "ED_armature.h"
#include "ED_keyframes_draw.h"
#include "WM_api.h"

@ -129,7 +129,6 @@ void view3d_project_float(ARegion *ar, float *vec, float *adr, float mat[4][4]);
int get_view3d_viewplane(View3D *v3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
short view3d_opengl_select(struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, rcti *input);
void initlocalview(Scene *scene, ARegion *ar, View3D *v3d);
void restore_localviewdata(View3D *vd);
void endlocalview(Scene *scene, ScrArea *sa);

@ -67,7 +67,6 @@
#include "BIF_gl.h"
#include "BIF_retopo.h"
#include "BIF_editarmature.h"
#include "WM_api.h"
#include "WM_types.h"
@ -75,6 +74,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
#include "ED_armature.h"
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_screen.h"
@ -784,11 +784,9 @@ static unsigned int samplerect(unsigned int *buf, int size, unsigned int dontdo)
/* ************************** mouse select ************************* */
#define MAXPICKBUF 10000
/* The max number of menu items in an object select menu */
#define SEL_MENU_SIZE 22
static void deselectall_except(Scene *scene, Base *b) /* deselect all except b */
{
Base *base;

@ -101,7 +101,6 @@
//#include "BIF_editview.h"
//#include "BIF_editlattice.h"
//#include "BIF_editconstraint.h"
#include "BIF_editarmature.h"
//#include "BIF_editmesh.h"
//#include "BIF_editnla.h"
//#include "BIF_editsima.h"
@ -117,6 +116,7 @@
//#include "BIF_space.h"
//#include "BIF_toolbox.h"
#include "ED_armature.h"
#include "ED_types.h"
#include "ED_anim_api.h"
#include "ED_keyframing.h"

@ -57,7 +57,6 @@
//#include "BIF_mywindow.h"
#include "BIF_gl.h"
//#include "BIF_editaction.h"
#include "BIF_editarmature.h"
//#include "BIF_editmesh.h"
//#include "BIF_editnla.h"
//#include "BIF_editsima.h"
@ -87,6 +86,7 @@
#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "ED_armature.h"
#include "ED_view3d.h"
#include "ED_mesh.h"

@ -49,11 +49,11 @@
#include "BLI_editVert.h"
//#include "BIF_editmesh.h"
#include "BIF_editarmature.h"
//#include "BIF_interface.h"
//#include "BIF_space.h"
//#include "BIF_toolbox.h"
#include "ED_armature.h"
#include "ED_mesh.h"
#include "transform.h"