[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18542] branches/blender2.5/blender/source /blender: RNA

Brecht Van Lommel brecht at blender.org
Sat Jan 17 00:53:15 CET 2009


Revision: 18542
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18542
Author:   blendix
Date:     2009-01-17 00:53:11 +0100 (Sat, 17 Jan 2009)

Log Message:
-----------
RNA
* Added more compact property definitions, with a single function.
  Only used by operators at the moment, would need to tweak regular
  expressions a bit more to use it also for other RNA definitions.

* The operator properties defined now were completed a bit more but
  still have many issues that need to be adressed, specifically;

  * Some properties that should be booleans or enums are defined as
    ints, note that ints are only for numeric values, not bitflags
	or multiple choice.
  * Soft/hard limits and default values of many properties are not
    well defined still,
  * Inconsistent naming, especially for example mouse locations or
    bounds are named differently in different places. Also mouse
	locations and other vector like properties should become a single
	vector property instead of multiple X/Y properties.
  * Almost no properties have descriptions, these would be good to
    have for docs and tooltips.

So, please verify that the properties of the operators you wrote are
well defined.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_ipo_utils.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_markers.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_ops.c
    branches/blender2.5/blender/source/blender/editors/animation/keyframes_draw.c
    branches/blender2.5/blender/source/blender/editors/animation/keyframes_edit.c
    branches/blender2.5/blender/source/blender/editors/animation/keyframes_general.c
    branches/blender2.5/blender/source/blender/editors/animation/keyframing.c
    branches/blender2.5/blender/source/blender/editors/interface/view2d_ops.c
    branches/blender2.5/blender/source/blender/editors/mesh/editmesh_add.c
    branches/blender2.5/blender/source/blender/editors/mesh/editmesh_mods.c
    branches/blender2.5/blender/source/blender/editors/mesh/editmesh_tools.c
    branches/blender2.5/blender/source/blender/editors/object/object_edit.c
    branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c
    branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_edit.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_ops.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_select.c
    branches/blender2.5/blender/source/blender/editors/space_image/image_ops.c
    branches/blender2.5/blender/source/blender/editors/space_ipo/ipo_draw.c
    branches/blender2.5/blender/source/blender/editors/space_node/node_select.c
    branches/blender2.5/blender/source/blender/editors/space_node/node_state.c
    branches/blender2.5/blender/source/blender/editors/space_script/script_edit.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_edit.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_select.c
    branches/blender2.5/blender/source/blender/editors/transform/transform_ops.c
    branches/blender2.5/blender/source/blender/editors/uvedit/uvedit_ops.c
    branches/blender2.5/blender/source/blender/makesrna/RNA_define.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c

Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c	2009-01-16 20:24:31 UTC (rev 18541)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c	2009-01-16 23:53:11 UTC (rev 18542)
@@ -1,1542 +1,1511 @@
-/**
- * $Id: editaction.c 17746 2008-12-08 11:19:44Z aligorith $
- *
- * ***** 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): 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_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_object_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_userdef_types.h"
-#include "DNA_gpencil_types.h"
-#include "DNA_windowmanager_types.h"
-
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "BKE_action.h"
-#include "BKE_depsgraph.h"
-#include "BKE_ipo.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_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 "WM_api.h"
-#include "WM_types.h"
-
-/* ************************************************************************** */
-/* CHANNELS API */
-
-/* -------------------------- Internal Macros ------------------------------- */
-
-/* set/clear/toggle macro 
- *	- channel - channel with a 'flag' member that we're setting
- *	- smode - 0=clear, 1=set, 2=toggle
- *	- sflag - bitflag to set
- */
-#define ACHANNEL_SET_FLAG(channel, smode, sflag) \
-	{ \
-		if (smode == ACHANNEL_SETFLAG_TOGGLE) 	(channel)->flag ^= (sflag); \
-		else if (smode == ACHANNEL_SETFLAG_ADD) (channel)->flag |= (sflag); \
-		else 									(channel)->flag &= ~(sflag); \
-	}
-
-/* -------------------------- Internal Tools -------------------------------- */
-
-/* set the given Action Channel to be the 'active' one in its Action */
-static void action_set_active_achan (bAction *act, bActionChannel *achan)
-{
-	bActionChannel *chan;
-	
-	/* sanity check */
-	if (act == NULL)
-		return;
-	
-	/* clear active flag on all others */
-	for (chan= act->chanbase.first; chan; chan= chan->next)
-		chan->flag &= ~ACHAN_HILIGHTED;
-		
-	/* set the given Action Channel to be the active one */
-	if (achan)
-		achan->flag |= ACHAN_HILIGHTED;
-}
-
-/* set the given Action Group to be the 'active' one in its Action */
-static void action_set_active_agrp (bAction *act, bActionGroup *agrp)
-{
-	bActionGroup *grp;
-	
-	/* sanity check */
-	if (act == NULL)
-		return;
-		
-	/* clear active flag on all others */
-	for (grp= act->groups.first; grp; grp= grp->next)
-		grp->flag &= ~AGRP_ACTIVE;
-		
-	/* set the given group to be the active one */
-	if (agrp)
-		agrp->flag |= AGRP_ACTIVE;
-}
-
-/* -------------------------- Exposed API ----------------------------------- */
-
-/* Set the given ActionChannel or ActionGroup as the active one in the given action
- *	- data: should be bAction...
- *	- datatype: should be ANIMCONT_ACTION 
- *	- channel_data: bActionChannel or bActionGroup
- *	- channel_type: eAnim_ChannelType
- */
-void ANIM_action_set_active_channel (void *data, short datatype, void *channel_data, short channel_type)
-{
-	/* sanity checks */
-	if ((data == NULL) || (datatype != ANIMCONT_ACTION))
-		return;
-		
-	switch (channel_type) {
-		case ANIMTYPE_ACHAN:
-			action_set_active_achan((bAction *)data, (bActionChannel *)channel_data);
-			break;
-		case ANIMTYPE_GROUP:
-			action_set_active_agrp((bAction *)data, (bActionGroup *)channel_data);
-			break;
-	}
-}
-
-/* Deselect all animation channels 
- *	- data: pointer to datatype, as contained in bAnimContext
- *	- datatype: the type of data that 'data' represents (eAnimCont_Types)
- *	- test: check if deselecting instead of selecting
- *	- sel: eAnimChannels_SetFlag;
- */
-void ANIM_deselect_anim_channels (void *data, short datatype, short test, short sel)
-{
-	ListBase anim_data = {NULL, NULL};
-	bAnimListElem *ale;
-	int filter;
-	
-	/* filter data */
-	filter= ANIMFILTER_VISIBLE;
-	ANIM_animdata_filter(&anim_data, filter, data, datatype);
-	
-	/* See if we should be selecting or deselecting */
-	if (test) {
-		for (ale= anim_data.first; ale; ale= ale->next) {
-			if (sel == 0) 
-				break;
-			
-			switch (ale->type) {
-				case ANIMTYPE_OBJECT:
-					if (ale->flag & SELECT)
-						sel= ACHANNEL_SETFLAG_CLEAR;
-					break;
-				case ANIMTYPE_FILLACTD:
-					if (ale->flag & ACTC_SELECTED)
-						sel= ACHANNEL_SETFLAG_CLEAR;
-					break;
-				case ANIMTYPE_GROUP:
-					if (ale->flag & AGRP_SELECTED)
-						sel= ACHANNEL_SETFLAG_CLEAR;
-					break;
-				case ANIMTYPE_ACHAN:
-					if (ale->flag & ACHAN_SELECTED) 
-						sel= ACHANNEL_SETFLAG_CLEAR;
-					break;
-				case ANIMTYPE_CONCHAN:
-					if (ale->flag & CONSTRAINT_CHANNEL_SELECT) 
-						sel= ACHANNEL_SETFLAG_CLEAR;
-					break;
-				case ANIMTYPE_ICU:
-					if (ale->flag & IPO_SELECT)
-						sel= ACHANNEL_SETFLAG_CLEAR;
-					break;
-			}
-		}
-	}
-		
-	/* Now set the flags */
-	for (ale= anim_data.first; ale; ale= ale->next) {
-		switch (ale->type) {
-			case ANIMTYPE_OBJECT:
-			{
-				Base *base= (Base *)ale->data;
-				Object *ob= base->object;
-				
-				ACHANNEL_SET_FLAG(base, sel, SELECT);
-				ACHANNEL_SET_FLAG(ob, sel, SELECT);
-			}
-				break;
-			case ANIMTYPE_FILLACTD:
-			{
-				bAction *act= (bAction *)ale->data;
-				
-				ACHANNEL_SET_FLAG(act, sel, ACTC_SELECTED);
-			}
-				break;
-			case ANIMTYPE_GROUP:
-			{
-				bActionGroup *agrp= (bActionGroup *)ale->data;
-				
-				ACHANNEL_SET_FLAG(agrp, sel, AGRP_SELECTED);
-				agrp->flag &= ~AGRP_ACTIVE;
-			}
-				break;
-			case ANIMTYPE_ACHAN:
-			{
-				bActionChannel *achan= (bActionChannel *)ale->data;
-				
-				ACHANNEL_SET_FLAG(achan, sel, ACHAN_SELECTED);
-				
-				//select_poseelement_by_name(achan->name, sel); // XXX
-				achan->flag &= ~ACHAN_HILIGHTED;
-			}
-				break;
-			case ANIMTYPE_CONCHAN:
-			{
-				bConstraintChannel *conchan= (bConstraintChannel *)ale->data;
-				
-				ACHANNEL_SET_FLAG(conchan, sel, CONSTRAINT_CHANNEL_SELECT);
-			}
-				break;
-			case ANIMTYPE_ICU:
-			{
-				IpoCurve *icu= (IpoCurve *)ale->data;
-				
-				ACHANNEL_SET_FLAG(icu, sel, IPO_SELECT);
-				icu->flag &= ~IPO_ACTIVE;
-			}
-				break;
-		}
-	}
-	
-	/* Cleanup */
-	BLI_freelistN(&anim_data);
-}
-
-/* ************************************************************************** */
-/* OPERATORS */
-
-/* ****************** Rearrange Channels Operator ******************* */
-/* This operator only works for Action Editor mode for now, as having it elsewhere makes things difficult */
-
-/* constants for channel rearranging */
-/* WARNING: don't change exising ones without modifying rearrange func accordingly */
-enum {
-	REARRANGE_ACTCHAN_TOP= -2,
-	REARRANGE_ACTCHAN_UP= -1,
-	REARRANGE_ACTCHAN_DOWN= 1,
-	REARRANGE_ACTCHAN_BOTTOM= 2
-};
-
-/* make sure all action-channels belong to a group (and clear action's list) */
-static void split_groups_action_temp (bAction *act, bActionGroup *tgrp)
-{
-	bActionChannel *achan;
-	bActionGroup *agrp;
-	
-	/* Separate action-channels into lists per group */
-	for (agrp= act->groups.first; agrp; agrp= agrp->next) {
-		if (agrp->channels.first) {
-			achan= agrp->channels.last;
-			act->chanbase.first= achan->next;
-			
-			achan= agrp->channels.first;
-			achan->prev= NULL;
-			
-			achan= agrp->channels.last;
-			achan->next= NULL;
-		}
-	}
-	
-	/* Initialise memory for temp-group */
-	memset(tgrp, 0, sizeof(bActionGroup));
-	tgrp->flag |= (AGRP_EXPANDED|AGRP_TEMP);
-	strcpy(tgrp->name, "#TempGroup");
-		
-	/* Move any action-channels not already moved, to the temp group */
-	if (act->chanbase.first) {
-		/* start of list */
-		achan= act->chanbase.first;
-		achan->prev= NULL;
-		tgrp->channels.first= achan;
-		act->chanbase.first= NULL;
-		
-		/* end of list */
-		achan= act->chanbase.last;
-		achan->next= NULL;
-		tgrp->channels.last= achan;
-		act->chanbase.last= NULL;
-	}
-	
-	/* Add temp-group to list */
-	BLI_addtail(&act->groups, tgrp);
-}
-
-/* link lists of channels that groups have */
-static void join_groups_action_temp (bAction *act)
-{
-	bActionGroup *agrp;
-	bActionChannel *achan;
-	
-	for (agrp= act->groups.first; agrp; agrp= agrp->next) {
-		ListBase tempGroup;
-		
-		/* add list of channels to action's channels */
-		tempGroup= agrp->channels;
-		addlisttolist(&act->chanbase, &agrp->channels);
-		agrp->channels= tempGroup;
-		
-		/* clear moved flag */
-		agrp->flag &= ~AGRP_MOVED;
-		
-		/* if temp-group... remove from list (but don't free as it's on the stack!) */
-		if (agrp->flag & AGRP_TEMP) {
-			BLI_remlink(&act->groups, agrp);
-			break;
-		}
-	}
-	
-	/* clear "moved" flag from all achans */
-	for (achan= act->chanbase.first; achan; achan= achan->next) 
-		achan->flag &= ~ACHAN_MOVED;
-}
-
-
-static short rearrange_actchannel_is_ok (Link *channel, short type)
-{
-	if (type == ANIMTYPE_GROUP) {
-		bActionGroup *agrp= (bActionGroup *)channel;
-		

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list