[Plugin] Remove group materials, leave geometry material

[Plugin] Remove group materials, leave geometry material

Postby Matt666 » Sun Oct 26, 2008 5:31 pm

Jackson wrote:Sorry about the rather cryptic topic, hard to explain this one in a few words.

I've been discussing the new Service Release of VRay for SU over at ASGvis' forums and there is one major problem which their developers don't seem to be able to circumvent. In short, any materials which are applied to groups or components cause the export process to take ridiculously long: 20+ minutes even for simple models. If I take the time to sit down and go through the group hierarchy of large skp file to ensure that all materials are applied directly to geometry rather than the groups, the export time usually takes just a few seconds, but I haven't worked out a simple and effective way of doing this and so not for the first time I thought I'd turn to the ruby forum and see if there's anything anyone can think of or come up with which would disable SU's ability to apply textures to groups or comps, and if possible to be able to apply that retrospectively.

I'm a little irritated that the ASGvis developers seem to have chosen to ignore a very useful feature of SU (to be able to switch materials of groups very quickly by painting selected geometry within them with the default material), but this is how they explained it to me:

"This is how our programmers described it to me. Sometimes there would be modifications made to the geometry that we told SU to tell us about, but unfortunately SU decided not to tell us. We thought there were no modifications made and no new geometry to keep track of. The result was geometry "popping" out of nowhere when we went to render the scene and so we didn't have a material for it. Hence no material and there for "disappeared". Obviously, if you apply a material to something, you no longer have the problem of there being no material.".

So until either Google or ASGvis sort this out (if they ever do), maybe a ruby whizz can think of a workaround which would benefit all VRay for SU users enormously?

Many thanks in advance,

Hi Jackson!

I Hope that's you want ! Remove all com/Group materials, but leave other entities..

EDIT1 : New version with demanded improvments.
EDIT2 : V1.3 with plot-paris improvments. ;)
EDIT3 : V1.4 with SU7 speed improvment, RickW's collaborative effort ;) and Organizer.rb support...
EDIT4 : V1.5 Can choose default material color.
0
Last edited by Matt666 on Tue Mar 17, 2009 9:15 am, edited 8 times in total.
Frenglish at its best !
My scripts

Matt666 
 

Re: [REQ] Remove group materials, leave geometry materials?

Postby Jackson » Mon Oct 27, 2008 7:56 am

Wow Matthieu, I am almost lost for words! I never expected a response and certainly not a fully functioning script within 24 hours of posting! I just ran the script on a fairly complex skp file (amazed how fast it worked), purged the file and then hit VfSU's render button and it parsed in under 10 seconds compared to 20 minutes! This is going to be a HUGE help as I have to convert dozens of my skp/VfSU files to work properly with VfSU's new way of handling materials and I was frankly dreading the many days of work I would need to sit, searching through groups trying to delete the group materials. Do you mind if I post a link to this topic over at the VfSU forums as this ruby script will be an extremely useful tool for a lot of VfSU users?

Many many thanks,
0
Jackson

Jackson 
 

Re: [REQ] Remove group materials, leave geometry materials?

Postby Matt666 » Mon Oct 27, 2008 9:56 am

Do you mind if I post a link to this topic over at the VfSU forums as this ruby script will be an extremely useful tool for a lot of VfSU users?

Yes, you can ! :D And perhaps change your topic name to add [Plugin] ?

I am almost lost for words!
Glad to helped you.. (I think we say it like that in English :? )
0
Frenglish at its best !
My scripts

Matt666 
 

Re: [REQ] Remove group materials, leave geometry materials?

Postby Gaieus » Mon Oct 27, 2008 10:31 am

Matt666 wrote:...And perhaps change your topic name to add [Plugin] ...

Done - I hope you don't mind Jackson.
0
User avatar
Gaieus 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Jackson » Mon Oct 27, 2008 10:53 am

Merci beaucoup Matthieu (and Csaba for editing the title)!

I was wondering, is there a way you can think of which would do what your script does (delete group materials), but rather than just leaving the default material in it's place it would actually apply the group material to the default geometry itself? One workaround would be to explode and then regroup all groups one-by-one, but the catch is components- their attributes are just too valuable to lose by converting them into groups.

Thanks again, you've already saved me DAYS of very, very tedious work.

p.s. I have one suggestion for your script above, maybe it would be better if it was named "Remove_CG_Mat" as ""Delete_CG_Mat" sounds like it would delete/purge those materials from the actual skp file, which might make people a little reluctant to use it.
0
Jackson

Jackson 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby EarthMover » Tue Oct 28, 2008 6:13 pm

I want to extend my thanks as well. This will be an invaluable ruby to help speed up processing/parsing times for Vray!
0
3D Artist at Clearstory 3D Imaging
Guide Tool at Winning With Sketchup
Content Creator at Skapeup
User avatar
EarthMover 
Premium Member
Premium Member
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby plot-paris » Wed Oct 29, 2008 11:07 am

Jacksons suggestion for the script to apply the material of the group to all geometry with default colour within the group before removing the group-colour is a fantastic idea.

Imagine you have a rather complex group, several faces are painted with different materials, the rest is not coloured yet. all you have to do now is apply the colour for the rest of the faces to the group and rund Matthieu's script. that is much faster, than selecting all the untextured faces manually...

of course it could be quite tricky if you have nested groups within the painted group. then the script had to go down all the hierarchy into the lowest groups to paint the faces. of course it had to work from the 'inside' to the 'outside', so that the colour on the outermost group has lowest priority...
0
User avatar
plot-paris 
 

Re: [PLUGIN] Remove group materials, leave geometry material

Postby TIG » Wed Oct 29, 2008 6:23 pm

My earlier 'GlobalMaterialChange' script works on a selection: so by using Didier's filter tools you could just have what you want selected [e.g. Groups] and 'change all' materials in that to <default>. It can 'mine' into a group or component to change things within it too...
http://www.sketchucation.com/forums/scf ... 863#p96863
Or am I missing something ?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby free agent » Thu Oct 30, 2008 2:08 pm

while on the subject of helping out vray, vray SR1 creates vray materials of all materials in the scene even the materials on lines (multi-coloured from CAD imports) could there also be a script to remove all materials from lines? that way vray wouldnt create any unnecessary materials
0
User avatar
free agent 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Matt666 » Sun Nov 02, 2008 11:47 am

Hi all!
Sorry for the delay, I was in London last week...

So:
jackson wrote:it would actually apply the group material to the default geometry itself
Yes, it's possible. I will add a message box to the script.
p.s. I have one suggestion for your script above, maybe it would be better if it was named "Remove_CG_Mat" as ""Delete_CG_Mat" sounds like it would delete/purge those materials from the actual skp file, which might make people a little reluctant to use it.
Ok!

Free Agent wrote:while on the subject of helping out vray, vray SR1 creates vray materials of all materials in the scene even the materials on lines (multi-coloured from CAD imports) could there also be a script to remove all materials from lines? that way vray wouldnt create any unnecessary materials
Yes, it's possible. Vray uses attributes to record all object material. You just want to remove it.

I just need for time to do that :)
0
Frenglish at its best !
My scripts

Matt666 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Jackson » Sun Nov 02, 2008 5:41 pm

Matthieu,

You are the man! If you can produce a ruby script which removes group materials and applies them to the default geometry you will save me about 3 day's work on this model alone! I'm trying to update my portfolio so this would be of enormous benefit to me as I've got lots to do and very little time to do it.

0
Jackson

Jackson 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Matt666 » Mon Nov 03, 2008 10:03 am

To Free Agent, can you share an example with Vray line material, please ?
Thank you !
0
Frenglish at its best !
My scripts

Matt666 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Jackson » Mon Nov 03, 2008 12:30 pm

Matthieu,

Free Agent means SUs own materials on lines, there's no separate VRay materials- it just creates/links it's own materials from those of SU. A standard skp model will contain the line materials Free Agent is describing.

Free Agent,

When SU imports dwgs and adds materials to lines (i.e. layer materials from Autocad) just delete those materials either by right-clicking on them in SU's material editor or (if there's lots of them) by opening the imported dwg group, switch to wireframe view, select all, paint with the default SU material and then purge the file. This will also delete all unnecessary VfSU materials.
0
Jackson

Jackson 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Matt666 » Mon Nov 03, 2008 1:24 pm

Ok, but I will wait for Free agent answer to do smt :D !
I've updated post of the script with demanded improvments... I did'nt really test it... :bounce:
0
Frenglish at its best !
My scripts

Matt666 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Jackson » Mon Nov 03, 2008 2:37 pm

Matthieu,

I just ran it on this fairly simple model, but unfortunately it has applied the wrong materials to the groups, see before and after image below. I thought it might be applying materials from higher up the group heirarchy, but that doesn't seem to be the case. Any idea what's going wrong? I can send you the skp file if you like.

0
Jackson

Jackson 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Matt666 » Mon Nov 03, 2008 3:03 pm

Can you send me the skp, please?
Thank you !
Sorry, I don't have a lot of time to test... :(
0
Frenglish at its best !
My scripts

Matt666 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Jackson » Mon Nov 03, 2008 3:52 pm

Here's the Rapidshare link:

http://rapidshare.com/files/160279614/H ... T.skp.html

LOL, definitely no need to apologise!
0
Jackson

Jackson 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Matt666 » Fri Nov 14, 2008 1:11 pm

Hi Jackson !
I don't forget your demand !!
I have no time to do smt now, and I have a problem of "Hierarchy" in your drawing example... So it's quite difficult !
But I think I will show smt in a few days..

See you soon !
0
Frenglish at its best !
My scripts

Matt666 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Jackson » Fri Nov 14, 2008 4:39 pm

Matthieu,

No worries, your original "Remove CG Materials" script has already saved me about 20 hour's work so I'm pretty happy already!

Best regards,
Jackson
0
Jackson

Jackson 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Matt666 » Thu Nov 27, 2008 6:01 pm

We loosed some posts here :(

So, script's post has been updated... Not tested enough, but I'm a few confident ! :D
Now all Comp/Groups materials are transfered to geometry if you want.
:fro:
0
Frenglish at its best !
My scripts

Matt666 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Jackson » Thu Nov 27, 2008 8:35 pm

:berserk: :berserk: :berserk:

Seems to work perfectly Matthieu! I just ran it with the test file I sent you and it reassigned all the materials in just a few seconds. This is such a valuable little tool for "VRay for SU" users, I will spread the good word (and your name) over at the ASGvis forums.

Many many thanks for creating this little gem, MERCI BEAUCOUP!
Jackson
0
Jackson

Jackson 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Matt666 » Thu Nov 27, 2008 10:23 pm

:D
You're welcome, Jackson ! Glad to help you !
0
Frenglish at its best !
My scripts

Matt666 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby plot-paris » Fri Nov 28, 2008 8:52 am

thanks so much, Matthieu! :ecstatic:

only one minor thing still: while all the materials are applied to faces and the material of the outer group is changed to default, nested groups still keep their assigned material. that is not very important, because the face's textures are the dominant ones. but to be perfectly accurate, it would be great if the plugin could assign the default material to nested groups too.

one positive side effect I experienced is, that your plugin coloures front and back faces. that is really good!
0
User avatar
plot-paris 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Matt666 » Fri Nov 28, 2008 9:09 am

Hi plot-paris !
ok, that's been updated !
Thank you for testing !
0
Frenglish at its best !
My scripts

Matt666 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby plot-paris » Fri Nov 28, 2008 9:49 am

damn, you are fast! now the plugin is flawless. fantastic! thank you so much!!! :berserk:
0
User avatar
plot-paris 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby Jackson » Fri Nov 28, 2008 7:27 pm

LOL, you guys are a two-man developer and beta team!

Great work, I'll link this thread over at ASGvis.
0
Last edited by Jackson on Sat Nov 29, 2008 10:55 am, edited 2 times in total.

Jackson 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby vinchvinchvinch » Fri Nov 28, 2008 10:56 pm

Hi!
Matt, you are already a legend in ASGvis forum!
Thank you man!
:thumb:
0

vinchvinchvinch 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby thomthom » Mon Dec 01, 2008 10:56 am

Jackson wrote:Matthieu,

You are the man! If you can produce a ruby script which removes group materials and applies them to the default geometry you will save me about 3 day's work on this model alone! I'm trying to update my portfolio so this would be of enormous benefit to me as I've got lots to do and very little time to do it.



somewhat off topic, but: where did you get hold of the ground texture?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby watkins » Mon Dec 01, 2008 12:46 pm

Could someone explain exactly what this script does, and what are the benefits? It would help the technically challenged, like myself.

Kind regards,
Bob
0

watkins 
 

Re: [PLUGIN] Remove group materials, leave geometry materials?

Postby thomthom » Mon Dec 01, 2008 1:17 pm

It makes sure that no materials are applied to groups and components. It will either remove the materials of groups and components or transfer them to the geometry.
For users of V-Ray for SketchUp it has the benefit of faster parsing time and more reliable outcome as VfSU struggles to get correct data for groups and components with materials applied to them.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: layercero, Pjotrdeotter and 5 guests

Visit our sponsors: