Thanks Trylon. That should make things easier.
I tried to make a wizard to do this automatically. It adds the "physical.campassthrough: true" AlcScript to all objects with physical bounds with the exception of regions. Unfortunately I have run into a strange bug.
I read the AlcScript with the PyPRP AlcScript parser, then I add the extra info to the dictionary where needed. But when the new AlcScript is written to the text datablock, somehow the order of the pythonfilemods comes out differently. And that is bad, because that order determines the index number which is hardcoded in the Uru Python scripts.
Apart from that single bug the script works as intended.
Here is my code. Does anyone know why this goes wrong?
- Code: Select all
#!BPY
"""
Name: 'PyPRP Remove Camera Avoiders'
Blender: 245
Group: 'Wizards'
Tooltip: 'Set AlcScript <campassthrough: true> for colliders'
"""
from Blender import Object
from alc_AlcScript import *
from alc_Functions import *
objlist = Object.Get()
AlcScript.LoadFromBlender()
for obj in objlist:
objscript = AlcScript.objects.FindOrCreate(obj.name)
if obj.rbFlags & Object.RBFlags["BOUNDS"]:
cam = FindInDict(objscript,"physical.campassthrough",None)
type = getTextPropertyOrDefault(obj,"type","object")
if cam is None and type != "region":
StoreInDict(objscript,"physical.campassthrough","true")
if len(AlcScript.objects.content) > 0:
blendtext = alcFindBlenderText(AlcScript.ObjectTextFileName)
blendtext.clear()
alctext = AlcScript.objects.Write()
blendtext.write(alctext)