示例#1
0
static FCurve *ui_but_get_fcurve(uiBut *but, AnimData **adt, bAction **action, bool *r_driven, bool *r_special)
{
	/* for entire array buttons we check the first component, it's not perfect
	 * but works well enough in typical cases */
	int rnaindex = (but->rnaindex == -1) ? 0 : but->rnaindex;

	return rna_get_fcurve_context_ui(but->block->evil_C, &but->rnapoin, but->rnaprop, rnaindex, adt, action, r_driven, r_special);
}
示例#2
0
static bool add_driver_button_poll(bContext *C)
{
  PointerRNA ptr = {{NULL}};
  PropertyRNA *prop = NULL;
  int index;
  bool driven, special;

  /* this operator can only run if there's a property button active, and it can be animated */
  UI_context_active_but_prop_get(C, &ptr, &prop, &index);

  if (!(ptr.id.data && ptr.data && prop)) {
    return false;
  }
  if (!RNA_property_animateable(&ptr, prop)) {
    return false;
  }

  /* Don't do anything if there is an fcurve for animation without a driver. */
  FCurve *fcu = rna_get_fcurve_context_ui(C, &ptr, prop, index, NULL, NULL, &driven, &special);
  return (fcu == NULL || fcu->driver);
}