Skip to content

Commit af633e8

Browse files
committed
Added: Join As Proxy can now take the path from a "proxy" named selection on the joining object
1 parent 7441de7 commit af633e8

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

ArmaToolbox/ArmaTools.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,3 +1073,16 @@ def deleteVertexGroupList(context, vgrpList):
10731073
bpy.ops.mesh.delete(type='VERT')
10741074

10751075
bpy.ops.object.mode_set(mode="OBJECT")
1076+
1077+
def findNamedSelectionString(obj, selectionName):
1078+
index = obj.armaObjProps.namedProps.find(selectionName)
1079+
1080+
if index is -1:
1081+
return None
1082+
1083+
output = obj.armaObjProps.namedProps[selectionName]
1084+
1085+
if len(output.value) is 0:
1086+
return None
1087+
1088+
return output.value

ArmaToolbox/operators.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,8 @@ def execute(self, context):
570570
index = context.window_manager.armaGUIProps.mapProxyIndex
571571
doDel = context.window_manager.armaGUIProps.mapProxyDelete
572572

573+
574+
573575
enclose = context.window_manager.armaGUIProps.mapProxyEnclose
574576
if len(enclose) == 0:
575577
enclose = None
@@ -578,6 +580,13 @@ def execute(self, context):
578580
if sel == obj:
579581
pass
580582
else:
583+
if context.window_manager.armaGUIProps.mapUseNamedSelection:
584+
newPath = ArmaTools.findNamedSelectionString(sel, "proxy")
585+
if newPath is not None:
586+
path = newPath
587+
else:
588+
path = context.window_manager.armaGUIProps.mapProxyObject
589+
581590
if enclose == None:
582591
e = None
583592
else:
@@ -590,6 +599,9 @@ def execute(self, context):
590599
obj.select_set(False)
591600
bpy.ops.object.delete();
592601

602+
if context.window_manager.armaGUIProps.mapAutoIncrementProxy:
603+
context.window_manager.armaGUIProps.mapProxyIndex = index
604+
593605
return {"FINISHED"}
594606

595607
###

ArmaToolbox/panels.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,11 +518,17 @@ def draw(self, context):
518518
row = layout.row()
519519
box = createToggleBox(context, row, "mapOpen", "Join as Proxy", "armatoolbox.joinasproxy")
520520
if guiProp.mapOpen == True:
521+
row = box.row()
522+
row.prop(guiProp, "mapUseNamedSelection", text="Use proxy named selection (if present)")
523+
row = box.row()
524+
row.label(text="Otherwise use path")
521525
row = box.row()
522526
row.prop(guiProp, "mapProxyObject", text="Path")
523527
row = box.row()
524528
row.prop(guiProp, "mapProxyIndex", text="Index")
525529
row = box.row()
530+
row.prop(guiProp, "mapAutoIncrementProxy", text="Auto-Increment Proxy Index")
531+
row = box.row()
526532
row.prop(guiProp, "mapProxyDelete", text="Delete source objects")
527533
row = box.row()
528534
bx = row.box()

ArmaToolbox/properties.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ class ArmaToolboxGUIProps(bpy.types.PropertyGroup):
349349
mapProxyDelete : bpy.props.BoolProperty("mapProxyDelete", description="Delete original", default=True)
350350
mapProxyEnclose : bpy.props.StringProperty("mapProxyEnclose", description="Enclosed Selection")
351351
mapOpen : bpy.props.BoolProperty(name="mapOpen", default=False)
352+
mapUseNamedSelection : bpy.props.BoolProperty(name="mapUseNamedSelection", default=True)
353+
mapAutoIncrementProxy : bpy.props.BoolProperty(name="mapAutoIncrementProxy", default=False)
352354

353355
# Proxy Path Changer
354356
proxyPathFrom : bpy.props.StringProperty("proxyPathFrom", description="Proxy Path From", subtype = 'FILE_PATH')

0 commit comments

Comments
 (0)