Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/ui/space_view3d.py51
-rw-r--r--source/blender/editors/screen/screen_context.c18
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c84
-rw-r--r--source/blender/makesrna/intern/rna_scene.c4
-rw-r--r--source/blender/makesrna/intern/rna_vpaint.c4
-rw-r--r--source/blender/python/generic/bpy_internal_import.c2
6 files changed, 77 insertions, 86 deletions
diff --git a/release/ui/space_view3d.py b/release/ui/space_view3d.py
index e194e6f939b..9d4994b9793 100644
--- a/release/ui/space_view3d.py
+++ b/release/ui/space_view3d.py
@@ -197,10 +197,59 @@ class VIEW3D_PT_sculpt(bpy.types.Panel):
row.itemR(sculpt, "lock_y", text="Y", toggle=True)
row.itemR(sculpt, "lock_z", text="Z", toggle=True)
+class VIEW3D_PT_brush(bpy.types.Panel):
+ __space_type__ = "VIEW_3D"
+ __region_type__ = "UI"
+ __label__ = "Brush"
+
+ def brush_src(self, context):
+ ts = context.scene.tool_settings
+ if context.sculpt_object:
+ return ts.sculpt
+ elif context.vpaint_object:
+ return ts.vpaint
+ elif context.wpaint_object:
+ return ts.wpaint
+ return False
+
+ def poll(self, context):
+ return self.brush_src(context)
+
+ def draw(self, context):
+ src = self.brush_src(context)
+ brush = src.brush
+ layout = self.layout
+
+ layout.split().row().template_ID(src, "brush")
+
+ split = layout.split()
+ col = split.column(align=True)
+ col.itemR(brush, "size", slider=True)
+ if context.wpaint_object:
+ col.itemR(context.scene.tool_settings, "vertex_group_weight", text="Weight", slider=True)
+ col.itemR(brush, "strength", slider=True)
+
+ if context.sculpt_object:
+ layout.split().row().itemR(brush, "sculpt_tool")
+
+ split = layout.split()
+ col = split.column()
+ col.itemR(brush, "airbrush")
+ col.itemR(brush, "anchored")
+ col.itemR(brush, "rake")
+ col = split.column()
+ col.itemR(brush, "space")
+ col.itemR(brush, "spacing")
+
+ split = layout.split()
+ split.template_curve_mapping(brush.curve)
+
bpy.types.register(VIEW3D_MT_view_navigation)
bpy.types.register(VIEW3D_MT_view)
bpy.types.register(VIEW3D_HT_header)
+bpy.types.register(VIEW3D_PT_sculpt)
+bpy.types.register(VIEW3D_PT_brush)
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)
+
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 5944ef5f507..19750833b4d 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -37,6 +37,8 @@
#include "RNA_access.h"
+#include "ED_object.h"
+
int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result)
{
bScreen *sc= CTX_wm_screen(C);
@@ -47,8 +49,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
static const char *dir[] = {
"scene", "selected_objects", "selected_bases",
"selected_editable_objects", "selected_editable_bases"
- "active_base",
- "active_object", "edit_object", "sculpt_object", NULL};
+ "active_base", "active_object", "edit_object",
+ "sculpt_object", "vpaint_object", "wpaint_object", NULL};
CTX_data_dir_set(result, dir);
return 1;
@@ -114,6 +116,18 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
+ else if(CTX_data_equals(member, "vpaint_object")) {
+ if(G.f & G_VERTEXPAINT && scene->basact)
+ CTX_data_id_pointer_set(result, &scene->basact->object->id);
+
+ return 1;
+ }
+ else if(CTX_data_equals(member, "wpaint_object")) {
+ if(G.f & G_WEIGHTPAINT && scene->basact)
+ CTX_data_id_pointer_set(result, &scene->basact->object->id);
+
+ return 1;
+ }
return 0;
}
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 077f34f3c4d..a50502e8265 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -1101,81 +1101,6 @@ static void brush_idpoin_handle(bContext *C, ID *id, int event)
}
}
-static int view3d_panel_brush_poll(const bContext *C, PanelType *pt)
-{
- Brush **brp = current_brush_source(CTX_data_scene(C));
-
- return ((G.f & (G_SCULPTMODE|G_TEXTUREPAINT|G_VERTEXPAINT|G_WEIGHTPAINT)) && brp);
-}
-
-static void view3d_panel_brush(const bContext *C, Panel *pa)
-{
- uiBlock *block;
- ToolSettings *ts= CTX_data_tool_settings(C);
- Brush **brp = current_brush_source(CTX_data_scene(C)), *br;
- short w = 268, h = 400, cx = 10, cy = h;
- rctf rect;
-
- br = *brp;
-
- block= uiLayoutFreeBlock(pa->layout);
- uiBlockSetHandleFunc(block, do_view3d_region_buttons, NULL);
-
- uiBlockBeginAlign(block);
- uiDefIDPoinButs(block, CTX_data_main(C), NULL, &br->id, ID_BR, NULL, cx, cy,
- brush_idpoin_handle, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_ADD_NEW|UI_ID_OPEN|UI_ID_DELETE|UI_ID_ALONE);
- cy-= 25;
- uiBlockEndAlign(block);
-
- if(!br)
- return;
-
- if(G.f & G_SCULPTMODE) {
- uiBlockBeginAlign(block);
- uiDefButC(block,ROW,B_REDR,"Draw",cx,cy,67,19,&br->sculpt_tool,14.0,SCULPT_TOOL_DRAW,0,0,"Draw lines on the model");
- uiDefButC(block,ROW,B_REDR,"Smooth",cx+67,cy,67,19,&br->sculpt_tool,14.0,SCULPT_TOOL_SMOOTH,0,0,"Interactively smooth areas of the model");
- uiDefButC(block,ROW,B_REDR,"Pinch",cx+134,cy,67,19,&br->sculpt_tool,14.0,SCULPT_TOOL_PINCH,0,0,"Interactively pinch areas of the model");
- uiDefButC(block,ROW,B_REDR,"Inflate",cx+201,cy,67,19,&br->sculpt_tool,14,SCULPT_TOOL_INFLATE,0,0,"Push vertices along the direction of their normals");
- cy-= 20;
- uiDefButC(block,ROW,B_REDR,"Grab", cx,cy,67,19,&br->sculpt_tool,14,SCULPT_TOOL_GRAB,0,0,"Grabs a group of vertices and moves them with the mouse");
- uiDefButC(block,ROW,B_REDR,"Layer", cx+67,cy,67,19,&br->sculpt_tool,14, SCULPT_TOOL_LAYER,0,0,"Adds a layer of depth");
- uiDefButC(block,ROW,B_REDR,"Flatten", cx+134,cy,67,19,&br->sculpt_tool,14, SCULPT_TOOL_FLATTEN,0,0,"Interactively flatten areas of the model");
- uiDefButC(block,ROW,B_REDR,"Clay", cx+201,cy,67,19,&br->sculpt_tool,14, SCULPT_TOOL_CLAY,0,0,"Build up depth quickly");
- cy-= 25;
- uiBlockEndAlign(block);
- }
-
- uiBlockBeginAlign(block);
- uiDefButI(block,NUMSLI,B_NOP,"Size: ",cx,cy,w,19,&br->size,1.0,200.0,0,0,"Set brush radius in pixels");
- cy-= 20;
- if(G.f & G_WEIGHTPAINT) {
- uiDefButF(block,NUMSLI,B_NOP,"Weight: ",cx,cy,w,19,&ts->vgroup_weight,0,1.0,0,0,"Set vertex weight");
- cy-= 20;
- }
- uiDefButF(block,NUMSLI,B_NOP,"Strength: ",cx,cy,w,19,&br->alpha,0,1.0,0,0,"Set brush strength");
- cy-= 25;
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
-
- uiDefButBitS(block, TOG, BRUSH_AIRBRUSH, B_NOP, "Airbrush", cx,cy,w/3,19, &br->flag,0,0,0,0, "Brush makes changes without waiting for the mouse to move");
- uiDefButBitS(block, TOG, BRUSH_RAKE, B_NOP, "Rake", cx+w/3,cy,w/3,19, &br->flag,0,0,0,0, "");
- uiDefButBitS(block, TOG, BRUSH_ANCHORED, B_NOP, "Anchored", cx+w*2.0/3,cy,w/3,19, &br->flag,0,0,0,0, "");
- cy-= 20;
- uiDefButBitS(block, TOG, BRUSH_SPACE, B_NOP, "Space", cx,cy,w/3,19, &br->flag,0,0,0,0, "");
- uiDefButF(block,NUMSLI,B_NOP,"Spacing: ",cx+w/3,cy,w*2.0/3,19,&br->spacing,1.0,500,0,0,"");
- cy-= 20;
- uiBlockEndAlign(block);
-
- if(br->curve) {
- rect.xmin= cx; rect.xmax= cx + w;
- rect.ymin= cy - 200; rect.ymax= cy;
- uiBlockBeginAlign(block);
- curvemap_buttons(block, br->curve, (char)0, B_NOP, 0, &rect);
- uiBlockEndAlign(block);
- }
-}
-
static void view3d_panel_object(const bContext *C, Panel *pa)
{
uiBlock *block;
@@ -1715,14 +1640,7 @@ void view3d_buttons_register(ARegionType *art)
strcpy(pt->label, "Background Image");
pt->draw= view3d_panel_background;
BLI_addtail(&art->paneltypes, pt);
-*/
- pt= MEM_callocN(sizeof(PanelType), "spacetype view3d panel brush");
- strcpy(pt->idname, "VIEW3D_PT_brush");
- strcpy(pt->label, "Brush");
- pt->draw= view3d_panel_brush;
- pt->poll= view3d_panel_brush_poll;
- BLI_addtail(&art->paneltypes, pt);
-/*
+
pt= MEM_callocN(sizeof(PanelType), "spacetype view3d panel transform spaces");
strcpy(pt->idname, "VIEW3D_PT_transform spaces");
strcpy(pt->label, "Transform Orientations");
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 8d0fc4f6a8b..d1ef9dbbef3 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -294,6 +294,10 @@ void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "VPaint");
RNA_def_property_ui_text(prop, "Vertex Paint", "");
+ prop= RNA_def_property(srna, "wpaint", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "VPaint");
+ RNA_def_property_ui_text(prop, "Weight Paint", "");
+
/* Transform */
prop= RNA_def_property(srna, "proportional_editing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "proportional", 0);
diff --git a/source/blender/makesrna/intern/rna_vpaint.c b/source/blender/makesrna/intern/rna_vpaint.c
index a34099dffb7..bf6b70dab23 100644
--- a/source/blender/makesrna/intern/rna_vpaint.c
+++ b/source/blender/makesrna/intern/rna_vpaint.c
@@ -51,6 +51,10 @@ void RNA_def_vpaint(BlenderRNA *brna)
srna= RNA_def_struct(brna, "VPaint", NULL);
RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of the Vpaint tool.");
+
+ 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, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_mode_items);
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index c41ea386c0e..b8c17d71ac4 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -65,6 +65,8 @@ PyObject *bpy_text_import( char *name, int *found )
Main *maggie= bpy_import_main;
*found= 0;
+
+ if(!maggie) return NULL;
if (namelen>21-3) return NULL; /* we know this cant be importable, the name is too long for blender! */