forked from bartvdbraak/blender
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
This commit is contained in:
parent
d7564761c0
commit
036c0012e6
@ -170,6 +170,32 @@ class VIEW3D_PT_background_image(bpy.types.Panel):
|
||||
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)
|
||||
@ -177,5 +203,4 @@ 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)
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_global.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
@ -47,7 +48,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
||||
"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 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -1176,41 +1176,6 @@ static void view3d_panel_brush(const bContext *C, Panel *pa)
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
|
||||
/* '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);
|
||||
|
@ -213,6 +213,10 @@ void rna_def_sculpt(BlenderRNA *brna)
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user