Page Menu
Home
Search
Configure Global Search
Log In
Files
F11876
wireops.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
8 KB
Subscribers
None
wireops.patch
View Options
diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py
index fa2cd75..7211829 100644
--- a/release/scripts/ui/space_view3d.py
+++ b/release/scripts/ui/space_view3d.py
@@ -694,6 +694,7 @@ class VIEW3D_MT_object(bpy.types.Menu):
layout.separator()
layout.operator("object.move_to_layer", text="Move to Layer...")
+ layout.menu("VIEW3D_MT_display_options")
layout.menu("VIEW3D_MT_object_showhide")
layout.operator_menu_enum("object.convert", "target")
@@ -869,6 +870,19 @@ class VIEW3D_MT_object_showhide(bpy.types.Menu):
layout.operator("object.hide_view_set", text="Hide Selected")
layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
+class VIEW3D_MT_display_options(bpy.types.Menu):
+ bl_label = "Display Options"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("object.wiredraw_toggle")
+ layout.operator("object.wiredraw_copy_selected")
+ layout.separator()
+
+ layout.operator("object.use_cust_wire_colour_toggle")
+ layout.operator("object.use_cust_wire_colour_copy_selected")
+ layout.operator("object.cust_wire_colour_copy_selected")
class VIEW3D_MT_make_single_user(bpy.types.Menu):
bl_label = "Make Single User"
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index bd55282..8dd2bf3 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -2250,3 +2250,158 @@ void OBJECT_OT_logic_bricks_copy(wmOperatorType *ot)
/* operators for wire and wire colour settings. */
+static int wiredraw_poll(bContext *C)
+{
+ Object *ob = ED_object_active_context(C);
+ return ((ob != NULL) && !(ob->id.lib));
+}
+
+static int wiredraw_toggle_exec(bContext *C, wmOperator *op)
+{
+ Object *ob = ED_object_active_context(C);
+
+ if(ob->dtx & OB_DRAWWIRE) ob->dtx &= ~OB_DRAWWIRE;
+ else ob->dtx |= OB_DRAWWIRE;
+
+ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D|ND_SPACE_PROPERTIES, NULL);
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_wiredraw_toggle(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Display Wireframe";
+ ot->description = "Turn wireframe display on/off.";
+ ot->idname= "OBJECT_OT_wiredraw_toggle";
+
+ /* api callbacks */
+ ot->exec= wiredraw_toggle_exec;
+ ot->poll= wiredraw_poll;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int wiredraw_copy_exec(bContext *C, wmOperator *op)
+{
+ Object *cur = ED_object_active_context(C);
+ int allon = (cur->dtx & OB_DRAWWIRE);
+
+ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ if(allon) ob->dtx |= OB_DRAWWIRE;
+ else ob->dtx &= ~OB_DRAWWIRE;
+ }
+ CTX_DATA_END;
+
+ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D|ND_SPACE_PROPERTIES, NULL);
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_wiredraw_copy_selected(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Copy Wireframe Draw to Selected";
+ ot->description = "Copy active wireframe draw to other selected objects.";
+ ot->idname= "OBJECT_OT_wiredraw_copy_selected";
+
+ /* api callbacks */
+ ot->exec= wiredraw_copy_exec;
+ ot->poll= wiredraw_poll;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int use_cust_wire_colour_exec(bContext *C, wmOperator *op)
+{
+ Object *ob = ED_object_active_context(C);
+
+ if(ob->use_cust_wire_colour & OB_CUSTOM_WIRE) ob->use_cust_wire_colour &= ~OB_CUSTOM_WIRE;
+ else ob->use_cust_wire_colour |= OB_CUSTOM_WIRE;
+
+ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D|ND_SPACE_PROPERTIES, NULL);
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_use_cust_wire_colour_toggle(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Use Wireframe Custom Colour";
+ ot->description = "Turn use wireframe custom colour on/off.";
+ ot->idname= "OBJECT_OT_use_cust_wire_colour_toggle";
+
+ /* api callbacks */
+ ot->exec= use_cust_wire_colour_exec;
+ ot->poll= wiredraw_poll;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int use_cust_wire_colour_copy_exec(bContext *C, wmOperator *op)
+{
+ Object *cur = ED_object_active_context(C);
+ int allon = (cur->use_cust_wire_colour & OB_CUSTOM_WIRE);
+
+ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ if(allon)
+ ob->use_cust_wire_colour |= OB_CUSTOM_WIRE;
+ else
+ ob->use_cust_wire_colour &= ~OB_CUSTOM_WIRE;
+ }
+ CTX_DATA_END;
+
+ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D|ND_SPACE_PROPERTIES, NULL);
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_use_cust_wire_colour_copy_selected(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Copy Use Wireframe Custom Colour";
+ ot->description = "Copy use wireframe custom colour to other selected objects.";
+ ot->idname= "OBJECT_OT_use_cust_wire_colour_copy_selected";
+
+ /* api callbacks */
+ ot->exec= use_cust_wire_colour_copy_exec;
+ ot->poll= wiredraw_poll;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int use_cust_wire_colour_copy_selected_exec(bContext *C, wmOperator *op)
+{
+ Object *cur = ED_object_active_context(C);
+ int x;
+ float newcol[3];
+
+ for(x=0;x<3;x++)
+ newcol[x] = cur->cust_wire_colour[x];
+
+ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ for(x=0;x<3;x++)
+ ob->cust_wire_colour[x] = newcol[x];
+ }
+ CTX_DATA_END;
+
+ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D|ND_SPACE_PROPERTIES, NULL);
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_cust_wire_colour_copy_selected(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Copy Wireframe Colour to Selected";
+ ot->description = "Copy wireframe draw colour to other selected objects.";
+ ot->idname= "OBJECT_OT_cust_wire_colour_copy_selected";
+
+ /* api callbacks */
+ ot->exec= use_cust_wire_colour_copy_selected_exec;
+ ot->poll= wiredraw_poll;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index ed75c40..9023cc7 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -91,6 +91,12 @@ void OBJECT_OT_game_property_copy(struct wmOperatorType *ot);
void OBJECT_OT_game_property_clear(struct wmOperatorType *ot);
void OBJECT_OT_logic_bricks_copy(struct wmOperatorType *ot);
+void OBJECT_OT_wiredraw_toggle(wmOperatorType *ot);
+void OBJECT_OT_wiredraw_copy_selected(wmOperatorType *ot);
+void OBJECT_OT_use_cust_wire_colour_toggle(wmOperatorType *ot);
+void OBJECT_OT_use_cust_wire_colour_copy_selected(wmOperatorType *ot);
+void OBJECT_OT_cust_wire_colour_copy_selected(wmOperatorType *ot);
+
/* object_select.c */
void OBJECT_OT_select_all(struct wmOperatorType *ot);
void OBJECT_OT_select_inverse(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 6e9e8ee..b59e6f3 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -139,6 +139,12 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_meshdeform_bind);
WM_operatortype_append(OBJECT_OT_explode_refresh);
+ WM_operatortype_append(OBJECT_OT_wiredraw_toggle);
+ WM_operatortype_append(OBJECT_OT_wiredraw_copy_selected);
+ WM_operatortype_append(OBJECT_OT_use_cust_wire_colour_toggle);
+ WM_operatortype_append(OBJECT_OT_use_cust_wire_colour_copy_selected);
+ WM_operatortype_append(OBJECT_OT_cust_wire_colour_copy_selected);
+
WM_operatortype_append(OBJECT_OT_constraint_add);
WM_operatortype_append(OBJECT_OT_constraint_add_with_targets);
WM_operatortype_append(POSE_OT_constraint_add);
File Metadata
Details
Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
5a/5c/fce7658f51a65defb8c0fa15bc1c
Event Timeline
Log In to Comment