当前位置: 首页>>代码示例>>C++>>正文


C++ Application::getCurrentFrame方法代码示例

本文整理汇总了C++中ttool::Application::getCurrentFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ Application::getCurrentFrame方法的具体用法?C++ Application::getCurrentFrame怎么用?C++ Application::getCurrentFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ttool::Application的用法示例。


在下文中一共展示了Application::getCurrentFrame方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: multiAutocloseRegion

 void multiAutocloseRegion(TStroke *stroke, const TMouseEvent &e) {
   TTool::Application *app = TTool::getApplication();
   if (m_firstStroke) {
     multiApplyAutoclose(m_firstFrameId, getFrameId(), TRectD(), TRectD(),
                         m_firstStroke, stroke);
     invalidate();
     if (e.isShiftPressed()) {
       delete m_firstStroke;
       m_firstStroke  = new TStroke(*stroke);
       m_firstFrameId = getFrameId();
     } else {
       if (m_isXsheetCell) {
         app->getCurrentColumn()->setColumnIndex(m_currCell.first);
         app->getCurrentFrame()->setFrame(m_currCell.second);
       } else
         app->getCurrentFrame()->setFid(m_veryFirstFrameId);
       resetMulti();
     }
   } else {
     m_isXsheetCell = app->getCurrentFrame()->isEditingScene();
     // if (m_isXsheetCell)
     m_currCell    = std::pair<int, int>(getColumnIndex(), getFrame());
     m_firstStroke = new TStroke(*stroke);
   }
   return;
 }
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:26,代码来源:rastertapetool.cpp

示例2: updateLevel

	void updateLevel()
	{
		TTool::Application *app = TTool::getApplication();
		if (!app->getCurrentLevel()->getLevel())
			return;
		TXshSimpleLevelP xl = app->getCurrentLevel()->getLevel()->getSimpleLevel();
		if (app->getCurrentFrame()->getFrameType() != TFrameHandle::LevelFrame)
			return;

		TFrameId fid = app->getCurrentFrame()->getFid();
		TVectorImageP src = xl->getFrame(fid, true);
		int count = src->getStrokeCount();

		for (int i = 1; i < 10; i++) {
			++fid;
			if (!xl->isFid(fid)) {
				TVectorImageP vi = new TVectorImage();
				xl->setFrame(fid, vi);
			}
			TVectorImageP vi = xl->getFrame(fid, true);
			TVectorImageP dst = src->clone();
			deform(dst.getPointer(), src.getPointer(), (double)i / (double)9);
			count = dst->getStrokeCount();
			vi->mergeImage(dst, TAffine());
			app->getCurrentTool()->getTool()->notifyImageChanged(fid);
		}
	}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:27,代码来源:morphtool.cpp

示例3: leftButtonDown

  void leftButtonDown(const TPointD &pos, const TMouseEvent &) override {
    TToonzImageP ti = TToonzImageP(getImage(true));
    if (!ti) return;

    if (m_closeType.getValue() == RECT_CLOSE) {
      m_selecting        = true;
      m_selectingRect.x0 = pos.x;
      m_selectingRect.y0 = pos.y;
      m_selectingRect.x1 = pos.x + 1;
      m_selectingRect.y1 = pos.y + 1;
      return;
    } else if (m_closeType.getValue() == FREEHAND_CLOSE) {
      startFreehand(pos);
      return;
    } else if (m_closeType.getValue() == POLYLINE_CLOSE) {
      addPointPolyline(pos);
      return;
    } else if (m_closeType.getValue() == NORMAL_CLOSE) {
      if (m_multi.getValue()) {
        TTool::Application *app = TTool::getApplication();
        if (m_firstFrameSelected) {
          multiApplyAutoclose(m_firstFrameId, getFrameId());
          invalidate();
          if (m_isXsheetCell) {
            app->getCurrentColumn()->setColumnIndex(m_currCell.first);
            app->getCurrentFrame()->setFrame(m_currCell.second);
          } else
            app->getCurrentFrame()->setFid(m_veryFirstFrameId);
          resetMulti();
        } else {
          m_isXsheetCell = app->getCurrentFrame()->isEditingScene();
          // if (m_isXsheetCell)
          m_currCell = std::pair<int, int>(getColumnIndex(), getFrame());
          m_firstFrameSelected = true;
          m_firstPoint         = pos;
        }
        invalidate();
        return;
      }

      m_selecting = false;
      applyAutoclose(ti);
      invalidate();
      notifyImageChanged();
    }
  }
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:46,代码来源:rastertapetool.cpp

示例4:

TAffine TTool::getCurrentObjectParentMatrix2() const {
  TTool::Application *app = m_application;
  TFrameHandle *fh        = app->getCurrentFrame();
  if (fh->isEditingLevel()) return TAffine();
  int frame               = fh->getFrame();
  TXsheet *xsh            = app->getCurrentXsheet()->getXsheet();
  TStageObjectId id       = app->getCurrentObject()->getObjectId();
  double objZ             = xsh->getZ(id, frame);
  TStageObjectId parentId = xsh->getStageObjectParent(id);
  if (parentId == TStageObjectId::NoneId) return TAffine();
  id                   = parentId;
  TAffine objPlacement = xsh->getPlacement(id, frame);

  TStageObjectId cameraId = xsh->getStageObjectTree()->getCurrentCameraId();
  TStageObject *camera    = xsh->getStageObject(cameraId);
  TAffine cameraPlacement = camera->getPlacement(frame);
  double cameraZ          = camera->getZ(frame);

  TAffine placement;
  TStageObject::perspective(placement, cameraPlacement, cameraZ, objPlacement,
                            objZ, 0);
  return placement;
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:23,代码来源:tool.cpp

示例5: leftButtonUp

  void leftButtonUp(const TPointD &pos, const TMouseEvent &e) override {
    TToonzImageP ti = TToonzImageP(getImage(true));
    if (!ti) return;

    /*-- Rectの座標の向きを揃える --*/
    if (m_selectingRect.x0 > m_selectingRect.x1)
      tswap(m_selectingRect.x1, m_selectingRect.x0);
    if (m_selectingRect.y0 > m_selectingRect.y1)
      tswap(m_selectingRect.y1, m_selectingRect.y0);

    TTool::Application *app = TTool::getApplication();

    m_selecting = false;
    TRasterCM32P ras;
    if (m_closeType.getValue() == RECT_CLOSE) {
      if (m_multi.getValue()) {
        if (m_firstFrameSelected) {
          multiApplyAutoclose(m_firstFrameId, getFrameId(), m_firstRect,
                              m_selectingRect);
          invalidate(m_selectingRect.enlarge(2));
          if (e.isShiftPressed()) {
            m_firstRect    = m_selectingRect;
            m_firstFrameId = getFrameId();
          } else {
            if (m_isXsheetCell) {
              app->getCurrentColumn()->setColumnIndex(m_currCell.first);
              app->getCurrentFrame()->setFrame(m_currCell.second);
            } else
              app->getCurrentFrame()->setFid(m_veryFirstFrameId);
            resetMulti();
          }
        } else {
          m_isXsheetCell = app->getCurrentFrame()->isEditingScene();
          // if (m_isXsheetCell)
          m_currCell = std::pair<int, int>(getColumnIndex(), this->getFrame());
        }
        return;
      }

      /*-- AutoCloseが実行されたか判定する --*/
      if (!applyAutoclose(ti, m_selectingRect)) {
        if (m_stroke) {
          delete m_stroke;
          m_stroke = 0;
        }
        invalidate();
        return;
      }

      invalidate();
      notifyImageChanged();
    } else if (m_closeType.getValue() == FREEHAND_CLOSE) {
      closeFreehand(pos);
      if (m_multi.getValue())
        multiAutocloseRegion(m_stroke, e);
      else
        applyAutoclose(ti, TRectD(), m_stroke);
      m_track.clear();
      invalidate();
    }
    if (m_stroke) {
      delete m_stroke;
      m_stroke = 0;
    }
  }
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:65,代码来源:rastertapetool.cpp

示例6: drawHooks

void SkeletonTool::drawHooks()
{
	// camera stand reference system
	//glColor3d(0,0,1);
	//tglDrawRect(3,3,97,97);

	//glColor3d(0,1,1);
	//tglDrawRect(0,100,Stage::inch,110);

	QTime time;
	time.start();

	m_magicLinks.clear();
	computeMagicLinks();

	TTool::Application *app = TTool::getApplication();
	TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
	int row = app->getCurrentFrame()->getFrame();
	int col = app->getCurrentColumn()->getColumnIndex();
	TPointD dpiScale = getViewer()->getDpiScale();

	// glColor3d(1,0,1);
	// tglDrawRect(-100*dpiScale.x, -100*dpiScale.y, 0,0);

	// I should not show hooks of columns already connected with the current one
	// ("linking" to those hooks would create evil loops in the hierarchy)
	std::set<int> connectedColumns;
	getConnectedColumns(connectedColumns, xsh, col);

	std::vector<HookData> currentColumnHooks;
	std::vector<HookData> otherColumnsHooks;

	// fill currentColumnHooks
	// detect otherColumn (i.e. the active column during a click&drag operator
	int otherColumn = -1;
	if (m_parentProbeEnabled) {
		// qDebug("  parent probe enabled");
		// currentColumnHooks <- current column & current handle
		int hookId = 0;
		std::string handle = xsh->getStageObject(TStageObjectId::ColumnId(col))->getHandle();
		if (handle.find("H") == 0) {
			int j = 1;
			while (j < (int)handle.size() && '0' <= handle[j] && handle[j] <= '9') {
				hookId = hookId * 10 + (int)handle[j] - '0';
				j++;
			}
		}

		currentColumnHooks.push_back(HookData(xsh, col, hookId, m_parentProbe));

		// otherColumn = "picked" column not connected
		TPoint parentProbePos = getViewer()->worldToPos(m_parentProbe);
		std::vector<int> indexes;
		getViewer()->posToColumnIndexes(parentProbePos, indexes, getPixelSize() * 10, false);
		for (int i = (int)indexes.size() - 1; i >= 0; i--) {
			if (connectedColumns.count(indexes[i]) == 0) {
				otherColumn = indexes[i];
				break;
			}
		}
		// if the mouse is not on a stroke, I'm using the "old" m_otherColumn, if any.
		// (this is needed because of the hooks put inside of unfilled regions)
		if (otherColumn < 0 && m_otherColumn >= 0) {
			if (m_otherColumnBBox.contains(m_otherColumnBBoxAff.inv() * m_parentProbe))
				otherColumn = m_otherColumn;
			else
				m_otherColumn = -1;
		}
	} else {
		// parent probe not enabled: get all hooks of current column. other column = -1
		getHooks(currentColumnHooks, xsh, row, col, TPointD(1, 1)); // dpiScale);
	}

	// other columns hooks <- all hooks of all unlinked columns
	for (int i = 0; i < xsh->getColumnCount(); i++)
		if (xsh->getColumn(i)->isCamstandVisible())
			if (connectedColumns.count(i) == 0)
				getHooks(otherColumnsHooks, xsh, row, i, TPointD(1, 1)); // dpiScale);

	/*
  qDebug("  time=%dms", time.elapsed());
  qDebug("  %d hooks (current column)", currentColumnHooks.size());
  for(int i=0;i<(int)currentColumnHooks.size();i++)
    qDebug("    %d,%d",currentColumnHooks[i].m_columnIndex,currentColumnHooks[i].m_hookId);
  qDebug("  %d hooks (other columns)", otherColumnsHooks.size());
  for(int i=0;i<(int)otherColumnsHooks.size();i++)
    qDebug("    %d,%d",otherColumnsHooks[i].m_columnIndex,otherColumnsHooks[i].m_hookId);
*/

	std::vector<TRectD> balloons;

	// draw current column hooks
	for (int i = 0; i < (int)currentColumnHooks.size(); i++) {
		const HookData &hook = currentColumnHooks[i];
		if (hook.m_name == "")
			continue; // should not happen
		int code = TD_Hook + hook.m_hookId;
		TPointD pos = hook.m_pos;
		ToolUtils::drawHook(pos, ToolUtils::OtherLevelHook);
		glPushName(code);
//.........这里部分代码省略.........
开发者ID:titer1,项目名称:opentoonz,代码行数:101,代码来源:skeletontool.cpp

示例7: leftButtonDown

void SkeletonTool::leftButtonDown(const TPointD &ppos, const TMouseEvent &e)
{
	m_otherColumn = -1;
	m_otherColumnBBox = TRectD();
	m_otherColumnBBoxAff = TAffine();
	m_labelPos = TPointD(0, 0);
	m_label = "";

	TUndoManager::manager()->beginBlock();
	if (!doesApply())
		return;

	assert(m_dragTool == 0);
	m_dragTool = 0;

	TTool::Application *app = TTool::getApplication();
	int currentColumnIndex = app->getCurrentColumn()->getColumnIndex();
	TXsheet *xsh = app->getCurrentScene()->getScene()->getXsheet();
	TPointD pos = ppos;

	int selectedDevice = pick(e.m_pos);

	// cambio drawing
	if (selectedDevice == TD_ChangeDrawing ||
		selectedDevice == TD_IncrementDrawing ||
		selectedDevice == TD_DecrementDrawing) {
		int d = 0;
		if (selectedDevice == TD_IncrementDrawing)
			d = 1;
		else if (selectedDevice == TD_DecrementDrawing)
			d = -1;
		m_dragTool = new ChangeDrawingTool(this, d);
		m_dragTool->leftButtonDown(ppos, e);
		return;
	}

	// click su un hook: attacca la colonna corrente tramite quell'hook
	if (TD_Hook <= selectedDevice && selectedDevice < TD_Hook + 50) {
		TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
		TStageObjectId objId = TStageObjectId::ColumnId(currentColumnIndex);
		TPointD p0 = getCurrentColumnMatrix() * TPointD(0, 0);
		HookData hook(xsh, currentColumnIndex, selectedDevice - TD_Hook, p0);
		TStageObjectCmd::setHandle(objId, hook.getHandle(), app->getCurrentXsheet());
		app->getCurrentXsheet()->notifyXsheetChanged();
		invalidate();
		return;
	}

	// magic link
	if (TD_MagicLink <= selectedDevice && selectedDevice < TD_MagicLink + (int)m_magicLinks.size()) {
		magicLink(selectedDevice - TD_MagicLink);
		app->getCurrentXsheet()->notifyXsheetChanged();
		return;
	}

	m_device = selectedDevice;
	bool justSelected = false;

	if (m_device < 0) {
		// nessun gadget cliccato. Eventualmente seleziono la colonna
		std::vector<int> columnIndexes;
		getViewer()->posToColumnIndexes(e.m_pos, columnIndexes, getPixelSize() * 5, false);
		if (!columnIndexes.empty()) {
			int columnIndex;
			columnIndex = columnIndexes.back();

			if (columnIndex >= 0 && columnIndex != currentColumnIndex) {
				if (!isColumnLocked(columnIndex)) {
					pos = getMatrix() * pos;
					app->getCurrentColumn()->setColumnIndex(columnIndex);
					updateMatrix();
					currentColumnIndex = columnIndex;
					justSelected = true;
					pos = getMatrix().inv() * pos;
				} else {
					m_label = "Column is locked";
					m_labelPos = pos;
				}
			}
		}
	}

	if (m_device < 0) {
		if (m_mode.getValue() == INVERSE_KINEMATICS)
			m_device = TD_InverseKinematics;
		else if (m_mode.getValue() == ANIMATE)
			m_device = TD_Rotation;
	}

	// lock/unlock: modalita IK
	if (TD_LockStageObject <= m_device && m_device < TD_LockStageObject + 1000) {
		int columnIndex = m_device - TD_LockStageObject;
		int frame = app->getCurrentFrame()->getFrame();
		togglePinnedStatus(columnIndex, frame, e.isShiftPressed());
		invalidate();
		m_dragTool = 0;
		return;
	}

	switch (m_device) {
//.........这里部分代码省略.........
开发者ID:titer1,项目名称:opentoonz,代码行数:101,代码来源:skeletontool.cpp

示例8: draw

void SkeletonTool::draw()
{
	// parent object reference system
	//glColor3d(1,0,0);
	//tglDrawRect(0,0,100,100);

	if (m_label != "")
		ToolUtils::drawBalloon(m_labelPos, m_label, TPixel32::Red, TPoint(20, -20), false);

	bool ikEnabled = m_mode.getValue() == INVERSE_KINEMATICS;
	assert(glGetError() == GL_NO_ERROR);

	// l'xsheet, oggetto (e relativo placement), frame corrente
	TTool::Application *app = TTool::getApplication();
	TXsheet *xsh = getXsheet();
	assert(xsh);
	TStageObjectId objId = app->getCurrentObject()->getObjectId();
	// se l'oggetto corrente non e' una colonna non disegno nulla
	if (!objId.isColumn())
		return;

	TStageObject *pegbar = xsh->getStageObject(objId);
	int col = objId.getIndex();

	int frame = app->getCurrentFrame()->getFrame();
	if (m_currentFrame != frame)
		m_temporaryPinnedColumns.clear();

	TAffine aff = getMatrix();
	// puo' suggere che il placement degeneri (es.: c'e' uno h-scale = 0%)
	if (fabs(aff.det()) < 0.00001)
		return;

	// m_unit = getPixelSize() * sqrt(fabs(aff.det()));

	if (!ikEnabled)
		drawLevelBoundingBox(frame, col);

	glPushMatrix();
	tglMultMatrix(aff.inv());

	// camera stand reference system
	//glColor3d(0,1,0);
	//tglDrawRect(0,0,100,100);

	bool changingParent = dynamic_cast<ParentChangeTool *>(m_dragTool) != 0;

	// !changingParent &&
	if (m_mode.getValue() == BUILD_SKELETON && !xsh->getStageObjectParent(objId).isColumn()) {
		if (!changingParent)
			drawHooks();
	}

	Skeleton skeleton;
	buildSkeleton(skeleton, col);

	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	drawSkeleton(skeleton, frame);
	glDisable(GL_BLEND);

	TXshCell cell = xsh->getCell(frame, objId.getIndex());
	Skeleton::Bone *rootBone = skeleton.getRootBone();
	for (int i = 0; i < skeleton.getBoneCount(); i++) {
		Skeleton::Bone *bone = skeleton.getBone(i);
		TStageObjectId currentId = bone->getStageObject()->getId();
		bool isCurrent = (currentId == objId);
		TPointD pos = bone->getCenter();
		if (isCurrent && m_mode.getValue() != BUILD_SKELETON) {
			drawDrawingBrowser(cell, pos);
		}

		bool isActiveChain = bone->isSelected();

		glColor3d(0, 1, 0);
		if (ikEnabled) {
			drawIKJoint(bone);
		} else {
			TPointD pos = bone->getCenter();
			if (isCurrent && m_mode.getValue() == ANIMATE) {
				drawMainGadget(pos);
			}
		}
	}
	m_currentFrame = frame;

	if (m_dragTool)
		m_dragTool->draw();
	glPopMatrix();
}
开发者ID:titer1,项目名称:opentoonz,代码行数:90,代码来源:skeletontool.cpp


注:本文中的ttool::Application::getCurrentFrame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。