Will attach if not currently attached.
1836{
1839 +QString(unpickable?"true":"false"));
1840 if (!simple||!detailed) {
1841 VP1Msg::messageVerbose(
"AssocObjAttachmentHandle::setPickableStateOfNodes ERROR: Called with null pointers!");
1842 return;
1843 }
1844 }
1846 int isimple =
m_d->septrack_simple->findChild(simple);
1848 if (
m_d->septrack_simple->getNumChildren()!=
m_d->septrack_detailed->getNumChildren()) {
1849 VP1Msg::message(
"ERROR: AssocObjAttachmentHandle::setPickableStateOfNodes septrack_simple->getNumChildren()"
1850 "!=m_d->septrack_detailed->getNumChildren().");
1851 return;
1852 }
1853 int idetailed =
m_d->septrack_detailed->findChild(detailed);
1854 if (idetailed!=isimple) {
1855 VP1Msg::message(
"ERROR: AssocObjAttachmentHandle::setPickableStateOfNodes"
1856 " called with simple and detailed nodes that are not at same child idx!");
1857 return;
1858 }
1861 VP1Msg::message(
"ERROR: AssocObjAttachmentHandle::setPickableStateOfNodes detected wrong pickStyleChildIdx");
1862 return;
1863 }
1864 }
1865 if (isimple<0) {
1867 " called with nodes that are not currently children. Calling attachNodes(..)." );
1869 return;
1870 }
1871 if (unpickable == (
m_d->pickStyleChildIdx>-1&&isimple>
m_d->pickStyleChildIdx)) {
1873 " already in correct state.");
1874 return;
1875 }
1876
1877 simple->ref();
1878 detailed->ref();
1879 if (unpickable) {
1880 m_d->septrack_simple->removeChild(simple);
1881 m_d->septrack_detailed->removeChild(detailed);
1882 if (
m_d->pickStyleChildIdx==-1) {
1883 m_d->pickStyleChildIdx =
m_d->septrack_simple->getNumChildren();
1886 } else {
1887 --(
m_d->pickStyleChildIdx);
1888 }
1889 m_d->septrack_simple->addChild(simple);
1890 m_d->septrack_detailed->addChild(detailed);
1891 } else {
1892 if (
m_d->pickStyleChildIdx==-1) {
1893 VP1Msg::message(
"ERROR: AssocObjAttachmentHandle::setPickableStateOfNodes Inconsistent logic");
1894 simple->unref();
1895 detailed->unref();
1896 return;
1897 }
1898 if (
m_d->pickStyleChildIdx==isimple-1&&isimple==
m_d->septrack_simple->getNumChildren()-1) {
1899
1903 m_d->pickStyleChildIdx = -1;
1904 } else {
1905
1906 m_d->septrack_simple->removeChild(simple);
1907 m_d->septrack_detailed->removeChild(detailed);
1908 m_d->septrack_simple->insertChild(simple,
m_d->pickStyleChildIdx);
1909 m_d->septrack_detailed->insertChild(detailed,
m_d->pickStyleChildIdx);
1910 ++(
m_d->pickStyleChildIdx);
1911 }
1912 }
1913 simple->unref();
1914 detailed->unref();
1915}
void attachNodes(SoNode *simple, SoNode *detailed, bool unpickable)
static void messageDebug(const QString &)