henrique 1 month ago
parent 4e8b45fa30
commit 4886aa2620

@ -48,8 +48,35 @@ def attach_grouped_objects(ui, from_auto=False):
ui.pb.setFormat("Fundindo grupos inteiros...") ui.pb.setFormat("Fundindo grupos inteiros...")
QtWidgets.QApplication.processEvents() QtWidgets.QApplication.processEvents()
ms = """( ms = """(
local act = 0; local new_objs = #(); local orig_sel = selection as array; local loose = for o in orig_sel where not isGroupHead o and not isGroupMember o collect o; local heads = for o in orig_sel where isGroupHead o collect o fn hasProtectedName nd = (
for h in heads do ( local valid_cg = for c in h.children where superclassof c == GeometryClass and classof c != TargetObject collect c; if valid_cg.count > 0 do ( local b = valid_cg[1]; if not isKindOf b Editable_Poly do try(convertToPoly b)catch(); if isKindOf b Editable_Poly do ( for i = 2 to valid_cg.count do ( local n = valid_cg[i]; if not isKindOf n Editable_Poly do try(convertToPoly n)catch(); if isKindOf n Editable_Poly do try(polyOp.attach b n)catch() ); b.name = h.name; setGroupMember b false; append new_objs b; act += 1 ) ); try(delete h)catch() ) local nm = toLower nd.name
if (matchPattern nm pattern:"*_mult*") or (matchPattern nm pattern:"*_catg*") or (matchPattern nm pattern:"*_mat*") do return true
for c in nd.children do ( if hasProtectedName c do return true )
return false
)
local act = 0; local new_objs = #(); local orig_sel = selection as array;
local loose = for o in orig_sel where not isGroupHead o and not isGroupMember o collect o;
local heads = for o in orig_sel where isGroupHead o and not (hasProtectedName o) collect o
for h in heads do (
local valid_cg = for c in h.children where superclassof c == GeometryClass and classof c != TargetObject collect c
if valid_cg.count > 0 do (
local b = valid_cg[1]
if not isKindOf b Editable_Poly do try(convertToPoly b)catch()
if isKindOf b Editable_Poly do (
for i = 2 to valid_cg.count do (
local n = valid_cg[i]
if not isKindOf n Editable_Poly do try(convertToPoly n)catch()
if isKindOf n Editable_Poly do try(polyOp.attach b n)catch()
)
b.name = h.name
setGroupMember b false
append new_objs b
act += 1
)
)
try(delete h)catch()
)
local final_sel = loose; for no in new_objs do append final_sel no; if final_sel.count > 0 do select final_sel; act local final_sel = loose; for no in new_objs do append final_sel no; if final_sel.count > 0 do select final_sel; act
)""" )"""
try: try:
@ -64,7 +91,29 @@ def attach_grouped_objects(ui, from_auto=False):
def super_attach_objects(ui, from_auto=False): def super_attach_objects(ui, from_auto=False):
ui.pb.setFormat("Super Solda VR...") ui.pb.setFormat("Super Solda VR...")
QtWidgets.QApplication.processEvents() QtWidgets.QApplication.processEvents()
ms = """( local sel = for o in selection where superclassof o == GeometryClass and classof o != TargetObject collect o; if sel.count > 1 do ( local b = sel[1]; if not isKindOf b Editable_Poly do try(convertToPoly b)catch(); if isKindOf b Editable_Poly do ( for i = 2 to sel.count do ( local n = sel[i]; if not isKindOf n Editable_Poly do try(convertToPoly n)catch(); if isKindOf n Editable_Poly do try(polyOp.attach b n)catch() ); b.name = uniqueName "VR_Bloco_Fundido"; select b ) ); sel.count )""" ms = """(
fn hasProtectedName nd = (
local nm = toLower nd.name
if (matchPattern nm pattern:"*_mult*") or (matchPattern nm pattern:"*_catg*") or (matchPattern nm pattern:"*_mat*") do return true
for c in nd.children do ( if hasProtectedName c do return true )
return false
)
local sel = for o in selection where superclassof o == GeometryClass and classof o != TargetObject and not (hasProtectedName o) collect o
if sel.count > 1 do (
local b = sel[1]
if not isKindOf b Editable_Poly do try(convertToPoly b)catch()
if isKindOf b Editable_Poly do (
for i = 2 to sel.count do (
local n = sel[i]
if not isKindOf n Editable_Poly do try(convertToPoly n)catch()
if isKindOf n Editable_Poly do try(polyOp.attach b n)catch()
)
b.name = uniqueName "VR_Bloco_Fundido"
select b
)
)
sel.count
)"""
try: try:
act = rt.execute(ms) act = rt.execute(ms)
load_selection(ui) load_selection(ui)
@ -389,7 +438,7 @@ def process_bake_logic(ui, auto_export=False):
$.INodeBakeProperties.addBakeElement be $.INodeBakeProperties.addBakeElement be
$.INodeBakeProperties.bakeEnabled = true $.INodeBakeProperties.bakeEnabled = true
$.INodeBakeProperties.bakeChannel = 3 $.INodeBakeProperties.bakeChannel = 3
render rendertype:#bakeSelected vfb:true quiet:true outputfile:fileOut render rendertype:#bakeSelected vfb:true quiet:true production:true outputfile:fileOut
return 1 return 1
) )
try ( doBake "{t_rnd_id}" {cr} {cr} "{ext}" {str(i_cor).lower()} {str(u_den).lower()} "{el}" ) catch ( 0 ) try ( doBake "{t_rnd_id}" {cr} {cr} "{ext}" {str(i_cor).lower()} {str(u_den).lower()} "{el}" ) catch ( 0 )

Loading…
Cancel
Save