Page 1 of 2

New code repo for Blendigo

Posted: Thu Sep 27, 2012 5:23 am
by OnoSendai

Re: New code repo for Blendigo

Posted: Mon Oct 29, 2012 12:58 am
by solarray
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):

Code: Select all

'env_rot_type':				{'type': 'env_map',  'env_map_type': 'spherical' or 'spherical_environment'},
and I tried this:

Code: Select all

'env_rot_type':				{'type': 'env_map',  'env_map_type': 'spherical_environment'},
'env_rot_type':				{'type': 'env_map',  'env_map_type': 'spherical'},
...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

Re: New code repo for Blendigo

Posted: Wed Oct 31, 2012 3:00 am
by OnoSendai
Hi solarray,
I'm not sure how that stuff works either, sorry. Your guess is as good as mine.

Re: New code repo for Blendigo

Posted: Wed Oct 31, 2012 3:16 am
by solarray
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.

Re: New code repo for Blendigo

Posted: Wed Oct 31, 2012 4:31 am
by StompinTom
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

Posted: Wed Oct 31, 2012 6:05 am
by solarray
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

Posted: Fri Nov 02, 2012 1:45 am
by solarray
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:

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

Posted: Thu Nov 29, 2012 10:09 am
by dougal2
solarray wrote:Hey Ono,

Code: Select all

'env_rot_type':				{'type': 'env_map',  'env_map_type': 'spherical' or 'spherical_environment'},
whilst what you wrote is valid python, the way it is evaluated is not what you want.

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'])},
it needs to be written this way since the O operator can now be evaluated at run (export) time.

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

Posted: Thu Nov 29, 2012 10:19 am
by OnoSendai
Thanks for the explanation Doug!

Re: New code repo for Blendigo

Posted: Tue Apr 02, 2013 10:40 pm
by solarray
Hi Ono, did you added my patch, or was it needless?

Re: New code repo for Blendigo

Posted: Fri Apr 12, 2013 1:48 am
by fused
Hi solarray,

I have merged your patch.

Re: New code repo for Blendigo

Posted: Fri Apr 12, 2013 2:47 am
by StompinTom
Any news for the new Blendigo? Are there any plans for using PyNodes?

Re: New code repo for Blendigo

Posted: Fri Apr 12, 2013 3:59 am
by fused
StompinTom wrote:Any news for the new Blendigo? Are there any plans for using PyNodes?
No, not really, but I just added a transmission channel to the double sided material :)

Re: New code repo for Blendigo

Posted: Fri Apr 12, 2013 4:29 am
by StompinTom
fused wrote:
StompinTom wrote:Any news for the new Blendigo? Are there any plans for using PyNodes?
No, not really, but I just added a transmission channel to the double sided material :)
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 wait :P

Re: New code repo for Blendigo

Posted: Tue May 14, 2013 5:44 pm
by Phil
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