[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12126] trunk/blender/source/blender: bugfix - running scriptlinks did not initialize the armature weakref dict, thanks for finding caedes!
Campbell Barton
cbarton at metavr.com
Mon Sep 24 00:02:19 CEST 2007
Revision: 12126
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12126
Author: campbellbarton
Date: 2007-09-24 00:02:18 +0200 (Mon, 24 Sep 2007)
Log Message:
-----------
bugfix - running scriptlinks did not initialize the armature weakref dict, thanks for finding caedes!
this bug is in 2.45 but can work around by setting it manually
---
import sys as pysys
try:
pysys.modules['__main__'].__arm_weakrefs
except:
pysys.modules['__main__'].__arm_weakrefs = {}
---
changed how draw modes work - when displaying textured meshes in editmode, only draw selected edges when "Edge Draw" is not enabled. this makes it easy to see the texture/mapping without edges getting in the way.
This means editmode can draw like UV/Face mode did when "Draw Edges" was disabled.
Also made the active vert/edge/face color themeable, still need to set the default to somthing other then pink.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_utildefines.h
trunk/blender/source/blender/include/BIF_resources.h
trunk/blender/source/blender/python/BPY_interface.c
trunk/blender/source/blender/src/drawobject.c
trunk/blender/source/blender/src/resources.c
trunk/blender/source/blender/src/space.c
Modified: trunk/blender/source/blender/blenkernel/BKE_utildefines.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_utildefines.h 2007-09-23 18:27:01 UTC (rev 12125)
+++ trunk/blender/source/blender/blenkernel/BKE_utildefines.h 2007-09-23 22:02:18 UTC (rev 12126)
@@ -57,6 +57,7 @@
#define ELEM6(a, b, c, d, e, f, g) ( ELEM(a, b, c) || ELEM4(a, d, e, f, g) )
#define ELEM7(a, b, c, d, e, f, g, h) ( ELEM3(a, b, c, d) || ELEM4(a, e, f, g, h) )
#define ELEM8(a, b, c, d, e, f, g, h, i) ( ELEM4(a, b, c, d, e) || ELEM4(a, f, g, h, i) )
+#define ELEM9(a, b, c, d, e, f, g, h, i, j) ( ELEM4(a, b, c, d, e) || ELEM5(a, f, g, h, i, j) )
/* string compare */
#define STREQ(str, a) ( strcmp((str), (a))==0 )
Modified: trunk/blender/source/blender/include/BIF_resources.h
===================================================================
--- trunk/blender/source/blender/include/BIF_resources.h 2007-09-23 18:27:01 UTC (rev 12125)
+++ trunk/blender/source/blender/include/BIF_resources.h 2007-09-23 22:02:18 UTC (rev 12126)
@@ -525,6 +525,7 @@
TH_SEQ_META,
TH_EDGE_SHARP,
+ TH_EDITMESH_ACTIVE,
};
/* XXX WARNING: previous is saved in file, so do not change order! */
Modified: trunk/blender/source/blender/python/BPY_interface.c
===================================================================
--- trunk/blender/source/blender/python/BPY_interface.c 2007-09-23 18:27:01 UTC (rev 12125)
+++ trunk/blender/source/blender/python/BPY_interface.c 2007-09-23 22:02:18 UTC (rev 12126)
@@ -1915,7 +1915,12 @@
/* invalid scriptlinks (new .blend was just loaded), return */
if( during_slink < 0 )
return;
-
+
+ if( !setup_armature_weakrefs()){
+ printf("Oops - weakref dict\n");
+ return;
+ }
+
/* tell we're running a scriptlink. The sum also tells if this script
* is running nested inside another. Blender.Load needs this info to
* avoid trouble with invalid slink pointers. */
Modified: trunk/blender/source/blender/src/drawobject.c
===================================================================
--- trunk/blender/source/blender/src/drawobject.c 2007-09-23 18:27:01 UTC (rev 12125)
+++ trunk/blender/source/blender/src/drawobject.c 2007-09-23 22:02:18 UTC (rev 12126)
@@ -1468,10 +1468,14 @@
static int draw_dm_edges_sel__setDrawOptions(void *userData, int index)
{
EditEdge *eed = EM_get_edge_for_index(index);
- unsigned char **cols = userData;
+ unsigned char **cols = userData, *col;
if (eed->h==0) {
- glColor4ubv(cols[(eed->f&SELECT)?1:0]);
+ col = cols[(eed->f&SELECT)?1:0];
+ /* no alpha, this is used so a transparent color can disable drawing unselected edges in editmode */
+ if (col[3]==0) return 0;
+
+ glColor4ubv(col);
return 1;
} else {
return 0;
@@ -1651,7 +1655,7 @@
glPointSize(1.0);
}
-static void draw_em_fancy_edges(DerivedMesh *cageDM)
+static void draw_em_fancy_edges(DerivedMesh *cageDM, short sel_only)
{
int pass;
unsigned char wire[4], sel[4];
@@ -1659,6 +1663,11 @@
/* since this function does transparant... */
BIF_GetThemeColor3ubv(TH_EDGE_SELECT, (char *)sel);
BIF_GetThemeColor3ubv(TH_WIRE, (char *)wire);
+
+ /* when sel only is used, dont render wire, only selected, this is used for
+ * textured draw mode when the 'edges' option is disabled */
+ if (sel_only)
+ wire[3] = 0;
for (pass=0; pass<2; pass++) {
/* show wires in transparant when no zbuf clipping for select */
@@ -1666,13 +1675,14 @@
if (G.vd->zbuf && (G.vd->flag & V3D_ZBUF_SELECT)==0) {
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
-
- wire[3] = sel[3] = 85;
+ sel[3] = 85;
+ if (!sel_only) wire[3] = 85;
} else {
continue;
}
} else {
- wire[3] = sel[3] = 255;
+ sel[3] = 255;
+ if (!sel_only) wire[3] = 255;
}
if(G.scene->selectmode == SCE_SELECT_FACE) {
@@ -1688,8 +1698,10 @@
}
}
else {
- glColor4ubv(wire);
- draw_dm_edges(cageDM);
+ if (!sel_only) {
+ glColor4ubv(wire);
+ draw_dm_edges(cageDM);
+ }
}
if (pass==0) {
@@ -1993,33 +2005,42 @@
}
/* here starts all fancy draw-extra over */
-
- if(G.f & G_DRAWSEAMS) {
- BIF_ThemeColor(TH_EDGE_SEAM);
- glLineWidth(2);
-
- draw_dm_edges_seams(cageDM);
-
- glColor3ub(0,0,0);
- glLineWidth(1);
- }
+ if( (G.f & G_DRAWEDGES)==0 &&
+ ((G.vd->drawtype==OB_TEXTURE && dt>OB_SOLID) ||
+ (G.vd->drawtype==OB_SOLID && G.vd->flag2 & V3D_SOLID_TEX))
+ ) {
+ /* we are drawing textures and 'G_DRAWEDGES' is disabled, dont draw any edges */
+
+ /* only draw selected edges otherwise there is no way of telling if a face is selected */
+ draw_em_fancy_edges(cageDM, 1);
+
+ } else {
+ if(G.f & G_DRAWSEAMS) {
+ BIF_ThemeColor(TH_EDGE_SEAM);
+ glLineWidth(2);
- if(G.f & G_DRAWSHARP) {
- BIF_ThemeColor(TH_EDGE_SHARP);
- glLineWidth(2);
-
- draw_dm_edges_sharp(cageDM);
-
- glColor3ub(0,0,0);
- glLineWidth(1);
+ draw_dm_edges_seams(cageDM);
+
+ glColor3ub(0,0,0);
+ glLineWidth(1);
+ }
+
+ if(G.f & G_DRAWSHARP) {
+ BIF_ThemeColor(TH_EDGE_SHARP);
+ glLineWidth(2);
+
+ draw_dm_edges_sharp(cageDM);
+
+ glColor3ub(0,0,0);
+ glLineWidth(1);
+ }
+
+ if(G.f & G_DRAWCREASES) {
+ draw_dm_creases(cageDM);
+ }
+
+ draw_em_fancy_edges(cageDM, 0);
}
-
- if(G.f & G_DRAWCREASES) {
- draw_dm_creases(cageDM);
- }
-
- draw_em_fancy_edges(cageDM);
-
if(ob==G.obedit) {
retopo_matrix_update(G.vd);
@@ -2043,8 +2064,10 @@
/* Draw active editmode vertex edge of face (if any)*/
if (em->selected.last) {
+ unsigned char act_col[4];
EditSelection *ese = em->selected.last;
-
+ BIF_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, (char *)act_col);
+
if( ese->type == EDITVERT && ((EditVert *)ese->data)->h==0) {
EditVert *ev = (EditVert*)ese->data;
float size = BIF_GetThemeValuef(TH_VERTEX_SIZE)*4;
@@ -2052,7 +2075,7 @@
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(0);
- glColor4ub(255,255,255,64);
+ glColor4ubv(act_col);
glPointSize(size);
glBegin(GL_POINTS);
@@ -2069,7 +2092,7 @@
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(0);
- glColor4ub(255,255,255,128);
+ glColor4ubv(act_col);
glLineWidth(2.0);
@@ -2107,7 +2130,7 @@
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(0);
- glColor4ub(255,255,255,64);
+ glColor4ubv(act_col);
glEnable(GL_POLYGON_STIPPLE);
glPolygonStipple(stipplepattern);
@@ -2160,7 +2183,6 @@
glDepthMask(1);
}
}
-
}
if(dt>OB_WIRE) {
Modified: trunk/blender/source/blender/src/resources.c
===================================================================
--- trunk/blender/source/blender/src/resources.c 2007-09-23 18:27:01 UTC (rev 12125)
+++ trunk/blender/source/blender/src/resources.c 2007-09-23 22:02:18 UTC (rev 12126)
@@ -599,6 +599,7 @@
str += sprintf(str, "Face Selected (transp) %%x%d|", TH_FACE_SELECT);
str += sprintf(str, "Face Dot Selected %%x%d|", TH_FACE_DOT);
str += sprintf(str, "Face Dot Size %%x%d|", TH_FACEDOT_SIZE);
+ str += sprintf(str, "Active Vert/Edge/Face %%x%d|", TH_EDITMESH_ACTIVE);
str += sprintf(str, "Normal %%x%d|", TH_NORMAL);
str += sprintf(str, "Bone Solid %%x%d|", TH_BONE_SOLID);
str += sprintf(str, "Bone Pose %%x%d", TH_BONE_POSE);
Modified: trunk/blender/source/blender/src/space.c
===================================================================
--- trunk/blender/source/blender/src/space.c 2007-09-23 18:27:01 UTC (rev 12125)
+++ trunk/blender/source/blender/src/space.c 2007-09-23 22:02:18 UTC (rev 12126)
@@ -3131,7 +3131,7 @@
}
else {
uiBlockBeginAlign(block);
- if ELEM8(th_curcol, TH_PANEL, TH_LAMP, TH_FACE, TH_FACE_SELECT, TH_MENU_BACK, TH_MENU_HILITE, TH_MENU_ITEM, TH_NODE) {
+ if ELEM9(th_curcol, TH_PANEL, TH_LAMP, TH_FACE, TH_FACE_SELECT, TH_EDITMESH_ACTIVE, TH_MENU_BACK, TH_MENU_HILITE, TH_MENU_ITEM, TH_NODE) {
uiDefButC(block, NUMSLI, B_UPDATE_THEME,"A ", 465,y3+25,200,20, col+3, 0.0, 255.0, B_THEMECOL, 0, "");
}
uiDefButC(block, NUMSLI, B_UPDATE_THEME,"R ", 465,y3,200,20, col, 0.0, 255.0, B_THEMECOL, 0, "");
More information about the Bf-blender-cvs
mailing list