forked from bartvdbraak/blender
2.5 - Giving shapekeys UI a bit of attention
* Separated value and range sliders for the value into two separate rows. Value comes before the range settings since it's used more often, and is drawn as a slider instead. * Tweaked ranges for the sliders so that they will work sanely.
This commit is contained in:
parent
dc90e758b4
commit
78bbe5c479
@ -125,7 +125,11 @@ class DATA_PT_shape_keys(DataButtonsPanel):
|
|||||||
if ob.active_shape_key_index != 0:
|
if ob.active_shape_key_index != 0:
|
||||||
if not ob.shape_key_lock:
|
if not ob.shape_key_lock:
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.itemR(kb, "value", text="")
|
row.itemL(text="Value:")
|
||||||
|
row.itemR(kb, "value", text="", slider=True)
|
||||||
|
|
||||||
|
row = layout.row(align=True);
|
||||||
|
row.itemL(text="Range:")
|
||||||
row.itemR(kb, "slider_min", text="Min")
|
row.itemR(kb, "slider_min", text="Min")
|
||||||
row.itemR(kb, "slider_max", text="Max")
|
row.itemR(kb, "slider_max", text="Max")
|
||||||
|
|
||||||
|
@ -164,14 +164,20 @@ static KeyBlock *add_keyblock(Scene *scene, Key *key)
|
|||||||
kb= MEM_callocN(sizeof(KeyBlock), "Keyblock");
|
kb= MEM_callocN(sizeof(KeyBlock), "Keyblock");
|
||||||
BLI_addtail(&key->block, kb);
|
BLI_addtail(&key->block, kb);
|
||||||
kb->type= KEY_CARDINAL;
|
kb->type= KEY_CARDINAL;
|
||||||
|
|
||||||
tot= BLI_countlist(&key->block);
|
tot= BLI_countlist(&key->block);
|
||||||
if(tot==1) strcpy(kb->name, "Basis");
|
if(tot==1) strcpy(kb->name, "Basis");
|
||||||
else sprintf(kb->name, "Key %d", tot-1);
|
else sprintf(kb->name, "Key %d", tot-1);
|
||||||
|
|
||||||
|
// XXX this is old anim system stuff? (i.e. the 'index' of the shapekey)
|
||||||
kb->adrcode= tot-1;
|
kb->adrcode= tot-1;
|
||||||
|
|
||||||
key->totkey++;
|
key->totkey++;
|
||||||
if(key->totkey==1) key->refkey= kb;
|
if(key->totkey==1) key->refkey= kb;
|
||||||
|
|
||||||
|
kb->slidermin= 0.0f;
|
||||||
|
kb->slidermax= 1.0f;
|
||||||
|
|
||||||
// XXX kb->pos is the confusing old horizontal-line RVK crap in old IPO Editor...
|
// XXX kb->pos is the confusing old horizontal-line RVK crap in old IPO Editor...
|
||||||
if(key->type == KEY_RELATIVE)
|
if(key->type == KEY_RELATIVE)
|
||||||
kb->pos= curpos+0.1;
|
kb->pos= curpos+0.1;
|
||||||
|
@ -93,6 +93,7 @@
|
|||||||
//#include "BSE_view.h"
|
//#include "BSE_view.h"
|
||||||
|
|
||||||
#include "ED_image.h"
|
#include "ED_image.h"
|
||||||
|
#include "ED_keyframing.h"
|
||||||
#include "ED_screen.h"
|
#include "ED_screen.h"
|
||||||
#include "ED_space_api.h"
|
#include "ED_space_api.h"
|
||||||
#include "ED_markers.h"
|
#include "ED_markers.h"
|
||||||
@ -298,6 +299,10 @@ static void viewRedrawForce(bContext *C, TransInfo *t)
|
|||||||
{
|
{
|
||||||
/* Do we need more refined tags? */
|
/* Do we need more refined tags? */
|
||||||
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
|
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
|
||||||
|
|
||||||
|
/* for realtime animation record - send notifiers recognised by animation editors */
|
||||||
|
if ((t->animtimer) && IS_AUTOKEY_ON(t->scene))
|
||||||
|
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, NULL);
|
||||||
}
|
}
|
||||||
else if (t->spacetype == SPACE_ACTION) {
|
else if (t->spacetype == SPACE_ACTION) {
|
||||||
//SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
|
//SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
|
||||||
|
@ -758,8 +758,7 @@ void recalcData(TransInfo *t)
|
|||||||
* (i.e. uneditable animation values)
|
* (i.e. uneditable animation values)
|
||||||
*/
|
*/
|
||||||
// TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
|
// TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
|
||||||
// TODO: maybe the ob->adt check isn't really needed? makes it too difficult to use...
|
if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
|
||||||
if (/*(ob->adt) && */(t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
|
|
||||||
short targetless_ik= (t->flag & T_AUTOIK); // XXX this currently doesn't work, since flags aren't set yet!
|
short targetless_ik= (t->flag & T_AUTOIK); // XXX this currently doesn't work, since flags aren't set yet!
|
||||||
|
|
||||||
animrecord_check_state(t->scene, &ob->id, t->animtimer);
|
animrecord_check_state(t->scene, &ob->id, t->animtimer);
|
||||||
@ -790,8 +789,7 @@ void recalcData(TransInfo *t)
|
|||||||
* (i.e. uneditable animation values)
|
* (i.e. uneditable animation values)
|
||||||
*/
|
*/
|
||||||
// TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
|
// TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
|
||||||
// TODO: maybe the ob->adt check isn't really needed? makes it too difficult to use...
|
if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
|
||||||
if (/*(ob->adt) && */(t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
|
|
||||||
animrecord_check_state(t->scene, &ob->id, t->animtimer);
|
animrecord_check_state(t->scene, &ob->id, t->animtimer);
|
||||||
autokeyframe_ob_cb_func(t->scene, (View3D *)t->view, ob, t->mode);
|
autokeyframe_ob_cb_func(t->scene, (View3D *)t->view, ob, t->mode);
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,21 @@
|
|||||||
#include "WM_api.h"
|
#include "WM_api.h"
|
||||||
#include "WM_types.h"
|
#include "WM_types.h"
|
||||||
|
|
||||||
|
static void rna_ShapeKey_value_set(PointerRNA *ptr, float value)
|
||||||
|
{
|
||||||
|
KeyBlock *data= (KeyBlock*)ptr->data;
|
||||||
|
CLAMP(value, data->slidermin, data->slidermax);
|
||||||
|
data->curval= value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rna_ShapeKey_value_range(PointerRNA *ptr, float *min, float *max)
|
||||||
|
{
|
||||||
|
KeyBlock *data= (KeyBlock*)ptr->data;
|
||||||
|
|
||||||
|
*min= data->slidermin;
|
||||||
|
*max= data->slidermax;
|
||||||
|
}
|
||||||
|
|
||||||
static Key *rna_ShapeKey_find_key(ID *id)
|
static Key *rna_ShapeKey_find_key(ID *id)
|
||||||
{
|
{
|
||||||
switch(GS(id->name)) {
|
switch(GS(id->name)) {
|
||||||
@ -345,6 +360,7 @@ static void rna_def_keyblock(BlenderRNA *brna)
|
|||||||
/* for now, this is editable directly, as users can set this even if they're not animating them (to test results) */
|
/* for now, this is editable directly, as users can set this even if they're not animating them (to test results) */
|
||||||
prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
|
prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
|
||||||
RNA_def_property_float_sdna(prop, NULL, "curval");
|
RNA_def_property_float_sdna(prop, NULL, "curval");
|
||||||
|
RNA_def_property_float_funcs(prop, NULL, "rna_ShapeKey_value_set", "rna_ShapeKey_value_range");
|
||||||
RNA_def_property_ui_text(prop, "Value", "Value of shape key at the current frame.");
|
RNA_def_property_ui_text(prop, "Value", "Value of shape key at the current frame.");
|
||||||
RNA_def_property_update(prop, 0, "rna_Key_update_data");
|
RNA_def_property_update(prop, 0, "rna_Key_update_data");
|
||||||
|
|
||||||
@ -380,6 +396,7 @@ static void rna_def_keyblock(BlenderRNA *brna)
|
|||||||
prop= RNA_def_property(srna, "slider_max", PROP_FLOAT, PROP_NONE);
|
prop= RNA_def_property(srna, "slider_max", PROP_FLOAT, PROP_NONE);
|
||||||
RNA_def_property_float_sdna(prop, NULL, "slidermax");
|
RNA_def_property_float_sdna(prop, NULL, "slidermax");
|
||||||
RNA_def_property_range(prop, -10.0f, 10.0f);
|
RNA_def_property_range(prop, -10.0f, 10.0f);
|
||||||
|
RNA_def_property_float_default(prop, 1.0f);
|
||||||
RNA_def_property_ui_text(prop, "Slider Max", "Maximum for slider.");
|
RNA_def_property_ui_text(prop, "Slider Max", "Maximum for slider.");
|
||||||
|
|
||||||
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
|
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
|
||||||
|
Loading…
Reference in New Issue
Block a user