本文整理汇总了C++中ttool::Application::getCurrentXsheet方法的典型用法代码示例。如果您正苦于以下问题:C++ Application::getCurrentXsheet方法的具体用法?C++ Application::getCurrentXsheet怎么用?C++ Application::getCurrentXsheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttool::Application
的用法示例。
在下文中一共展示了Application::getCurrentXsheet方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: doesApply
bool SkeletonTool::doesApply() const
{
TTool::Application *app = TTool::getApplication();
TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
assert(xsh);
TStageObjectId objId = app->getCurrentObject()->getObjectId();
if (objId.isColumn()) {
TXshColumn *column = xsh->getColumn(objId.getIndex());
if (column && column->getSoundColumn())
return false;
}
return true;
}
示例3:
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;
}
示例4: 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);
//.........这里部分代码省略.........
示例5: 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) {
//.........这里部分代码省略.........