二维矢量动画智能制作软件开发合集
个人开发二维矢量动画智能制作软件界面如下:
目录
结束语
一、选择模式原理
本软件选择模式中设计了3种情况:1)选择当前图层所有节点;2)清空当前选择节点;3)反向选择当前图层未被选择节点,界面设计如下:
实现方法为根据需求对选择节点集合进行修改,当选择当前图层所有节点时则直接将选择节点集合设置为当前图层节点父对象的childItems();清空当前选择节点时则对集合进行clear();反向选择当前未被选择节点,则根据当前图层节点父对象的childItems()进行是否被选择判断,若isSelected()为false,则将该对象放入选择节点集合。
二、选择模式代码实现
.h文件变量申明:
QList<QGraphicsItem *> selectedPosItems
void Scene::selectNodes(int type)
{
switch(type)
{
case 0: // 选择全部
{
selectedClear();
selectedPosItems = nodeBox[currentLayerIdx]->childItems();
}
break;
case 1: // 选择反向
{
QList<QGraphicsItem *> tmp;
QList<QGraphicsItem *> tmp1 = nodeBox[currentLayerIdx]->childItems();
for(int i = 0; i<tmp1.count(); i++)
if(!tmp1[i]->isSelected())
tmp.append(tmp1[i]);
selectedClear();
selectedPosItems = tmp;
}
break;
default:
break;
}
if(!selectedPosItems.isEmpty())
for(int i = 0; i<selectedPosItems.count(); i++)
{
selectedPosItems[i]->setSelected(true);
for(int j = 0;j<selectedPosItems[i]->curveG.count();j++)
selectedPosItems[i]->curveG[j]->setSelected(true);
}
update();
}
三、选择模式软件测试视频
选择模式
结束语
本文简要梳理了软件【选择模式】的实现框架,内容均为原创。
作者文笔水平一般,请大家多多包涵和指正,十分欢迎进一步交流学习。
若需,请联系本人小红书(小红书号:YzLab96),谢谢。
链接: 软件开发及测试所有视频合集见小红书