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


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

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


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

示例1: magicLink

void SkeletonTool::magicLink(int index)
{
	if (index < 0 || index >= (int)m_magicLinks.size())
		return;
	HookData h0 = m_magicLinks[index].m_h0;
	HookData h1 = m_magicLinks[index].m_h1;
	TTool::Application *app = TTool::getApplication();
	TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
	int columnIndex = app->getCurrentColumn()->getColumnIndex();
	TStageObjectId id = TStageObjectId::ColumnId(columnIndex);
	TStageObject *obj = xsh->getStageObject(id);

	int parentColumnIndex = h1.m_columnIndex;
	TStageObjectId parentId = TStageObjectId::ColumnId(parentColumnIndex);
	std::string parentHandle = h1.getHandle();

	std::string handle = "";
	if (h0.m_columnIndex < 0) {
		handle = obj->getHandle();
	} else {
		handle = h0.getHandle();
	}

	//TUndoManager *undoManager = TUndoManager::manager();
	//undoManager->beginBlock();
	TStageObjectCmd::setHandle(id, handle, app->getCurrentXsheet());
	TStageObjectCmd::setParent(id, parentId, parentHandle, app->getCurrentXsheet());
	//undoManager->endBlock();
}
开发者ID:titer1,项目名称:opentoonz,代码行数:29,代码来源:skeletontool.cpp

示例2: 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

示例3: onActivate

void SkeletonTool::onActivate()
{
	TTool::Application *app = TTool::getApplication();
	if (m_firstTime) {
		m_globalKeyframes.setValue(SkeletonGlobalKeyFrame ? 1 : 0);
		m_mode.setValue(BUILD_SKELETON);
		// m_ikEnabled.setValue(SkeletonInverseKinematics ? 1 : 0);
		m_firstTime = false;
	}
	TStageObjectId objId = app->getCurrentObject()->getObjectId();
	if (objId == TStageObjectId::NoneId) {
		int index = app->getCurrentColumn()->getColumnIndex();
		objId = TStageObjectId::ColumnId(index);
	}
	//  app->editStageObject(objId);
}
开发者ID:titer1,项目名称:opentoonz,代码行数:16,代码来源:skeletontool.cpp

示例4: 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

示例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


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