New code repo for Blendigo

Announcements, requests and support regarding the Blender Indigo export script
User avatar
OnoSendai
Developer
Posts: 6179
Joined: Sat May 20, 2006 6:16 pm
Location: Newcastle upon Tyne, UK
Contact:

New code repo for Blendigo

Post by OnoSendai » Thu Sep 27, 2012 5:23 am


User avatar
solarray
1st Place Winner
Posts: 110
Joined: Mon Apr 20, 2009 3:22 am
Contact:

Re: New code repo for Blendigo

Post by solarray » Mon Oct 29, 2012 12:58 am

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

User avatar
OnoSendai
Developer
Posts: 6179
Joined: Sat May 20, 2006 6:16 pm
Location: Newcastle upon Tyne, UK
Contact:

Re: New code repo for Blendigo

Post by OnoSendai » Wed Oct 31, 2012 3:00 am

Hi solarray,
I'm not sure how that stuff works either, sorry. Your guess is as good as mine.

User avatar
solarray
1st Place Winner
Posts: 110
Joined: Mon Apr 20, 2009 3:22 am
Contact:

Re: New code repo for Blendigo

Post by solarray » Wed Oct 31, 2012 3:16 am

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.

StompinTom
Indigo 100
Posts: 1820
Joined: Mon Sep 04, 2006 3:33 pm

Re: New code repo for Blendigo

Post by StompinTom » Wed Oct 31, 2012 4:31 am

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?

User avatar
solarray
1st Place Winner
Posts: 110
Joined: Mon Apr 20, 2009 3:22 am
Contact:

Re: New code repo for Blendigo

Post by solarray » Wed Oct 31, 2012 6:05 am

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.

User avatar
solarray
1st Place Winner
Posts: 110
Joined: Mon Apr 20, 2009 3:22 am
Contact:

Re: New code repo for Blendigo

Post by solarray » Fri Nov 02, 2012 1:45 am

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]


User avatar
dougal2
Developer
Posts: 2532
Joined: Wed Nov 15, 2006 8:17 am
Location: South London

Re: New code repo for Blendigo

Post by dougal2 » Thu Nov 29, 2012 10:09 am

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

User avatar
OnoSendai
Developer
Posts: 6179
Joined: Sat May 20, 2006 6:16 pm
Location: Newcastle upon Tyne, UK
Contact:

Re: New code repo for Blendigo

Post by OnoSendai » Thu Nov 29, 2012 10:19 am

Thanks for the explanation Doug!

User avatar
solarray
1st Place Winner
Posts: 110
Joined: Mon Apr 20, 2009 3:22 am
Contact:

Re: New code repo for Blendigo

Post by solarray » Tue Apr 02, 2013 10:40 pm

Hi Ono, did you added my patch, or was it needless?

User avatar
fused
Developer
Posts: 3557
Joined: Fri Sep 22, 2006 7:19 am
Location: Berlin, Germany
3D Software: Cinema 4D

Re: New code repo for Blendigo

Post by fused » Fri Apr 12, 2013 1:48 am

Hi solarray,

I have merged your patch.

StompinTom
Indigo 100
Posts: 1820
Joined: Mon Sep 04, 2006 3:33 pm

Re: New code repo for Blendigo

Post by StompinTom » Fri Apr 12, 2013 2:47 am

Any news for the new Blendigo? Are there any plans for using PyNodes?

User avatar
fused
Developer
Posts: 3557
Joined: Fri Sep 22, 2006 7:19 am
Location: Berlin, Germany
3D Software: Cinema 4D

Re: New code repo for Blendigo

Post by fused » Fri Apr 12, 2013 3:59 am

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 :)

StompinTom
Indigo 100
Posts: 1820
Joined: Mon Sep 04, 2006 3:33 pm

Re: New code repo for Blendigo

Post by StompinTom » Fri Apr 12, 2013 4:29 am

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

Phil
Posts: 154
Joined: Mon Nov 06, 2006 2:22 am
Location: St. Wendel, Germany

Re: New code repo for Blendigo

Post by Phil » Tue May 14, 2013 5:44 pm

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

Post Reply
16 posts

Who is online

Users browsing this forum: No registered users and 2 guests