Im believing the way i compare them is wrong. But it worked in some files earlier when the types where still registered.
This is the complete loop code.
class WORLD_PT_TransferOldWorldSettings(bpy.types.Operator): bl_idname = "world.transferset"
bl_label = "Transfer Old World Settings"
bl_description = "Transfer all Display, Environment & Render Channels settings over from old setup to the new setup. New setup uses world preset, this means you can have multiple Environment, Display & Render Channels settings in one scene. Each world will have is own environment lighting setup, display settings & render channels. Please note that when IBL images are used, you need to update the texture link names by opening the the file picker and closing it, this simply updates the name in the texture slots. Also you should delete the old textures then."
oldDisplay = ["thea_DispISO","thea_DispShutter", "thea_DispFNumber","thea_DispGamma","thea_DispBrightness","thea_DispCRFMenu","thea_DispSharpness","thea_DispSharpnessWeight",
"thea_DispBurn","thea_DispBurnWeight","thea_DispVignetting","thea_DispVignettingWeight","thea_DispChroma","thea_DispChromaWeight","thea_DispContrast","thea_DispContrastWeight","thea_DispTemperature","thea_DispTemperatureWeight","thea_DispBloom","thea_DispBloomItems","thea_DispBloomWeight","thea_DispGlareRadius","thea_DispMinZ","thea_DispMaxZ"]
oldIBL = ["thea_IBLEnable","thea_IBLTypeMenu","thea_IBLWrappingMenu","thea_IBLFilename","thea_IBLRotation","thea_IBLIntensity","thea_IBLColorFilename"
,"thea_BackgroundMappingEnable","thea_BackgroundMappingWrappingMenu","thea_BackgroundMappingFilename","thea_BackgroundMappingRotation","thea_BackgroundMappingIntensity","thea_ReflectionMappingEnable","thea_ReflectionMappingWrappingMenu","thea_ReflectionMappingFilename","thea_ReflectionMappingRotation","thea_ReflectionMappingIntensity","thea_RefractionMappingEnable","thea_RefractionMappingWrappingMenu","thea_RefractionMappingFilename","thea_RefractionMappingRotation","thea_RefractionMappingIntensity",]
oldPhySky = ["thea_EnvPSEnable","thea_SkyTypeMenu","thea_EnvPSTurb","thea_EnvPSOzone","thea_EnvPSWatVap","thea_EnvPSTurbCo","thea_EnvPSWaveExp","thea_EnvPSalbedo"]
oldLoc = ["thea_Envlocation", "thea_EnvLat", "thea_EnvLong", "thea_EnvTZ", "thea_EnvDate", "thea_EnvTime"]
oldGlobMed = ["thea_GlobalMediumEnable","thea_GlobalMediumIOR","thea_MediumAbsorptionCol","thea_MediumAbsorptionFilename","thea_MediumScatterCol","thea_MediumScatterFilename","thea_MediumAbsorptionDensity","thea_MediumAbsorptionDensityFilename","thea_MediumScatterDensity","thea_MediumScatterDensityFilename","thea_MediumCoefficient","thea_MediumMenu","thea_MediumPhaseFunction","thea_Asymetry"]
oldChannels = ["thea_channelNormal","thea_channelPosition","thea_channelUV","thea_channelDepth","thea_channelAlpha","thea_channelObject_Id","thea_channelMaterial_Id","thea_channelShadow","thea_channelRaw_Diffuse_Color","thea_channelRaw_Diffuse_Lighting","thea_channelRaw_Diffuse_GI","thea_channelDirect","thea_channelAO","thea_channelGI","thea_channelSelf_Illumination","thea_channelSSS","thea_channelReflection","thea_channelRefraction","thea_channelTransparent","thea_channelIrradiance","thea_channelMask","thea_channelInvert_Mask"]
transfer = bpy.props.StringProperty()
from TheaForBlender.thea_properties import worldFilenameUpdated
def execute(self, context):
world = context.scene.world
scn = context.scene
scene = bpy.data.scenes[scn.name]
wldName = bpy.data.worlds[world.name]
thea_globals.displayPreset = False
k = 0
for display in self.oldDisplay:
try:
if scene[display] != None:
k+=1
thea_globals.log.debug("## Transfer Display: %s" % scene[display])
if self.transfer=="True":
world[display] = scene[display]
thea_globals.log.debug("## Transfer Display: %s" % scene[display])
k-=1
thea_globals.log.debug("## K: %s" % k)
del scene[display]
if self.transfer=="Delete":
k-=1
del scene[display]
except:
pass
for IBL in self.oldIBL:
try:
if scene[IBL] != None or scene[IBL] != "":
k+=1
if self.transfer=="True":
world[IBL] = scene[IBL]
if IBL[-8:] == "Filename":
if len(scene[IBL])>0:
self.worldFilenameUpdated(scene,origin=IBL)
thea_globals.log.debug("## IBL: %s" % scene[IBL][-8:])
thea_globals.log.debug("## Transfer IBL: %s" % scene[IBL])
k-=1
del scene[IBL]
if self.transfer=="Delete":
k-=1
del scene[IBL]
except KeyError as e:
thea_globals.log.debug("## Transfer skipped: %s" % e)
for PhySky in self.oldPhySky:
try:
if scene[PhySky] != None or scene[PhySky] != "":
k+=1
if self.transfer=="True":
world[PhySky] = scene[PhySky]
k-=1
thea_globals.log.debug("## Transfer Phys: %s" % scene[PhySky])
del scene[PhySky]
if self.transfer=="Delete":
k-=1
del scene[PhySky]
except KeyError as e:
thea_globals.log.debug("## Transfer skipped: %s" % e)
for locations in self.oldLoc:
try:
if scene[locations] != None or scene[locations] != "":
k+=1
if self.transfer=="True":
world[locations] = scene[locations]
k-=1
thea_globals.log.debug("## Transfer Locations: %s" % scene[locations])
del scene[locations]
if self.transfer=="Delete":
k-=1
del scene[locations]
except KeyError as e:
thea_globals.log.debug("## Transfer skipped: %s" % e)
for globMed in self.oldGlobMed:
try:
if scene[globMed] != None or scene[globMed] != "":
k+=1
if self.transfer=="True":
world[globMed] = scene[globMed]
k-=1
thea_globals.log.debug("## Transfer Ren Channels: %s" % scene[globMed])
del scene[globMed]
if self.transfer=="Delete":
k-=1
del scene[globMed]
except KeyError as e:
thea_globals.log.debug("## Transfer skipped: %s" % e)
for channels in self.oldChannels:
try:
if scene[channels] != None or scene[channels] != "":
k+=1
if self.transfer=="True":
world[channels] = scene[channels]
k-=1
del scene[channels]
if self.transfer=="Delete":
k-=1
del scene[channels]
thea_globals.log.debug("## Transfer Settings: %s" % scene[channels])
except KeyError as e:
thea_globals.log.debug("## Transfer skipped: %s" % e)
if k == 0:
thea_globals.transferWorld = True
scene.thea_transferCleaned = True
if k != 0 and scene.thea_transferCleaned == True:
thea_globals.transferWorld = True
if thea_globals.transferWorld:
self.report({'WARNING'}, "Transfer completed")
if self.transfer == "Delete":
self.report({'WARNING'}, "Old settings deleted")
thea_globals.log.debug("## Transfer Settings Left: %s" % k)
return{'FINISHED'}
The list is all the props which i want to copy to new prop. All the old props arent active no more cause i replaced them with bpy.types.World instead of bpy.types.Scene
When i test a print now adding the old bpy.types.Scene.thea_DispISO and print it using, print(“Old: %s” % scene.thea_DispISO) it does get print. However the for loop it made suddenly doesnt work.
But when i run a operator with adding the attribute “transfere=True” it does copy all items. I dont understand why it can copy it, but when i want to check and print them it doesnt work and raises errors that Key is not found