Majik Primer: MoI's Lighting Options and You!
 1-4  5-24  25-44  45-64  65-69

Previous
Next
 From:  dinos
5222.25 
Hi Mike.

Reading your excellent Detergent Bottle tutorial reminded me of this thread.
I've always wanted a way to use the lighting settings you created here, preferably through a nice dropdown list.



This is the result. Its called Lighting Themes, for lack of a better name.
It was tested on the latest Moi beta, and it works fine. It should work on anything over V2.0, but it wasn't tested.

To use it you will need to copy the LightingTheme.htm file from the zip to your ui folder.
BEFORE you try the script please take a minute to change the first set of settings in the LightingTheme.htm file called: Default to your current lighting settings.
Otherwise your current settings will be lost.

Here is the relevant part:

code:
Default: {
	lightingStyle: 'Default',
	specularHighlights: true,
	specularBrightness: 0.28,
	specularFocusSize: 2.00,
	metallicLighting: false,
	fixedLightPositions: true,
	customKeyLightLevel: 0.0,
	customFillLightLevel: 0.0
},




Then add a shortcut:
code:
script:moi.ui.createDialog( 'moi://ui/LightingTheme.htm' );


Thats it.

You can define as many themes/lighting settings as you like. It should be fairly easy if you study the LightingTheme.htm file for a bit.


Enjoy :-)

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Mike K4ICY (MAJIKMIKE)
5222.26 In reply to 5222.25 
You're amazing Dinos!! :-)

I can't wait to try it out.
This means I can try more out and not have to remember shortcut keys.


Michael,

I believe that you were considering some kind of quick buttons or some UI setting tool that would stream line our UI tweaks, along with maybe zebras and such. I can't wait.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5222.27 In reply to 5222.25 
Cool script dinos!

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Don (DON_CHEKE)
5222.28 In reply to 5222.25 
Thanks for the Script. It works well.

_________________________
Don Cheke
Visit: Textual Creations
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Mike K4ICY (MAJIKMIKE)
5222.29 
Hi Dinos!

Thanks to your script idea, I took the LightingOptions.htm UI script for V3 and basically merged your Themes script into it!

So, I was curious to see if this could be done. Having the ability to choose from good presets and being able to simultaneous tweak the finer details was a plus.

By the way, I renamed your "Default" to "Oil Slick" (I like it!) and added MoI's default for "Default".





Download the zip file:

LightingOptions(Themes_V3).zip

You'll find "LightingOptions.htm".
Copy this over the original file in the MoI 3 Beta.../UI folder and you'll have this new feature integrated into your MoI Options.
Please remember to backup you original "LightingOptions.htm" file!

To bring this dialog up by itself - add this script to your keyboard shortcuts:

script: /* Opens Lighting Options Dialog */ moi.ui.createDialog( 'moi://ui/LightingOptions.htm' );

--This is for the V3 Beta version only--
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Rich_Art
5222.30 In reply to 5222.29 
Nice.... Thanks.. :-)

Peace,
Rich_Art. ;-)

| C4DLounge.eu | Our Dutch/Belgium C4D forum. |
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  dinos
5222.31 In reply to 5222.29 
Hi Mike.
Yup, Oil Slick is a very fitting name for my defaults!

The script that i did is based on the LightingOptions.htm, so you are absolutely right in merging it back to it.
Your modified file also works in V2.52 as the original file is the same for both versions. I don't have anything older installed so i cant check if it can be used with it.

It would be nice to have an option to add a new theme or edit an existing directly from this ui. That would require a major change, as we will have to move the presets into moi.ini. Maybe during the first time it is run.

It might be possible using setOption/getOption and loading/saving the data using JSON, but i'll need to check it in more detail.

Thanks to everyone for their feedback!

Dinos
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5222.32 In reply to 5222.31 
Hi dinos, yes even though I don't think there's anything that uses it currently, a script can save something to the moi.ini file by passing true for the 3rd parameter value in setOption(), like: moi.command.setOption( 'name', value, true ) - that will save it under a [Commands] section of moi.ini . Then when you read it back in use moi.command.getOption( 'name', true ); , and also be aware that getOption will throw an exception if the value does not exist so you usually need to put it in a try / catch block.

For the name it's good to make sure it's not too generic to avoid future collisions, usually sticking the name of the .htm file or command at the start of the name is a good idea, like 'LightingOptions.htm_value', rather than just plain 'value' for the name.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  dinos
5222.33 In reply to 5222.32 
Hi Michael.
Thats exactly what i was thinking. I did some preliminary tests and it works as expected.

I meant to ask you about naming, to avoid polluting the ini file, so thanks for clearing this up.
An option to disable cashing would definitely help script development a lot.

I will give it a shot when i have some free time, hopefully soon.

Dinos
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Mike K4ICY (MAJIKMIKE)
5222.34 In reply to 5222.33 
WOW! I can't wait to see what you come up with.


So maybe, not only will you be able to pick a preset and tweak it on the fly, but be able to save the result to choose at a later time.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  dinos
5222.35 In reply to 5222.34 
ok. This what we might call V2.0 BUT please note that there might still be a few bugs left. I will stop for tonight and fix/finalize by monday.

Mike, thanks for merging the original version of this script back to LightingOptions.htm. That was the basis for this version.

As far as i've tested it there is definitely one error, but you can safely ignore it. When you choose Add you will see an exception. Press ok and the script will continue working correctly and Add the new theme.

Michael: I'm using: var dialog = moi.ui.createDialog('EditNameDialog.htm', '', moiWindow); to request the name for the new theme, but i can find a way to pass nameval as a global variable for this script. Can you help?


Here is the basic functionality of this version.



Installation:
Just copy the script in the zip file to your ui folder. Rememer to backup the existing file, just in case. No need to create a preset for your current settings. A "My favorite" preset will be created automatically for you.

Usage:
Add will create a new preset from the current settings below.
Delete will delete the selected preset.
Update will update the selected preset to the settings below.

Thats it. Everything should be saved and restored correctly between sessions.

Please post any bugs you might find.

Dinos

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5222.36 In reply to 5222.35 
Hi Dinos - re: edit name dialog, when you create the dialog it doesn't finish loading until after that so you can set global variables on the dialog's script environment by using the htmlWindow property off the returned dialog.

Then after you set it you probably want to call doModal() on it to get a result back, here's an example:

script:var dialog = moi.ui.createDialog('EditNameDialog.htm'); dialog.htmlWindow.nameval = 'test'; var result = dialog.window.doModal(); moi.ui.alert(result);

At some point this sequence should get bundled up into some kind of EditName() function in a script support library.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  dinos
5222.37 In reply to 5222.36 
Thanks Michael. That was quick!

But i'm getting an Unsafe javascript attempt exception accessing the frame.

Here is the code section:

code:
function AddClicked() {
	var dialog = moi.ui.createDialog('EditNameDialog.htm', '', moiWindow);
	dialog.htmlWindow.nameval = '';
	if (dialog.window.doModal() != -1) {
		if (dialog.window.dialogReturnValue != '') {
			var name = dialog.window.dialogReturnValue;
			themeData.themes[name] = themeGetCurrent();
			g_select.add(new Option(name, name, false, true), null);
			themeSaveThemes(name);
		}
	}
}


Any suggestions?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Mike K4ICY (MAJIKMIKE)
5222.38 
Now I'm starting to feel all happy inside! =-)

I like it!!!

Dino, best of luck on knocking out the kinks.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5222.39 In reply to 5222.37 
Hi dinos - re unsafe javascript error - I haven't happened to run across that one before, it looks like some security measure for anti-cross-site script usage that only kicks in for the script engines that have been created by an HTML page and not the other script contexts that are created when you run a shortcut key or command script for example.

I'll have to dig into that to see how to enable script access between 2 HTML script contexts like that.

In the meantime I guess you would have to make your own edit name dialog that might take the name in the URL query string rather than as a global script variable if you want to make an edit name dialog that would work off of a dialog right now.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5222.40 In reply to 5222.37 
Hi dinos, I've attached an updated version of EditNameDialog.htm that might work better for you.

This version fixes a bug where it was actually supposed to be possible to not initialize the name at all, that was not working before, and also now there is an alternate way to initialize the name by passing nameval=somename in the query string of the URL as well, like this:

code:
function AddClicked() {

	var name = 'This is the name';

	var dialog = moi.ui.createDialog('EditNameDialog.htm?nameval=' + encodeURIComponent(name), '', moiWindow);
	if (dialog.window.doModal() != -1) {
		if (dialog.window.dialogReturnValue != '') {
			var name = dialog.window.dialogReturnValue;
			moi.ui.alert( name );
		}
	}
}


This should hopefully work for you for the moment until the cross-page script permission thing is fixed up.

- Michael
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5222.41 In reply to 5222.37 
Hi dinos, so that cross-domain security error was a timing issue related thing, the same access would work later on once the page had proceeded loading a bit and had it's base URL updated to a moi:// one.

Anyway for the next v3 beta I've got the cross-domain security checking mechanism turned off completely now and that should prevent this kind of inter-page script exception from happening anymore after that.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Rich_Art
5222.42 In reply to 5222.41 
I really like this script... thanks...


Peace,
Rich_Art. ;-)

| C4DLounge.eu | Our Dutch/Belgium C4D forum. |
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  dinos
5222.43 In reply to 5222.40 
Thanks Michael. This version of EditNameDialog.htm definitely fixes the issue. I will include it with the script, until it the next beta/release version of Moi.
Even after that it might be useful for people using an older version of Moi.



So, here is the fully working version. I will include the instructions again for consistency.




Installation:
Just copy EditNameDialog.htm and LightingOptions.htm included in the zip file to your ui folder. Remember to rename/backup the existing files, just in case.
No need to create a preset for your current settings. A "My favorite" preset will be created automatically for you.
You can add a shortcut, if you like :
code:
script: /* Opens Lighting Options Dialog */ moi.ui.createDialog( 'moi://ui/LightingOptions.htm' );


Usage:
Add will create a new preset from the current settings below.
Delete will delete the selected preset.
Update will update the selected preset to the settings below.

Thats it. Everything is saved and restored correctly between sessions in moi.ini.

Please post any bugs you might find.

EDITED: 12 Nov 2012 by DINOS


  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  SurlyBird
5222.44 
Holy cow! Thank you, Mike!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
Show messages:  1-4  5-24  25-44  45-64  65-69