Shadow Control Possible? (solved)
-
Hi,
I want to create a plugin that will set scenes with different rendering styles so I can then export them to Photoshop.
To get better idea of what I want to create through code please open this LINK to see the rendering setting to set scenes for Color, Shadows, Alpha Channel and ZDeapth.
I can't seem to find a way to control Shadows parameter like 'Light' and 'Dark' values. Also the only way to active Shadows through code that I know of is this the following...
Sketchup.send_action(1213)
...
I am just starting this so I don't have much but here is a WIP to creat aplha channel (still not complete).
################## ###Alpha Channe### ################## Sketchup.active_model.rendering_options['DisplayFog']=false Sketchup.active_model.rendering_options['BackgroundColor']=[0, 0, 0] #Ground Sketchup.active_model.rendering_options['DrawGround']=false #Sky Sketchup.active_model.rendering_options['DrawHorizon']=false #EndPoint (lines) Sketchup.active_model.rendering_options['DrawLineEnds']=false #Profile (lines) Sketchup.active_model.rendering_options['DrawSilhouettes']=false #Display Lines? Sketchup.active_model.rendering_options['EdgeDisplayMode']=0 #Back Face Color Sketchup.active_model.rendering_options['FaceBackColor']=[255, 255, 255] #Front Face Color Sketchup.active_model.rendering_options['FaceFrontColor']=[255, 255, 255] #Fog Color Sketchup.active_model.rendering_options['FogColor']=[255, 255, 255]
If anyone can help me I will be very greatfull. Thanks!
-
You also need to consider the
shadow_info
and its['Light']
&['Dark']
settings [%] ? -
For example if I want to set the Alpha Channel scene I need to set the following shadow settings with code...
Shadow Settings:
Use Shadow = false
Light = 0
Dark = 100
Use sun for shading = trueIf I am not mistaken the shadow_info Api is only to extract their values so it cannot let me set their values right?
...
Maybe the solution is to provide SketchUp File with all the scenes with styles settings already provided and just import the them somehow but not sure if that is possible. I need to do some more research!
-
No.
Play around in the Ruby Console to see what changing things does...
Sketchup.active_model.shadow_info['Dark']=0 Sketchup.active_model.shadow_info['Light']=100
Will both change things as you might expect
-
WOW!
TIG, did I said you are awesome!
Thanks!
-
The following is the code for creating an Alpha Channel Scene...
################## ###Alpha Channe### ################## ###Create Scene### Sketchup.send_action(CMD_PAGE_NEW) ###Style### Sketchup.active_model.rendering_options['RenderMode']=5 #Edge Settings Sketchup.active_model.rendering_options['EdgeDisplayMode']=0 Sketchup.active_model.rendering_options['DrawSilhouettes']=false #Face Settings Sketchup.active_model.rendering_options['FaceFrontColor']=[255, 255, 255] Sketchup.active_model.rendering_options['FaceBackColor']=[255, 255, 255] #Background Settings Sketchup.active_model.rendering_options['BackgroundColor']=[0, 0, 0] Sketchup.active_model.rendering_options['DrawHorizon']=false Sketchup.active_model.rendering_options['DrawGround']=false #Watermark Settings Sketchup.active_model.rendering_options['DisplayWatermarks']=false ###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100 ###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false ############ ###Update### ############ model = Sketchup.active_model pages = model.pages c_page = pages.selected_page c_page.update
Only thing I wish didn't happen is the Warning! message saying "You are creating or updating a scene and have not saved the changes you've made to your style."
Is there a way to get rid of that?
Anyways just wanted to post what I had so far...thanks!
-
Here is an interesting plugin...
Rendering Favourites (v1.1) by Trogluddite - This is a plugin which can store style options and its great to store things like Alpha Channels, ZDeapth, Color, ect.
-
Hi,
Here is what I assume to be a BUG... When the code creates the Zdepth page even though the Fog settings appear to be applied it doesn't display it! This is strange and for it to work I need to move the distance slider a nudge manually which defeats the purpose.
Here is the code...Notice I saved the style properties into folder and I am just importing them so the rest of the code works on Shadow & Fog properties.
model = Sketchup.active_model pages = model.pages ######################################## ###Aplha################################ ######################################## ###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100 ###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false pages.add("Aplha") styles = Sketchup.active_model.styles status = styles.add_style "c;\\styles\\Aplha Style.style", true selpage = pages.selected_page selpage.update ######################################## ###Zdepth############################### ######################################## ###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100 ###Fog Settings### Sketchup.active_model.rendering_options["FogEndDist"]=35.m Sketchup.active_model.rendering_options['DisplayFog']=true pages.add("Zdepth") styles = Sketchup.active_model.styles status = styles.add_style "c;\\styles\\Zdepth Style.style", true selpage = pages.selected_page selpage.update
Any help will be appreciated!
-
Seems the Fog part is working now but not sure what was that I did to fix it. For the most part I think I am finish but just need to worry about the interface part of things now.
model = Sketchup.active_model pages = model.pages ######################################## ###Alpha################################ ######################################## ###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100 ###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false ###Add Page### pages.add("Alpha") styles = Sketchup.active_model.styles status = styles.add_style "c;\\styles\\Alpha Style.style", true ###Update### selpage = pages.selected_page selpage.update ######################################## ###Cley################################# ######################################## ###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=50 Sketchup.active_model.shadow_info['Dark']=15 ###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false ###Add Page### pages.add("Cley") styles = Sketchup.active_model.styles status = styles.add_style "c;\\styles\\Cley Style.style", true ###Update### selpage = pages.selected_page selpage.update ######################################## ###Color################################ ######################################## ###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100 ###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false ###Add Page### pages.add("Color") styles = Sketchup.active_model.styles status = styles.add_style "c;\\styles\\Color Style.style", true ###Update### selpage = pages.selected_page selpage.update ######################################## ###Color by Layer####################### ######################################## ###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100 ###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false ###Add Page### pages.add("Color by Layer") styles = Sketchup.active_model.styles status = styles.add_style "c;\\styles\\Color by Layer Style.style", true ###Update### selpage = pages.selected_page selpage.update ######################################## ###Line################################ ######################################## ###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100 ###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false ###Add Page### pages.add("Line") styles = Sketchup.active_model.styles status = styles.add_style "c;\\styles\\Line Style.style", true ###Update### selpage = pages.selected_page selpage.update ######################################## ###Profile############################## ######################################## ###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100 ###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false ###Add Page### pages.add("Profile") styles = Sketchup.active_model.styles status = styles.add_style "c;\\styles\\Profile Style.style", true ###Update### selpage = pages.selected_page selpage.update ######################################## ###Shadow################################ ######################################## ###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=true Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=100 Sketchup.active_model.shadow_info['Dark']=0 ###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false ###Add Page### pages.add("Shadow") styles = Sketchup.active_model.styles status = styles.add_style "c;\\styles\\Shadow Style.style", true ###Update### selpage = pages.selected_page selpage.update ######################################## ###Texture################################ ######################################## ###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100 ###Fog Settings### Sketchup.active_model.rendering_options['DisplayFog']=false ###Add Page### pages.add("Texture") styles = Sketchup.active_model.styles status = styles.add_style "c;\\styles\\Texture Style.style", true ###Update### selpage = pages.selected_page selpage.update ######################################## ###Zdepth############################### ######################################## ###Shadow Settings### Sketchup.active_model.shadow_info['DisplayShadows']=false Sketchup.active_model.shadow_info['UseSunForAllShading']=true Sketchup.active_model.shadow_info['Light']=0 Sketchup.active_model.shadow_info['Dark']=100 ###Fog Settings### Sketchup.active_model.rendering_options['FogEndDist']=35.m Sketchup.active_model.rendering_options['DisplayFog']=true ###Add Page### pages.add("Zdepth") styles = Sketchup.active_model.styles status = styles.add_style "c;\\styles\\Zdepth Style.style", true ###Update### selpage = pages.selected_page selpage.update
-
dude, did you know that everytime you save a scene there is the option to save it with the current settings? Maybe this wasn't the case back in 2013 but there you go
Advertisement