Skip to content

Commit 9e379cf

Browse files
committed
Added: Proxies can now be copied by from active to selected object without going through a dialog
1 parent 6174c12 commit 9e379cf

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

ArmaToolbox/operators.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -279,20 +279,26 @@ class ATBX_OT_copy_proxy(bpy.types.Operator):
279279

280280
def execute(self, context):
281281
sObj = context.active_object
282-
for obj in self.objectArray:
283-
if obj.doCopy:
284-
enclose = self.encloseInto
285-
enclose = enclose.strip()
286-
if len(enclose) == 0:
287-
enclose = None
288-
289-
CopyProxy(sObj, bpy.data.objects[obj.name], self.copyProxyName, enclose)
282+
if len(context.selected_objects) > 1:
283+
for obj in context.selected_objects:
284+
if obj != context.active_object:
285+
CopyProxy(sObj, bpy.data.objects[obj.name], self.copyProxyName)
286+
else:
287+
for obj in self.objectArray:
288+
if obj.doCopy:
289+
enclose = self.encloseInto
290+
enclose = enclose.strip()
291+
if len(enclose) == 0:
292+
enclose = None
293+
294+
CopyProxy(sObj, bpy.data.objects[obj.name], self.copyProxyName, enclose)
290295

291-
self.objectArray.clear()
296+
self.objectArray.clear()
292297
return {"FINISHED"}
293298

294299
def invoke(self, context, event):
295-
300+
if len(context.selected_objects) > 1:
301+
return self.execute(context)
296302
for obj in bpy.data.objects.values():
297303
if obj.armaObjProps.isArmaObject == True and obj != context.active_object:
298304
prop = self.objectArray.add()
@@ -303,6 +309,8 @@ def invoke(self, context, event):
303309
return wm.invoke_props_dialog(self)
304310

305311
def draw(self, context):
312+
if len(context.selected_objects) > 1:
313+
return
306314
layout = self.layout
307315
col = layout.column()
308316
col.label(text="Copy Proxy!")

0 commit comments

Comments
 (0)