diff options
author | Campbell Barton <ideasman42@gmail.com> | 2006-01-03 02:26:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2006-01-03 02:26:54 +0300 |
commit | 80f903ed73878c42b005069c2453c2737275a845 (patch) | |
tree | 43949e5d5cb873e9599eb7908cd73ecaf9534ec6 | |
parent | 8b0c3de7d9791646c09a002b14afc21d6b3da5ae (diff) |
Small commit, hopefully the last Duplicate change.
Made pythons duplicate not redraw, documented adduplicate()
-rw-r--r-- | source/blender/include/BDR_editobject.h | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Object.c | 2 | ||||
-rw-r--r-- | source/blender/src/editobject.c | 25 |
3 files changed, 21 insertions, 8 deletions
diff --git a/source/blender/include/BDR_editobject.h b/source/blender/include/BDR_editobject.h index 27c23b22ca3..a3f2a1061f1 100644 --- a/source/blender/include/BDR_editobject.h +++ b/source/blender/include/BDR_editobject.h @@ -92,7 +92,7 @@ void single_tex_users_expand(void); void single_mat_users_expand(void); void single_user(void); void make_local(void); -void adduplicate(int noTrans, int dupflag); /* when the dupflag is 0 no data is duplicated */ +void adduplicate(int mode, int dupflag); /* when the dupflag is 0 no data is duplicated */ void selectlinks_menu(void); void selectlinks(int nr); void image_aspect(void); diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index 5bcb12a5b8b..10d9370383a 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -848,7 +848,7 @@ static PyObject *M_Object_Duplicate( PyObject * self, PyObject * args, PyObject if (material_dupe) dupflag |= USER_DUP_MAT; if (texture_dupe) dupflag |= USER_DUP_TEX; if (ipo_dupe) dupflag |= USER_DUP_IPO; - adduplicate(1, dupflag); /* Duplicate the current selection, context sensitive */ + adduplicate(2, dupflag); /* 2 is a mode with no transform and no redraw, Duplicate the current selection, context sensitive */ Py_RETURN_NONE; } diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 8a3455b7111..6ba220e427f 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -4161,7 +4161,19 @@ static void adduplicate__forwardModifierLinks(void *userData, Object *ob, Object ID_NEW(*obpoin); } -void adduplicate(int noTrans, int dupflag) +/* This function duplicated the current visible selection, its used by Duplicate and Linked Duplicate +Alt+D/Shift+D as well as Pythons Object.Duplicate(), it takes +mode: + 0: Duplicate with transform, Redraw. + 1: Duplicate, no transform, Redraw + 2: Duplicate, no transform, no redraw (Only used by python) +if true the user will not be dropped into grab mode directly after and.. +dupflag: a flag made from constants declared in DNA_userdef_types.h + The flag tells adduplicate() weather to copy data linked to the object, or to reference the existing data. + U.dupflag for default operations or you can construct a flag as python does + if the dupflag is 0 then no data will be copied (linked duplicate) */ + +void adduplicate(int mode, int dupflag) { Base *base, *basen; Object *ob, *obn; @@ -4421,16 +4433,17 @@ void adduplicate(int noTrans, int dupflag) clear_id_newpoins(); countall(); - if(!noTrans) { + if(mode==0) { BIF_TransformSetUndo("Add Duplicate"); initTransform(TFM_TRANSLATION, CTX_NONE); Transform(); } set_active_base(BASACT); - - allqueue(REDRAWNLA, 0); - allqueue(REDRAWACTION, 0); /* also oops */ - allqueue(REDRAWIPO, 0); /* also oops */ + if(mode!=2) { /* mode of 2 is used by python to avoid unrequested redraws */ + allqueue(REDRAWNLA, 0); + allqueue(REDRAWACTION, 0); /* also oops */ + allqueue(REDRAWIPO, 0); /* also oops */ + } } void selectlinks_menu(void) |