[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22376] branches/blender2.5/blender/source /blender/editors/animation/anim_channels_defines.c: SVN maintenance.
gsr b3d
gsr.b3d at infernal-iceberg.com
Tue Aug 11 19:51:45 CEST 2009
Revision: 22376
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22376
Author: gsrb3d
Date: 2009-08-11 19:51:45 +0200 (Tue, 11 Aug 2009)
Log Message:
-----------
SVN maintenance.
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/animation/anim_channels_defines.c
Property Changed:
----------------
branches/blender2.5/blender/source/blender/editors/animation/anim_channels_defines.c
Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_channels_defines.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_channels_defines.c 2009-08-11 17:44:58 UTC (rev 22375)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_channels_defines.c 2009-08-11 17:51:45 UTC (rev 22376)
@@ -1,1946 +1,1946 @@
-/**
- * $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, Joshua Leung
- * All rights reserved.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <float.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "DNA_listBase.h"
-#include "DNA_anim_types.h"
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_object_types.h"
-#include "DNA_particle_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_space_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_material_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_gpencil_types.h"
-#include "DNA_windowmanager_types.h"
-#include "DNA_world_types.h"
-
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "BKE_animsys.h"
-#include "BKE_action.h"
-#include "BKE_depsgraph.h"
-#include "BKE_fcurve.h"
-#include "BKE_key.h"
-#include "BKE_material.h"
-#include "BKE_object.h"
-#include "BKE_context.h"
-#include "BKE_utildefines.h"
-
-#include "UI_interface.h"
-#include "UI_interface_icons.h"
-#include "UI_resources.h"
-#include "UI_view2d.h"
-
-#include "ED_anim_api.h"
-#include "ED_keyframes_edit.h" // XXX move the select modes out of there!
-#include "ED_screen.h"
-#include "ED_space_api.h"
-
-#include "BIF_gl.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-/* *********************************************** */
-// XXX constant defines to be moved elsewhere?
-
-/* extra padding for lengths (to go under scrollers) */
-#define EXTRA_SCROLL_PAD 100.0f
-
-/* size of indent steps */
-#define INDENT_STEP_SIZE 7
-
-/* macros used for type defines */
- /* get the pointer used for some flag */
-#define GET_ACF_FLAG_PTR(ptr) \
- { \
- *type= sizeof((ptr)); \
- return &(ptr); \
- }
-
-
-/* XXX */
-extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad);
-extern void gl_round_box_shade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown);
-
-
-/* *********************************************** */
-/* Generic Functions (Type independent) */
-
-/* Draw Backdrop ---------------------------------- */
-
-/* backdrop for top-level widgets (Scene and Object only) */
-static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
-{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
- View2D *v2d= &ac->ar->v2d;
- short expanded= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
- short offset= (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
-
- /* darker blue for top-level widgets */
- UI_ThemeColor(TH_DOPESHEET_CHANNELOB);
-
- /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
- uiSetRoundBox((expanded)? (1):(1|8));
- gl_round_box(GL_POLYGON, offset, yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc, 8);
-}
-
-/* backdrop for data expanders under top-level Scene/Object */
-static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
-{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
- View2D *v2d= &ac->ar->v2d;
- short offset= (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
-
- /* lighter color than top-level widget */
- UI_ThemeColor(TH_DOPESHEET_CHANNELSUBOB);
-
- /* no rounded corner - just rectangular box */
- glRectf(offset, yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc);
-}
-
-/* backdrop for generic channels */
-static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
-{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
- View2D *v2d= &ac->ar->v2d;
- SpaceAction *saction = NULL;
- bActionGroup *grp = NULL;
- short indent= (acf->get_indent_level) ? acf->get_indent_level(ac, ale) : 0;
- short offset= (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
-
- /* get context info needed... */
- if ((ac->sa) && (ac->sa->spacetype == SPACE_ACTION))
- saction= (SpaceAction *)ac->sa->spacedata.first;
-
- if (ale->type == ANIMTYPE_FCURVE) {
- FCurve *fcu= (FCurve *)ale->data;
- grp= fcu->grp;
- }
-
- /* set color for normal channels
- * - use 3 shades of color group/standard color for 3 indention level
- * - only use group colors if allowed to, and if actually feasible
- */
- if ( (saction && !(saction->flag & SACTION_NODRAWGCOLORS)) &&
- ((grp) && (grp->customCol)) )
- {
- char cp[3];
-
- if (indent == 2) {
- VECCOPY(cp, grp->cs.solid);
- }
- else if (indent == 1) {
- VECCOPY(cp, grp->cs.select);
- }
- else {
- VECCOPY(cp, grp->cs.active);
- }
-
- glColor3ub(cp[0], cp[1], cp[2]);
- }
- else // FIXME: what happens when the indention is 1 greater than what it should be (due to grouping)?
- UI_ThemeColorShade(TH_HEADER, ((indent==0)?20: (indent==1)?-20: -40));
-
- /* no rounded corners - just rectangular box */
- glRectf(offset, yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc);
-}
-
-/* Indention + Offset ------------------------------------------- */
-
-/* indention level is always the value in the name */
-static short acf_generic_indention_0(bAnimContext *ac, bAnimListElem *ale)
-{
- return 0;
-}
-static short acf_generic_indention_1(bAnimContext *ac, bAnimListElem *ale)
-{
- return 1;
-}
-#if 0 // XXX not used
-static short acf_generic_indention_2(bAnimContext *ac, bAnimListElem *ale)
-{
- return 2;
-}
-#endif
-
-/* indention which varies with the grouping status */
-static short acf_generic_indention_flexible(bAnimContext *ac, bAnimListElem *ale)
-{
- short indent= 0;
-
- if (ale->id) {
- /* special exception for materials and particles */
- if (ELEM(GS(ale->id->name),ID_MA,ID_PA))
- indent++;
- }
-
- /* grouped F-Curves need extra level of indention */
- if (ale->type == ANIMTYPE_FCURVE) {
- FCurve *fcu= (FCurve *)ale->data;
-
- // TODO: we need some way of specifying that the indention color should be one less...
- if (fcu->grp)
- indent++;
- }
-
- /* no indention */
- return indent;
-}
-
-/* basic offset for channels derived from indention */
-static short acf_generic_basic_offset(bAnimContext *ac, bAnimListElem *ale)
-{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
-
- if (acf && acf->get_indent_level)
- return acf->get_indent_level(ac, ale) * INDENT_STEP_SIZE;
- else
- return 0;
-}
-
-/* offset for groups + grouped entities */
-static short acf_generic_group_offset(bAnimContext *ac, bAnimListElem *ale)
-{
- short offset= acf_generic_basic_offset(ac, ale);
-
- if (ale->id) {
- /* special exception for materials and particles */
- if (ELEM(GS(ale->id->name),ID_MA,ID_PA))
- offset += 21;
-
- /* if not in Action Editor mode, groupings must carry some offset too... */
- else if (ac->datatype != ANIMCONT_ACTION)
- offset += 14;
- }
-
- /* offset is just the normal type - i.e. based on indention */
- return offset;
-}
-
-/* Name ------------------------------------------- */
-
-/* name for ID block entries */
-static void acf_generic_idblock_name(bAnimListElem *ale, char *name)
-{
- ID *id= (ID *)ale->data; /* data pointed to should be an ID block */
-
- /* just copy the name... */
- if (id && name)
- sprintf(name, id->name+2);
-}
-
-/* Settings ------------------------------------------- */
-
-/* check if some setting exists for this object-based data-expander (category only) */
-static short acf_generic_dsexpand_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
-{
- switch (setting) {
- /* only expand supported */
- case ACHANNEL_SETTING_EXPAND:
- return 1;
-
- default:
- return 0;
- }
-}
-
-/* get pointer to the setting (category only) */
-static void *acf_generic_dsexpand_setting_ptr(bAnimListElem *ale, int setting, short *type)
-{
- Object *ob= (Object *)ale->data;
-
- /* clear extra return data first */
- *type= 0;
-
- switch (setting) {
- case ACHANNEL_SETTING_EXPAND: /* expanded */
- GET_ACF_FLAG_PTR(ob->nlaflag); // XXX
-
- default: /* unsupported */
- return NULL;
- }
-}
-
-/* check if some setting exists for this object-based data-expander (datablock only) */
-static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
-{
- switch (setting) {
- /* expand is always supported */
- case ACHANNEL_SETTING_EXPAND:
- return 1;
-
- /* mute is only supported for NLA */
- case ACHANNEL_SETTING_MUTE:
- return ((ac) && (ac->spacetype == SPACE_NLA));
-
- /* other flags are never supported */
- default:
- return 0;
- }
-}
-
-/* *********************************************** */
-/* Type Specific Functions + Defines */
-
-/* Scene ------------------------------------------- */
-
-// TODO: just get this from RNA?
-static int acf_scene_icon(bAnimListElem *ale)
-{
- return ICON_SCENE_DATA;
-}
-
-/* check if some setting exists for this channel */
-static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
-{
- switch (setting) {
- /* muted only in NLA */
- case ACHANNEL_SETTING_MUTE:
- return ((ac) && (ac->spacetype == SPACE_NLA));
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list