Revision: 19350
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19350
Author: theeth
Date: 2009-03-22 01:30:18 +0100 (Sun, 22 Mar 2009)
Log Message:
-----------
First part of operatorizing etch-a-ton in 2.5
Polyline, selection and a couple of others work. (note that polyline is
shift-click because click is taken by 3d cursor. Needs a way to overwrite lower
maps).
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/armature/BIF_generate.h
branches/blender2.5/blender/source/blender/editors/armature/armature_intern.h
branches/blender2.5/blender/source/blender/editors/armature/armature_ops.c
branches/blender2.5/blender/source/blender/editors/armature/editarmature_generate.c
branches/blender2.5/blender/source/blender/editors/armature/editarmature_sketch.c
branches/blender2.5/blender/source/blender/editors/include/ED_armature.h
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_view.c
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_init_exit.c
Modified:
branches/blender2.5/blender/source/blender/editors/armature/BIF_generate.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/armature/BIF_generate.h
2009-03-21 16:03:26 UTC (rev 19349)
+++ branches/blender2.5/blender/source/blender/editors/armature/BIF_generate.h
2009-03-22 00:30:18 UTC (rev 19350)
@@ -23,21 +23,21 @@
#ifndef BIF_GENERATE_H
#define BIF_GENERATE_H
-struct bContext;
+struct ToolSettings;
struct EditBone;
struct BArcIterator;
struct bArmature;
struct ListBase;
-typedef int(NextSubdivisionFunc)(struct bContext*, struct BArcIterator*, int,
int, float[3], float[3]);
+typedef int(NextSubdivisionFunc)(struct ToolSettings*, struct BArcIterator*,
int, int, float[3], float[3]);
float calcArcCorrelation(struct BArcIterator *iter, int start, int end, float
v0[3], float n[3]);
-int nextFixedSubdivision(struct bContext *C, struct BArcIterator *iter, int
start, int end, float head[3], float p[3]);
-int nextLengthSubdivision(struct bContext *C, struct BArcIterator *iter, int
start, int end, float head[3], float p[3]);
-int nextAdaptativeSubdivision(struct bContext *C, struct BArcIterator *iter,
int start, int end, float head[3], float p[3]);
+int nextFixedSubdivision(struct ToolSettings *toolsettings, struct
BArcIterator *iter, int start, int end, float head[3], float p[3]);
+int nextLengthSubdivision(struct ToolSettings *toolsettings, struct
BArcIterator *iter, int start, int end, float head[3], float p[3]);
+int nextAdaptativeSubdivision(struct ToolSettings *toolsettings, struct
BArcIterator *iter, int start, int end, float head[3], float p[3]);
-struct EditBone * subdivideArcBy(struct bContext *C, struct bArmature *arm,
ListBase *editbones, struct BArcIterator *iter, float invmat[][4], float
tmat[][3], NextSubdivisionFunc next_subdividion);
+struct EditBone * subdivideArcBy(struct ToolSettings *toolsettings, struct
bArmature *arm, ListBase *editbones, struct BArcIterator *iter, float
invmat[][4], float tmat[][3], NextSubdivisionFunc next_subdividion);
void setBoneRollFromNormal(struct EditBone *bone, float *no, float
invmat[][4], float tmat[][3]);
Modified:
branches/blender2.5/blender/source/blender/editors/armature/armature_intern.h
===================================================================
---
branches/blender2.5/blender/source/blender/editors/armature/armature_intern.h
2009-03-21 16:03:26 UTC (rev 19349)
+++
branches/blender2.5/blender/source/blender/editors/armature/armature_intern.h
2009-03-22 00:30:18 UTC (rev 19350)
@@ -61,6 +61,15 @@
void POSE_OT_select_hierarchy(struct wmOperatorType *ot);
void POSE_OT_select_connected(struct wmOperatorType *ot);
+void SKETCH_OT_gesture(struct wmOperatorType *ot);
+void SKETCH_OT_delete(struct wmOperatorType *ot);
+void SKETCH_OT_draw_poly(struct wmOperatorType *ot);
+void SKETCH_OT_draw_stroke(struct wmOperatorType *ot);
+void SKETCH_OT_draw_preview(struct wmOperatorType *ot);
+void SKETCH_OT_finish_stroke(struct wmOperatorType *ot);
+void SKETCH_OT_cancel_stroke(struct wmOperatorType *ot);
+void SKETCH_OT_select(struct wmOperatorType *ot);
+
/* editarmature.c */
struct bArmature;
struct EditBone;
Modified:
branches/blender2.5/blender/source/blender/editors/armature/armature_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/armature/armature_ops.c
2009-03-21 16:03:26 UTC (rev 19349)
+++ branches/blender2.5/blender/source/blender/editors/armature/armature_ops.c
2009-03-22 00:30:18 UTC (rev 19350)
@@ -129,7 +129,17 @@
WM_operatortype_append(ARMATURE_OT_duplicate_selected);
WM_operatortype_append(ARMATURE_OT_extrude);
WM_operatortype_append(ARMATURE_OT_click_extrude);
-
+
+ /* SKETCH */
+ WM_operatortype_append(SKETCH_OT_gesture);
+ WM_operatortype_append(SKETCH_OT_delete);
+ WM_operatortype_append(SKETCH_OT_draw_poly);
+ WM_operatortype_append(SKETCH_OT_draw_stroke);
+ WM_operatortype_append(SKETCH_OT_draw_preview);
+ WM_operatortype_append(SKETCH_OT_finish_stroke);
+ WM_operatortype_append(SKETCH_OT_cancel_stroke);
+ WM_operatortype_append(SKETCH_OT_select);
+
/* POSE */
WM_operatortype_append(POSE_OT_hide);
WM_operatortype_append(POSE_OT_reveal);
@@ -197,6 +207,22 @@
RNA_boolean_set(kmi->ptr, "forked", 1);
WM_keymap_add_item(keymap, "ARMATURE_OT_click_extrude", LEFTMOUSE,
KM_PRESS, KM_CTRL, 0);
+ /* Armature ------------------------ */
+// keymap= WM_keymap_listbase(wm, "Sketch", 0, 0);
+
+ WM_keymap_add_item(keymap, "SKETCH_OT_gesture", EVT_TWEAK_S, KM_ANY, 0,
0);
+ WM_keymap_add_item(keymap, "SKETCH_OT_delete", XKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "SKETCH_OT_draw_poly", ACTIONMOUSE,
KM_PRESS, KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_poly", ACTIONMOUSE,
KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+ RNA_boolean_set(kmi->ptr, "snap", 1);
+ WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE, KM_ANY,
KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE,
KM_ANY, KM_SHIFT|KM_CTRL, 0);
+ RNA_boolean_set(kmi->ptr, "snap", 1);
+ WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", EVT_TWEAK_A,
KM_ANY, 0, 0);
+ WM_keymap_add_item(keymap, "SKETCH_OT_finish_stroke", SELECTMOUSE,
KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "SKETCH_OT_cancel_stroke", ESCKEY, KM_PRESS,
0, 0);
+ WM_keymap_add_item(keymap, "SKETCH_OT_select", SELECTMOUSE, KM_PRESS,
0, 0);
+
/* Pose ------------------------ */
/* only set in posemode, by space_view3d listener */
keymap= WM_keymap_listbase(wm, "Pose", 0, 0);
Modified:
branches/blender2.5/blender/source/blender/editors/armature/editarmature_generate.c
===================================================================
---
branches/blender2.5/blender/source/blender/editors/armature/editarmature_generate.c
2009-03-21 16:03:26 UTC (rev 19349)
+++
branches/blender2.5/blender/source/blender/editors/armature/editarmature_generate.c
2009-03-22 00:30:18 UTC (rev 19350)
@@ -46,6 +46,7 @@
#include "BKE_context.h"
#include "ED_armature.h"
+#include "armature_intern.h"
#include "BIF_generate.h"
void setBoneRollFromNormal(EditBone *bone, float *no, float invmat[][4], float
tmat[][3])
@@ -120,12 +121,11 @@
}
}
-int nextFixedSubdivision(bContext *C, BArcIterator *iter, int start, int end,
float head[3], float p[3])
+int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int
start, int end, float head[3], float p[3])
{
static float stroke_length = 0;
static float current_length;
static char n;
- Scene *scene = CTX_data_scene(C);
float *v1, *v2;
float length_threshold;
int i;
@@ -153,7 +153,7 @@
n++;
- length_threshold = n * stroke_length /
scene->toolsettings->skgen_subdivision_number;
+ length_threshold = n * stroke_length /
toolsettings->skgen_subdivision_number;
IT_peek(iter, start);
v1 = iter->p;
@@ -179,10 +179,9 @@
return -1;
}
-int nextAdaptativeSubdivision(bContext *C, BArcIterator *iter, int start, int
end, float head[3], float p[3])
+int nextAdaptativeSubdivision(ToolSettings *toolsettings, BArcIterator *iter,
int start, int end, float head[3], float p[3])
{
- Scene *scene = CTX_data_scene(C);
- float correlation_threshold =
scene->toolsettings->skgen_correlation_limit;
+ float correlation_threshold = toolsettings->skgen_correlation_limit;
float *start_p;
float n[3];
int i;
@@ -207,10 +206,9 @@
return -1;
}
-int nextLengthSubdivision(bContext *C, BArcIterator *iter, int start, int end,
float head[3], float p[3])
+int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int
start, int end, float head[3], float p[3])
{
- Scene *scene = CTX_data_scene(C);
- float lengthLimit = scene->toolsettings->skgen_length_limit;
+ float lengthLimit = toolsettings->skgen_length_limit;
int same = 1;
int i;
@@ -282,7 +280,7 @@
return -1;
}
-EditBone * subdivideArcBy(bContext *C, bArmature *arm, ListBase *editbones,
BArcIterator *iter, float invmat[][4], float tmat[][3], NextSubdivisionFunc
next_subdividion)
+EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase
*editbones, BArcIterator *iter, float invmat[][4], float tmat[][3],
NextSubdivisionFunc next_subdividion)
{
EditBone *lastBone = NULL;
EditBone *child = NULL;
@@ -296,7 +294,7 @@
parent = addEditBone(arm, "Bone");
VECCOPY(parent->head, iter->p);
- index = next_subdividion(C, iter, bone_start, end, parent->head,
parent->tail);
+ index = next_subdividion(toolsettings, iter, bone_start, end,
parent->head, parent->tail);
while (index != -1)
{
IT_peek(iter, index);
@@ -314,7 +312,7 @@
parent = child; // new child is next parent
bone_start = index; // start next bone from current index
- index = next_subdividion(C, iter, bone_start, end,
parent->head, parent->tail);
+ index = next_subdividion(toolsettings, iter, bone_start, end,
parent->head, parent->tail);
}
iter->tail(iter);
Modified:
branches/blender2.5/blender/source/blender/editors/armature/editarmature_sketch.c
===================================================================
---
branches/blender2.5/blender/source/blender/editors/armature/editarmature_sketch.c
2009-03-21 16:03:26 UTC (rev 19349)
+++
branches/blender2.5/blender/source/blender/editors/armature/editarmature_sketch.c
2009-03-22 00:30:18 UTC (rev 19350)
@@ -35,6 +35,9 @@
#include "DNA_armature_types.h"
#include "DNA_userdef_types.h"
+#include "RNA_define.h"
+#include "RNA_access.h"
+
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "BLI_graph.h"
@@ -48,6 +51,7 @@
#include "BKE_context.h"
#include "ED_view3d.h"
+#include "ED_screen.h"
#include "BIF_gl.h"
#include "UI_resources.h"
@@ -63,6 +67,7 @@
#include "BIF_transform.h"
+#include "WM_api.h"
#include "WM_types.h"
//#include "blendef.h"
@@ -1059,7 +1064,7 @@
// glEnd();
}
-void drawSubdividedStrokeBy(bContext *C, BArcIterator *iter,
NextSubdivisionFunc next_subdividion)
+void drawSubdividedStrokeBy(ToolSettings *toolsettings, BArcIterator *iter,
NextSubdivisionFunc next_subdividion)
{
float head[3], tail[3];
int bone_start = 0;
@@ -1073,7 +1078,7 @@
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) * 2);
glBegin(GL_POINTS);
- index = next_subdividion(C, iter, bone_start, end, head, tail);
+ index = next_subdividion(toolsettings, iter, bone_start, end, head,
tail);
while (index != -1)
{
@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs