void LandscapeEditorHeightmap::UpdateToolImage() { if(toolImage && currentTool) { if(prevToolSize != currentTool->size) { SafeRelease(toolImage); if(LandscapeTool::TOOL_COPYPASTE == currentTool->type) { SafeRelease(toolImageTile); } } } if(currentTool && !toolImage) { prevToolSize = currentTool->size; int32 sideSize = (int32)currentTool->size; toolImage = CreateToolImage(sideSize); if(LandscapeTool::TOOL_COPYPASTE == currentTool->type && tilemaskImage) { float32 multiplier = (float32)tilemaskImage->GetWidth() / (float32)(landscapeSize); sideSize = (int32)(currentTool->size * multiplier); toolImageTile = CreateToolImage(sideSize); } } }
LandscapeEditorDrawSystem::eErrorType CustomColorsSystem::EnableLandscapeEditing() { if (enabled) { return LandscapeEditorDrawSystem::LANDSCAPE_EDITOR_SYSTEM_NO_ERRORS; } LandscapeEditorDrawSystem::eErrorType canBeEnabledError = IsCanBeEnabled(); if ( canBeEnabledError!= LandscapeEditorDrawSystem::LANDSCAPE_EDITOR_SYSTEM_NO_ERRORS) { return canBeEnabledError; } LandscapeEditorDrawSystem::eErrorType enableCustomDrawError = drawSystem->EnableCustomDraw(); if (enableCustomDrawError != LandscapeEditorDrawSystem::LANDSCAPE_EDITOR_SYSTEM_NO_ERRORS) { return enableCustomDrawError; } selectionSystem->SetLocked(true); modifSystem->SetLocked(true); landscapeSize = drawSystem->GetTextureSize(Landscape::TEXTURE_TILE_FULL); FilePath filePath = GetCurrentSaveFileName(); if (!filePath.IsEmpty()) { const bool isTextureLoaded = LoadTexture(filePath, false); drawSystem->GetCustomColorsProxy()->ResetLoadedState(isTextureLoaded); } else { drawSystem->GetCustomColorsProxy()->UpdateSpriteFromConfig(); } drawSystem->EnableCursor(landscapeSize); drawSystem->SetCursorTexture(cursorTexture); drawSystem->SetCursorSize(cursorSize); Texture* customColorsTexture = drawSystem->GetCustomColorsProxy()->GetSprite()->GetTexture(); drawSystem->GetLandscapeProxy()->SetCustomColorsTexture(customColorsTexture); drawSystem->GetLandscapeProxy()->SetCustomColorsTextureEnabled(true); if (!toolImageSprite) { CreateToolImage(512, "~res:/LandscapeEditor/Tools/customcolorsbrush/circle.tex"); } enabled = true; return LandscapeEditorDrawSystem::LANDSCAPE_EDITOR_SYSTEM_NO_ERRORS; }
void HeightmapEditorSystem::UpdateToolImage(bool force) { if (toolImage) { if (curToolSize != cursorSize || force) { SafeRelease(toolImage); } } if (!toolImage) { if (!toolImagePath.IsEmpty()) { toolImage = CreateToolImage(cursorSize, toolImagePath); curToolSize = cursorSize; } } }