Beispiel #1
0
bool CustomConnection::UnBind()
{
	bool result = true;

	while (true)
	{
		if (!isConnected)
		{
			NGT_WARNING_MSG("Connection is not connected\n");
			break;
		}

		if (!m_inputSlot->Disconnect(m_id, m_outputSlot))
		{
			result = false;
			NGT_ERROR_MSG("Failed to disconnect input slot with output slot\n");
			break;
		}

		if (!m_outputSlot->Disconnect(m_id, m_inputSlot))
		{
			result = false;
			NGT_ERROR_MSG("Failed to disconnect output slot with input slot\n");
			break;
		}

		m_inputSlot = nullptr;
		m_outputSlot = nullptr;
		isConnected = false;
		break;
	}

	return result;
}
Beispiel #2
0
//------------------------------------------------------------------------------
void InvertFilterObject::setSubFilter(QObject* subFilter)
{
	pSubFilter_ = dynamic_cast<QtFilterObject*>(subFilter);

	if (subFilter && !pSubFilter_)
	{
		NGT_ERROR_MSG("InvertFilterObject: filter must be native");
	}

	if (pSubFilter_ && !pSubFilter_->filterAcceptsRowValid())
	{
		NGT_ERROR_MSG("InvertFilterObject: filter must have valid filterAcceptsRow");
		pSubFilter_ = nullptr;
	}
}
Beispiel #3
0
bool CustomConnection::Bind(ObjectHandleT<ISlot> outputSlot, ObjectHandleT<ISlot> inputSlot)
{
	bool result = false;
	if (outputSlot == nullptr || inputSlot == nullptr)
	{
		NGT_ERROR_MSG("Input arguments are null\n");
		return result;
	}

	if (isConnected)
	{
		NGT_ERROR_MSG("Connection is already connected\n");
		return result;
	}

	while (true)
	{
		result = outputSlot->CanConnect(inputSlot);

		if (!result)
			break;

		result = inputSlot->CanConnect(outputSlot);

		if (!result)
			break;

		if (outputSlot->Connect(m_id, inputSlot) && inputSlot->Connect(m_id, outputSlot))
		{
			m_inputSlot = inputSlot.get();
			m_outputSlot = outputSlot.get();
			isConnected = true;
		}
		else
		{
			result = false;
			NGT_ERROR_MSG("Failed to connect input and output slots\n");

			outputSlot->Disconnect(m_id, inputSlot);
			inputSlot->Disconnect(m_id, outputSlot);
		}

		break;
	}

	return result;
}
Beispiel #4
0
	virtual bool error( const QXmlParseException & exception ) override
	{
		NGT_ERROR_MSG( "%d, %d: %s\n",
			exception.lineNumber(),
			exception.columnNumber(),
			exception.message().toUtf8().constData() );
		return true;
	}
Beispiel #5
0
	virtual bool fatalError( const QXmlParseException & exception ) override
	{
		NGT_ERROR_MSG( "%d, %d: %s\n",
			exception.lineNumber(),
			exception.columnNumber(),
			exception.message().toUtf8().constData() );
		assert( false && "Fatal error" );
		return false;
	}
Beispiel #6
0
void NodeEditor::SetGraph(std::shared_ptr<IGraph> graph)
{
    if (graph == nullptr)
    {
        NGT_ERROR_MSG("Graph is Null");
        return;
    }
    
    graphModel.clear();
    graphModel.push_back(graph);
}
Beispiel #7
0
bool PythonPanel::addPanel()
{
	auto viewCreator = get< IViewCreator >();
	if (viewCreator == nullptr)
	{
		NGT_ERROR_MSG("Failed to find IViewCreator\n");
		return false;
	}
	viewCreator->createView(
		"Python27UITest/PythonObjectTestPanel.qml", contextObject_, pythonView_ );
	return true;
}
Beispiel #8
0
void QtActionManager::loadActionData( QIODevice & source )
{
	QXmlSimpleReader actions;
	QtActionContentHandler contentHandler( *this );
	actions.setContentHandler( &contentHandler );
	QtActionErrorHandler errorHandler;
	actions.setErrorHandler( &errorHandler );
	const auto result = actions.parse( QXmlInputSource( &source ) );
	if (!result)
	{
		NGT_ERROR_MSG( "Failed to parse actions\n" );
	}
}
void FileSystemAssetBrowserModel::addAssetPath(const std::string& path)
{
	if (std::find(impl_->assetPaths_.begin(), impl_->assetPaths_.end(), path) == impl_->assetPaths_.end())
	{
		if (!impl_->fileSystem_.exists(path.c_str()))
		{
			NGT_ERROR_MSG("TestAssetBrowserModel::addAssetPath: "
			              "asset folder path does not exist: %s\n",
			              path.c_str());
			return;
		}

		impl_->assetPaths_.push_back(path);
	}
}
Beispiel #10
0
void PythonPanel::removePanel()
{
	auto uiApplication = get< IUIApplication >();
	
	if (uiApplication == nullptr)
	{
		NGT_ERROR_MSG( "Failed to find IUIApplication\n" );
		return;
	}

	if (pythonView_ != nullptr)
	{
		uiApplication->removeView( *pythonView_ );
	}
}
Beispiel #11
0
//-----------------------------------------------------------------------------
void FolderFilterObject::setFilterRole(FolderFilterRole filterRole)
{
	filterRole_ = filterRole;
	switch (filterRole_)
	{
	case FolderFilterObject::Directory:
		filterRoleId_ = ItemRole::isDirectoryId;
		break;
	case FolderFilterObject::Folder:
		filterRoleId_ = ItemRole::isFolderId;
		break;
	default:
		filterRoleId_ = ItemRole::isDirectoryId;
		NGT_ERROR_MSG("FolderFilterObject: Unknown filter role set");
	}
}
Beispiel #12
0
bool MappingIterator::setValue(const Variant& value) const /* override */
{
	if (!key_.exists() || (index_ < 0) || (index_ >= container_.size()))
	{
		NGT_ERROR_MSG("KeyError: %s\n", key_.str(PyScript::ScriptErrorPrint()).c_str());
		return false;
	}

	PyScript::ScriptObject scriptValue;
	const bool success = typeConverters_.toScriptType(value, scriptValue);
	if (!success)
	{
		return false;
	}

	return container_.setItem(key_, scriptValue, PyScript::ScriptErrorPrint());
}
Beispiel #13
0
bool SequenceIterator<T>::setValue(const Variant& value) const /* override */
{
	if ((index_ < 0) || (index_ >= container_.size()))
	{
		NGT_ERROR_MSG("IndexError: sequence assignment index out of range\n");
		return false;
	}

	PyScript::ScriptObject scriptValue;
	const bool success = typeConverters_.toScriptType(value, scriptValue);
	if (!success)
	{
		return false;
	}

	return SequenceIterator_Detail::setItem<T>(container_, index_, scriptValue);
}
Beispiel #14
0
Variant SequenceIterator<T>::value() const /* override */
{
	if ((index_ < 0) || (index_ >= container_.size()))
	{
		NGT_ERROR_MSG("IndexError: sequence index out of range\n");
		return Variant();
	}

	PyScript::ScriptObject item = SequenceIterator_Detail::getItem<T>(container_, index_);

	Variant result;
	std::string childPath;
	childPath += IClassDefinition::INDEX_OPEN;
	childPath += std::to_string(index_);
	childPath += IClassDefinition::INDEX_CLOSE;
	const bool success = typeConverters_.toVariant(item, result, containerHandle_, childPath);
	return result;
}
Beispiel #15
0
Variant MappingIterator::value() const /* override */
{
	if (!key_.exists() || (index_ < 0) || (index_ >= container_.size()))
	{
		NGT_ERROR_MSG("KeyError: %s\n", key_.str(PyScript::ScriptErrorPrint()).c_str());
		return Variant();
	}

	PyScript::ScriptObject item = container_.getItem(key_, PyScript::ScriptErrorPrint());

	Variant result;
	std::string childPath;
	childPath += Collection::getIndexOpen();
	childPath += key_.str(PyScript::ScriptErrorPrint()).c_str();
	childPath += Collection::getIndexClose();
	const bool success = typeConverters_.toVariant(item, result, containerHandle_, childPath);
	assert(success);
	return result;
}
Beispiel #16
0
void QtMenuBar::removeAction(IAction& action)
{
	auto qAction = getQAction(action);
	if (qAction == nullptr)
	{
		NGT_ERROR_MSG("Target action '%s' '%s' does not exist\n", action.text(),
		              StringUtils::join(action.paths(), ';').c_str());
		return;
	}

	auto menus = qMenuBar_.findChildren<QMenu*>(QString(), Qt::FindDirectChildrenOnly);
	for (auto& menu : menus)
	{
		QtMenu::removeMenuAction(*menu, *qAction);
		if (menu->isEmpty())
		{
			delete menu;
		}
	}

	destroyQAction(action);
}
Beispiel #17
0
ObjectHandleT<ISlot> IntToStringNode::GetSlotById(size_t slotId) const
{
	auto inputSlotPos =
	std::find_if(m_inputSlotsModel.begin(), m_inputSlotsModel.end(),
	             [slotId](const ObjectHandleT<ISlot>& inputSlot) { return slotId == inputSlot->Id(); });

	if (inputSlotPos != m_inputSlotsModel.end())
	{
		return *inputSlotPos;
	}

	auto outputSlotPos =
	std::find_if(m_outputSlotsModel.begin(), m_outputSlotsModel.end(),
	             [slotId](const ObjectHandleT<ISlot>& outputSlot) { return slotId == outputSlot->Id(); });

	if (outputSlotPos != m_outputSlotsModel.end())
	{
		return *outputSlotPos;
	}

	NGT_ERROR_MSG("Slot with id: %d not found\n", slotId);
	return nullptr;
}
Beispiel #18
0
bool IntToStringNode::Validate(std::string& errorMessage)
{
	NGT_ERROR_MSG("METHOD IS NOT IMPLEMENTED\n");
	return true;
}
Beispiel #19
0
void IntToStringNode::OnDisconnect(ObjectHandleT<ISlot> mySlot, ObjectHandleT<ISlot> otherSlot)
{
	NGT_ERROR_MSG("METHOD IS NOT IMPLEMENTED\n");
}
Beispiel #20
0
MetaType* StringSlot::Type() const
{
    NGT_ERROR_MSG("METHOD IS NOT IMPLEMENTED\n");
    return nullptr;
}
Beispiel #21
0
bool NodeEditor::Disconnect(size_t nodeIdFrom, size_t slotIdFrom,
    size_t nodeIdTo, size_t slotIdTo)
{
    NGT_ERROR_MSG("METHOD IS NOT IMPLEMENTED\n");
	return false;
}
Beispiel #22
0
bool NodeEditor::DeleteNode(size_t id)
{
    NGT_ERROR_MSG("METHOD IS NOT IMPLEMENTED\n");
	return false;
}
Beispiel #23
0
INode* NodeEditor::GetNode(size_t id)
{
    NGT_ERROR_MSG("METHOD IS NOT IMPLEMENTED\n");
    return nullptr;
}