Question Regarding Octane's Map types

Forums: Question Regarding Octane's Map types
A public forum for discussing and asking questions about the demo version of Octane Render.
Forum rules
For new users: this forum is moderated. Your first post will appear only after it has been reviewed by a moderator, so it will not show up immediately.
This is necessary to avoid this forum being flooded by spam.

Question Regarding Octane's Map types

Postby colinsenner » Sun Feb 08, 2015 12:11 am

colinsenner Sun Feb 08, 2015 12:11 am
Hello Octane,
I'm working on integrating Octane support for Relink Bitmaps and have come across a strange problem. This is regarding the integration of octane maps in the 3dsmax 2014 plugin - octane demo. Take a look.


Regarding problem 1: Octane attempts to load the bitmap when accessing the .filename property on all Octane specific maps Image_Texture/Alpha_Image_Texture, etc. Relink Bitmaps has to access the filename property to check if it exists (doesFileExist theMap.filename). No other map types/objects work like I'm seeing from Octane. Can anyone shed some light on this?

Problem 2: isProperty (octanemap) #filename - reports false...That's strange when "show Image_Texture" reports (correctly) that there is a filename property.

Check the below code which shows off both problems.

Code: Select all
(
   clearListener()
   
   -- This code works fine and has no problem getting the property #filename in a BitmapTexture (not the bitmap is not attempted to be opened)   
   local bmaps = GetClassInstances BitmapTexture

   if (bmaps.count > 0) then (
      for m in bmaps do (
         format "% filename: \"%\"\n" m.name m.filename
      )   
   ) else
      format "No BitmapTexture in the scene\n"
   
   /**************** PROBLEM #1 ****************/
   -- Octane Problem with textures
   -- This errors with a runtime error:  -- Runtime error: Error opening bitmap: C:\Users\###\textures\04_FUNGUS.jpg
   -- It shouldn't be attempting to open the bitmap when just accessing the #filename property
   for m in (getClassInstances Alpha_Image_Texture) do (
      print m.filename
   )
   
   -- Same thing for Image_Texture class
   for m in (getClassInstances Image_Texture) do (
      print m.filename
   )
   
   /**************** PROBLEM #2 ***************/
   -- Amazingly this doesn't work even though there is a #filename property on Image_Texture class
   local imgTexture = GetClassInstances Image_Texture      -- Get the first Image_Texture in the scene
   local bitTexture = GetClassInstances BitmapTexture      -- Get the first BitmapTexture in the scene
   
   if (bitTexture.count > 0) then
      format "isProperty bitTexture[1] #filename = %\n" ((isProperty bitTexture[1] #filename) as string)
   else
      format "No BitmapTexture in the scene\n"
      
   if (imgTexture.count > 0) then
      format "isProperty imgTexture #filename = %\n" ((isProperty imgTexture #filename) as string)
   else
      format "No Image_Texture in the scene\n"
   
   
)
colinsenner
 
Posts: 6
Joined: Fri Feb 06, 2015 9:04 pm

Re: Question Regarding Octane's Map types

Postby colinsenner » Mon Feb 09, 2015 5:23 pm

colinsenner Mon Feb 09, 2015 5:23 pm
Devs? Any ideas? My only idea for a work around would be to throw the whole damn thing in a try/catch and detect for that error. This isn't good coding practice, but it might be all I can do for my users, and even it isn't great, because I can't assign the map a new filename without accessing the .filename prop anyway.
colinsenner
 
Posts: 6
Joined: Fri Feb 06, 2015 9:04 pm

Re: Question Regarding Octane's Map types

Postby colinsenner » Mon Feb 09, 2015 10:20 pm

colinsenner Mon Feb 09, 2015 10:20 pm
colinsenner wrote:Devs? Any ideas? My only idea for a work around would be to throw the whole damn thing in a try/catch and detect for that error. This isn't good coding practice, but it might be all I can do for my users, and even it isn't great, because I can't assign the map a new filename without accessing the .filename prop anyway.


Ok, I attempted the try/catch solution and can successfully get instances of the maps where bitmaps are missing in the catch(), however to assign them a new .filename (bitmap type)

I would have to do

(Image_Texture).filename = OpenBitmap filename:"C:\\test.jpg"

The problem with this is it will mess up any environment mapping, offsets, blur values, and the like if I don't save these prior. Are there any solutions that might work?

The problem doesn't only affect me and my script, This is why the Asset Tracker can't even pickup missing octane maps/filenames, as well as anyone's (Like Martin Breidt's excellent MB_ResourceCollect, among many others of collector/relinker scripts.
colinsenner
 
Posts: 6
Joined: Fri Feb 06, 2015 9:04 pm

Re: Question Regarding Octane's Map types

Postby lunarstudio » Thu Feb 12, 2015 3:21 pm

lunarstudio Thu Feb 12, 2015 3:21 pm
Hey Colin. I messaged two admins/moderators and haven't heard back.
I don't know if they realize how useful your scripts are to the Max community but anyone that uses the scripts knows.

Perhaps they're just really busy. :cry:
lunarstudio
Licensed Customer
Licensed Customer
 
Posts: 71
Joined: Fri May 16, 2014 12:36 pm
Location: Boston, MA

Re: Question Regarding Octane's Map types

Postby colinsenner » Thu Feb 12, 2015 7:35 pm

colinsenner Thu Feb 12, 2015 7:35 pm
Thanks lunarstudio, I'm hoping they are able to reply at some point soon as I was hoping to have RB support for octane by last weekend in. I added corona support but the octane stuff might have to be put on hold til they communicate that it is working as intended or they will do something about it. My trial runs out soon.
colinsenner
 
Posts: 6
Joined: Fri Feb 06, 2015 9:04 pm

Re: Question Regarding Octane's Map types

Postby abstrax » Thu Feb 12, 2015 10:40 pm

abstrax Thu Feb 12, 2015 10:40 pm
We really don't know what the problem is and Andrey, the developer of the 3ds max plugin, doesn't know much about Max Script, so is not sure what the reason for those issues is.
In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
User avatar
abstrax
OctaneRender Team
OctaneRender Team
 
Posts: 5484
Joined: Tue May 18, 2010 11:01 am
Location: Auckland, New Zealand

Re: Question Regarding Octane's Map types

Postby colinsenner » Fri Feb 13, 2015 12:19 am

colinsenner Fri Feb 13, 2015 12:19 am
Ok, have Andrey take a look and run the example code I provided in a scene that has a bitmap texture (standard max map) applied to a material and assigned to an object, and do the same with an octane material. Run the code and you'll see the problem.

The implementation for the .filename property in Octane is inconsistent with all other filename properties in all other renderers and not like max's native way of treating these.

Andrey shouldn't have any problems decoding maxscript because they're (mostly) the same name API calls for the SDK as well.


In max you can create a standard map type - BitmapTexture that has a .filename property
In VRay you could create a VRayProxy object that has a .filename property
In Corona you could create a CoronaLight which has a .iesFile property
etc. the list goes on

All of these are treated the same way, just as a string property. This would allow you to access the .filename/.iesFile/etc property as a string

bitmapTexture.filename (returns a string pointing to the filename of the texture)
VRayProxy.filename (returns a string pointing to the filename of the texture)
CoronaLight.iesFile (returns a string pointing to the filename of the texture)

If you attempt this behavior in Octane, it will actually return a Bitmap() object

Image_Texture.filename

This is problematic because in the preceeding examples you could do things to the files at that location (move/copy functionality for "Resource collecting" scripts for example)

In Octane accessing a filename property on a map that doesn't exist will throw an error instead of just returning a string to the file path of the texture, like the other examples and how max natively handles this behavior.

I'm just trying to find a workaround the error for accessing a .filename property on any Octane map type for a missing texture.
colinsenner
 
Posts: 6
Joined: Fri Feb 06, 2015 9:04 pm

Re: Question Regarding Octane's Map types

Postby Karba » Fri Feb 13, 2015 1:31 am

Karba Fri Feb 13, 2015 1:31 am
Hi

As Marcus said I don't have max script experience
This is how I access file name string in C++

Code: Select all
PBBitmap *bmp = pblock->GetBitmap(mMaxParamId, t);
MaxSDK::Util::Path filePath = bmp->bi.GetAsset().GetFullFilePath(filePath)
MCHAR *fileName = filePath.GetString();


I hope it helps
User avatar
Karba
OctaneRender Team
OctaneRender Team
 
Posts: 2300
Joined: Sat Jun 11, 2011 9:05 am

Re: Question Regarding Octane's Map types

Postby colinsenner » Fri Feb 13, 2015 6:41 pm

colinsenner Fri Feb 13, 2015 6:41 pm
Thanks for replying. I'll see if I can code a workaround for the time being. You can consider this closed for now. Cheers.
colinsenner
 
Posts: 6
Joined: Fri Feb 06, 2015 9:04 pm

Re: Question Regarding Octane's Map types

Postby lunarstudio » Fri Feb 13, 2015 7:55 pm

lunarstudio Fri Feb 13, 2015 7:55 pm
Thanks guys for trying to assist and sorry Colin - wasn't expecting this to be so much trouble when I asked for some help. It is however much appreciated.

I really hope it gets sorted as this script is a huge timesaver and offers up more functionality than anything else. ADesk should really consider just making it standard with their Max releases.
lunarstudio
Licensed Customer
Licensed Customer
 
Posts: 71
Joined: Fri May 16, 2014 12:36 pm
Location: Boston, MA
Next

Return to Demo Version Questions & Discussion


Who is online

Users browsing this forum: No registered users and 20 guests

Thu Apr 25, 2024 4:53 am [ UTC ]