Пример #1
0
/*
 * Set the constraint according to the user defined orientation
 *
 * ftext is a format string passed to BLI_snprintf. It will add the name of
 * the orientation where %s is (logically).
 */
void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[])
{
  char text[256];

  switch (orientation) {
    case V3D_ORIENT_GLOBAL: {
      float mtx[3][3];
      BLI_snprintf(text, sizeof(text), ftext, IFACE_("global"));
      unit_m3(mtx);
      setConstraint(t, mtx, mode, text);
      break;
    }
    case V3D_ORIENT_LOCAL:
      BLI_snprintf(text, sizeof(text), ftext, IFACE_("local"));
      setLocalConstraint(t, mode, text);
      break;
    case V3D_ORIENT_NORMAL:
      BLI_snprintf(text, sizeof(text), ftext, IFACE_("normal"));
      if (checkUseAxisMatrix(t)) {
        setAxisMatrixConstraint(t, mode, text);
      }
      else {
        setConstraint(t, t->spacemtx, mode, text);
      }
      break;
    case V3D_ORIENT_VIEW:
      BLI_snprintf(text, sizeof(text), ftext, IFACE_("view"));
      setConstraint(t, t->spacemtx, mode, text);
      break;
    case V3D_ORIENT_CURSOR:
      BLI_snprintf(text, sizeof(text), ftext, IFACE_("cursor"));
      setConstraint(t, t->spacemtx, mode, text);
      break;
    case V3D_ORIENT_GIMBAL:
      BLI_snprintf(text, sizeof(text), ftext, IFACE_("gimbal"));
      setConstraint(t, t->spacemtx, mode, text);
      break;
    case V3D_ORIENT_CUSTOM_MATRIX:
      BLI_snprintf(text, sizeof(text), ftext, IFACE_("custom matrix"));
      setConstraint(t, t->spacemtx, mode, text);
      break;
    case V3D_ORIENT_CUSTOM: {
      char orientation_str[128];
      BLI_snprintf(orientation_str,
                   sizeof(orientation_str),
                   "%s \"%s\"",
                   IFACE_("custom orientation"),
                   t->orientation.custom->name);
      BLI_snprintf(text, sizeof(text), ftext, orientation_str);
      setConstraint(t, t->spacemtx, mode, text);
      break;
    }
  }

  t->con.orientation = orientation;

  t->con.mode |= CON_USER;
}
Пример #2
0
void setLocalConstraint(TransInfo *t, int mode, const char text[])
{
	/* edit-mode now allows local transforms too */
	if (t->flag & T_EDIT) {
		setConstraint(t, t->obedit_mat, mode, text);
	}
	else {
		setAxisMatrixConstraint(t, mode, text);
	}
}
Пример #3
0
void setLocalConstraint(TransInfo *t, int mode, const char text[])
{
  /* edit-mode now allows local transforms too */
  if (t->flag & T_EDIT) {
    /* Use the active (first) edit object. */
    TransDataContainer *tc = t->data_container;
    setConstraint(t, tc->mat3_unit, mode, text);
  }
  else {
    setAxisMatrixConstraint(t, mode, text);
  }
}
Пример #4
0
/*
 * Set the constraint according to the user defined orientation
 *
 * ftext is a format string passed to BLI_snprintf. It will add the name of
 * the orientation where %s is (logically).
 */
void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[])
{
	char text[40];

	switch (orientation) {
		case V3D_MANIP_GLOBAL:
		{
			float mtx[3][3];
			BLI_snprintf(text, sizeof(text), ftext, IFACE_("global"));
			unit_m3(mtx);
			setConstraint(t, mtx, mode, text);
			break;
		}
		case V3D_MANIP_LOCAL:
			BLI_snprintf(text, sizeof(text), ftext, IFACE_("local"));
			setLocalConstraint(t, mode, text);
			break;
		case V3D_MANIP_NORMAL:
			BLI_snprintf(text, sizeof(text), ftext, IFACE_("normal"));
			if (checkUseAxisMatrix(t)) {
				setAxisMatrixConstraint(t, mode, text);
			}
			else {
				setConstraint(t, t->spacemtx, mode, text);
			}
			break;
		case V3D_MANIP_VIEW:
			BLI_snprintf(text, sizeof(text), ftext, IFACE_("view"));
			setConstraint(t, t->spacemtx, mode, text);
			break;
		case V3D_MANIP_GIMBAL:
			BLI_snprintf(text, sizeof(text), ftext, IFACE_("gimbal"));
			setConstraint(t, t->spacemtx, mode, text);
			break;
		default: /* V3D_MANIP_CUSTOM */
			BLI_snprintf(text, sizeof(text), ftext, t->spacename);
			setConstraint(t, t->spacemtx, mode, text);
			break;
	}

	t->con.orientation = orientation;

	t->con.mode |= CON_USER;
}