2
$\begingroup$

I am working on an addon that creates siding, it also allows you to cut out rectangles in it for windows and doors. It uses Boolean modifiers for this. When you select bricks it cuts the brick then it cuts the mortar then it joins the two, but currently I am having trouble getting it to cut the mortar properly.

Run the code from the Text Editor, go to Add Mesh > JARCH Vis > Add Siding, then once the object is added go to Properties > Modifiers > JARCH Vis, then change the Material to bricks, click Cutouts and enter something like 5, 2, 2, 2.

You will notice how it does cut through the brick, but not through the mortar. The code for all this starts at line 1,524. It is like

bpy.context.scene.objects.active = mortar

isn't switching right, but if you check active object it is correct. So I don't know why the modifier is being applied to o but not mortar. Here is the python file

$\endgroup$
  • $\begingroup$ I think it is related to context - try putting your panel into the 3dview - bl_space_type = "VIEW_3D" and bl_region_type = "UI". Not sure of a workaround to change the active object from a panel in the properties window. $\endgroup$ – sambler Oct 29 '14 at 11:41
  • $\begingroup$ @sambler that worked, I had to change my code a little, but it is getting the context right now. I don't mind just moving the whole panel out to VIEW_3D in some ways it is better, as the modifier panel is now less cluttered. Do you mind posting that back as an answer so I can accept it? Thanks $\endgroup$ – BlendingJake Oct 29 '14 at 14:10
2
$\begingroup$

I have seen this issue when using a panel in the properties window to alter the active object. It would be related to the context.

The easy fix is to place your panel in the 3dview. This is just a matter of changing the panel's bl_space_type to VIEW_3D and bl_region_type to UI

It is possible that you can override the context to get it working, this answer explains that and links to more information.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.