Revision: 21686
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21686
Author:   nicholasbishop
Date:     2009-07-19 03:55:21 +0200 (Sun, 19 Jul 2009)

Log Message:
-----------
Sculpt/2.5:

* Added pointer RNA for the sculpt brush
* Converted sculpt settings panel (in the NKEY area) from C to Python
* For Python UI, needed context for whether sculpt is enabled or not; discussed 
this with Brecht and added sculpt_object to scene context

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/space_view3d.py
    branches/blender2.5/blender/source/blender/editors/screen/screen_context.c
    
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_buttons.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c

Modified: branches/blender2.5/blender/release/ui/space_view3d.py
===================================================================
--- branches/blender2.5/blender/release/ui/space_view3d.py      2009-07-19 
00:49:44 UTC (rev 21685)
+++ branches/blender2.5/blender/release/ui/space_view3d.py      2009-07-19 
01:55:21 UTC (rev 21686)
@@ -170,12 +170,37 @@
                col.itemR(bg, "x_offset", text="X")
                col.itemR(bg, "y_offset", text="Y")
 
+class VIEW3D_PT_sculpt(bpy.types.Panel):
+       __space_type__ = "VIEW_3D"
+       __region_type__ = "UI"
+       __label__ = "Sculpt"
 
+       def poll(self, context):
+               return context.sculpt_object
+
+       def draw(self, context):
+               sculpt = context.scene.tool_settings.sculpt
+
+               split = self.layout.split()
+               
+               col = split.column()
+               col.itemL(text="Symmetry")
+               row = col.row(align=True)
+               row.itemR(sculpt, "symmetry_x", text="X", toggle=True)
+               row.itemR(sculpt, "symmetry_y", text="Y", toggle=True)
+               row.itemR(sculpt, "symmetry_z", text="Z", toggle=True)
+
+               col = split.column()
+               col.itemL(text="Lock Axis")
+               row = col.row(align=True)
+               row.itemR(sculpt, "lock_x", text="X", toggle=True)
+               row.itemR(sculpt, "lock_y", text="Y", toggle=True)
+               row.itemR(sculpt, "lock_z", text="Z", toggle=True)
+
 bpy.types.register(VIEW3D_MT_view_navigation)
 bpy.types.register(VIEW3D_MT_view)
 bpy.types.register(VIEW3D_HT_header)
 bpy.types.register(VIEW3D_PT_3dview_properties)
 bpy.types.register(VIEW3D_PT_3dview_display)
 bpy.types.register(VIEW3D_PT_background_image)
-
-
+bpy.types.register(VIEW3D_PT_sculpt)

Modified: 
branches/blender2.5/blender/source/blender/editors/screen/screen_context.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/screen_context.c  
2009-07-19 00:49:44 UTC (rev 21685)
+++ branches/blender2.5/blender/source/blender/editors/screen/screen_context.c  
2009-07-19 01:55:21 UTC (rev 21686)
@@ -33,6 +33,7 @@
 
 #include "BKE_context.h"
 #include "BKE_utildefines.h"
+#include "BKE_global.h"
 
 #include "RNA_access.h"
 
@@ -47,7 +48,7 @@
                        "scene", "selected_objects", "selected_bases",
                        "selected_editable_objects", "selected_editable_bases"
                        "active_base",
-                       "active_object", "edit_object", NULL};
+                       "active_object", "edit_object", "sculpt_object", NULL};
 
                CTX_data_dir_set(result, dir);
                return 1;
@@ -107,6 +108,12 @@
                
                return 1;
        }
+       else if(CTX_data_equals(member, "sculpt_object")) {
+               if(G.f & G_SCULPTMODE && scene->basact)
+                       CTX_data_id_pointer_set(result, 
&scene->basact->object->id);
+
+               return 1;
+       }
        
        return 0;
 }

Modified: 
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_buttons.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_buttons.c
    2009-07-19 00:49:44 UTC (rev 21685)
+++ 
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_buttons.c
    2009-07-19 01:55:21 UTC (rev 21686)
@@ -1176,41 +1176,6 @@
        }
 }
 
-static void sculptmode_draw_interface_tools(Scene *scene, uiBlock *block, 
unsigned short cx, unsigned short cy)
-{
-       Sculpt *s = scene->toolsettings->sculpt;
-       
-       //XXX if(sd->brush_type != SMOOTH_BRUSH && sd->brush_type != GRAB_BRUSH 
&& sd->brush_type != FLATTEN_BRUSH) {
-       {
-               
/*uiDefButBitS(block,ROW,B_NOP,"Add",cx,cy,89,19,&br->dir,15.0,1.0,0, 0,"Add 
depth to model [Shift]");
-               
uiDefButBitS(block,ROW,B_NOP,"Sub",cx+89,cy,89,19,&br->dir,15.0,2.0,0, 
0,"Subtract depth from model [Shift]");
-               */}
-       //XXX if(sd->brush_type!=GRAB_BRUSH)
-       
-       uiBlockBeginAlign(block);
-       uiDefBut( block,LABEL,B_NOP,"Symmetry",cx,cy,90,19,NULL,0,0,0,0,"");
-       cy-= 20;
-       uiBlockBeginAlign(block);
-       uiDefButBitI(block, TOG, SCULPT_SYMM_X, B_NOP, "X", cx,cy,40,19, 
&s->flags, 0,0,0,0, "Mirror brush across X axis");
-       uiDefButBitI(block, TOG, SCULPT_SYMM_Y, B_NOP, "Y", cx+40,cy,40,19, 
&s->flags, 0,0,0,0, "Mirror brush across Y axis");
-       uiDefButBitI(block, TOG, SCULPT_SYMM_Z, B_NOP, "Z", cx+80,cy,40,19, 
&s->flags, 0,0,0,0, "Mirror brush across Z axis");
-       uiBlockEndAlign(block);
-       
-       
-       cy+= 20;
-       uiBlockBeginAlign(block);
-       uiDefBut( block,LABEL,B_NOP,"LockAxis",cx+140,cy,90,19,NULL,0,0,0,0,"");
-       cy-= 20;
-       uiBlockBeginAlign(block);
-       uiDefButBitI(block, TOG, SCULPT_LOCK_X, B_NOP, "X", cx+140,cy,40,19, 
&s->flags, 0,0,0,0, "Constrain X axis");
-       uiDefButBitI(block, TOG, SCULPT_LOCK_Y, B_NOP, "Y", cx+180,cy,40,19, 
&s->flags, 0,0,0,0, "Constrain Y axis");
-       uiDefButBitI(block, TOG, SCULPT_LOCK_Z, B_NOP, "Z", cx+220,cy,40,19, 
&s->flags, 0,0,0,0, "Constrain Z axis");
-       uiBlockEndAlign(block);
-               
-       cx+= 210;
-}
-
-
 static void view3d_panel_object(const bContext *C, Panel *pa)
 {
        uiBlock *block;
@@ -1278,10 +1243,6 @@
                        /* 'f' is for floating panel */
                        uiBlockPickerButtons(block, (*br)->rgb, hsv, old, 
hexcol, 'f', B_REDR);
        }
-       else if(G.f & G_SCULPTMODE) {
-               BLI_strncpy(pa->drawname, "Sculpt Properties", 
sizeof(pa->drawname));
-               sculptmode_draw_interface_tools(scene, block, 10, 150);
-       } 
        else if(G.f & G_PARTICLEEDIT){
                BLI_strncpy(pa->drawname, "Particle Edit Properties", 
sizeof(pa->drawname));
 // XXX         particle_edit_buttons(block);

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c      
2009-07-19 00:49:44 UTC (rev 21685)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c      
2009-07-19 01:55:21 UTC (rev 21686)
@@ -213,6 +213,10 @@
        srna= RNA_def_struct(brna, "Sculpt", NULL);
        RNA_def_struct_nested(brna, srna, "Scene");
        RNA_def_struct_ui_text(srna, "Sculpt", "");
+       
+       prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
+       RNA_def_property_struct_type(prop, "Brush");
+       RNA_def_property_ui_text(prop, "Brush", "");
 
        prop= RNA_def_property(srna, "symmetry_x", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_X);


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

Reply via email to