Revision: 16519
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16519
Author:   aligorith
Date:     2008-09-14 14:41:42 +0200 (Sun, 14 Sep 2008)

Log Message:
-----------
== Global 'Delete Key' Tool ==

The 'opposite' of the "Insert Key" tool. 
- Use the hotkey Ctrl-Alt-IKEY to activate.
- Only available in 3d-view and buttons window 

I've added an extra var to verify_ipo and verify_ipocurve to save having to 
make another duplicate of that code. Hopefully the gameengine compiles ok with 
this.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/bad_level_call_stubs/stubs.c
    trunk/blender/source/blender/include/BSE_editipo.h
    trunk/blender/source/blender/python/api2_2x/Constraint.c
    trunk/blender/source/blender/python/api2_2x/Object.c
    trunk/blender/source/blender/src/buttons_object.c
    trunk/blender/source/blender/src/drawipo.c
    trunk/blender/source/blender/src/editaction.c
    trunk/blender/source/blender/src/editipo.c
    trunk/blender/source/blender/src/editkey.c
    trunk/blender/source/blender/src/keyframing.c
    trunk/blender/source/blender/src/toets.c
    trunk/blender/source/gameengine/Converter/KX_BlenderSceneConverter.cpp

Modified: trunk/blender/source/blender/blenkernel/bad_level_call_stubs/stubs.c
===================================================================
--- trunk/blender/source/blender/blenkernel/bad_level_call_stubs/stubs.c        
2008-09-14 09:09:10 UTC (rev 16518)
+++ trunk/blender/source/blender/blenkernel/bad_level_call_stubs/stubs.c        
2008-09-14 12:41:42 UTC (rev 16519)
@@ -60,7 +60,7 @@
 
 char *getIpoCurveName( struct IpoCurve * icu );
 void insert_vert_icu(struct IpoCurve *icu, float x, float y, short fast);
-struct IpoCurve *verify_ipocurve(struct ID *id, short a, char *b, char *d, int 
e);
+struct IpoCurve *verify_ipocurve(struct ID *id, short a, char *b, char *d, int 
e, short f);
 void elbeemDebugOut(char *msg);
 void fluidsimSettingsFree(struct FluidsimSettings* sb);
 void fluidsimSettingsCopy(struct FluidsimSettings* sb);
@@ -88,7 +88,7 @@
 }
 
 
-struct IpoCurve *verify_ipocurve(struct ID *id, short a, char *b, char *d, int 
e)
+struct IpoCurve *verify_ipocurve(struct ID *id, short a, char *b, char *d, int 
e, short f)
 {
        return 0;
 }

Modified: trunk/blender/source/blender/include/BSE_editipo.h
===================================================================
--- trunk/blender/source/blender/include/BSE_editipo.h  2008-09-14 09:09:10 UTC 
(rev 16518)
+++ trunk/blender/source/blender/include/BSE_editipo.h  2008-09-14 12:41:42 UTC 
(rev 16519)
@@ -86,8 +86,8 @@
 
 
 /* gets ipo curve, creates if needed */
-struct IpoCurve *verify_ipocurve(struct ID *, short, char *, char *, char *, 
int);
-struct Ipo *verify_ipo(struct ID *, short, char *, char *, char *);
+struct IpoCurve *verify_ipocurve(struct ID *, short, char *, char *, char *, 
int, short);
+struct Ipo *verify_ipo(struct ID *, short, char *, char *, char *, short);
 int texchannel_to_adrcode(int channel);
 
 

Modified: trunk/blender/source/blender/python/api2_2x/Constraint.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Constraint.c    2008-09-14 
09:09:10 UTC (rev 16518)
+++ trunk/blender/source/blender/python/api2_2x/Constraint.c    2008-09-14 
12:41:42 UTC (rev 16519)
@@ -442,7 +442,7 @@
                return EXPP_ReturnPyObjError( PyExc_RuntimeError,
                                "constraint doesn't belong to anything" );
        }
-       icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, NULL, 
CO_ENFORCE);
+       icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, NULL, 
CO_ENFORCE, 1);
        
        if (!icu)
                return EXPP_ReturnPyObjError( PyExc_RuntimeError,

Modified: trunk/blender/source/blender/python/api2_2x/Object.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Object.c        2008-09-14 
09:09:10 UTC (rev 16518)
+++ trunk/blender/source/blender/python/api2_2x/Object.c        2008-09-14 
12:41:42 UTC (rev 16519)
@@ -2735,7 +2735,7 @@
                                "expects bonename, constraintname, 
influenceval" );
        
        icu = verify_ipocurve((ID *)self->object, ID_CO, boneName, constName, 
NULL,
-                       CO_ENFORCE);
+                       CO_ENFORCE, 1);
        
        if (!icu)
                return EXPP_ReturnPyObjError( PyExc_RuntimeError,

Modified: trunk/blender/source/blender/src/buttons_object.c
===================================================================
--- trunk/blender/source/blender/src/buttons_object.c   2008-09-14 09:09:10 UTC 
(rev 16518)
+++ trunk/blender/source/blender/src/buttons_object.c   2008-09-14 12:41:42 UTC 
(rev 16519)
@@ -242,9 +242,9 @@
        
        /* adds ipo & channels & curve if needed */
        if(con->flag & CONSTRAINT_OWN_IPO)
-               verify_ipo((ID *)ob, ID_CO, NULL, con->name, actname);
+               verify_ipo((ID *)ob, ID_CO, NULL, con->name, actname, 1);
        else
-               verify_ipo((ID *)ob, ID_CO, actname, con->name, NULL);
+               verify_ipo((ID *)ob, ID_CO, actname, con->name, NULL, 1);
                
        /* make sure ipowin shows it */
        ob->ipowin= ID_CO;
@@ -269,9 +269,9 @@
 
        /* adds ipo & channels & curve if needed */
        if(con->flag & CONSTRAINT_OWN_IPO)
-               icu= verify_ipocurve((ID *)ob, ID_CO, NULL, con->name, actname, 
CO_ENFORCE);
+               icu= verify_ipocurve((ID *)ob, ID_CO, NULL, con->name, actname, 
CO_ENFORCE, 1);
        else
-               icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, NULL, 
CO_ENFORCE);
+               icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, NULL, 
CO_ENFORCE, 1);
                
        if (!icu) {
                error("Cannot get a curve from this IPO, may be dealing with 
linked data");

Modified: trunk/blender/source/blender/src/drawipo.c
===================================================================
--- trunk/blender/source/blender/src/drawipo.c  2008-09-14 09:09:10 UTC (rev 
16518)
+++ trunk/blender/source/blender/src/drawipo.c  2008-09-14 12:41:42 UTC (rev 
16519)
@@ -1952,7 +1952,7 @@
                ei= get_active_editipo();
                if(ei) {
                        if(ei->icu==NULL) {
-                               ei->icu= verify_ipocurve(G.sipo->from, 
G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, 
ei->adrcode);
+                               ei->icu= verify_ipocurve(G.sipo->from, 
G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, 
ei->adrcode, 1);
                                if (!ei->icu) {
                                        error("Could not add a driver to this 
curve, may be linked data!");
                                        break;

Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c       2008-09-14 09:09:10 UTC 
(rev 16518)
+++ trunk/blender/source/blender/src/editaction.c       2008-09-14 12:41:42 UTC 
(rev 16519)
@@ -2154,7 +2154,7 @@
                
                /* loop over curves, pasting keyframes */
                for (ico= ipo_src->curve.first; ico; ico= ico->next) {
-                       icu= verify_ipocurve((ID*)ob, ico->blocktype, actname, 
conname, "", ico->adrcode);
+                       icu= verify_ipocurve((ID*)ob, ico->blocktype, actname, 
conname, "", ico->adrcode, 1);
                        
                        if (icu) {
                                /* just start pasting, with the the first 
keyframe on the current frame, and so on */

Modified: trunk/blender/source/blender/src/editipo.c
===================================================================
--- trunk/blender/source/blender/src/editipo.c  2008-09-14 09:09:10 UTC (rev 
16518)
+++ trunk/blender/source/blender/src/editipo.c  2008-09-14 12:41:42 UTC (rev 
16519)
@@ -1777,113 +1777,129 @@
    - if bonename, the constname is the ipo to the constraint
 */
 
-/* note; check header_ipo.c, spaceipo_assign_ipo() too */
-Ipo *verify_ipo(ID *from, short blocktype, char *actname, char *constname, 
char *bonename)
+/* note: check header_ipo.c, spaceipo_assign_ipo() too */
+Ipo *verify_ipo(ID *from, short blocktype, char *actname, char *constname, 
char *bonename, short add)
 {
-
-       if(from==NULL || from->lib) return NULL;
+       /* lib-linked data is not appropriate here */
+       if ((from==NULL) || (from->lib))
+               return NULL;
        
        /* first check action ipos */
-       if(actname && actname[0]) {
+       if (actname && actname[0]) {
                Object *ob= (Object *)from;
                bActionChannel *achan;
                
-               if(GS(from->name)!=ID_OB) {
+               if (GS(from->name)!=ID_OB) {
                        printf("called ipo system for action with wrong base 
pointer\n");
                        return NULL;
                }
                
-               if(ob->action==NULL)
+               if ((ob->action==NULL) && (add))
                        ob->action= add_empty_action("Action");
                
-               achan= verify_action_channel(ob->action, actname);
+               if (add)
+                       achan= verify_action_channel(ob->action, actname);
+               else    
+                       achan= get_action_channel(ob->action, actname);
                
-               if(achan) {
+               if (achan) {
                        /* automatically assign achan to act-group based on 
pchan's grouping */
-                       if (blocktype == ID_PO)
+                       if ((blocktype == ID_PO) && (add))
                                verify_pchan2achan_grouping(ob->action, 
ob->pose, actname);
                        
                        /* constraint exception */
-                       if(blocktype==ID_CO) {
-                               bConstraintChannel *conchan= 
verify_constraint_channel(&achan->constraintChannels, constname);
-                               if(conchan->ipo==NULL) {
-                                       conchan->ipo= add_ipo("CoIpo", ID_CO);  
+                       if (blocktype==ID_CO) {
+                               bConstraintChannel *conchan;
+                               
+                               if (add)
+                                       conchan= 
verify_constraint_channel(&achan->constraintChannels, constname);
+                               else
+                                       conchan= 
get_constraint_channel(&achan->constraintChannels, constname);
+                                       
+                               if (conchan) {
+                                       if ((conchan->ipo==NULL) && (add))
+                                               conchan->ipo= add_ipo("CoIpo", 
ID_CO);  
+                                       return conchan->ipo;
                                }
-                               return conchan->ipo;
                        }
                        else {
-                               if(achan->ipo==NULL) {
+                               if ((achan->ipo==NULL) && (add))
                                        achan->ipo= add_ipo("ActIpo", 
blocktype);
-                               }
-                               
                                return achan->ipo;
                        }
                }
        }
        else {
-               
-               switch(GS(from->name)) {
+               switch (GS(from->name)) {
                case ID_OB:
                        {
                                Object *ob= (Object *)from;
                                
                                /* constraint exception */
-                               if(blocktype==ID_CO) {
+                               if (blocktype==ID_CO) {
                                        /* check the local constraint ipo */
-                                       if(bonename && bonename[0] && ob->pose) 
{
+                                       if (bonename && bonename[0] && 
ob->pose) {
                                                bPoseChannel *pchan= 
get_pose_channel(ob->pose, bonename);
                                                bConstraint *con;
-                                               for(con= 
pchan->constraints.first; con; con= con->next)
-                                                       if(strcmp(con->name, 
constname)==0)
+                                               
+                                               for (con= 
pchan->constraints.first; con; con= con->next) {
+                                                       if (strcmp(con->name, 
constname)==0)
                                                                break;
-                                               if(con) {
-                                                       if(con->ipo==NULL) {
+                                               }
+                                               
+                                               if (con) {
+                                                       if ((con->ipo==NULL) && 
(add))
                                                                con->ipo= 
add_ipo("CoIpo", ID_CO);
-                                                       }
                                                        return con->ipo;
                                                }
                                        }
                                        else { /* the actionchannel */
-                                               bConstraintChannel *conchan= 
verify_constraint_channel(&ob->constraintChannels, constname);
-                                               if(conchan->ipo==NULL) {
-                                                       conchan->ipo= 
add_ipo("CoIpo", ID_CO);  
+                                               bConstraintChannel *conchan;
+                                               
+                                               if (add)
+                                                       conchan= 
verify_constraint_channel(&ob->constraintChannels, constname);
+                                               else
+                                                       conchan= 
get_constraint_channel(&ob->constraintChannels, constname);
+                                                       
+                                               if (conchan) {
+                                                       if 
((conchan->ipo==NULL) && (add))
+                                                               conchan->ipo= 
add_ipo("CoIpo", ID_CO);  
+                                                       return conchan->ipo;
                                                }
-                                               return conchan->ipo;
                                        }
                                }
-                               else if(blocktype==ID_OB) {
-                                       if(ob->ipo==NULL) {
+                               else if (blocktype==ID_OB) {
+                                       if ((ob->ipo==NULL) && (add))
                                                ob->ipo= add_ipo("ObIpo", 
ID_OB);
-                                       }
                                        return ob->ipo;
                                }
-                               else if(blocktype==ID_KE) {
+                               else if (blocktype==ID_KE) {
                                        Key *key= ob_get_key((Object *)from);
                                        
-                                       if(key) {
-                                               if(key->ipo==NULL) {
+                                       if (key) {
+                                               if ((key->ipo==NULL) && (add))
                                                        key->ipo= 
add_ipo("KeyIpo", ID_KE);
-                                               }
                                                return key->ipo;
                                        }
                                        return NULL;
                                }
-                               else if(blocktype== ID_FLUIDSIM) {
+                               else if (blocktype== ID_FLUIDSIM) {

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to