|
|
@@ -1,103 +0,0 @@
|
|
1
|
|
-# -*- coding: utf-8 -*-
|
|
2
|
|
-import bpy
|
|
3
|
|
-
|
|
4
|
|
-# count values, contains only 2 values : old count and current
|
|
5
|
|
-at_count_values = []
|
|
6
|
|
-# row value, contains old row and current
|
|
7
|
|
-at_row_values = []
|
|
8
|
|
-# alter values, contains old and current
|
|
9
|
|
-at_alter = []
|
|
10
|
|
-# maximun row according to column and alter
|
|
11
|
|
-maxrow = 1
|
|
12
|
|
-# list of the copies / list of lists
|
|
13
|
|
-atools_objs = []
|
|
14
|
|
-ref_mtx = [] # reference matrix
|
|
15
|
|
-# collection name
|
|
16
|
|
-col_name = "Array_collection"
|
|
17
|
|
-
|
|
18
|
|
-
|
|
19
|
|
-def init_array_tool(context):
|
|
20
|
|
- """Initialisation of the array tools"""
|
|
21
|
|
- global at_count_values
|
|
22
|
|
- global at_row_values
|
|
23
|
|
- global at_alter
|
|
24
|
|
- global atools_objs
|
|
25
|
|
- global ref_mtx
|
|
26
|
|
- global col_name
|
|
27
|
|
-
|
|
28
|
|
- prop = context.scene.arraytools_prop
|
|
29
|
|
- name = col_name
|
|
30
|
|
- i = 1
|
|
31
|
|
- collect = bpy.data.collections.get(col_name)
|
|
32
|
|
- # create and link the new collection
|
|
33
|
|
- if collect is None:
|
|
34
|
|
- array_col = bpy.data.collections.new(col_name)
|
|
35
|
|
- bpy.context.scene.collection.children.link(array_col)
|
|
36
|
|
- else:
|
|
37
|
|
- # if a collection already exist, create a new one
|
|
38
|
|
- while bpy.data.collections.get(name) is not None:
|
|
39
|
|
- name = col_name + str(i)
|
|
40
|
|
- i += 1
|
|
41
|
|
- array_col = bpy.data.collections.new(name)
|
|
42
|
|
- bpy.context.scene.collection.children.link(array_col)
|
|
43
|
|
- col_name = name
|
|
44
|
|
-
|
|
45
|
|
- if not prop.already_start:
|
|
46
|
|
- at_count_values = [1, 2]
|
|
47
|
|
- at_row_values = [0, 1]
|
|
48
|
|
- at_alter = [0, 0]
|
|
49
|
|
- active = context.active_object
|
|
50
|
|
- prop.already_start = True
|
|
51
|
|
- prop.is_tr_off_last = True
|
|
52
|
|
- if active is not None:
|
|
53
|
|
- atools_objs.append([active.name])
|
|
54
|
|
- ref_mtx = active.matrix_world.copy()
|
|
55
|
|
- del active
|
|
56
|
|
- prop.add_in_column(prop.row)
|
|
57
|
|
- # no need anymore
|
|
58
|
|
- else:
|
|
59
|
|
- print("No object selected")
|
|
60
|
|
- else:
|
|
61
|
|
- print("Already started!")
|
|
62
|
|
-
|
|
63
|
|
-
|
|
64
|
|
-def add_count(value):
|
|
65
|
|
- """Save the current count"""
|
|
66
|
|
- global at_count_values
|
|
67
|
|
- at_count_values.append(value)
|
|
68
|
|
-
|
|
69
|
|
-
|
|
70
|
|
-def del_count():
|
|
71
|
|
- """Del the previous count"""
|
|
72
|
|
- global at_count_values
|
|
73
|
|
- del at_count_values[0]
|
|
74
|
|
-
|
|
75
|
|
-
|
|
76
|
|
-def add_row(value):
|
|
77
|
|
- """Save the current row"""
|
|
78
|
|
- global at_row_values
|
|
79
|
|
- at_row_values.append(value)
|
|
80
|
|
-
|
|
81
|
|
-
|
|
82
|
|
-def del_row():
|
|
83
|
|
- """ Del the previous row value"""
|
|
84
|
|
- global at_row_values
|
|
85
|
|
- del at_row_values[0]
|
|
86
|
|
-
|
|
87
|
|
-
|
|
88
|
|
-def add_alter(value):
|
|
89
|
|
- """save the current variation"""
|
|
90
|
|
- global at_alter
|
|
91
|
|
- at_alter.append(value)
|
|
92
|
|
-
|
|
93
|
|
-
|
|
94
|
|
-def del_alter():
|
|
95
|
|
- """Remove previous variation"""
|
|
96
|
|
- global at_alter
|
|
97
|
|
- del at_alter[0]
|
|
98
|
|
-
|
|
99
|
|
-
|
|
100
|
|
-def display_error(msg):
|
|
101
|
|
- """Call the operator to display an error message"""
|
|
102
|
|
- bpy.ops.info.at_error('INVOKE_DEFAULT', info = msg)
|
|
103
|
|
-
|