Thread Tools Display Modes
11-09-10, 01:07 PM   #1
Jigain
A Molten Giant
 
Jigain's Avatar
Join Date: Jul 2009
Posts: 732
Graphic presets

Here's a question for you knowledgeable people...

Is it possible for an addon to change graphic settings (like sunshafts, liquid detail, particle density, texture resolution, shadow quality, view distance) at the click of a button?

If so, is there one that works post 4.0?

If not, could one be made?

Basically, I want to be able to use higher video settings (thus lower FPS) outside of instances and raids, and when in raids or instances I want to be able to choose to set my graphics quality lower to increase my performance while reducing the eyecandy, without having to spend several minutes tweaking video settings in the menu.

What do you think? Possible?
__________________


  Reply With Quote
11-09-10, 01:30 PM   #2
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
That's possible yes, caelUI does it, you should be able to change this to your likings.

This code is by Caellian, I just changed it a little so it'll work standalone:

Code:
local f = CreateFrame("Frame")

local ZoneChange = function(zone)
	local _, instanceType = IsInInstance()
	if zone == "Dalaran" then
		SetCVar("useWeatherShaders", "0")
		SetCVar("weatherDensity", 0)
		SetCVar("environmentDetail", 0.5)
		SetCVar("groundEffectDensity", 16)
		SetCVar("groundEffectDist", 0)
		SetCVar("particleDensity", 0.11)
		SetCVar("projectedTextures", 0)
		SetCVar("chatBubbles", 0)
	elseif instanceType == "raid" then
		SetCVar("useWeatherShaders", "0")
		SetCVar("weatherDensity", 0)
		SetCVar("environmentDetail", 1.5)
		SetCVar("groundEffectDensity", 256)
		SetCVar("groundEffectDist", 45)
		SetCVar("particleDensity", 1)
		SetCVar("projectedTextures", 1)
		SetCVar("chatBubbles", 1)
	else
		SetCVar("useWeatherShaders", "1")
		SetCVar("weatherDensity", 3)
		SetCVar("environmentDetail", 1.5)
		SetCVar("groundEffectDensity", 128)
		SetCVar("groundEffectDist", 45)
		SetCVar("particleDensity", 1)
		SetCVar("projectedTextures", 1)
		SetCVar("chatBubbles", 0)
	end
end

f:RegisterEvent("ZONE_CHANGED_NEW_AREA")
f:RegisterEvent("WORLD_MAP_UPDATE")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function(self, event)
	if event == "ZONE_CHANGED_NEW_AREA" or event == "WORLD_MAP_UPDATE" or event == "PLAYER_ENTERING_WORLD" then
		local zone = GetRealZoneText()
		if zone and zone ~= "" then
			return ZoneChange(zone)
		end
	end
end)
Complete list of cvars with their default values: http://wowprogramming.com/docs/cvars

You can look in your own config.wtf files in the WTF folder to see the value of your current settings.

Last edited by Haleth : 11-09-10 at 01:33 PM.
  Reply With Quote
11-09-10, 05:01 PM   #3
Jigain
A Molten Giant
 
Jigain's Avatar
Join Date: Jul 2009
Posts: 732
Yayness! Thanks a bunch, this'll come in handy for the raid on thursday!
__________________


  Reply With Quote
11-13-10, 05:25 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
FYI, the lines I've marked in red are unnecessary and do nothing but consume CPU cycles. Since your frame is only registered for those three events, and you want to run the same code in response to all three events, there's no need to check if the event is one of the three; frames only receive events they have registered for.

Code:
f:RegisterEvent("ZONE_CHANGED_NEW_AREA")
f:RegisterEvent("WORLD_MAP_UPDATE")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function(self, event)
	if event == "ZONE_CHANGED_NEW_AREA" or event == "WORLD_MAP_UPDATE" or event == "PLAYER_ENTERING_WORLD" then
		local zone = GetRealZoneText()
		if zone and zone ~= "" then
			return ZoneChange(zone)
		end
	end
end)
You're also creating an extra function closure (wastes memory) for no particular reason; since your addon is only running the code inside the ZoneChange function in response to events, you should just put that code directly inside the event handler.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Graphic presets


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off