I know that Segmentation Fault
is some sort of memory error having to do with C
and C++
- beyond that I don't really know how to handle it. I read up on this error through this post on stackoverflow, and this post on multi-file registering/unregistering but still don't have much of a clue.
I am experimenting with custom properties, sliders and operators. Everything as far as I can tell is accessing what it is supposed to (as in, I adjust the slider and the appropriate object's value is updated) but I am getting a bajillion KeyError
's and then Blender crashes with a segfault.
Code
# Functions/Callbacks
def get_rotate_cam(self):
return self["Rotate Camera"]
def set_rotate_cam(self, value):
self["Rotate Camera"] = value
def update_rotate_cam(self, context):
for obj in bpy.context.selected_objects:
bpy.ops.opject.select_pattern(pattern="Camera")
obj.rotation_euler[0] = get_rotate_cam_x(self)
#Property Group
class SliderProperties(bpy.types.PropertyGroup):
bpy.types.Scene.rotCam = FloatProperty(
name="Rotate Camera",
description="Rotate the camera with the slider"
default=0,
min=0,
max=360,
update=update_rotate_cam,
get=get_rotate_cam,
set=set_rotate_cam
)
#Panel
class EditStuff(bpy.types.Panel):
bl_label = "Edit"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_context = "objectmode"
def draw(self, context):
layout = self.layout
layout.prop(bpy.context.scene, "rotCam")
# Registration
def register():
bpy.utils.register_module(__name__)
def unregister():
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":
register()
So I am clearly doing something super inefficient here, I'm just not sure what it is. What is also throwing me off is when I use the custom slider once, clear the terminal, I don't get the KeyError
any more. That has me thinking that it is some sort of initialization or context shenanegains going on. Hanging pointer maybe? Just not sure.
I also have a similar set up with compositor nodes to adjust things like shadows. Everything works correctly, I can adjust the shadows, but the KeyError
makes Blender crash.
Thanks for the help!