Profile Picture

How the heck do I use the Self parm when calling an RL function?

Posted By Kelleytoons Last Year
You don't have permission to rate!

How the heck do I use the Self parm when calling an RL function?

Author
Message
Kelleytoons
Kelleytoons
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)

Group: Forum Members
Last Active: Last Year
Posts: 9.2K, Visits: 22.1K
I realize this is a more generalized Python question but without examples (and OF COURSE the RL docs don't have examples) even reading on the web doesn't tell this old man how to use it.

I have a function: 

RLPy.RIVisualSettingComponent.LoadIBLImage(self, strFilePath )

Load the Image for IBL.

Experimental API

Parameters

strFilePath[IN] Enable or disable two sided material - string

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail

 Now this IS experimental, but how the heck do I call this?  This old man doesn't want to learn any more about coding in my few remaining years, but even the examples online don't explain this well.  Is the call: RLPy.RIVisualSettingComponent.LoadIBLImage(" ", "C:\testes.hdr")?  That doesn't seem right (and doesn't work) but I don't have any other ideas about it.





Alienware Aurora R16, Win 11, i9-149000KF, 3.20GHz CPU, 64GB RAM, RTX 4090 (24GB), Samsung 870 Pro 8TB, Gen3 MVNe M-2 SSD, 4TBx2, 39" Alienware Widescreen Monitor
Mike "ex-genius" Kelley
Victor.Soupday
Victor.Soupday
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)

Group: Forum Members
Last Active: 5 days ago
Posts: 569, Visits: 9.0K
In python class function declarations, the first parameter (usually called self) is an explicit reference to the class instance calling the the function. So when you use it, you don't pass it as a parameter, it's the object that calls the function.

Which means you need to get a reference to the class object before you can call it.

ibl_path = "c:\\path\\to\\ibl"
visual_setting_component = RLPy.RGlobal.GetVisualSettingComponent()
visual_setting_component.LoadIBLImage(ibl_path)


visual_setting_component is the "self" that is automatically passed as the first parameter to RLPy.RIVisualSettingComponent.LoadIBLImage(self, strFilePath)

At least that's how I've always understood it.

I should add:
RLPy.RGlobal.GetVisualSettingComponent() isn't documented and I found it by searching RLPy.py, which is in "C:\Program Files\Reallusion\Character Creator 4\Bin64\RLPy.py" by default.

Kelleytoons
Kelleytoons
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)Distinguished Member (37.8K reputation)

Group: Forum Members
Last Active: Last Year
Posts: 9.2K, Visits: 22.1K
Thanks!  I never would have figured this out.

And it works.  Sort of.  Which is to say if there is ALREADY an image loaded in you can load another one.  But if you delete that first image then you cannot load another one, at least programmatically.

I don't think this is a huge issue since it appears that both CC4 and iClone 8 have an IBL image loaded by default (IBL is also on by default - at least in my instances. This might be settable, as is whether you have an image loaded in by default.  But I will assume most folks have the same defaults as I have.  In any case, there's nothing I can do about it).



Alienware Aurora R16, Win 11, i9-149000KF, 3.20GHz CPU, 64GB RAM, RTX 4090 (24GB), Samsung 870 Pro 8TB, Gen3 MVNe M-2 SSD, 4TBx2, 39" Alienware Widescreen Monitor
Mike "ex-genius" Kelley



Reading This Topic