Revision: 23266
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23266
Author:   campbellbarton
Date:     2009-09-16 03:15:30 +0200 (Wed, 16 Sep 2009)

Log Message:
-----------
Object mode Selection options brought back for view3d.select
- 'center', while Ctrl is held select objects from their center location
- 'enumerate', while Alt is held, give a list of objects under the mouse
- Object selection menu now uses icons with names
- operator object.select_name(name, extend=False)
- keybindings so combinations of Ctrl/Alt/Shift can be used (like in 2.4x)
- logic text input field was using deprecated ID_SCRIPT rather then ID_TXT

details
- added comments to DNA_ID.h ID types
- removed unused ID types Sector and Life
- added uiIconFromID() to get an icon from the object.
- using name for selection is weak but currently there isnt a really good way 
to do this.

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readblenentry.c
    trunk/blender/source/blender/editors/include/UI_interface.h
    trunk/blender/source/blender/editors/interface/interface_utils.c
    trunk/blender/source/blender/editors/object/object_intern.h
    trunk/blender/source/blender/editors/object/object_ops.c
    trunk/blender/source/blender/editors/object/object_select.c
    trunk/blender/source/blender/editors/space_logic/logic_window.c
    trunk/blender/source/blender/editors/space_view3d/view3d_ops.c
    trunk/blender/source/blender/editors/space_view3d/view3d_select.c
    trunk/blender/source/blender/makesdna/DNA_ID.h

Modified: trunk/blender/source/blender/blenloader/intern/readblenentry.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readblenentry.c      
2009-09-16 00:59:55 UTC (rev 23265)
+++ trunk/blender/source/blender/blenloader/intern/readblenentry.c      
2009-09-16 01:15:30 UTC (rev 23266)
@@ -99,7 +99,6 @@
        { ID_IP,                "Ipo",          IDTYPE_FLAGS_ISLINKABLE}, 
        { ID_KE,                "Key",          0}, 
        { ID_LA,                "Lamp",         IDTYPE_FLAGS_ISLINKABLE}, 
-       { ID_LF,                "Life",         0}, 
        { ID_LI,                "Library",      0}, 
        { ID_LT,                "Lattice",      IDTYPE_FLAGS_ISLINKABLE}, 
        { ID_MA,                "Material", IDTYPE_FLAGS_ISLINKABLE}, 
@@ -110,7 +109,6 @@
        { ID_SCE,               "Scene",        IDTYPE_FLAGS_ISLINKABLE}, 
        { ID_SCR,               "Screen",       0}, 
        { ID_SEQ,               "Sequence",     0}, 
-       { ID_SE,                "Sector",       0}, 
        { ID_SO,                "Sound",        IDTYPE_FLAGS_ISLINKABLE}, 
        { ID_TE,                "Texture",      IDTYPE_FLAGS_ISLINKABLE}, 
        { ID_TXT,               "Text",         IDTYPE_FLAGS_ISLINKABLE}, 

Modified: trunk/blender/source/blender/editors/include/UI_interface.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_interface.h 2009-09-16 
00:59:55 UTC (rev 23265)
+++ trunk/blender/source/blender/editors/include/UI_interface.h 2009-09-16 
01:15:30 UTC (rev 23266)
@@ -420,6 +420,8 @@
                                                short x1, short y1, short x2, 
short y2, void *idpp, char *tip);
 int uiDefIDPoinButs(uiBlock *block, struct Main *main, struct ID *parid, 
struct ID *id, int id_code, short *pin_p, int x, int y, uiIDPoinFunc func, int 
events);
 
+int uiIconFromID(struct ID *id);
+
 uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, 
char *str, short x1, short y1, short x2, short y2, char *tip);
 uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, char 
*str, short x1, short y1, short x2, short y2, char *tip);
 uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, 
int icon, char *str, short x1, short y1, short x2, short y2, char *tip);

Modified: trunk/blender/source/blender/editors/interface/interface_utils.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_utils.c    
2009-09-16 00:59:55 UTC (rev 23265)
+++ trunk/blender/source/blender/editors/interface/interface_utils.c    
2009-09-16 01:15:30 UTC (rev 23266)
@@ -33,6 +33,7 @@
 #include "DNA_color_types.h"
 #include "DNA_listBase.h"
 #include "DNA_material_types.h"
+#include "DNA_lamp_types.h""
 #include "DNA_object_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_texture_types.h"
@@ -509,6 +510,64 @@
        return x;
 }
 
+/* currently only object-data types */
+int uiIconFromID(ID *id)
+{
+       if (id==NULL)
+               return 0;
+
+       switch(GS(id->name)) {
+               case ID_OB:
+               {
+                       Object *ob= (Object *)id;
+
+                       switch(ob->type) {
+                               case OB_EMPTY:
+                                       return ICON_EMPTY_DATA;
+                               case OB_CURVE:
+                                       return ICON_CURVE_DATA;
+                               case OB_SURF:
+                                       return ICON_SURFACE_DATA;
+                               case OB_FONT:
+                                       return ICON_FONT_DATA;
+                       }
+
+                       return uiIconFromID(ob->data);
+               }
+               case ID_ME:
+                       return ICON_MESH_DATA;
+               case ID_AR:
+                       return ICON_ARMATURE_DATA;
+               case ID_MB:
+                       return ICON_META_DATA;
+               case ID_CA:
+                       return ICON_CAMERA_DATA;
+               case ID_LT:
+                       return ICON_LATTICE_DATA;
+               case ID_CU:
+                       return ICON_CURVE_DATA;
+               case ID_LA:
+               {
+                       Lamp *la= (Lamp *)id;
+                       switch(la->type) {
+                       case LA_LOCAL:
+                               return ICON_LAMP_POINT;
+                       case LA_SUN:
+                               return ICON_LAMP_SUN;
+                       case LA_SPOT:
+                               return ICON_LAMP_SPOT;
+                       case LA_HEMI:
+                               return ICON_LAMP_HEMI;
+                       case LA_AREA:
+                               return ICON_LAMP_AREA;
+                       }
+                       return ICON_LAMP_DATA;
+               }
+       }
+
+       return 0;
+}
+
 /* ****************************** default button callbacks ******************* 
*/
 /* ************ LEGACY WARNING, only to get things work with 2.48 code! ****** 
*/
 

Modified: trunk/blender/source/blender/editors/object/object_intern.h
===================================================================
--- trunk/blender/source/blender/editors/object/object_intern.h 2009-09-16 
00:59:55 UTC (rev 23265)
+++ trunk/blender/source/blender/editors/object/object_intern.h 2009-09-16 
01:15:30 UTC (rev 23266)
@@ -79,6 +79,7 @@
 void OBJECT_OT_select_linked(struct wmOperatorType *ot);
 void OBJECT_OT_select_grouped(struct wmOperatorType *ot);
 void OBJECT_OT_select_mirror(struct wmOperatorType *ot);
+void OBJECT_OT_select_name(struct wmOperatorType *ot);
 
 /* object_add.c */
 void OBJECT_OT_add(struct wmOperatorType *ot);

Modified: trunk/blender/source/blender/editors/object/object_ops.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_ops.c    2009-09-16 
00:59:55 UTC (rev 23265)
+++ trunk/blender/source/blender/editors/object/object_ops.c    2009-09-16 
01:15:30 UTC (rev 23266)
@@ -102,6 +102,7 @@
        WM_operatortype_append(OBJECT_OT_select_linked);
        WM_operatortype_append(OBJECT_OT_select_grouped);
        WM_operatortype_append(OBJECT_OT_select_mirror);
+       WM_operatortype_append(OBJECT_OT_select_name); /* XXX - weak, not 
compat with linked objects */
 
        WM_operatortype_append(GROUP_OT_group_create);
        WM_operatortype_append(GROUP_OT_objects_remove);

Modified: trunk/blender/source/blender/editors/object/object_select.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_select.c 2009-09-16 
00:59:55 UTC (rev 23265)
+++ trunk/blender/source/blender/editors/object/object_select.c 2009-09-16 
01:15:30 UTC (rev 23266)
@@ -923,6 +923,59 @@
        RNA_def_enum(ot->srna, "seltype", prop_select_types, 1, "Selection", 
"Extend selection or clear selection then select");
 }
 
+
+static int object_select_name_exec(bContext *C, wmOperator *op)
+{
+       char *name= RNA_string_get_alloc(op->ptr, "name", NULL, 0);
+       short extend= RNA_boolean_get(op->ptr, "extend");
+       short changed = 0;
+
+       if(!extend) {
+               CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+                       ED_base_object_select(base, BA_DESELECT);
+               }
+               CTX_DATA_END;
+       }
+
+       CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
+               if(strcmp(name, base->object->id.name+2)==0) {
+                       ED_base_object_select(base, BA_SELECT);
+                       changed= 1;
+               }
+       }
+       CTX_DATA_END;
+
+       MEM_freeN(name);
+
+       /* undo? */
+       if(changed) {
+               WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, 
CTX_data_scene(C));
+               return OPERATOR_FINISHED;
+       }
+       else {
+               return OPERATOR_CANCELLED;
+       }
+}
+
+void OBJECT_OT_select_name(wmOperatorType *ot)
+{
+
+       /* identifiers */
+       ot->name= "Select Name";
+       ot->description = "Select an object with this name";
+       ot->idname= "OBJECT_OT_select_name";
+
+       /* api callbacks */
+       ot->exec= object_select_name_exec;
+       ot->poll= ED_operator_scene_editable;
+
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+       RNA_def_string(ot->srna, "name", "", 0, "Name", "Object name to 
select.");
+       RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection 
instead of deselecting everything first.");
+}
+
 /**************************** Select Random ****************************/
 
 static int object_select_random_exec(bContext *C, wmOperator *op)

Modified: trunk/blender/source/blender/editors/space_logic/logic_window.c
===================================================================
--- trunk/blender/source/blender/editors/space_logic/logic_window.c     
2009-09-16 00:59:55 UTC (rev 23265)
+++ trunk/blender/source/blender/editors/space_logic/logic_window.c     
2009-09-16 01:15:30 UTC (rev 23266)
@@ -1534,7 +1534,7 @@
                uiBlockBeginAlign(block);
                uiDefButI(block, MENU, B_REDR, "Execution 
Method%t|Script%x0|Module%x1", xco+4,yco-23, 66, 19, &pc->mode, 0, 0, 0, 0, 
"Python script type (textblock or module - faster)");
                if(pc->mode==0)
-                       uiDefIDPoinBut(block, test_scriptpoin_but, ID_SCRIPT, 
1, "", xco+70,yco-23,width-74, 19, &pc->text, "Blender textblock to run as a 
script");
+                       uiDefIDPoinBut(block, test_scriptpoin_but, ID_TXT, 1, 
"", xco+70,yco-23,width-74, 19, &pc->text, "Blender textblock to run as a 
script");
                else {
                        uiDefBut(block, TEX, 1, "", 
xco+70,yco-23,(width-70)-25, 19, pc->module, 0, 63, 0, 0, "Module name and 
function to run e.g. \"someModule.main\". Internal texts and external python 
files can be used");
                        uiDefButBitI(block, TOG, CONT_PY_DEBUG, B_REDR, "D", 
(xco+width)-25, yco-23, 19, 19, &pc->flag, 0, 0, 0, 0, "Continuously reload the 
module from disk for editing external modules without restarting");

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_ops.c      
2009-09-16 00:59:55 UTC (rev 23265)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_ops.c      
2009-09-16 01:15:30 UTC (rev 23266)
@@ -201,7 +201,25 @@
 
        /* selection*/
        WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, 
0, 0);
-       RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", 
SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1);
+       RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", 
SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", TRUE);
+       RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", 
SELECTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "center", TRUE);
+       RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", 
SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "enumerate", TRUE);
+
+       /* selection key-combinations */
+       km = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, 
KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+       RNA_boolean_set(km->ptr, "center", TRUE);
+       RNA_boolean_set(km->ptr, "extend", TRUE);
+       km = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, 
KM_PRESS, KM_CTRL|KM_ALT, 0);
+       RNA_boolean_set(km->ptr, "center", TRUE);
+       RNA_boolean_set(km->ptr, "enumerate", TRUE);
+       km = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, 
KM_PRESS, KM_SHIFT|KM_ALT, 0);
+       RNA_boolean_set(km->ptr, "extend", TRUE);
+       RNA_boolean_set(km->ptr, "enumerate", TRUE);
+       km = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, 
KM_PRESS, KM_SHIFT|KM_CTRL|KM_ALT, 0);
+       RNA_boolean_set(km->ptr, "center", TRUE);
+       RNA_boolean_set(km->ptr, "extend", TRUE);
+       RNA_boolean_set(km->ptr, "enumerate", TRUE);
+
        WM_keymap_add_item(keymap, "VIEW3D_OT_select_border", BKEY, KM_PRESS, 
0, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, 
KM_ANY, KM_CTRL, 0);

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to