Commit: cbf86cbe3b1298706b2500b3160b303417483d7b
Author: Julian Eisel
Date:   Fri Dec 4 01:17:45 2015 +0100
Branches: wiggly-widgets
https://developer.blender.org/rBcbf86cbe3b1298706b2500b3160b303417483d7b

Cleanup: Remove dead/unused code

===================================================================

M       source/blender/editors/object/CMakeLists.txt
M       source/blender/editors/object/object_intern.h
D       source/blender/editors/object/object_lamp.c
M       source/blender/editors/object/object_ops.c
M       source/blender/editors/space_graph/graph_edit.c
M       source/blender/editors/space_sequencer/sequencer_view.c
M       source/blender/editors/space_view3d/view3d_widgets.c
M       source/blender/windowmanager/intern/wm_event_system.c
M       source/blender/windowmanager/intern/wm_generic_widgets.c
M       source/blender/windowmanager/intern/wm_operators.c
M       source/blender/windowmanager/intern/wm_widgets.c
M       source/blender/windowmanager/wm_event_types.h

===================================================================

diff --git a/source/blender/editors/object/CMakeLists.txt 
b/source/blender/editors/object/CMakeLists.txt
index 768f216..60f4766 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -49,7 +49,6 @@ set(SRC
        object_fmap.c
        object_group.c
        object_hook.c
-       object_lamp.c
        object_lattice.c
        object_lod.c
        object_modifier.c
diff --git a/source/blender/editors/object/object_intern.h 
b/source/blender/editors/object/object_intern.h
index 979af26..ec705fd 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -284,9 +284,6 @@ void OBJECT_OT_lod_remove(struct wmOperatorType *ot);
 /* object_random.c */
 void TRANSFORM_OT_vertex_random(struct wmOperatorType *ot);
 
-/* object_lamp.c */
-void LAMP_OT_lamp_position(struct wmOperatorType *ot);
-
 /* object_transfer_data.c */
 void OBJECT_OT_data_transfer(struct wmOperatorType *ot);
 void OBJECT_OT_datalayout_transfer(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_lamp.c 
b/source/blender/editors/object/object_lamp.c
deleted file mode 100644
index cb0e578..0000000
--- a/source/blender/editors/object/object_lamp.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-
-/** \file blender/editors/object/object_lamp.c
- *  \ingroup edobj
- */
-
-#include "WM_types.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_object_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_windowmanager_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BLI_utildefines.h"
-#include "BLI_math_matrix.h"
-#include "BLI_math.h"
-
-#include "BKE_context.h"
-#include "BKE_depsgraph.h"
-#include "BKE_object.h"
-
-#include "ED_view3d.h"
-#include "ED_screen.h"
-
-#include "WM_types.h"
-#include "WM_api.h"
-
-#include "BIF_glutil.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "UI_interface.h"
-#include "object_intern.h"
-
-#include "RNA_define.h"
-#include "RNA_access.h"
-
-typedef struct LampPositionData {
-       int pos[2];
-       float quat[4];
-       float lvec[3];
-} LampPositionData;
-
-/* Modal Operator init */
-static int lamp_position_invoke(bContext *C, wmOperator *op, const wmEvent 
*event)
-{
-       Object *ob = CTX_data_active_object(C);
-       LampPositionData *data;
-       data = op->customdata = MEM_mallocN(sizeof (LampPositionData), 
"lamp_position_data");
-
-       copy_v2_v2_int(data->pos, event->mval);
-
-       mat4_to_quat(data->quat, ob->obmat);
-       copy_v3_v3(data->lvec, ob->obmat[2]);
-       negate_v3(data->lvec);
-       normalize_v3(data->lvec);
-
-       WM_event_add_modal_handler(C, op);
-
-       return OPERATOR_RUNNING_MODAL;
-}
-
-/* Repeat operator */
-static int lamp_position_modal(bContext *C, wmOperator *op, const wmEvent 
*event)
-{
-
-       LampPositionData *data = op->customdata;
-
-       switch (event->type) {
-               case MOUSEMOVE:
-               {
-                       Object *ob = CTX_data_active_object(C);
-                       Lamp *la = ob->data;
-                       Scene *scene = CTX_data_scene(C);
-                       ARegion *ar = CTX_wm_region(C);
-                       View3D *v3d = CTX_wm_view3d(C);
-                       float world_pos[3];
-                       int flag = v3d->flag2;
-
-                       v3d->flag2 |= V3D_RENDER_OVERRIDE;
-
-                       view3d_operator_needs_opengl(C);
-                       if (ED_view3d_autodist(scene, ar, v3d, event->mval, 
world_pos, true, NULL)) {
-                               float axis[3];
-
-                               /* restore the floag here */
-                               v3d->flag2 = flag;
-
-                               sub_v3_v3(world_pos, ob->obmat[3]);
-                               la->dist = normalize_v3(world_pos);
-
-                               cross_v3_v3v3(axis, data->lvec, world_pos);
-                               if (normalize_v3(axis) > 0.0001) {
-                                       float mat[4][4];
-                                       float quat[4], qfinal[4];
-                                       float angle = 
saacos(dot_v3v3(world_pos, data->lvec));
-
-                                       /* transform the initial rotation 
quaternion to the new position and set the matrix to the lamp */
-                                       axis_angle_to_quat(quat, axis, angle);
-                                       mul_qt_qtqt(qfinal, quat, data->quat);
-                                       quat_to_mat4(mat, qfinal);
-                                       copy_v3_v3(mat[3], ob->obmat[3]);
-
-                                       BKE_object_apply_mat4(ob, mat, true, 
false);
-                               }
-
-                               DAG_id_tag_update(&ob->id, OB_RECALC_OB);
-
-                               ED_region_tag_redraw(ar);
-                       }
-
-                       v3d->flag2 = flag;
-
-                       break;
-               }
-
-               case LEFTMOUSE:
-                       if (event->val == KM_RELEASE) {
-                               MEM_freeN(op->customdata);
-                               return OPERATOR_FINISHED;
-                       }
-
-               case EVT_WIDGET_UPDATE:
-               {
-                       ARegion *ar = CTX_wm_region(C);
-                       Object *ob = CTX_data_active_object(C);
-                       Lamp *la = ob->data;
-                       float value[3], len;
-
-                       RNA_float_get_array(op->ptr, "value", value);
-
-                       sub_v3_v3(value, ob->obmat[3]);
-
-                       len = len_v3(value);
-
-                       la->spotsize = len * 0.1f;
-                       DAG_id_tag_update(&ob->id, OB_RECALC_OB);
-
-                       ED_region_tag_redraw(ar);
-                       break;
-               }
-
-               case EVT_WIDGET_RELEASED:
-               {
-                       MEM_freeN(op->customdata);
-                       return OPERATOR_FINISHED;
-               }
-       }
-
-       return OPERATOR_RUNNING_MODAL;
-}
-
-static int lamp_position_poll(bContext *C)
-{
-       return CTX_wm_region_view3d(C) != NULL;
-}
-
-
-void LAMP_OT_lamp_position(struct wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name = "Lamp Position";
-       ot->idname = "UI_OT_lamp_position";
-       ot->description = "Sample a color from the Blender Window to store in a 
property";
-
-       /* api callbacks */
-       ot->invoke = lamp_position_invoke;
-       ot->modal = lamp_position_modal;
-       ot->poll = lamp_position_poll;
-
-       /* flags */
-       ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO;
-
-       /* properties */
-       RNA_def_float_vector_xyz(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, 
"Vector", "", -FLT_MAX, FLT_MAX);
-}
-
-int WIDGETGROUP_lamp_poll(const struct bContext *C, struct wmWidgetGroupType 
*UNUSED(wgrouptype))
-{
-       Object *ob = CTX_data_active_object(C);
-
-       if (ob && ob->type == OB_LAMP) {
-               Lamp *la = ob->data;
-               return (la->type == LA_SPOT);
-       }
-       return false;
-}
-
-void WIDGETGROUP_lamp_create(const struct bContext *C, struct wmWidgetGroup 
*wgroup)
-{
-       Object *ob = CTX_data_active_object(C);
-       Lamp *la = ob->data;
-       wmWidget *widget;
-       PointerRNA ptr;
-       float dir[3];
-       const char *propname = "spot_size";
-
-       const float color[4] = {0.5f, 0.5f, 1.0f, 1.0f};
-       const float color_hi[4] = {0.8f, 0.8f, 0.45f, 1.0f};
-
-
-       negate_v3_v3(dir, ob->obmat[2]);
-
-       widget = WIDGET_arrow_new(wgroup, propname, 
WIDGET_ARROW_STYLE_INVERTED);
-
-       RNA_pointer_create(&la->id, &RNA_Lamp, la, &ptr);
-       WIDGET_arrow_set_range_fac(widget, 4.0f);
-       WIDGET_arrow_set_direction(widget, dir);
-       WM_widget_set_origin(widget, ob->obmat[3]);
-       WM_widget_set_colors(widget, color, color_hi);
-       WM_widget_set_property(widget, ARROW_SLOT_OFFSET_WORLD_SPACE, &ptr, 
propname);
-}
diff --git a/source/blender/editors/object/object_ops.c 
b/source/blender/editors/object/object_ops.c
index 2a4f0a0..aa48983 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -259,8 +259,6 @@ void ED_operatortypes_object(void)
 
        WM_operatortype_append(TRANSFORM_OT_vertex_random);
 
-       WM_operatortype_append(LAMP_OT_lamp_position);
-
        WM_operatortype_append(OBJECT_OT_data_transfer);
        WM_operatortype_append(OBJECT_OT_datalayout_transfer);
 
diff --git a/source/blender/editors/space_graph/graph_edit.c 
b/source/blender/editors/space_graph/graph_edit.c
index 8b9c52b..d46c4d7 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -2614,7 +2614,6 @@ static int graph_widget_backdrop_transform_modal(bContext 
*C, wmOperator *op, co
 
        switch (event->type) {
                case EVT_WIDGET_UPDATE:
-               case EVT_WIDGET_RELEASED:
                {
                        SpaceIpo *sipo = CTX_wm_space_graph(C);
                        RNA_float_get_array(op->ptr, "offset", 
sipo->backdrop_offset);
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c 
b/source/blender/editors/space_sequencer/sequencer_view.c
index 790fcc0..000dddc 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -341,7 +341,6 @@ static int sequencer_overdrop_transform_modal(bContext *C, 
wmOperator *op, const
        
        switch (event->type) {
                case EVT_WIDGET_UPDATE:
-               case EVT_WIDGET_RELEASED:
                {
                        SpaceSeq *sseq = CTX_wm_space_seq(C);
                        RNA_float_get_array(op->ptr, "offset", 
sseq->overdrop_offset);
diff --git a/source/blender/editors/space_view3d/view3d_widgets.c 
b/source/blender/editors/space_view3d/view3d_widgets.c
index c63d1a7..e23cea7 100644
--- a/source/blender/editors/space_view3d/view3d_widgets.c
+++ b/source/blender/editors/space_view3d/view3d_widgets.c
@@ -37,6 +37,7 @@
 #include "DNA_camera_types.h"
 #include "DNA_object_types.h"
 #include "DNA_object_force.h"
+#include "DNA_lamp_types.h"
 
 #include "ED_armature.h"
 #include "ED_screen.h"
@@ -49,6 +50,42 @@
 #include "view3d_intern.h"  /* own include */
 
 
+int WIDGETGROUP_lamp_poll(const struct bContext *C, struct wmWidgetGroupType 
*UNUSED(wgrouptype))
+{
+       Object *ob = CTX_data_active_object(C);
+
+       if (ob && ob->type == OB_LAMP) {
+               Lamp *la = ob->data;
+               return (la->type == LA_SPOT);
+       }
+       return false;
+}
+
+void WIDGETGROUP_lamp_create(const struct bContext *C, struct wmWidgetGroup 
*wgroup)
+{
+       Object *ob = CTX_data_active_object(C);
+       Lamp *la = ob->data;
+       wmWidget *widget;
+       PointerRNA ptr;
+       float dir[3];
+       const char *propname = "spot_size";
+
+       const float color[4] = {0.5f, 0.5f, 1.0f, 1.0f};
+       const float color_hi[4] = {0.8f, 0.8f, 0.45f, 1.0f};
+
+
+       negat

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to