Page Menu
Home
Search
Configure Global Search
Log In
Files
F11874
wirecolour.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Shane Ambler (sambler)
Nov 13 2013, 2:28 PM
Size
15 KB
Subscribers
None
wirecolour.patch
View Options
diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py
index 35037b1..83a4832 100644
--- a/release/scripts/ui/properties_object.py
+++ b/release/scripts/ui/properties_object.py
@@ -187,6 +187,11 @@ class OBJECT_PT_display(ObjectButtonsPanel, bpy.types.Panel):
col.prop(ob, "show_name", text="Name")
col.prop(ob, "show_axis", text="Axis")
col.prop(ob, "show_wire", text="Wire")
+ col.prop(ob, "show_wire_custom", text="Wire Colour")
+ sub = col.row()
+ sub.active = ob.show_wire_custom
+ col.prop(ob, "wire_colour", text="")
+
col.prop(ob, "color", text="Object Color")
col = split.column()
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index adff6ff..c25c62d 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -1257,20 +1257,39 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned
static void draw_custom_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int dt, int armflag, int boneflag, unsign
{
+ float curColour[4];
+
if(ob==NULL) return;
+ glGetFloatv(GL_CURRENT_COLOR, curColour); /* store the current draw colour to prevent messing up other bones and ghosts */
+
glScalef(length, length, length);
/* colors for posemode */
- if (armflag & ARM_POSEMODE) {
- set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, 0);
- }
+ if(armflag & ARM_POSEMODE) {
+ if( (ob->use_cust_wire_colour == OB_CUSTOM_WIRE) && !(armflag & ARM_DRAWGHOST)
+ && !(boneflag & BONE_DRAW_ACTIVE) && !(boneflag & BONE_SELECTED) )
+ glColor3fv(ob->cust_wire_colour);
+ else
+ set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, 0);
+ }else{ /* object mode?? or ghost drawing - edit mode doesn't draw custom bones */
+ if( ((ob->use_cust_wire_colour == OB_CUSTOM_WIRE) && (!(boneflag & BONE_DRAW_ACTIVE) || (armflag & ARM_COL_CUSTOM))
+ && !(armflag & ARM_DRAWGHOST)) )
+ glColor3fv(ob->cust_wire_colour);
+ else{
+ if( !(armflag & ARM_DRAWGHOST) )
+ if (dt <= OB_WIRE) set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, 0);
+ else set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, 0);
+ }
+ }
if (id != -1) {
glLoadName((GLuint) id|BONESEL_BONE);
}
draw_object_instance(scene, v3d, rv3d, ob, dt, armflag & ARM_POSEMODE);
+
+ glColor4fv(curColour); /* restore the previous draw colour */
}
@@ -2171,6 +2190,7 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base
cfrao= CFRA;
flago= arm->flag;
arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES);
+ arm->flag |= ARM_DRAWGHOST;
ipoflago= ob->ipoflag;
ob->ipoflag |= OB_DISABLE_PATH;
@@ -2249,6 +2269,7 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *
cfrao= CFRA;
flago= arm->flag;
arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES);
+ arm->flag |= ARM_DRAWGHOST;
ob->ipoflag |= OB_DISABLE_PATH;
/* copy the pose */
@@ -2316,7 +2337,8 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
actframe= BKE_nla_tweakedit_remap(adt, (float)CFRA, 0);
flago= arm->flag;
arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES);
-
+ arm->flag |= ARM_DRAWGHOST;
+
/* copy the pose */
poseo= ob->pose;
copy_pose(&posen, ob->pose, 1);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index d3162c4..5658b77 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -2297,7 +2297,10 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
// Setup for drawing wire over, disable zbuffer
// write to show selected edge wires better
- UI_ThemeColor(TH_WIRE);
+ if(ob->use_cust_wire_colour == OB_CUSTOM_WIRE)
+ glColor3fv(ob->cust_wire_colour);
+ else
+ UI_ThemeColor(TH_WIRE);
bglPolygonOffset(rv3d->dist, 1.0);
glDepthMask(0);
@@ -2507,8 +2512,10 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
if(!faceselect) {
if(base->flag & SELECT)
UI_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
- else
- UI_ThemeColor(TH_WIRE);
+ else if(ob->use_cust_wire_colour == OB_CUSTOM_WIRE)
+ glColor3fv(ob->cust_wire_colour);
+ else
+ UI_ThemeColor(TH_WIRE);
if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
dm->drawLooseEdges(dm);
@@ -2576,7 +2583,10 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
if(base->flag & SELECT) {
UI_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
} else {
- UI_ThemeColor(TH_WIRE);
+ if(ob->use_cust_wire_colour == OB_CUSTOM_WIRE)
+ glColor3fv(ob->cust_wire_colour);
+ else
+ UI_ThemeColor(TH_WIRE);
}
if(!ob->sculpt && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
dm->drawLooseEdges(dm);
@@ -2643,7 +2653,10 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
if(base->flag & SELECT) {
UI_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
} else {
- UI_ThemeColor(TH_WIRE);
+ if(ob->use_cust_wire_colour == OB_CUSTOM_WIRE)
+ glColor3fv(ob->cust_wire_colour);
+ else
+ UI_ThemeColor(TH_WIRE);
}
if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
dm->drawLooseEdges(dm);
@@ -2662,13 +2675,17 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
else
glColor3ub(80,80,80);
} else {
- if (ob->flag & OB_FROMGROUP)
- UI_ThemeColor(TH_GROUP);
- else {
+ if (ob->flag & OB_FROMGROUP) {
+ UI_ThemeColor(TH_GROUP);
+ } else {
if(ob->dtx & OB_DRAWWIRE && flag==DRAW_CONSTCOLOR)
glColor3ub(80,80,80);
- else
- UI_ThemeColor(TH_WIRE);
+ else {
+ if(ob->use_cust_wire_colour == OB_CUSTOM_WIRE)
+ glColor3fv(ob->cust_wire_colour);
+ else
+ UI_ThemeColor(TH_WIRE);
+ }
}
}
}
@@ -4693,7 +4710,10 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
// XXX retopo_matrix_update(v3d);
/* DispList */
- UI_ThemeColor(TH_WIRE);
+ if( (ob->use_cust_wire_colour == OB_CUSTOM_WIRE) && !(ob->mode & OB_MODE_EDIT) )
+ glColor3fv(ob->cust_wire_colour);
+ else
+ UI_ThemeColor(TH_WIRE);
drawDispList(scene, v3d, rv3d, base, dt);
if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
@@ -4723,7 +4743,10 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
when at its lowest, dont render normals */
if(cu->flag & CU_3D && ts->normalsize > 0.0015 && (cu->drawflag & CU_HIDE_NORMALS)==0) {
- UI_ThemeColor(TH_WIRE);
+ if( (ob->use_cust_wire_colour == OB_CUSTOM_WIRE) && !(ob->mode & OB_MODE_EDIT) )
+ glColor3fv(ob->cust_wire_colour);
+ else
+ UI_ThemeColor(TH_WIRE);
for (bl=cu->bev.first,nu=nurb; nu && bl; bl=bl->next,nu=nu->next) {
BevPoint *bevp= (BevPoint *)(bl+1);
int nr= bl->nr;
@@ -4991,7 +5014,10 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
mb= ob->data;
if(mb->editelems) {
- UI_ThemeColor(TH_WIRE);
+ if(ob->use_cust_wire_colour == OB_CUSTOM_WIRE)
+ glColor3fv(ob->cust_wire_colour);
+ else
+ UI_ThemeColor(TH_WIRE);
if((G.f & G_PICKSEL)==0 ) drawDispList(scene, v3d, rv3d, base, dt);
ml= mb->editelems->first;
}
@@ -5010,7 +5036,10 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
if(ob==OBACT) UI_ThemeColor(TH_ACTIVE);
else UI_ThemeColor(TH_SELECT);
}
- else UI_ThemeColor(TH_WIRE);
+ else if(ob->use_cust_wire_colour == OB_CUSTOM_WIRE)
+ glColor3fv(ob->cust_wire_colour);
+ else
+ UI_ThemeColor(TH_WIRE);
invert_m4_m4(imat, rv3d->viewmatob);
normalize_v3(imat[0]);
@@ -5417,9 +5446,15 @@ static void drawWireExtra(Scene *scene, RegionView3D *rv3d, Object *ob)
UI_ThemeColor(TH_GROUP);
else {
if(ob->dtx & OB_DRAWWIRE) {
- glColor3ub(80,80,80);
+ if(ob->use_cust_wire_colour == OB_CUSTOM_WIRE)
+ glColor3fv(ob->cust_wire_colour);
+ else
+ glColor3ub(80,80,80);
} else {
- UI_ThemeColor(TH_WIRE);
+ if(ob->use_cust_wire_colour == OB_CUSTOM_WIRE)
+ glColor3fv(ob->cust_wire_colour);
+ else
+ UI_ThemeColor(TH_WIRE);
}
}
}
@@ -5666,7 +5701,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
else {
if(ob->type==OB_LAMP) UI_ThemeColor(TH_LAMP);
- else UI_ThemeColor(TH_WIRE);
+ else if(ob->use_cust_wire_colour == OB_CUSTOM_WIRE)
+ glColor3fv(ob->cust_wire_colour);
+ else
+ UI_ThemeColor(TH_WIRE);
if((scene->basact)==base) {
if(base->flag & (SELECT+BA_WAS_SEL)) UI_ThemeColor(TH_ACTIVE);
@@ -5785,7 +5823,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if (cu->linewidth != 0.0) {
cpack(0xff44ff);
- UI_ThemeColor(TH_WIRE);
+ if(ob->use_cust_wire_colour == OB_CUSTOM_WIRE)
+ glColor3fv(ob->cust_wire_colour);
+ else
+ UI_ThemeColor(TH_WIRE);
copy_v3_v3(vec1, ob->orig);
copy_v3_v3(vec2, ob->orig);
vec1[0] += cu->linewidth;
@@ -5805,8 +5846,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if (cu->tb[i].w != 0.0) {
if (i == (cu->actbox-1))
UI_ThemeColor(TH_ACTIVE);
- else
- UI_ThemeColor(TH_WIRE);
+ else if(ob->use_cust_wire_colour == OB_CUSTOM_WIRE)
+ glColor3fv(ob->cust_wire_colour);
+ else
+ UI_ThemeColor(TH_WIRE);
vec1[0] = (cu->xof * cu->fsize) + cu->tb[i].x;
vec1[1] = (cu->yof * cu->fsize) + cu->tb[i].y + cu->fsize;
vec1[2] = 0.001;
diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h
index f7533ff..2e6887e 100644
--- a/source/blender/makesdna/DNA_armature_types.h
+++ b/source/blender/makesdna/DNA_armature_types.h
@@ -118,7 +118,8 @@ typedef enum eArmature_Flag {
ARM_NO_CUSTOM = (1<<10), /* made option negative, for backwards compat */
ARM_COL_CUSTOM = (1<<11), /* draw custom colours */
ARM_GHOST_ONLYSEL = (1<<12), /* when ghosting, only show selected bones (this should belong to ghostflag instea
- ARM_DS_EXPAND = (1<<13)
+ ARM_DS_EXPAND = (1<<13),
+ ARM_DRAWGHOST = (1<<14) /* Drawing ghosts only - to prevent custom wire colour being used in ghosted bones */
} eArmature_Flag;
/* armature->drawtype */
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 60b4f6a..1e55a8e 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -252,6 +252,9 @@ typedef struct Object {
ListBase gpulamp; /* runtime, for lamps only */
ListBase pc_ids;
ListBase *duplilist; /* for temporary dupli list storage, only for use by RNA API */
+
+ int use_cust_wire_colour; /* Use Custom Wire Colour - use int for alignment */
+ float cust_wire_colour[3]; /* custom wireframe colour */
} Object;
/* Warning, this is not used anymore because hooks are now modifiers */
@@ -404,6 +407,8 @@ extern Object workob;
#define OB_BOUND_DYN_MESH 6
#define OB_BOUND_CAPSULE 7
+/* custom wire frame colour drawing */
+#define OB_CUSTOM_WIRE 1
/* **************** BASE ********************* */
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index f2abe69..34bbb8a 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index a6f99d0..e553a7d 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -2118,7 +2118,17 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY);
RNA_def_property_ui_text(prop, "X-Ray", "Makes the object draw in front of others");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
-
+
+ prop= RNA_def_property(srna, "show_wire_custom", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_cust_wire_colour", OB_CUSTOM_WIRE);
+ RNA_def_property_ui_text(prop, "Custom Wire", "Use a custom colour for the object's wireframe drawing");
+ RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
+
+ prop= RNA_def_property(srna, "wire_colour", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "cust_wire_colour");
+ RNA_def_property_ui_text(prop, "Wire Colour", "Custom wire colour, used when Wire Colour is enabled");
+ RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
+
/* Grease Pencil */
prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "gpd");
File Metadata
Details
Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b2/3f/cf89c4384da6ece813f6221a16eb
Event Timeline
Log In to Comment