diff --git a/__pycache__/vr4life_engine.cpython-311.pyc b/__pycache__/vr4life_engine.cpython-311.pyc index cdb7984..f2b3e19 100644 Binary files a/__pycache__/vr4life_engine.cpython-311.pyc and b/__pycache__/vr4life_engine.cpython-311.pyc differ diff --git a/vr4life_engine.py b/vr4life_engine.py index 5246cf2..9350cd1 100644 --- a/vr4life_engine.py +++ b/vr4life_engine.py @@ -48,8 +48,35 @@ def attach_grouped_objects(ui, from_auto=False): ui.pb.setFormat("Fundindo grupos inteiros...") QtWidgets.QApplication.processEvents() 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 - 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() ) + 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 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 )""" try: @@ -64,7 +91,29 @@ def attach_grouped_objects(ui, from_auto=False): def super_attach_objects(ui, from_auto=False): ui.pb.setFormat("Super Solda VR...") 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: act = rt.execute(ms) load_selection(ui) @@ -389,7 +438,7 @@ def process_bake_logic(ui, auto_export=False): $.INodeBakeProperties.addBakeElement be $.INodeBakeProperties.bakeEnabled = true $.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 ) try ( doBake "{t_rnd_id}" {cr} {cr} "{ext}" {str(i_cor).lower()} {str(u_den).lower()} "{el}" ) catch ( 0 )