Skip to content

Commit

Permalink
- Added: Now supports import/export of export configs via clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
AlwarrenSidh committed Jul 27, 2024
1 parent b7137aa commit c1d5179
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 3 deletions.
54 changes: 53 additions & 1 deletion ArmaToolbox/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,56 @@ def execute(self, context):
prp.remove(active)
return {"FINISHED"}

class ATBX_OT_save_configs(bpy.types.Operator):
bl_idname = "armatoolbox.save_configs"
bl_label = ""
bl_description = "Save Configs to the clipboard"

def execute(self, context):
prp = context.scene.armaExportConfigs.exportConfigs
text = ""
for p in prp:
text = text + p.name + "|"
text = text + p.fileName + "|"
if (p.originObject == None):
text = text + "\n"
else:
text = text + p.originObject.name + "\n"


context.window_manager.clipboard = text
return {"FINISHED"}

class ATBX_OT_load_configs(bpy.types.Operator):
bl_idname = "armatoolbox.load_configs"
bl_label = ""
bl_description = "Load Configs from Clipboard"

def execute(self, context):
prp = context.scene.armaExportConfigs.exportConfigs
text = context.window_manager.clipboard

prp.clear()

for line in text.splitlines():
results = line.split("|")
name = ""
fileName = ""
centerName = ""
if len(results) > 0:
name = results[0]
if len(results) > 1:
fileName = results[1]
if len(results) > 2:
centerName = results[2]

item = prp.add()
item.name = name
item.fileName = fileName
if len(centerName):
item.originObject = bpy.data.objects[centerName]

return {"FINISHED"}

class ATBX_OT_add_obj_config(bpy.types.Operator):
bl_idname = "armatoolbox.add_obj_config"
Expand Down Expand Up @@ -1557,7 +1607,9 @@ def execute(self,context):
ATBX_MT_add_atleast_config_mesh_collector,
ATBX_OT_add_del_vgroup,
ATBX_OT_rem_del_vgroup,
ATBX_MT_clear_del_vgroup
ATBX_MT_clear_del_vgroup,
ATBX_OT_save_configs,
ATBX_OT_load_configs
)


Expand Down
6 changes: 6 additions & 0 deletions ArmaToolbox/panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,12 @@ def draw(self,context):
#row = box.row()
row.label(text = "File Name")

row = layout.row()
row.label(text = "Clipboard")
col = row.column()
col.operator("armatoolbox.save_configs", text = "Save")
col.operator("armatoolbox.load_configs", text = "Load")


class ATBX_PT_export_configs_batch_panel(bpy.types.Panel):
bl_category = "Arma 3 Export Configs Batch"
Expand Down
4 changes: 2 additions & 2 deletions deploy.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
xcopy /y ArmaToolbox\*.* "%appdata%\Blender Foundation\Blender\4.1\scripts\addons\ArmaToolbox"
del /s/q "%appdata%\Blender Foundation\Blender\4.1\scripts\addons\ArmaToolbox\__pycache__"
xcopy /y ArmaToolbox\*.* "%appdata%\Blender Foundation\Blender\4.2\scripts\addons\ArmaToolbox"
del /s/q "%appdata%\Blender Foundation\Blender\4.2\scripts\addons\ArmaToolbox\__pycache__"

0 comments on commit c1d5179

Please sign in to comment.