Exemplo n.º 1
0
void VisibilityToolPanel::RestoreState()
{
	SceneEditor2* sceneEditor = GetActiveScene();

	bool enabled = sceneEditor->visibilityToolSystem->IsLandscapeEditingEnabled();
	int32 brushSize = AreaSizeSystemToUI(sceneEditor->visibilityToolSystem->GetBrushSize());
	VisibilityToolSystem::eVisibilityToolState state = sceneEditor->visibilityToolSystem->GetState();

	int32 areaSizeMin = DEF_AREA_MIN_SIZE;
	int32 areaSizeMax = DEF_AREA_MAX_SIZE;

	KeyedArchive* customProperties = GetCustomPropertiesArchieve(sceneEditor);
	if (customProperties)
	{
		areaSizeMin = customProperties->GetInt32(ResourceEditor::VISIBILITY_TOOL_AREA_SIZE_MIN, DEF_AREA_MIN_SIZE);
		areaSizeMax = customProperties->GetInt32(ResourceEditor::VISIBILITY_TOOL_AREA_SIZE_MAX, DEF_AREA_MAX_SIZE);
	}
	
	SetWidgetsState(enabled);
	
	BlockAllSignals(true);
	sliderWidgetAreaSize->SetRangeMin(areaSizeMin);
	sliderWidgetAreaSize->SetRangeMax(areaSizeMax);
	sliderWidgetAreaSize->SetValue(brushSize);
	buttonSetVisibilityPoint->setChecked(state == VisibilityToolSystem::VT_STATE_SET_POINT);
	buttonSetVisibilityArea->setChecked(state == VisibilityToolSystem::VT_STATE_SET_AREA);
	BlockAllSignals(!enabled);
}
Exemplo n.º 2
0
GameID Game::RegisterGameObject(GameObject* go){
	GameID id = Game::GetNextGameID();
	mGameObjectDB[id] = go;
	go->SetID(id);
	GetActiveScene()->AddGameObject(go);
	return id;
}
Exemplo n.º 3
0
void VisibilityToolPanel::StoreState()
{
	KeyedArchive* customProperties = GetOrCreateCustomProperties(GetActiveScene())->GetArchive();
    customProperties->SetInt32(ResourceEditor::VISIBILITY_TOOL_AREA_SIZE_MIN,
                               sliderWidgetAreaSize->GetRangeMin());
    customProperties->SetInt32(ResourceEditor::VISIBILITY_TOOL_AREA_SIZE_MAX,
                               sliderWidgetAreaSize->GetRangeMax());
}
Exemplo n.º 4
0
bool VisibilityToolPanel::GetEditorEnabled()
{
	SceneEditor2* sceneEditor = GetActiveScene();
	if (!sceneEditor)
	{
		return false;
	}

	return sceneEditor->visibilityToolSystem->IsLandscapeEditingEnabled();
}
Exemplo n.º 5
0
void VisibilityToolPanel::SaveTexture()
{
	FilePath currentPath = FileSystem::Instance()->GetUserDocumentsPath();
	QString filePath = QtFileDialog::getSaveFileName(NULL,
													QString(ResourceEditor::VISIBILITY_TOOL_SAVE_CAPTION.c_str()),
													QString(currentPath.GetAbsolutePathname().c_str()),
													QString(ResourceEditor::VISIBILITY_TOOL_FILE_FILTER.c_str()));

	FilePath selectedPathname = PathnameToDAVAStyle(filePath);

	if(!selectedPathname.IsEmpty())
	{
		GetActiveScene()->visibilityToolSystem->SaveTexture(selectedPathname);
	}
}
///	\brief	get pointer to stack by active scene or current view
///	\return	pointer to active stack or NULL otherwise
CUndoStack *CUndoRedoComponent::GetStack()
{
	CHashString hszScene = GetActiveScene();
	if (hszScene.IsEmpty())
	{
		CView* pActiveView = NULL;
		static DWORD msgHash_GetActiveView = CHashString(_T("GetActiveView")).GetUniqueID();
		if (MSG_HANDLED != m_pToolBox->SendMessage(msgHash_GetActiveView, sizeof(pActiveView), &pActiveView) &&
			pActiveView == NULL)
		{
			m_pToolBox->Log(LOGERROR, _T("%s(%i): GetActiveView failed\n"), __FILE__, __LINE__);
			return NULL;
		}
		return GetStack(pActiveView);
	}
	return GetStack(&hszScene);
}
Exemplo n.º 7
0
void VisibilityToolPanel::SetVisibilityToolButtonsState(SceneEditor2* scene,
														VisibilityToolSystem::eVisibilityToolState state)
{
	if (scene != GetActiveScene())
	{
		return;
	}

	bool pointButton = false;
	bool areaButton = false;

	switch (state)
	{
		case VisibilityToolSystem::VT_STATE_SET_AREA:
			areaButton = true;
			break;

		case VisibilityToolSystem::VT_STATE_SET_POINT:
			pointButton = true;
			break;

		default:
			break;
	}
	bool b;

	b = buttonSetVisibilityPoint->signalsBlocked();
	buttonSetVisibilityPoint->blockSignals(true);
	buttonSetVisibilityPoint->setChecked(pointButton);
	buttonSetVisibilityPoint->blockSignals(b);
	
	b = buttonSetVisibilityArea->signalsBlocked();
	buttonSetVisibilityArea->blockSignals(true);
	buttonSetVisibilityArea->setChecked(areaButton);
	buttonSetVisibilityArea->blockSignals(b);
}
Exemplo n.º 8
0
void VisibilityToolPanel::SetVisibilityAreaSize(int areaSize)
{
	GetActiveScene()->visibilityToolSystem->SetBrushSize(AreaSizeUIToSystem(areaSize));
}
Exemplo n.º 9
0
void VisibilityToolPanel::SetVisibilityArea()
{
	GetActiveScene()->visibilityToolSystem->SetVisibilityArea();
}