[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17971] branches/blender2.5/blender/source /blender/editors: 2.5

Ton Roosendaal ton at blender.org
Sat Dec 20 14:29:40 CET 2008


Revision: 17971
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17971
Author:   ton
Date:     2008-12-20 14:29:35 +0100 (Sat, 20 Dec 2008)

Log Message:
-----------
2.5

Put back armature drawing code.
The BIF_editarmature.h is a placeholder... need it to get it work.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/space_view3d/drawobject.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_intern.h

Added Paths:
-----------
    branches/blender2.5/blender/source/blender/editors/include/BIF_editarmature.h
    branches/blender2.5/blender/source/blender/editors/space_view3d/drawarmature.c

Added: branches/blender2.5/blender/source/blender/editors/include/BIF_editarmature.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/BIF_editarmature.h	                        (rev 0)
+++ branches/blender2.5/blender/source/blender/editors/include/BIF_editarmature.h	2008-12-20 13:29:35 UTC (rev 17971)
@@ -0,0 +1,178 @@
+/**
+ * $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
+
+
+

Copied: branches/blender2.5/blender/source/blender/editors/space_view3d/drawarmature.c (from rev 17970, trunk/blender/source/blender/src/drawarmature.c)
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_view3d/drawarmature.c	                        (rev 0)
+++ branches/blender2.5/blender/source/blender/editors/space_view3d/drawarmature.c	2008-12-20 13:29:35 UTC (rev 17971)
@@ -0,0 +1,2588 @@
+/**
+ * $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) 2005 by the Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "MEM_guardedalloc.h"
+
+#include "BMF_Api.h"
+
+#include "DNA_action_types.h"
+#include "DNA_armature_types.h"
+#include "DNA_constraint_types.h"
+#include "DNA_ID.h"
+#include "DNA_nla_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+#include "DNA_view3d_types.h"
+#include "DNA_userdef_types.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+
+#include "BKE_action.h"
+#include "BKE_armature.h"
+#include "BKE_constraint.h"
+#include "BKE_context.h"
+#include "BKE_depsgraph.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
+#include "BKE_object.h"
+#include "BKE_ipo.h"
+#include "BKE_utildefines.h"
+
+#include "BIF_editarmature.h"
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "UI_resources.h"
+
+#include "view3d_intern.h"
+
+/* XXX ***************** */
+int pose_channel_in_IK_chain() {return 0;}
+void ipo_to_keylist() {}
+void *ob_get_action() {return NULL;}
+void action_to_keylist() {}
+
+typedef struct ActKeyColumn {
+	struct ActKeyColumn *next, *prev;
+	short sel, handle_type;
+	float cfra;
+	
+	/* only while drawing - used to determine if long-keyframe needs to be drawn */
+	short modified;
+	short totcurve;
+} ActKeyColumn;
+typedef struct ActKeysInc {
+	struct Object *ob;				/* if present, used to find action-scaled time */
+	float start, end;				/* frames (global-time) to only consider keys between */
+} ActKeysInc;
+
+/* ******************** */
+
+
+/* *************** Armature Drawing - Coloring API ***************************** */
+
+/* global here is reset before drawing each bone */
+static ThemeWireColor *bcolor= NULL;
+
+/* values of colCode for set_pchan_glcolor */
+enum {
+	PCHAN_COLOR_NORMAL	= 0, 		/* normal drawing */
+	PCHAN_COLOR_SOLID,				/* specific case where "solid" color is needed */
+	PCHAN_COLOR_CONSTS,				/* "constraint" colors (which may/may-not be suppressed) */
+	
+	PCHAN_COLOR_SPHEREBONE_BASE,	/* for the 'stick' of sphere (envelope) bones */
+	PCHAN_COLOR_SPHEREBONE_END,		/* for the ends of sphere (envelope) bones */
+	PCHAN_COLOR_LINEBONE			/* for the middle of line-bones */
+};	
+
+/* This function sets the color-set for coloring a certain bone */
+static void set_pchan_colorset (Object *ob, bPoseChannel *pchan)
+{
+	bPose *pose= (ob) ? ob->pose : NULL;
+	bArmature *arm= (ob) ? ob->data : NULL;
+	bActionGroup *grp= NULL;
+	short color_index= 0;
+	

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list