本文整理汇总了C++中ttool::Application::getCurrentObject方法的典型用法代码示例。如果您正苦于以下问题:C++ Application::getCurrentObject方法的具体用法?C++ Application::getCurrentObject怎么用?C++ Application::getCurrentObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttool::Application
的用法示例。
在下文中一共展示了Application::getCurrentObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onActivate
void FullColorBrushTool::onActivate()
{
if (!m_notifier)
m_notifier = new FullColorBrushToolNotifier(this);
TTool::Application *app = getApplication();
if (app->getCurrentObject()->isSpline()) {
m_currentColor = TPixel32::Red;
return;
}
int styleIndex = app->getCurrentLevelStyleIndex();
TPalette *plt = app->getCurrentPalette()->getPalette();
if (plt) {
int style = app->getCurrentLevelStyleIndex();
TColorStyle *colorStyle = plt->getStyle(style);
m_currentColor = colorStyle->getMainColor();
}
if (m_firstTime) {
m_firstTime = false;
m_thickness.setValue(TIntPairProperty::Value(FullcolorBrushMinSize, FullcolorBrushMaxSize));
m_pressure.setValue(FullcolorPressureSensibility ? 1 : 0);
m_opacity.setValue(TDoublePairProperty::Value(FullcolorMinOpacity, FullcolorMaxOpacity));
m_hardness.setValue(FullcolorBrushHardness);
}
m_brushPad = ToolUtils::getBrushPad(m_thickness.getValue().second, m_hardness.getValue() * 0.01);
setWorkAndBackupImages();
}
示例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: 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);
}
示例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;
}
示例5: 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();
}