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:
authorCampbell Barton <ideasman42@gmail.com>2006-05-05 10:57:33 +0400
committerCampbell Barton <ideasman42@gmail.com>2006-05-05 10:57:33 +0400
commit9681a329c1d8cc40947023139ad56a63c5ea5243 (patch)
tree159e97e9e0daa118727fa09c1b162f14de84ca67 /source/blender
parent18a23ab8c91cecbbdfd2389453e1f8233c095075 (diff)
added a python menu slot for weight pain.
Also needed to seperate view3d_paintmenu into view3d_vpaintmenu view3d_tpaintmenu view3d_wpaintmenu The view3d_paintmenu and do_view3d_paintmenu were getting messy and had a lot of if's in it.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/python/BPY_menus.c5
-rw-r--r--source/blender/python/BPY_menus.h1
-rw-r--r--source/blender/python/api2_2x/doc/API_intro.py4
-rw-r--r--source/blender/python/api2_2x/doc/API_related.py4
-rw-r--r--source/blender/src/header_view3d.c124
5 files changed, 113 insertions, 25 deletions
diff --git a/source/blender/python/BPY_menus.c b/source/blender/python/BPY_menus.c
index f6220b87d5c..fd1a99a5a50 100644
--- a/source/blender/python/BPY_menus.c
+++ b/source/blender/python/BPY_menus.c
@@ -97,6 +97,8 @@ static int bpymenu_group_atoi( char *str )
return PYMENU_UV;
else if( !strcmp( str, "FaceSelect" ) )
return PYMENU_FACESELECT;
+ else if( !strcmp( str, "WeightPaint" ) )
+ return PYMENU_WEIGHTPAINT;
/* "Misc" or an inexistent group name: use misc */
else
return PYMENU_MISC;
@@ -153,6 +155,9 @@ char *BPyMenu_group_itoa( short menugroup )
case PYMENU_FACESELECT:
return "FaceSelect";
break;
+ case PYMENU_WEIGHTPAINT:
+ return "WeightPaint";
+ break;
case PYMENU_MISC:
return "Misc";
break;
diff --git a/source/blender/python/BPY_menus.h b/source/blender/python/BPY_menus.h
index 8ef94b1ce79..523a6c95403 100644
--- a/source/blender/python/BPY_menus.h
+++ b/source/blender/python/BPY_menus.h
@@ -96,6 +96,7 @@ typedef enum {
* see define right below */
PYMENU_FACESELECT,
+ PYMENU_WEIGHTPAINT,
PYMENU_HELP,/*Main Help menu items - prob best to leave for 'official' ones*/
PYMENU_HELPSYSTEM,/* Resources, troubleshooting, system tools */
PYMENU_HELPWEBSITES,/* Help -> Websites submenu */
diff --git a/source/blender/python/api2_2x/doc/API_intro.py b/source/blender/python/api2_2x/doc/API_intro.py
index e255a58dd1f..b325db237c5 100644
--- a/source/blender/python/api2_2x/doc/API_intro.py
+++ b/source/blender/python/api2_2x/doc/API_intro.py
@@ -217,8 +217,8 @@ A note to newbie script writers:
to get an idea of what can be done, you may be surprised.
@author: The Blender Python Team
-@requires: Blender 2.37 or newer.
-@version: 2.37
+@requires: Blender 2.42 or newer.
+@version: 2.42
@see: U{www.blender3d.org<http://www.blender3d.org>}: main site
@see: U{www.blender.org<http://www.blender.org>}: documentation and forum
@see: U{www.elysiun.com<http://www.elysiun.com>}: user forum
diff --git a/source/blender/python/api2_2x/doc/API_related.py b/source/blender/python/api2_2x/doc/API_related.py
index 9050ed0f715..fb84569f601 100644
--- a/source/blender/python/api2_2x/doc/API_related.py
+++ b/source/blender/python/api2_2x/doc/API_related.py
@@ -49,8 +49,8 @@ Introduction:
-------------------
To pass parameters to the script you can:
- - write them to a file before running Blender, then make your script parse that file;
- - set environment variables and access them with the 'os' module:
+ - write them to a file before running Blender, then make your script parse that file;
+ - set environment variables and access them with the 'os' module:
Examples with parameters being passed to the script via command line::
diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c
index 8ae356d38e1..b0488d11527 100644
--- a/source/blender/src/header_view3d.c
+++ b/source/blender/src/header_view3d.c
@@ -3539,47 +3539,117 @@ static uiBlock *view3d_pose_armaturemenu(void *arg_unused)
return block;
}
-
-static void do_view3d_paintmenu(void *arg, int event)
+/* vertex paint menu */
+static void do_view3d_vpaintmenu(void *arg, int event)
{
switch(event) {
case 0: /* undo vertex painting */
vpaint_undo();
break;
- case 1: /* undo weight painting */
- wpaint_undo();
- break;
- case 2: /* set vertex colors/weight */
+ case 1: /* set vertex colors/weight */
if(G.f & G_FACESELECT)
clear_vpaint_selectedfaces();
else /* we know were in vertex paint mode */
clear_vpaint();
break;
- case 3: /* set vertex colors/weight */
- clear_wpaint_selectedfaces();
- break;
}
allqueue(REDRAWVIEW3D, 0);
}
-static uiBlock *view3d_paintmenu(void *arg_unused)
+
+static uiBlock *view3d_vpaintmenu(void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
block= uiNewBlock(&curarea->uiblocks, "view3d_paintmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
- uiBlockSetButmFunc(block, do_view3d_paintmenu, NULL);
+ uiBlockSetButmFunc(block, do_view3d_vpaintmenu, NULL);
- if (G.f & G_VERTEXPAINT) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Vertex Painting|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- if (G.f & G_WEIGHTPAINT) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Weight Painting|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- if (G.f & G_TEXTUREPAINT) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Vertex Painting|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Vertex Colors|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- if (G.f & G_VERTEXPAINT) {
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Vertex Colors|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- } else if (G.f & G_WEIGHTPAINT && G.f & G_FACESELECT) {
+ if(curarea->headertype==HEADERTOP) {
+ uiBlockSetDirection(block, UI_DOWN);
+ }
+ else {
+ uiBlockSetDirection(block, UI_TOP);
+ uiBlockFlipOrder(block);
+ }
+
+ uiTextBoundsBlock(block, 50);
+ return block;
+}
+
+
+/* texture paint menu (placeholder, no items yet??) */
+static void do_view3d_tpaintmenu(void *arg, int event)
+{
+ allqueue(REDRAWVIEW3D, 0);
+}
+
+static uiBlock *view3d_tpaintmenu(void *arg_unused)
+{
+ uiBlock *block;
+ short yco= 0, menuwidth=120;
+
+ block= uiNewBlock(&curarea->uiblocks, "view3d_paintmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
+ uiBlockSetButmFunc(block, do_view3d_tpaintmenu, NULL);
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+
+ if(curarea->headertype==HEADERTOP) {
+ uiBlockSetDirection(block, UI_DOWN);
+ }
+ else {
+ uiBlockSetDirection(block, UI_TOP);
+ uiBlockFlipOrder(block);
+ }
+
+ uiTextBoundsBlock(block, 50);
+ return block;
+}
+
+
+static void do_view3d_wpaintmenu(void *arg, int event)
+{
+
+ /* events >= 2 are registered bpython scripts */
+ if (event >= 2) BPY_menu_do_python(PYMENU_WEIGHTPAINT, event - 2);
+
+ switch(event) {
+ case 0: /* undo weight painting */
+ wpaint_undo();
+ break;
+ case 1: /* set vertex colors/weight */
+ clear_wpaint_selectedfaces();
+ break;
+ }
+ allqueue(REDRAWVIEW3D, 0);
+}
+
+static uiBlock *view3d_wpaintmenu(void *arg_unused)
+{
+ uiBlock *block;
+ short yco= 0, menuwidth=120, menunr=1;
+ BPyMenu *pym;
+ int i=0;
+
+ block= uiNewBlock(&curarea->uiblocks, "view3d_paintmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
+ uiBlockSetButmFunc(block, do_view3d_wpaintmenu, NULL);
+
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Weight Painting|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
+ if (G.f & G_FACESELECT) {
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Weight|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Weight|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
+ menunr++;
+ }
+
+ /* note that we account for the 2 previous entries with i+2:
+ even if the last item isnt displayed, it dosent matter */
+ for (pym = BPyMenuTable[PYMENU_WEIGHTPAINT]; pym; pym = pym->next, i++) {
+ uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20,
+ menuwidth, 19, NULL, 0.0, 0.0, 1, i+2,
+ pym->tooltip?pym->tooltip:pym->filename);
}
if(curarea->headertype==HEADERTOP) {
@@ -3594,6 +3664,7 @@ static uiBlock *view3d_paintmenu(void *arg_unused)
return block;
}
+
static void do_view3d_facesel_propertiesmenu(void *arg, int event)
{
TFace *tf = get_active_tface();
@@ -4277,11 +4348,22 @@ static void view3d_header_pulldowns(uiBlock *block, short *xcoord)
xco+= xmax;
}
}
- else if ((G.f & G_VERTEXPAINT) || (G.f & G_TEXTUREPAINT) || (G.f & G_WEIGHTPAINT)) {
+
+ else if (G.f & G_VERTEXPAINT) {
xmax= GetButStringLength("Paint");
- uiDefPulldownBut(block, view3d_paintmenu, NULL, "Paint", xco,-2, xmax-3, 24, "");
+ uiDefPulldownBut(block, view3d_vpaintmenu, NULL, "Paint", xco,-2, xmax-3, 24, "");
xco+= xmax;
}
+ else if (G.f & G_TEXTUREPAINT) {
+ xmax= GetButStringLength("Paint");
+ uiDefPulldownBut(block, view3d_tpaintmenu, NULL, "Paint", xco,-2, xmax-3, 24, "");
+ xco+= xmax;
+ }
+ else if (G.f & G_WEIGHTPAINT) {
+ xmax= GetButStringLength("Paint");
+ uiDefPulldownBut(block, view3d_wpaintmenu, NULL, "Paint", xco,-2, xmax-3, 24, "");
+ xco+= xmax;
+ }
else if (G.f & G_FACESELECT) {
if (ob && ob->type == OB_MESH) {
xmax= GetButStringLength("Face");