[Bf-blender-cvs] [b0c0505] wiggly-widgets: Facemap bones now draw properly. It's not possible yet to select the bones so use with caution.
Antony Riakiotakis
noreply at git.blender.org
Wed Dec 17 18:52:08 CET 2014
Commit: b0c0505624b70aba97eecd7d5fa91fdc7c68a318
Author: Antony Riakiotakis
Date: Wed Dec 17 18:51:49 2014 +0100
Branches: wiggly-widgets
https://developer.blender.org/rBb0c0505624b70aba97eecd7d5fa91fdc7c68a318
Facemap bones now draw properly. It's not possible yet to select the
bones so use with caution.
===================================================================
M source/blender/editors/space_view3d/drawobject.c
M source/blender/editors/space_view3d/space_view3d.c
M source/blender/windowmanager/WM_api.h
M source/blender/windowmanager/intern/wm_generic_widgets.c
===================================================================
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index db9fe51..6546a60 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -4013,9 +4013,6 @@ static bool draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3
draw_mesh_fancy(scene, ar, v3d, rv3d, base, dt, ob_wire_col, dflag);
GPU_end_object_materials();
-
- if (ob->fmaps.first)
- ED_draw_object_facemap(scene, ob, ob->actfmap - 1);
if (me->totvert == 0) retval = true;
}
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 7724014..833b992 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -32,6 +32,7 @@
#include <string.h>
#include <stdio.h>
+#include "DNA_armature_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -780,16 +781,9 @@ static int WIDGETGROUP_armature_facemap_poll(const struct bContext *C, struct wm
{
Object *ob = CTX_data_active_object(C);
- if (ob && ob->type == OB_MESH) {
- Key *key = BKE_key_from_object(ob);
- KeyBlock *kb;
-
- if (key == NULL)
- return false;
-
- kb = BLI_findlink(&key->block, ob->shapenr - 1);
-
- if (kb)
+ if (ob && ob->type == OB_ARMATURE) {
+ bArmature *arm = ob->data;
+ if (!arm->edbo)
return true;
}
return false;
@@ -799,20 +793,20 @@ static void WIDGETGROUP_armature_facemap_draw(const struct bContext *C, struct w
{
float color_shape[4] = {1.0f, 0.3f, 0.0f, 1.0f};
Object *ob = CTX_data_active_object(C);
- Key *key = BKE_key_from_object(ob);
- KeyBlock *kb = BLI_findlink(&key->block, ob->shapenr - 1);
wmWidget *widget;
- PointerRNA shapeptr;
- float dir[3];
- widget = WIDGET_arrow_new(wgroup, WIDGET_ARROW_STYLE_NORMAL);
- WM_widget_set_3d_scale(widget, false);
- WIDGET_arrow_set_color(widget, color_shape);
- RNA_pointer_create(&key->id, &RNA_ShapeKey, kb, &shapeptr);
- WM_widget_set_origin(widget, ob->obmat[3]);
- WM_widget_property(widget, ARROW_SLOT_OFFSET_WORLD_SPACE, &shapeptr, "value");
- negate_v3_v3(dir, ob->obmat[2]);
- WIDGET_arrow_set_direction(widget, dir);
+ //bArmature *arm = ob->data;
+ bPoseChannel *pchan;
+
+ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+ if (pchan->custom && pchan->custom_fmap) {
+ int index = BLI_findindex(&pchan->custom->fmaps, pchan->custom_fmap);
+ if (index != -1) {
+ widget = WIDGET_facemap_new(wgroup, 0, pchan->custom, index);
+ WIDGET_facemap_set_color(widget, color_shape);
+ }
+ }
+ }
}
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 45176ae..7815d36 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -545,6 +545,7 @@ void WIDGET_dial_set_direction(struct wmWidget *widget, float direction[3]);
struct wmWidget *WIDGET_rect_transform_new(struct wmWidgetGroup *wgroup, int style, float width, float height);
struct wmWidget *WIDGET_facemap_new(struct wmWidgetGroup *wgroup, int style, struct Object *ob, int facemap);
+void WIDGET_facemap_set_color(struct wmWidget *widget, float color[4]);
#ifdef WITH_INPUT_IME
bool WM_event_is_ime_switch(const struct wmEvent *event);
diff --git a/source/blender/windowmanager/intern/wm_generic_widgets.c b/source/blender/windowmanager/intern/wm_generic_widgets.c
index 0bb50a7..5a66bad 100644
--- a/source/blender/windowmanager/intern/wm_generic_widgets.c
+++ b/source/blender/windowmanager/intern/wm_generic_widgets.c
@@ -1062,6 +1062,7 @@ typedef struct FacemapWidget {
Object *ob;
int facemap;
int style;
+ float color[4];
} FacemapWidget;
@@ -1074,6 +1075,11 @@ static void widget_facemap_draw(struct wmWidget *widget, const struct bContext *
glPopMatrix();
}
+void WIDGET_facemap_set_color(struct wmWidget *widget, float color[4])
+{
+ FacemapWidget *fmap_widget = (FacemapWidget *)widget;
+ copy_v4_v4(fmap_widget->color, color);
+}
struct wmWidget *WIDGET_facemap_new(struct wmWidgetGroup *wgroup, int style, struct Object *ob, int facemap)
{
@@ -1084,7 +1090,6 @@ struct wmWidget *WIDGET_facemap_new(struct wmWidgetGroup *wgroup, int style, str
// fmap_widget->widget.bind_to_prop = NULL;
// fmap_widget->widget.handler = NULL;
fmap_widget->widget.render_3d_intersection = NULL;
- fmap_widget->widget.max_prop = 2;
fmap_widget->ob = ob;
fmap_widget->facemap = facemap;
fmap_widget->style = style;
More information about the Bf-blender-cvs
mailing list