[Bf-extensions-cvs] [f3a93f0] master: Archimesh: Fix error when Cycles is not enabled

Antonioya noreply at git.blender.org
Tue Aug 9 18:23:47 CEST 2016


Commit: f3a93f08e81a185e058f2acb0ec4c7e1cc99f8d5
Author: Antonioya
Date:   Tue Aug 9 18:01:14 2016 +0200
Branches: master
https://developer.blender.org/rBAf3a93f08e81a185e058f2acb0ec4c7e1cc99f8d5

Archimesh: Fix error when Cycles is not enabled

Now if cycles render is not enabled or not selected, the materials are
not created.

===================================================================

M	archimesh/achm_books_maker.py
M	archimesh/achm_column_maker.py
M	archimesh/achm_curtain_maker.py
M	archimesh/achm_door_maker.py
M	archimesh/achm_kitchen_maker.py
M	archimesh/achm_lamp_maker.py
M	archimesh/achm_roof_maker.py
M	archimesh/achm_room_maker.py
M	archimesh/achm_shelves_maker.py
M	archimesh/achm_stairs_maker.py
M	archimesh/achm_tools.py
M	archimesh/achm_venetian_maker.py
M	archimesh/achm_window_maker.py
M	archimesh/achm_window_panel.py

===================================================================

diff --git a/archimesh/achm_books_maker.py b/archimesh/achm_books_maker.py
index e8d9fce..890a695 100644
--- a/archimesh/achm_books_maker.py
+++ b/archimesh/achm_books_maker.py
@@ -137,6 +137,8 @@ class AchmBooks(Operator):
             row.prop(self, 'afn', slider=True)
 
             box = layout.box()
+            if not context.scene.render.engine == 'CYCLES':
+                box.enabled = False
             box.prop(self, 'crt_mat')
             if self.crt_mat:
                 row = box.row()
@@ -201,7 +203,7 @@ def generate_books(self):
         mydata = create_book("Book" + str(x),
                              self.width, self.depth, self.height,
                              lastx, myloc.y, myloc.z,
-                             self.crt_mat,
+                             self.crt_mat if bpy.context.scene.render.engine == 'CYCLES' else False,
                              self.rX, self.rY, self.rZ, self.rot, ox, oy, oz, ot,
                              self.objcol, self.rC)
         boxes.extend([mydata[0]])
diff --git a/archimesh/achm_column_maker.py b/archimesh/achm_column_maker.py
index 40b4616..6bae7ef 100644
--- a/archimesh/achm_column_maker.py
+++ b/archimesh/achm_column_maker.py
@@ -322,6 +322,8 @@ class AchmColumn(bpy.types.Operator):
                     row.prop(self, 'ramp')
 
             box = layout.box()
+            if not context.scene.render.engine == 'CYCLES':
+                box.enabled = False
             box.prop(self, 'crt_mat')
         else:
             row = layout.row()
@@ -528,7 +530,7 @@ def create_column_mesh(self):
     # ------------------------
     # Create materials
     # ------------------------
-    if self.crt_mat:
+    if self.crt_mat and bpy.context.scene.render.engine == 'CYCLES':
         # Column material
         mat = create_diffuse_material("Column_material", False, 0.748, 0.734, 0.392, 0.573, 0.581, 0.318)
         set_material(mycolumn, mat)
diff --git a/archimesh/achm_curtain_maker.py b/archimesh/achm_curtain_maker.py
index d7ff101..dcb5dad 100644
--- a/archimesh/achm_curtain_maker.py
+++ b/archimesh/achm_curtain_maker.py
@@ -134,6 +134,8 @@ class AchmJapan(Operator):
                 row.prop(self, 'open05', slider=True)
 
             box = layout.box()
+            if not context.scene.render.engine == 'CYCLES':
+                box.enabled = False
             box.prop(self, 'crt_mat')
             if self.crt_mat:
                 box.label("* Remember to verify fabric texture folder")
@@ -218,6 +220,8 @@ class AchmRoller(Operator):
             row.prop(self, 'height')
 
             box = layout.box()
+            if not context.scene.render.engine == 'CYCLES':
+                box.enabled = False
             box.prop(self, 'crt_mat')
             if self.crt_mat:
                 box.label("* Remember to verify fabric texture folder")
@@ -352,7 +356,7 @@ def generate_japan(self):
     posz = -0.008
     x = 1
     fabricmat = None
-    if self.crt_mat:
+    if self.crt_mat and bpy.context.scene.render.engine == 'CYCLES':
         fabricmat = create_fabric_material("Fabric_material", False, 0.653, 0.485, 0.265,
                                            0.653, 0.485, 0.265)
 
@@ -392,7 +396,7 @@ def generate_japan(self):
     mycurve2.location.y = -0.01
     mycurve2.location.z = 0.005
 
-    if self.crt_mat:
+    if self.crt_mat and bpy.context.scene.render.engine == 'CYCLES':
         mat = create_diffuse_material("String_material", False, 0.1, 0.1, 0.1,
                                       0.1, 0.1, 0.1, 0.01)
         set_material(mycurve1, mat)
@@ -627,7 +631,7 @@ def generate_roller(self):
     # Roller Top
     # ------------------
     fabricsolid = None
-    if self.crt_mat:
+    if self.crt_mat and bpy.context.scene.render.engine == 'CYCLES':
         fabricsolid = create_diffuse_material("Fabric_solid_material", False, 0.653, 0.485, 0.265)
 
     myroller = create_roller_rail("Roller",
@@ -643,7 +647,7 @@ def generate_roller(self):
     # Sides
     # --------------------------------------------------------------------------------
     plastic = None
-    if self.crt_mat:
+    if self.crt_mat and bpy.context.scene.render.engine == 'CYCLES':
         plastic = create_diffuse_material("Plastic_roller_material", False, 0.653, 0.485, 0.265, 0.653, 0.485, 0.265,
                                           0.2)
 
@@ -665,7 +669,7 @@ def generate_roller(self):
     # Panel
     # --------------------------------------------------------------------------------
     fabricmat = None
-    if self.crt_mat:
+    if self.crt_mat and bpy.context.scene.render.engine == 'CYCLES':
         fabricmat = create_fabric_material("Fabric_translucent_material", False, 0.653, 0.485, 0.265, 0.653, 0.485,
                                            0.265)
 
@@ -703,7 +707,7 @@ def generate_roller(self):
     mycurve.location.x = self.width + 0.015
     mycurve.location.y = 0
     mycurve.location.z = -0.38
-    if self.crt_mat:
+    if self.crt_mat and bpy.context.scene.render.engine == 'CYCLES':
         mat = create_diffuse_material("String_material", False, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.01)
         set_material(mycurve, mat)
 
diff --git a/archimesh/achm_door_maker.py b/archimesh/achm_door_maker.py
index b090820..64ba782 100644
--- a/archimesh/achm_door_maker.py
+++ b/archimesh/achm_door_maker.py
@@ -205,7 +205,7 @@ def shape_children(mainobject, update=False):
         mydoor = make_one_door(mp, mainobject, widthr + mp.frame_size, "1")
         mydoor.location.x = mp.frame_width / 2 - mp.frame_size
 
-    if mp.crt_mat:
+    if mp.crt_mat and bpy.context.scene.render.engine == 'CYCLES':
         mat = create_diffuse_material("Door_material", False, 0.8, 0.8, 0.8)
         set_material(mainobject, mat)
 
@@ -236,12 +236,13 @@ def shape_children(mainobject, update=False):
     myctrl.draw_type = 'BOUNDS'
     myctrl.hide = False
     myctrl.hide_render = True
-    myctrl.cycles_visibility.camera = False
-    myctrl.cycles_visibility.diffuse = False
-    myctrl.cycles_visibility.glossy = False
-    myctrl.cycles_visibility.transmission = False
-    myctrl.cycles_visibility.scatter = False
-    myctrl.cycles_visibility.shadow = False
+    if bpy.context.scene.render.engine == 'CYCLES':
+        myctrl.cycles_visibility.camera = False
+        myctrl.cycles_visibility.diffuse = False
+        myctrl.cycles_visibility.glossy = False
+        myctrl.cycles_visibility.transmission = False
+        myctrl.cycles_visibility.scatter = False
+        myctrl.cycles_visibility.shadow = False
 
     # Create control box for baseboard
     myctrlbase = create_control_box("CTRL_Baseboard",
@@ -258,16 +259,17 @@ def shape_children(mainobject, update=False):
     myctrlbase.draw_type = 'BOUNDS'
     myctrlbase.hide = False
     myctrlbase.hide_render = True
-    myctrlbase.cycles_visibility.camera = False
-    myctrlbase.cycles_visibility.diffuse = False
-    myctrlbase.cycles_visibility.glossy = False
-    myctrlbase.cycles_visibility.transmission = False
-    myctrlbase.cycles_visibility.scatter = False
-    myctrlbase.cycles_visibility.shadow = False
-
-    mat = create_transparent_material("hidden_material", False)
-    set_material(myctrl, mat)
-    set_material(myctrlbase, mat)
+    if bpy.context.scene.render.engine == 'CYCLES':
+        myctrlbase.cycles_visibility.camera = False
+        myctrlbase.cycles_visibility.diffuse = False
+        myctrlbase.cycles_visibility.glossy = False
+        myctrlbase.cycles_visibility.transmission = False
+        myctrlbase.cycles_visibility.scatter = False
+        myctrlbase.cycles_visibility.shadow = False
+
+        mat = create_transparent_material("hidden_material", False)
+        set_material(myctrl, mat)
+        set_material(myctrlbase, mat)
 
     # deactivate others
     for o in bpy.data.objects:
@@ -457,6 +459,8 @@ class AchmDoorObjectgeneratorpanel(Panel):
                 layout.prop(myobjdat, 'handle')
 
                 box = layout.box()
+                if not context.scene.render.engine == 'CYCLES':
+                    box.enabled = False
                 box.prop(myobjdat, 'crt_mat')
             else:
                 row = layout.row()
@@ -539,7 +543,7 @@ def make_one_door(self, myframe, width, openside):
         set_smooth(handle2)
         set_modifier_subsurf(handle2)
     # Create materials
-    if self.crt_mat:
+    if self.crt_mat and bpy.context.scene.render.engine == 'CYCLES':
         # Door material
         mat = create_diffuse_material("Door_material", False, 0.8, 0.8, 0.8)
         set_material(mydoor, mat)
diff --git a/archimesh/achm_kitchen_maker.py b/archimesh/achm_kitchen_maker.py
index d34bc92..3cbfe02 100644
--- a/archimesh/achm_kitchen_maker.py
+++ b/archimesh/achm_kitchen_maker.py
@@ -522,6 +522,8 @@ class AchmKitchen(Operator):
                     add_cabinet(self, box, idx + 1, self.cabinets[idx])
 
             box = layout.box()
+            if not context.scene.render.engine == 'CYCLES':
+                box.enabled = False
             box.prop(self, 'crt_mat')
         else:
             row = layout.row()
@@ -831,7 +833,7 @@ def generate_cabinets(self):
         set_normals(base)
 
     # Create materials
-    if self.crt_mat:
+    if self.crt_mat and bpy.context.scene.render.engine == 'CYCLES':
         mat = create_diffuse_material("Cabinet_material", False, 0.8, 0.8, 0.8)
         for box in boxes:
             set_material(box, mat)
diff --git a/archimesh/achm_lamp_maker.py b/archimesh/achm_lamp_maker.py
index e8918a4..724f21a 100644
--- a/archimesh/achm_lamp_maker.py
+++ b/archimesh/achm_lamp_maker.py
@@ -354,6 +354,8 @@ class AchmLamp(Operator):
                 row.prop(self, 'tr03')
 
             box = layout.box()
+            if not context.scene.render.engine == 'CYCLES':
+                box.enabled = False
             box.prop(self, 'crt_mat')
             if self.crt_mat:
                 row = box.row()
@@ -484,7 +486,7 @@ def generate_lamp(self):
     mybulb.name = "Lamp_Bulb"
     mybulb.parent = myholder
     mybulb.location = (0, 0, radbulb + self.holder + 0.04)
-    if self.crt_mat:
+    if self.crt_mat and bpy.context.scene.render.engine == 'CYCLES':
         mat = create_e

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list