2.5
authorTon Roosendaal <ton@blender.org>
Tue, 7 Jul 2009 17:30:39 +0000 (17:30 +0000)
committerTon Roosendaal <ton@blender.org>
Tue, 7 Jul 2009 17:30:39 +0000 (17:30 +0000)
- Scrollers now only disappear for regions with a fixed total view, like
  lists, buttons, channels. More or less infinite views keep scrollers to
  indicate that you can still pan or zoom further.

- Nodes: put back SHIFT+D "Add duplicate"
  (Also fixed duplicate objects menu name... it should be a bit more
  descriptive)

source/blender/editors/interface/view2d.c
source/blender/editors/object/object_edit.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_node/node_intern.h
source/blender/editors/space_node/node_ops.c

index 11714df0491b5d6f3960631d51e3be7459ee6460..fcac1987fdccddad30d5f17957408f9babc44efb 100644 (file)
@@ -1279,8 +1279,10 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
                if (scrollers->hor_min > scrollers->hor_max) 
                        scrollers->hor_min= scrollers->hor_max;
                
-               if(fac1 <= 0.0f && fac2 >= 1.0f) 
-                       scrollers->horfull= 1;
+               /* check whether sliders can disappear */
+               if(v2d->keeptot)
+                       if(fac1 <= 0.0f && fac2 >= 1.0f) 
+                               scrollers->horfull= 1;
        }
        
        /* vertical scrollers */
@@ -1304,8 +1306,10 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
                if (scrollers->vert_min > scrollers->vert_max) 
                        scrollers->vert_min= scrollers->vert_max;
                
-               if(fac1 <= 0.0f && fac2 >= 1.0f) 
-                       scrollers->vertfull= 1;
+               /* check whether sliders can disappear */
+               if(v2d->keeptot)
+                       if(fac1 <= 0.0f && fac2 >= 1.0f) 
+                               scrollers->vertfull= 1;
        }
        
        /* grid markings on scrollbars */
index c28200612ead37086cbaa6ded24700b6784bb434..af6cb887e71c6a424217e14123d64a9443b58b16 100644 (file)
@@ -6139,8 +6139,8 @@ void OBJECT_OT_duplicate_add(wmOperatorType *ot)
 {
        
        /* identifiers */
-       ot->name= "Add Duplicate";
-       ot->description = "Duplicate the object.";
+       ot->name= "Duplicate Objects";
+       ot->description = "Duplicate the objects.";
        ot->idname= "OBJECT_OT_duplicate_add";
        
        /* api callbacks */
index f7f637670b52a08f1834274af73c31d09399f51b..0d6fc20c24861aec0262f6a418e4b64eb41e1525 100644 (file)
@@ -63,6 +63,7 @@
 #include "ED_previewrender.h"
 
 #include "BIF_gl.h"
+#include "BIF_transform.h"
 
 #include "BLI_arithb.h"
 #include "BLI_blenlib.h"
@@ -1686,18 +1687,54 @@ void node_mute(SpaceNode *snode)
 
 }
 
-void node_adduplicate(SpaceNode *snode)
+#endif
+
+int node_duplicate_add_exec(bContext *C, wmOperator *op)
 {
+       SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
        
        ntreeCopyTree(snode->edittree, 1);      /* 1 == internally selected nodes */
        
        ntreeSolveOrder(snode->edittree);
        snode_verify_groups(snode);
-       // XXX                  snode_handle_recalc(snode);
+       snode_handle_recalc(C, snode);
+
+       return OPERATOR_FINISHED;
+}
+
+static int node_duplicate_add_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+       node_duplicate_add_exec(C, op);
+       
+       RNA_int_set(op->ptr, "mode", TFM_TRANSLATION);
+       WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
+       
+       return OPERATOR_FINISHED;
+}
 
-// XXX transform_nodes(snode->edittree, 'g', "Duplicate");
+void NODE_OT_duplicate_add(wmOperatorType *ot)
+{
+       
+       /* identifiers */
+       ot->name= "Duplicate Nodes";
+       ot->description = "Duplicate the nodes.";
+       ot->idname= "NODE_OT_duplicate_add";
+       
+       /* api callbacks */
+       ot->invoke= node_duplicate_add_invoke;
+       ot->exec= node_duplicate_add_exec;
+       
+       ot->poll= ED_operator_node_active;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       
+       /* to give to transform */
+       RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
 }
 
+#if 0
+
 static void node_insert_convertor(SpaceNode *snode, bNodeLink *link)
 {
        bNode *newnode= NULL;
index b73f57f935ffd05a734871e89c5d3802b79317e9..b16971dab9e38ba7475c999a6375adb83416bdbc 100644 (file)
@@ -82,6 +82,7 @@ void snode_composite_job(const struct bContext *C, ScrArea *sa);
 bNode *snode_get_editgroup(SpaceNode *snode);
 void snode_autoconnect(SpaceNode *snode, bNode *node_to, int flag);
 
+void NODE_OT_duplicate_add(struct wmOperatorType *ot);
 void NODE_OT_link(struct wmOperatorType *ot);
 void NODE_OT_delete(struct wmOperatorType *ot);
 void NODE_OT_resize(struct wmOperatorType *ot);
index 7a1cc24fa5819692dbc1d5edb92c87733039caea..732b45f1f304a36031472aef39ef22fd55863cac 100644 (file)
@@ -59,6 +59,8 @@ void node_operatortypes(void)
        WM_operatortype_append(NODE_OT_link);
        WM_operatortype_append(NODE_OT_resize);
        WM_operatortype_append(NODE_OT_links_cut);
+       WM_operatortype_append(NODE_OT_duplicate_add);
+       
 }
 
 void node_keymap(struct wmWindowManager *wm)
@@ -71,6 +73,8 @@ void node_keymap(struct wmWindowManager *wm)
        RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_select_extend", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
        RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_select_extend", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
        
+       WM_keymap_add_item(keymap, "NODE_OT_duplicate_add", DKEY, KM_PRESS, KM_SHIFT, 0);
+       
        WM_keymap_add_item(keymap, "NODE_OT_link", LEFTMOUSE, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "NODE_OT_resize", LEFTMOUSE, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "NODE_OT_visibility_toggle", LEFTMOUSE, KM_PRESS, 0, 0);