New code repo for Blendigo
Re: New code repo for Blendigo
Hey Ono,
I want to add some more input possibilities to the section hemi, especially environment. Im not very familiar with python scripting but Im used to other more difficult languages very well, but this python thing is really strange so maybe you can tell me what Im doing wrong.
For the environment background settings in indigo you can choose 'spherical', 'uv' and 'spherical_environment' mapping type. So I added this to blender as an enum (worked fine). Now I want the rotation type as enum also (axis and matrix). But this rotation type enum should only be visibly when 'spherical' OR 'spherical_environent' is selected. I tried the following lines without success (In the visibility section):
and I tried this:
...and a lot of other possibilities, but the only thing what happens is that the 'env_rot_type' is visible at one of the 'env_map_type' selection, and not at both. I also cant find any tutorial or info about the visibility property for blender gui.
cheers
I want to add some more input possibilities to the section hemi, especially environment. Im not very familiar with python scripting but Im used to other more difficult languages very well, but this python thing is really strange so maybe you can tell me what Im doing wrong.
For the environment background settings in indigo you can choose 'spherical', 'uv' and 'spherical_environment' mapping type. So I added this to blender as an enum (worked fine). Now I want the rotation type as enum also (axis and matrix). But this rotation type enum should only be visibly when 'spherical' OR 'spherical_environent' is selected. I tried the following lines without success (In the visibility section):
Code: Select all
'env_rot_type': {'type': 'env_map', 'env_map_type': 'spherical' or 'spherical_environment'},
Code: Select all
'env_rot_type': {'type': 'env_map', 'env_map_type': 'spherical_environment'},
'env_rot_type': {'type': 'env_map', 'env_map_type': 'spherical'},
cheers
Re: New code repo for Blendigo
Hi solarray,
I'm not sure how that stuff works either, sorry. Your guess is as good as mine.
I'm not sure how that stuff works either, sorry. Your guess is as good as mine.
Re: New code repo for Blendigo
My workaround now is creating a 'env_rot_type_spherical' only for 'spherical' and a 'env_rot_type_spherical_env' for 'spherical_environment'. This way you also dont loose the values for each mapping type.
-
- Posts: 1828
- Joined: Mon Sep 04, 2006 3:33 pm
Re: New code repo for Blendigo
Maybe I'm missing something, but don't you already get rotation just by rotating the Hemi light that the Environment Map is attached to?
Re: New code repo for Blendigo
Thanks for the hint StompinTom I didnt realised that. But still with the ability to rotate the environment map over the hemi Im not able to get the same position of the environment map preview_map.float like in the material editor (which is used in the material editor). The only thing is to edit the mapping mode to spherical_environemnt and matrix rotation inside indigo after export. But I dont want to edit this all the time after export. So maybe I should remove the rotation type "axis" in the exporter and only add the "matrix" option.
Re: New code repo for Blendigo
What I did now is only adding the ability to change between 'spherical' and 'spherical_environment' mapping type. The rotation is working fine for both while rotating the hemi light. This way I can get the material editor env map behaviour.
Here the patch:
Here the patch:
Code: Select all
Index: lamp.py
===================================================================
--- lamp.py (revision 19)
+++ lamp.py (working copy)
@@ -169,7 +169,7 @@
] + Spe_BG.controls + [
# env map
'env_map_path',
- # 'env_map_type',
+ 'env_map_type',
['env_map_gain_val','env_map_gain_exp'],
# 'env_map_width',
@@ -217,8 +217,9 @@
'name': 'Env map type',
'description': 'The type of the environment map',
'items': [
- ('latlong', 'Lat-Long', 'latlong'),
- ('spherical', 'Spherical', 'spherical')
+ #('uv', 'UV', 'uv'), #TODO: uv need to be implemented
+ ('spherical', 'Spherical', 'spherical'),
+ ('spherical_environment', 'Spherical Environment', 'spherical_environment')
]
},
{
@@ -327,8 +328,8 @@
'path': [efutil.path_relative_to_export(self.env_map_path)],
'exponent': [1.0], # TODO; make configurable?
'tex_coord_generation': {
- 'spherical': {
- 'rotation': {
+ self.env_map_type: {
+ 'rotation': {
'axis_rotation': {
'axis': [' '.join(['%s'%v for v in rq.axis])],
'angle': ['%s'%-rq.angle]
Re: New code repo for Blendigo
whilst what you wrote is valid python, the way it is evaluated is not what you want.solarray wrote:Hey Ono,
Code: Select all
'env_rot_type': {'type': 'env_map', 'env_map_type': 'spherical' or 'spherical_environment'},
in python, ('spherical' or 'spherical_environment') evaluates to 'spherical' at the point of script loading and never changes. (the first 'truthy' value is used).
The 'language' used for the visibility is like a logical lambda function syntax. i.e. 'env_rot_type' evaluates to True if ('type'=='env_map' and 'env_map_type'==<something>) - the question is what is the <something> if we want some kind of logical sub-expression involving the values 'spherical' and 'spherical_environment'?
the answer if to use a tool in the extensions_framework.validate module - this is the module which resolves these visibility expressions for Blendigo. what you want is the Logic_OR operator. there is an example of its use in the render_settings.py module:
https://code.google.com/p/blendigo/sour ... ettings.py
see lines 34 and 194.
with that in mind, we can now substitute <something> with O(['spherical', 'spherical_environment']):
Code: Select all
'env_rot_type': {'type': 'env_map', 'env_map_type': O(['spherical', 'spherical_environment'])},
there are other operators available in the validate module, it's worth a read if you're interested. it's fairly well documented in the code:
https://svn.blender.org/svnroot/bf-exte ... alidate.py
Re: New code repo for Blendigo
Thanks for the explanation Doug!
Re: New code repo for Blendigo
Hi Ono, did you added my patch, or was it needless?
Re: New code repo for Blendigo
Hi solarray,
I have merged your patch.
I have merged your patch.
-
- Posts: 1828
- Joined: Mon Sep 04, 2006 3:33 pm
Re: New code repo for Blendigo
Any news for the new Blendigo? Are there any plans for using PyNodes?
Re: New code repo for Blendigo
No, not really, but I just added a transmission channel to the double sided materialStompinTom wrote:Any news for the new Blendigo? Are there any plans for using PyNodes?
-
- Posts: 1828
- Joined: Mon Sep 04, 2006 3:33 pm
Re: New code repo for Blendigo
Great! I wish I had time, because I've been slowly getting up to speed with Python + Blender and would love to take a stab at PyNodes myself, but I guess that will have to waitfused wrote:No, not really, but I just added a transmission channel to the double sided materialStompinTom wrote:Any news for the new Blendigo? Are there any plans for using PyNodes?
Re: New code repo for Blendigo
Hi all,
there is a problem when exporting the orthographic camera to indigo.
I configured blender assuming I use millimeters (scale 0.001).
The actual code (camera.py) is:
-----------------------------------------------------------------
if(scene.camera.data.type == 'ORTHO'):
xml_format['camera_type'] = ['orthographic']
xml_format['sensor_width'] = [scene.camera.data.ortho_scale]
This should be:
-----------------------------------------------------------------
if(scene.camera.data.type == 'ORTHO'):
xml_format['camera_type'] = ['orthographic']
xml_format['sensor_width'] = [scene.camera.data.ortho_scale * ws]
Cheers,
Philippe
there is a problem when exporting the orthographic camera to indigo.
I configured blender assuming I use millimeters (scale 0.001).
The actual code (camera.py) is:
-----------------------------------------------------------------
if(scene.camera.data.type == 'ORTHO'):
xml_format['camera_type'] = ['orthographic']
xml_format['sensor_width'] = [scene.camera.data.ortho_scale]
This should be:
-----------------------------------------------------------------
if(scene.camera.data.type == 'ORTHO'):
xml_format['camera_type'] = ['orthographic']
xml_format['sensor_width'] = [scene.camera.data.ortho_scale * ws]
Cheers,
Philippe
Who is online
Users browsing this forum: No registered users and 86 guests