testing-framework / plugin_blender / tools.py @ 17a68f48
History | View | Annotate | Download (2.332 KB)
| 1 |
import bpy |
|---|---|
| 2 |
|
| 3 |
class Import1(bpy.types.Operator): |
| 4 |
"""Fügt evtl. fehlende Schlüssel hinzu"""
|
| 5 |
bl_idname = "tools.import1"
|
| 6 |
bl_label = "Import 1"
|
| 7 |
|
| 8 |
# Wird ausgeführt um zu testen, ob die Operation des Operators möglich ist.
|
| 9 |
@classmethod
|
| 10 |
def poll(self, context): |
| 11 |
return True |
| 12 |
|
| 13 |
# Fügt evtl. fehlende Schlüssel hinzu
|
| 14 |
def execute(self, context): |
| 15 |
#Ergänzt das Schlüsselattribut:
|
| 16 |
for schluessel in bpy.data.objects.keys(): |
| 17 |
if (schluessel[-2] == '_'): |
| 18 |
print(schluessel) |
| 19 |
bpy.data.objects[schluessel].marker_id = int(schluessel[-1]) |
| 20 |
elif (schluessel[-3] == '_'): |
| 21 |
print(schluessel) |
| 22 |
bpy.data.objects[schluessel].marker_id = int(schluessel[-2:]) |
| 23 |
elif (schluessel[-4] == '_'): |
| 24 |
print(schluessel) |
| 25 |
bpy.data.objects[schluessel].marker_id = int(schluessel[-3:]) |
| 26 |
return{'FINISHED'} |
| 27 |
|
| 28 |
class Import2(bpy.types.Operator): |
| 29 |
"""Fügt neuere Schlüssel zu den Texturen hinzu"""
|
| 30 |
bl_idname = "tools.import2"
|
| 31 |
bl_label = "Import 2"
|
| 32 |
|
| 33 |
# Wird ausgeführt um zu testen, ob die Operation des Operators möglich ist.
|
| 34 |
@classmethod
|
| 35 |
def poll(self, context): |
| 36 |
return True |
| 37 |
|
| 38 |
# Fügt neuere Schlüssel zu den Texturen hinzu
|
| 39 |
def execute(self, context): |
| 40 |
#Ergänzt die Schlüsselattribute:
|
| 41 |
for schluessel in bpy.data.textures.keys(): |
| 42 |
if(bpy.data.textures[schluessel].type == 'IMAGE'): |
| 43 |
if (schluessel[-2] == '_'): |
| 44 |
print(schluessel) |
| 45 |
bpy.data.textures[schluessel].marker_id = int(schluessel[-1]) |
| 46 |
elif (schluessel[-3] == '_'): |
| 47 |
print(schluessel) |
| 48 |
bpy.data.textures[schluessel].marker_id = int(schluessel[-2:]) |
| 49 |
elif (schluessel[-4] == '_'): |
| 50 |
print(schluessel) |
| 51 |
bpy.data.textures[schluessel].marker_id = int(schluessel[-3:]) |
| 52 |
#
|
| 53 |
if(schluessel[0:5] == "ALVAR"): |
| 54 |
print("Lib: ALVAR")
|
| 55 |
bpy.data.textures[schluessel].library = "ALVAR"
|
| 56 |
elif(schluessel[0:4] == "BART"): |
| 57 |
print("Lib: BART")
|
| 58 |
bpy.data.textures[schluessel].library = "BART"
|
| 59 |
return{'FINISHED'} |