Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
if self.properties.cDomeZ < domeLimit:
self.properties.cDomeZ = domeLimit
# base can't be higher than double wall height (per level)
domeLimit = planeHL2 * self.properties.CLvls
if self.properties.cDomeZ > domeLimit:
self.properties.cDomeZ = domeLimit
# height limit to twice smallest wall width/depth.
if CastleD < CastleX: # use least dimension for dome.
domeLimit = CastleD * 2
else:
domeLimit = CastleX * 2
if self.properties.cDomeH > domeLimit:
self.properties.cDomeH = domeLimit
domeMaxO = self.properties.cDomeH / 2
# Dome Oculus (opening) can't be more than half dome height
if self.properties.cDomeO > domeMaxO:
self.properties.cDomeO = domeMaxO
#
############
#####
#
# After validating all the properties see if need to create...
# @todo: fix so last object preserved... (i.e. changing levels).
# No build if construct off
if not self.properties.ConstructTog:
# No build if construct off or just changing levels
# if not self.properties.ConstructTog or self.properties.curLvl!=self.properties.CLvl:
# self.properties.curLvl=self.properties.CLvl
return {'FINISHED'}
#
#####
############
#
# rowprocessing() front/back wall, modified by sides and Dome.
# this centers the wall, maybe add flag to center or offset from cursor...
# if centerwall:
dims['s'] = -midWallW
dims['e'] = midWallW
# else:
# dims['s'] = 0
# dims['e'] = CastleX
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
dims['t'] = planeHL
# block sizing
settings['h'] = blockHeight
settings['w'] = blockWidth
settings['d'] = blockDepth
if self.properties.blockVar:
settings['hv'] = self.properties.blockHVar
settings['wv'] = self.properties.blockWVar
settings['dv'] = self.properties.blockDVar
else:
settings['hv'] = 0
settings['wv'] = 0
settings['dv'] = 0
settings['sdv'] = blockWidth # divisions in area.
settings['g'] = self.properties.Grout
settings['eoff'] = self.properties.EdgeOffset
# when openings overlap they create inverse stonework - interesting but not the desired effect
# if opening width == indent*2 the edge blocks fail (row of blocks cross opening) - bug.
openingSpecs = []
archTop = [0, 0]
archBot = [0, 0]
#
############
#
# Openings always set info; flag per wall, per level to enable.
#
############
#
############
# Door
# set locals
# @todo: fix this....
openZ = self.properties.cBaseT + 1 # track with floor - else 0
if self.properties.doorArch:
archTop[0] = self.properties.doorArchC
archTop[1] = self.properties.doorArchT
# set opening values
openingSpecs += [{'a': False,
'w': self.properties.wallDoorW, 'h': self.properties.wallDoorH,
'x': self.properties.wallDoorX, 'z': openZ,
'n': self.properties.doorRpt, 'bvl': self.properties.doorBvl,
'v': archTop[0], 'vl':archBot[0], 't':archTop[1], 'tl':archBot[1]}]
archTop[0] = 0
archTop[1] = 0
archBot[0] = 0
archBot[1] = 0
if self.properties.wallPortArchT:
archTop[0] = self.properties.wallPortW / 2
archTop[1] = self.properties.wallPortW / 4
if self.properties.wallPortArchB:
archBot[0] = self.properties.wallPortW / 2
archBot[1] = self.properties.wallPortW / 4
# set opening values
openingSpecs += [{'a': False,
'w': self.properties.wallPortW, 'h': self.properties.wallPortH,
'x': self.properties.wallPortX, 'z': self.properties.wallPortZ,
'n': self.properties.wallPortRpt, 'bvl': self.properties.wallPortBvl,
'v': archTop[0], 'vl':archBot[0], 't':archTop[1], 'tl':archBot[1]}]
############
# crenellation, top wall gaps...
# if crenel opening overlaps with arch opening it fills with blocks...
archTop[0] = 0
archTop[1] = 0
archBot[0] = 0
archBot[1] = 0
crenelW = CastleX * self.properties.CrenelXP # Width % opening.
crenelz = planeHL - (crenelH / 2) # set bottom of opening
crenelSpace = crenelW * 2 # assume standard spacing
crenelRpt = True
# set indent 0 (center) if opening is 50% or more of wall width, no repeat.
if crenelSpace >= CastleX:
crenelSpace = 0
crenelRpt = False
# set opening values
openingSpecs += [{'a': False,
'w': crenelW, 'h': crenelH,
'x': crenelSpace, 'z': crenelz,
'n': crenelRpt, 'bvl': 0,
'v': archTop[0], 'vl':archBot[0], 't':archTop[1], 'tl':archBot[1]}]
archTop[0] = 0
archTop[1] = 0
archBot[0] = 0
archBot[1] = 0
if self.properties.slotVArchT:
archTop[0] = self.properties.SlotVW
archTop[1] = self.properties.SlotVW / 2
if self.properties.slotVArchB:
archBot[0] = self.properties.SlotVW
archBot[1] = self.properties.SlotVW / 2
# set opening values
openingSpecs += [{'a': False,
'w': self.properties.SlotVW, 'h': self.properties.SlotVH,
'x': self.properties.SlotVL, 'z': self.properties.SlotVZ,
'n': self.properties.SlotVRpt, 'bvl': 0,
'v': archTop[0], 'vl':archBot[0], 't':archTop[1], 'tl':archBot[1]}]
##
####
########################################################################
# Process the user settings to generate castle.
########################################################################
####
##
# Deselect all objects.
bpy.ops.object.select_all(action='DESELECT')
############
# Base/floor/foundation, main object for Castle, parent to all other elements.
wallExtOpts = [False, False] # no steps or shelf
# @todo: offset door by floor height/thickness
# @todo: replicate for "multi-floor" option-shared with roof.
# - will need openings (in plane) for stairs and such...
settings['Slope'] = False # no curve
settings['eoff'] = 0 # no edgeing
# need separate flag for floor/roof...
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
settings['Radial'] = False
baseMtl = uMatRGBSet('cBase_mat', self.cBaseRGB, matMod=True)
baseDisc = False # only when blocks and round...
if self.properties.CBaseB: # floor blocks
baseDisc = self.properties.CBaseR # rounded
# set block "area": height, width, depth, and spacing for floor
# - when rotated or disc shape, height is depth, depth is thickness.
blockArea = [self.properties.cBaseD, self.properties.cBaseW, self.properties.cBaseT, self.properties.blockZ, settings['hv'], self.properties.Grout]
# Block floor uses wall to generate... initialize location values.
wallLoc = [castleScene.cursor_location.x, castleScene.cursor_location.y, castleScene.cursor_location.z]
baseRotate = False # rotate for blocks...
if self.properties.CBaseB: # make floor with blocks.
saveBD = settings['d'] # put back when done with floor...
saveBDV = settings['dv']
settings['d'] = self.properties.cBaseT
settings['dv'] = 0
if baseDisc: # make base disc shaped
settings['Radial'] = True
if self.properties.cBaseD < self.properties.cBaseW: # narrowest extent
blockArea[0] = self.properties.cBaseD / 2
else:
blockArea[0] = self.properties.cBaseW / 2
wallLoc[1] += self.properties.cBaseW / 2 # adjust location for radius
else: # rotate if not disc.
baseRotate = True
castleObj = makeWallObj(self, castleScene, wallLoc, OBJ_N, blockArea, [], wallExtOpts, baseMtl)
if baseRotate:
castleObj.select_set(True) # must select to rotate
# rotate 90 backward
bpy.ops.transform.rotate(value=-cPieHlf, constraint_axis=[True, False, False])
bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
castleObj.select_set(False) # deselect after rotate else joined with others...
settings['d'] = saveBD # restore block values
settings['dv'] = saveBDV
else: # make solid plane
# set plane dimensions and location
baseZ = self.properties.cBaseO
baseT = baseZ + self.properties.cBaseT
baseW = self.properties.cBaseW
baseXO = -baseW / 2 # center
baseXE = baseW / 2
baseBounds = [baseXO, baseXE, baseZ, baseT, 0, self.properties.cBaseD]
castleObj = makePlaneObj(OBJ_N, baseBounds, baseMtl, baseW)
castleScene.objects.link(castleObj) # must do for generation/rotation
####################
# Make Floor and Walls
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
wallMtl = uMatRGBSet('cWall_mat', self.wallRGB, matMod=True)
# Block floor uses wall to generate... reset location values.
wallLoc[1] = castleScene.cursor_location.y
wallLvl = 0 # make per level as selected...
while wallLvl < self.properties.CLvls: # make castle levels
if wallLvl == 0:
floorLvl = False # First floor is Castle base (parent).
wallFLvl = self.properties.wallF1
wallLLvl = self.properties.wallL1
wallBLvl = self.properties.wallB1
wallRLvl = self.properties.wallR1
wallFOLvl = self.properties.wallFO1
wallLOLvl = self.properties.wallLO1
wallBOLvl = self.properties.wallBO1
wallROLvl = self.properties.wallRO1
wallDLvlF = self.properties.wallDF1
wallDLvlL = self.properties.wallDL1
wallDLvlB = self.properties.wallDB1
wallDLvlR = self.properties.wallDR1
wallPLvlF = self.properties.wallPF1
wallPLvlL = self.properties.wallPL1
wallPLvlB = self.properties.wallPB1
wallPLvlR = self.properties.wallPR1
wallELvlF = self.properties.wallEF1
wallELvlL = self.properties.wallEL1
wallELvlB = self.properties.wallEB1
wallELvlR = self.properties.wallER1
wallCLvlF = self.properties.wallCF1
wallCLvlL = self.properties.wallCL1
wallCLvlB = self.properties.wallCB1
wallCLvlR = self.properties.wallCR1
wallSLvlF = self.properties.wallSF1
wallSLvlL = self.properties.wallSL1
wallSLvlB = self.properties.wallSB1
wallSLvlR = self.properties.wallSR1
wallBLvlF = self.properties.wallBF1
wallBLvlL = self.properties.wallBL1
wallBLvlB = self.properties.wallBB1
wallBLvlR = self.properties.wallBR1
if wallLvl == 1:
floorLvl = self.properties.CFloor2
wallFLvl = self.properties.wallF2
wallLLvl = self.properties.wallL2
wallBLvl = self.properties.wallB2
wallRLvl = self.properties.wallR2
wallFOLvl = self.properties.wallFO2
wallLOLvl = self.properties.wallLO2
wallBOLvl = self.properties.wallBO2
wallROLvl = self.properties.wallRO2
wallDLvlF = self.properties.wallDF2
wallDLvlL = self.properties.wallDL2
wallDLvlB = self.properties.wallDB2
wallDLvlR = self.properties.wallDR2
wallPLvlF = self.properties.wallPF2
wallPLvlL = self.properties.wallPL2
wallPLvlB = self.properties.wallPB2
wallPLvlR = self.properties.wallPR2
wallELvlF = self.properties.wallEF2
wallELvlL = self.properties.wallEL2
wallELvlB = self.properties.wallEB2
wallELvlR = self.properties.wallER2
wallCLvlF = self.properties.wallCF2
wallCLvlL = self.properties.wallCL2
wallCLvlB = self.properties.wallCB2
wallCLvlR = self.properties.wallCR2
wallSLvlF = self.properties.wallSF2
wallSLvlL = self.properties.wallSL2
wallSLvlB = self.properties.wallSB2
wallSLvlR = self.properties.wallSR2
wallBLvlF = self.properties.wallBF2
wallBLvlL = self.properties.wallBL2
wallBLvlB = self.properties.wallBB2
wallBLvlR = self.properties.wallBR2
if wallLvl == 2:
floorLvl = self.properties.CFloor3
wallFLvl = self.properties.wallF3
wallLLvl = self.properties.wallL3
wallBLvl = self.properties.wallB3
wallRLvl = self.properties.wallR3
wallFOLvl = self.properties.wallFO3
wallLOLvl = self.properties.wallLO3
wallBOLvl = self.properties.wallBO3
wallROLvl = self.properties.wallRO3
wallDLvlF = self.properties.wallDF3
wallDLvlL = self.properties.wallDL3
wallDLvlB = self.properties.wallDB3
wallDLvlR = self.properties.wallDR3
wallPLvlF = self.properties.wallPF3
wallPLvlL = self.properties.wallPL3
wallPLvlB = self.properties.wallPB3
wallPLvlR = self.properties.wallPR3
wallELvlF = self.properties.wallEF3
wallELvlL = self.properties.wallEL3
wallELvlB = self.properties.wallEB3
wallELvlR = self.properties.wallER3
wallCLvlF = self.properties.wallCF3
wallCLvlL = self.properties.wallCL3
wallCLvlB = self.properties.wallCB3
wallCLvlR = self.properties.wallCR3
wallSLvlF = self.properties.wallSF3
wallSLvlL = self.properties.wallSL3
wallSLvlB = self.properties.wallSB3
wallSLvlR = self.properties.wallSR3
wallBLvlF = self.properties.wallBF3
wallBLvlL = self.properties.wallBL3
wallBLvlB = self.properties.wallBB3
wallBLvlR = self.properties.wallBR3
if wallLvl == 3:
floorLvl = self.properties.CFloor4
wallFLvl = self.properties.wallF4
wallLLvl = self.properties.wallL4
wallBLvl = self.properties.wallB4
wallRLvl = self.properties.wallR4
wallFOLvl = self.properties.wallFO4
wallLOLvl = self.properties.wallLO4
wallBOLvl = self.properties.wallBO4
wallROLvl = self.properties.wallRO4
wallDLvlF = self.properties.wallDF4
wallDLvlL = self.properties.wallDL4
wallDLvlB = self.properties.wallDB4
wallDLvlR = self.properties.wallDR4
wallPLvlF = self.properties.wallPF4
wallPLvlL = self.properties.wallPL4
wallPLvlB = self.properties.wallPB4
wallPLvlR = self.properties.wallPR4
wallELvlF = self.properties.wallEF4
wallELvlL = self.properties.wallEL4
wallELvlB = self.properties.wallEB4
wallELvlR = self.properties.wallER4
wallCLvlF = self.properties.wallCF4
wallCLvlL = self.properties.wallCL4
wallCLvlB = self.properties.wallCB4
wallCLvlR = self.properties.wallCR4
wallSLvlF = self.properties.wallSF4
wallSLvlL = self.properties.wallSL4
wallSLvlB = self.properties.wallSB4
wallSLvlR = self.properties.wallSR4
wallBLvlF = self.properties.wallBF4
wallBLvlL = self.properties.wallBL4
wallBLvlB = self.properties.wallBB4
wallBLvlR = self.properties.wallBR4
if wallLvl == 4:
floorLvl = self.properties.CFloor5
wallFLvl = self.properties.wallF5
wallLLvl = self.properties.wallL5
wallBLvl = self.properties.wallB5
wallRLvl = self.properties.wallR5
wallFOLvl = self.properties.wallFO5
wallLOLvl = self.properties.wallLO5
wallBOLvl = self.properties.wallBO5
wallROLvl = self.properties.wallRO5
wallDLvlF = self.properties.wallDF5
wallDLvlL = self.properties.wallDL5
wallDLvlB = self.properties.wallDB5
wallDLvlR = self.properties.wallDR5
wallPLvlF = self.properties.wallPF5
wallPLvlL = self.properties.wallPL5
wallPLvlB = self.properties.wallPB5
wallPLvlR = self.properties.wallPR5
wallELvlF = self.properties.wallEF5
wallELvlL = self.properties.wallEL5
wallELvlB = self.properties.wallEB5
wallELvlR = self.properties.wallER5
wallCLvlF = self.properties.wallCF5
wallCLvlL = self.properties.wallCL5
wallCLvlB = self.properties.wallCB5
wallCLvlR = self.properties.wallCR5
wallSLvlF = self.properties.wallSF5
wallSLvlL = self.properties.wallSL5
wallSLvlB = self.properties.wallSB5
wallSLvlR = self.properties.wallSR5
wallBLvlF = self.properties.wallBF5
wallBLvlL = self.properties.wallBL5
wallBLvlB = self.properties.wallBB5
wallBLvlR = self.properties.wallBR5
if wallLvl == 5:
floorLvl = self.properties.CFloor6
wallFLvl = self.properties.wallF6
wallLLvl = self.properties.wallL6
wallBLvl = self.properties.wallB6
wallRLvl = self.properties.wallR6
wallFOLvl = self.properties.wallFO6
wallLOLvl = self.properties.wallLO6
wallBOLvl = self.properties.wallBO6
wallROLvl = self.properties.wallRO6
wallDLvlF = self.properties.wallDF6
wallDLvlL = self.properties.wallDL6
wallDLvlB = self.properties.wallDB6
wallDLvlR = self.properties.wallDR6
wallPLvlF = self.properties.wallPF6
wallPLvlL = self.properties.wallPL6
wallPLvlB = self.properties.wallPB6
wallPLvlR = self.properties.wallPR6
wallELvlF = self.properties.wallEF6
wallELvlL = self.properties.wallEL6
wallELvlB = self.properties.wallEB6
wallELvlR = self.properties.wallER6
wallCLvlF = self.properties.wallCF6
wallCLvlL = self.properties.wallCL6
wallCLvlB = self.properties.wallCB6
wallCLvlR = self.properties.wallCR6
wallSLvlF = self.properties.wallSF6
wallSLvlL = self.properties.wallSL6
wallSLvlB = self.properties.wallSB6
wallSLvlR = self.properties.wallSR6
wallBLvlF = self.properties.wallBF6
wallBLvlL = self.properties.wallBL6
wallBLvlB = self.properties.wallBB6
wallBLvlR = self.properties.wallBR6
if wallLvl == 6:
floorLvl = self.properties.CFloor7
wallFLvl = self.properties.wallF7
wallLLvl = self.properties.wallL7
wallBLvl = self.properties.wallB7
wallRLvl = self.properties.wallR7
wallFOLvl = self.properties.wallFO7
wallLOLvl = self.properties.wallLO7
wallBOLvl = self.properties.wallBO7
wallROLvl = self.properties.wallRO7
wallDLvlF = self.properties.wallDF7
wallDLvlL = self.properties.wallDL7
wallDLvlB = self.properties.wallDB7
wallDLvlR = self.properties.wallDR7
wallPLvlF = self.properties.wallPF7
wallPLvlL = self.properties.wallPL7
wallPLvlB = self.properties.wallPB7
wallPLvlR = self.properties.wallPR7
wallELvlF = self.properties.wallEF7
wallELvlL = self.properties.wallEL7
wallELvlB = self.properties.wallEB7
wallELvlR = self.properties.wallER7
wallCLvlF = self.properties.wallCF7
wallCLvlL = self.properties.wallCL7
wallCLvlB = self.properties.wallCB7
wallCLvlR = self.properties.wallCR7
wallSLvlF = self.properties.wallSF7
wallSLvlL = self.properties.wallSL7
wallSLvlB = self.properties.wallSB7
wallSLvlR = self.properties.wallSR7
wallBLvlF = self.properties.wallBF7
wallBLvlL = self.properties.wallBL7
wallBLvlB = self.properties.wallBB7
wallBLvlR = self.properties.wallBR7
if wallLvl == 7:
floorLvl = self.properties.CFloor38
wallFLvl = self.properties.wallF8
wallLLvl = self.properties.wallL8
wallBLvl = self.properties.wallB8
wallRLvl = self.properties.wallR8
wallFOLvl = self.properties.wallFO8
wallLOLvl = self.properties.wallLO8
wallBOLvl = self.properties.wallBO8
wallROLvl = self.properties.wallRO8
wallDLvlF = self.properties.wallDF8
wallDLvlL = self.properties.wallDL8
wallDLvlB = self.properties.wallDB8
wallDLvlR = self.properties.wallDR8
wallPLvlF = self.properties.wallPF8
wallPLvlL = self.properties.wallPL8
wallPLvlB = self.properties.wallPB8
wallPLvlR = self.properties.wallPR8
wallELvlF = self.properties.wallEF8
wallELvlL = self.properties.wallEL8
wallELvlB = self.properties.wallEB8
wallELvlR = self.properties.wallER8
wallCLvlF = self.properties.wallCF8
wallCLvlL = self.properties.wallCL8
wallCLvlB = self.properties.wallCB8
wallCLvlR = self.properties.wallCR8
wallSLvlF = self.properties.wallSF8
wallSLvlL = self.properties.wallSL8
wallSLvlB = self.properties.wallSB8
wallSLvlR = self.properties.wallSR8
wallBLvlF = self.properties.wallBF8
wallBLvlL = self.properties.wallBL8
wallBLvlB = self.properties.wallBB8
wallBLvlR = self.properties.wallBR8
if wallLvl == 8:
floorLvl = self.properties.CFloor9
wallFLvl = self.properties.wallF9
wallLLvl = self.properties.wallL9
wallBLvl = self.properties.wallB9
wallRLvl = self.properties.wallR9
wallFOLvl = self.properties.wallFO9
wallLOLvl = self.properties.wallLO9
wallBOLvl = self.properties.wallBO9
wallROLvl = self.properties.wallRO9
wallDLvlF = self.properties.wallDF9
wallDLvlL = self.properties.wallDL9
wallDLvlB = self.properties.wallDB9
wallDLvlR = self.properties.wallDR9
wallPLvlF = self.properties.wallPF9
wallPLvlL = self.properties.wallPL9
wallPLvlB = self.properties.wallPB9
wallPLvlR = self.properties.wallPR9
wallELvlF = self.properties.wallEF9
wallELvlL = self.properties.wallEL9
wallELvlB = self.properties.wallEB9
wallELvlR = self.properties.wallER9
wallCLvlF = self.properties.wallCF9
wallCLvlL = self.properties.wallCL9
wallCLvlB = self.properties.wallCB9
wallCLvlR = self.properties.wallCR9
wallSLvlF = self.properties.wallSF9
wallSLvlL = self.properties.wallSL9
wallSLvlB = self.properties.wallSB9
wallSLvlR = self.properties.wallSR9
wallBLvlF = self.properties.wallBF9
wallBLvlL = self.properties.wallBL9
wallBLvlB = self.properties.wallBB9
wallBLvlR = self.properties.wallBR9
if wallLvl == 9:
floorLvl = self.properties.CFloor10
wallFLvl = self.properties.wallF10
wallLLvl = self.properties.wallL10
wallBLvl = self.properties.wallB10
wallRLvl = self.properties.wallR10
wallFOLvl = self.properties.wallFO10
wallLOLvl = self.properties.wallLO10
wallBOLvl = self.properties.wallBO10
wallROLvl = self.properties.wallRO10
wallDLvlF = self.properties.wallDF10
wallDLvlL = self.properties.wallDL10
wallDLvlB = self.properties.wallDB10
wallDLvlR = self.properties.wallDR10
wallPLvlF = self.properties.wallPF10
wallPLvlL = self.properties.wallPL10
wallPLvlB = self.properties.wallPB10
wallPLvlR = self.properties.wallPR10
wallELvlF = self.properties.wallEF10
wallELvlL = self.properties.wallEL10
wallELvlB = self.properties.wallEB10
wallELvlR = self.properties.wallER10
wallCLvlF = self.properties.wallCF10
wallCLvlL = self.properties.wallCL10
wallCLvlB = self.properties.wallCB10
wallCLvlR = self.properties.wallCR10
wallSLvlF = self.properties.wallSF10
wallSLvlL = self.properties.wallSL10
wallSLvlB = self.properties.wallSB10
wallSLvlR = self.properties.wallSR10
wallBLvlF = self.properties.wallBF10
wallBLvlL = self.properties.wallBL10
wallBLvlB = self.properties.wallBB10
wallBLvlR = self.properties.wallBR10
levelBase = planeHL * wallLvl
floorDisc = False # affects floor and wall positioning.
if self.properties.CBaseB: # if blocks for floor can make disc.
floorDisc = self.properties.CBaseR
############
# make floor for each level
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
if floorLvl:
objName = OBJ_CF + str(wallLvl)
# set plane dimensions and location
floorBase = levelBase
floorTop = floorBase + self.properties.cBaseT
floorPW = self.properties.cBaseW
floorD = self.properties.cBaseD
floorXO = -floorPW / 2 # center
floorXE = floorPW / 2
floorBounds = [floorXO, floorXE, floorBase, floorTop, 0, floorD]
floorObj = makePlaneObj(objName, floorBounds, baseMtl, floorPW)
# adjust floor location for 3D cursor since parented to Base...
yMod = castleScene.cursor_location.y
if floorDisc: # make a disc shaped floor
yMod += self.properties.cBaseD / 2
floorObj.location.x -= castleScene.cursor_location.x
floorObj.location.y -= yMod
floorObj.location.z -= castleScene.cursor_location.z
castleScene.objects.link(floorObj) # must do for generation/rotation
floorObj.parent = castleObj # Connect to parent
############
# make walls for each level
wallSides = [wallFLvl, wallLLvl, wallBLvl, wallRLvl]
# Wall modifiers, per level, per wall (FBLR not FLBR order to match wall build sequence).
wallMods = [[wallDLvlF, wallPLvlF, wallELvlF, wallCLvlF, wallSLvlF, wallBLvlF, wallFOLvl],
[wallDLvlB, wallPLvlB, wallELvlB, wallCLvlB, wallSLvlB, wallBLvlB, wallBOLvl],
[wallDLvlL, wallPLvlL, wallELvlL, wallCLvlL, wallSLvlL, wallBLvlL, wallLOLvl],
[wallDLvlR, wallPLvlR, wallELvlR, wallCLvlR, wallSLvlR, wallBLvlR, wallROLvl]
]
wallLoc[2] = levelBase # each segment base...
makeWalls(self, castleScene, castleObj, wallSides, wallMods, wallLoc, wallMtl, wallLvl, floorDisc)
wallLvl += 1
####################
# Make "Tower"
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
if self.properties.cXTest and self.properties.CTower:
# no steps or shelf for tower...
wallExtOpts[0] = False
wallExtOpts[1] = False
settings['Slope'] = True # force curvature
dims['s'] = 0.0 # radial origin
dims['e'] = CastleX / 2 # effective tower height; affects radius.
# set block "area": height, width, depth, and spacing.
blockArea = [dims['e'], CastleX, blockDepth, self.properties.blockZ, settings['hv'], self.properties.Grout]
# Make "tower" wall.
wallLoc[0] = 0
wallLoc[1] = 0
wallLoc[2] = castleScene.cursor_location.z
# generate tower...
cTower1Obj = makeWallObj(self, castleScene, wallLoc, "CTower1", blockArea, [], wallExtOpts, wallMtl)
cTower1Obj.select_set(True) # must select to rotate
# rotate 90 forward (face plant)...
# bpy.ops.transform.rotate(value=cPieHlf,constraint_axis=[True,False,False])
# rotate 90 ccw along side
bpy.ops.transform.rotate(value=-cPieHlf, constraint_axis=[False, True, False])
bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
cTower1Obj.select_set(False) # deselect after rotate else joined with others...
cTower1Obj.parent = castleObj # Connect to parent
####################
# Make "Dome"
settings['Radial'] = self.properties.cDome
if self.properties.cDome:
# no steps or shelf for dome...
wallExtOpts[0] = False
wallExtOpts[1] = False
settings['Slope'] = True # force curvature
settings['sdv'] = 0.12
wallLoc[0] = castleScene.cursor_location.x
wallLoc[1] = midWallD
wallLoc[2] = self.properties.cDomeZ
domeMtl = uMatRGBSet('cDome_mat', self.cDomeRGB, matMod=True)
# set block "area": height, width, depth, and spacing.
blockArea = [self.properties.cDomeH, CastleX, blockDepth, self.properties.blockZ, settings['hv'], self.properties.Grout]
# eliminate to allow user control for start/completion by width setting.
dims['s'] = 0.0 # complete radial
if midWallD < midWallW: # use shortest dimension for dome.
dims['e'] = midWallD
else:
dims['e'] = midWallW
# generate dome...
cDomeObj = makeWallObj(self, castleScene, wallLoc, "cDome", blockArea, [], wallExtOpts, domeMtl)
yMod = 0 # shift "location" as needed...
if floorDisc: # make a disc shaped floor
yMod -= (CastleD + blockDepth) / 2
cDomeObj.location.y += yMod
cDomeObj.parent = castleObj # Connect to parent
context.view_layer.objects.active = castleObj
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
return {'FINISHED'}
################################################################################
####################
#
# Walls
#
# when variations or openings are selected different block rows are
# generated for each wall; edges/ends don't match.
#
####################
def makeWalls(sRef, objScene, objParent, objSides, objMods, objLoc, objMat, objLvl, floorDisc):
wallExtOpts = [False, False] # no steps or shelf
WobjH = sRef.properties.wallH
WobjW = sRef.properties.cBaseW
WobjY = sRef.properties.cBaseD
WobjD = sRef.properties.blockD
segWidth = sRef.properties.blockX
# center wall...
midWallD = (WobjY + WobjD) / 2
midWallW = (WobjW + WobjD) / 2
settings['eoff'] = sRef.properties.EdgeOffset
settings['sdv'] = sRef.properties.blockX
settings['Slope'] = False
if sRef.properties.cXTest:
if sRef.properties.CTunnel:
settings['Slope'] = True # force curve
else:
settings['Slope'] = sRef.properties.wallSlope # user select curve walls...
# passed as params since modified by wall and dome...
settings['StepsB'] = sRef.properties.StepF # fill under with blocks
settings['StepsL'] = sRef.properties.StepL # up to left
settings['StepsO'] = sRef.properties.StepOut # outside of wall
# set block "area": height, width, depth, and spacing for front and back walls.
blockArea = [WobjH, WobjW, WobjD, sRef.properties.blockZ, settings['hv'], sRef.properties.Grout]
dims['s'] = -midWallW
dims['e'] = midWallW
yMod = 0 # shift front/back "location" as needed...
if floorDisc: # make a disc shaped floor
yMod = WobjY
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
if objSides[0]: # Make "front" wall
objName = OBJ_WF + str(objLvl)
wallRound = objMods[0][6] # round (disc) wall...
# adjust sizing for round wall else ensure full height.
if wallRound:
settings['Radial'] = True
blockArea[0] = WobjH / 2 # half height for radius
else:
settings['Radial'] = False # disable disc
blockArea[0] = WobjH # ensure full height
wallSteps = False
wallShelf = False
wallHoles = []
openingSpecs[OP_DOOR]['a'] = objMods[0][0] # door
openingSpecs[OP_PORT]['a'] = objMods[0][1] # window
openingSpecs[OP_SLOT]['a'] = objMods[0][2] # slot
openingSpecs[OP_CREN]['a'] = objMods[0][3] # crenel
wallExtOpts[0] = objMods[0][4] # steps
wallExtOpts[1] = objMods[0][5] # shelf
wallHoles = openList(sRef)
objLoc[0] = 0
if sRef.properties.cXTest and sRef.properties.CTunnel:
objLoc[1] = WobjY / 2
else:
objLoc[1] = 0
objLoc[1] -= yMod / 2 # offset for disc
# generate wall...
cFrontObj = makeWallObj(sRef, objScene, objLoc, objName, blockArea, wallHoles, wallExtOpts, objMat)
cFrontObj.parent = objParent # Connect to parent
if wallRound: # rotate 90 forward if round/disc
cFrontObj.select_set(True) # must select to rotate
bpy.ops.transform.rotate(value=cPieHlf, constraint_axis=[True, False, False])
bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
cFrontObj.location.z += WobjH / 2 # adjust vertical after rotate for radius
cFrontObj.select_set(False) # deselect after rotate else joined with others...
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
if objSides[2]: # Make "back" wall
objName = OBJ_WB + str(objLvl)
wallRound = objMods[1][6] # round (disc) wall...
# adjust sizing for round wall else ensure full height.
if wallRound:
settings['Radial'] = True
blockArea[0] = WobjH / 2 # half height for radius
else:
settings['Radial'] = False # disable disc
blockArea[0] = WobjH # ensure full height
wallSteps = False
wallShelf = False
wallHoles = []
openingSpecs[OP_DOOR]['a'] = objMods[1][0] # door
openingSpecs[OP_PORT]['a'] = objMods[1][1] # window
openingSpecs[OP_SLOT]['a'] = objMods[1][2] # slot
openingSpecs[OP_CREN]['a'] = objMods[1][3] # crenel
wallExtOpts[0] = objMods[1][4] # steps
wallExtOpts[1] = objMods[1][5] # shelf
wallHoles = openList(sRef)
objLoc[0] = 0
if sRef.properties.cXTest and sRef.properties.CTunnel:
objLoc[1] = WobjY / 2
else:
objLoc[1] = WobjY
objLoc[1] -= yMod / 2 # offset for floor disc
# generate wall...
cBackObj = makeWallObj(sRef, objScene, objLoc, objName, blockArea, wallHoles, wallExtOpts, objMat)
cBackObj.parent = objParent # Connect to parent
cBackObj.select_set(True) # must select to rotate
# rotate to "reverse" face of wall, else just a mirror of front.
bpy.ops.transform.rotate(value=cPie, constraint_axis=[False, False, True])
bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
if wallRound: # rotate 90 forward
bpy.ops.transform.rotate(value=cPieHlf, constraint_axis=[True, False, False])
cBackObj.location.z += WobjH / 2 # adjust vertical after rotate for radius
cBackObj.select_set(False) # de-select after rotate else joined with others...
# set block "area": height, width, depth, and spacing for side walls...
blockArea = [WobjH, WobjY - segWidth * 2, WobjD, sRef.properties.blockZ, settings['hv'], sRef.properties.Grout]
# blockArea=[WobjH,WobjY-segWidth,WobjD,sRef.properties.blockZ,settings['hv'],sRef.properties.Grout]
# blockArea=[WobjH,WobjY,WobjD,sRef.properties.blockZ,settings['hv'],sRef.properties.Grout]
# rowprocessing() side walls
dims['s'] = -midWallD
dims['e'] = midWallD
if objSides[1]: # Make "Left" wall
objName = OBJ_WL + str(objLvl)
wallRound = objMods[2][6] # round (disc) wall...
# adjust sizing for round wall else ensure full height.
if wallRound:
settings['Radial'] = True
blockArea[0] = WobjH / 2 # half height for radius
else:
settings['Radial'] = False # disable disc
blockArea[0] = WobjH # ensure full height
wallSteps = False
wallShelf = False
wallHoles = []
openingSpecs[OP_DOOR]['a'] = objMods[2][0] # door
openingSpecs[OP_PORT]['a'] = objMods[2][1] # window
openingSpecs[OP_SLOT]['a'] = objMods[2][2] # slot
# radius/round sizing wrong when crenel selected...
openingSpecs[OP_CREN]['a'] = objMods[2][3] # crenel
wallExtOpts[0] = objMods[2][4] # steps
wallExtOpts[1] = objMods[2][5] # shelf
wallHoles = openList(sRef)
if sRef.properties.cXTest and sRef.properties.CTunnel:
objLoc[0] = 0
else:
objLoc[0] = -midWallW
if floorDisc: # make a disc shaped floor
objLoc[1] = 0
else:
objLoc[1] = midWallD - (WobjD / 2)
# generate wall...
cSideLObj = makeWallObj(sRef, objScene, objLoc, objName, blockArea, wallHoles, wallExtOpts, objMat)
cSideLObj.parent = objParent # Connect to parent
cSideLObj.select_set(True) # must select to rotate
bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
if wallRound: # rotate 90 forward
bpy.ops.transform.rotate(value=cPieHlf, constraint_axis=[True, False, False])
cSideLObj.location.z += WobjH / 2 # adjust vertical after rotate for radius
if sRef.properties.cXTest and sRef.properties.CTunnel:
# rotate 90 horizontal, ccw...
bpy.ops.transform.rotate(value=cPieHlf, constraint_axis=[False, False, True])
else:
# rotate 90 horizontal, cw...
bpy.ops.transform.rotate(value=-cPieHlf, constraint_axis=[False, False, True])
# rotate 90 forward (face plant)...
# bpy.ops.transform.rotate(value=cPieHlf,constraint_axis=[True,False,False])
# rotate 90 cw along side
# bpy.ops.transform.rotate(value=cPieHlf,constraint_axis=[False,True,False])
cSideLObj.select_set(False) # deselect after rotate else joined with others...
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
if objSides[3]: # Make "Right" wall
objName = OBJ_WR + str(objLvl)
wallRound = objMods[3][6] # round (disc) wall...
# adjust sizing for round wall else ensure full height.
if wallRound:
settings['Radial'] = True
blockArea[0] = WobjH / 2 # half height for radius
else:
settings['Radial'] = False # disable disc
blockArea[0] = WobjH # ensure full height
wallSteps = False
wallShelf = False
wallHoles = []
openingSpecs[OP_DOOR]['a'] = objMods[3][0] # door
openingSpecs[OP_PORT]['a'] = objMods[3][1] # window
openingSpecs[OP_SLOT]['a'] = objMods[3][2] # slot
openingSpecs[OP_CREN]['a'] = objMods[3][3] # crenel
wallExtOpts[0] = objMods[3][4] # steps
wallExtOpts[1] = objMods[3][5] # shelf
wallHoles = openList(sRef)
if sRef.properties.cXTest and sRef.properties.CTunnel:
objLoc[0] = 0
else:
objLoc[0] = midWallW
if floorDisc: # make a disc shaped floor
objLoc[1] = 0
else:
objLoc[1] = midWallD - (WobjD / 2)
cSideRObj = makeWallObj(sRef, objScene, objLoc, objName, blockArea, wallHoles, wallExtOpts, objMat)
cSideRObj.parent = objParent # Connect to parent
cSideRObj.select_set(True) # must select to rotate
bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
if wallRound: # rotate 90 forward
bpy.ops.transform.rotate(value=cPieHlf, constraint_axis=[True, False, False])
cSideRObj.location.z += WobjH / 2 # adjust vertical after rotate for radius
if sRef.properties.cXTest and sRef.properties.CTunnel: