Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Parameter Defaults #13

Closed
donovankeith opened this issue Feb 17, 2018 · 7 comments
Closed

Add Support for Parameter Defaults #13

donovankeith opened this issue Feb 17, 2018 · 7 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@donovankeith
Copy link
Collaborator

This is probably a non-trivial issue, but it would be great if parameters could be initialized with default values based on the Default Value setting in the UserData Editor.

@NiklasRosenstein
Copy link
Collaborator

NiklasRosenstein commented Feb 17, 2018

This should already work -- at least for BOOL, LONG, REAL, VECTOR and COLOR parameters.

@NiklasRosenstein NiklasRosenstein self-assigned this Feb 17, 2018
@NiklasRosenstein
Copy link
Collaborator

Afaik, you can not set the default value for eg. for String or Gradient parameters in the description resource. That would need to be added to the generated Python plugin file.

@NiklasRosenstein NiklasRosenstein added the enhancement New feature or request label Feb 17, 2018
@donovankeith
Copy link
Collaborator Author

donovankeith commented Feb 17, 2018

This is the .res file that's generated:

CONTAINER Ocvcube {
	INCLUDE Obase;
	NAME Ocvcube;
	GROUP ID_OBJECTPROPERTIES {
		VECTOR CV_CUBE_SIZE { DEFAULT 100.0 100.0 100.0; MIN 0.0 0.0 0.0; MAX 1.79769313486e+308 1.79769313486e+308 1.79769313486e+308; }
		VECTOR CV_CUBE_SEGMENTS { DEFAULT 2.0 2.0 2.0; MIN 1.0 1.0 1.0; MAX 1000.0 1000.0 1000.0; }
	}
}

But this is what I see in C4D:

image

Expected based on the UserData:
image

C4D doesn't seem to be using the defaults - perhaps it's something that has to be done in Python code?

Also, Limit Max isn't active, yet a value is being added to the Resource file:
image
VECTOR CV_CUBE_SIZE { DEFAULT 100.0 100.0 100.0; MIN 0.0 0.0 0.0; MAX 1.79769313486e+308 1.79769313486e+308 1.79769313486e+308; }

Here's the .c4d file used to generate this:
CV-Cube.zip

@NiklasRosenstein
Copy link
Collaborator

NiklasRosenstein commented Feb 17, 2018

Oh right, I forgot. The default you set in the description is what you get when you do Right Click > Reset to Default on the parameter. The default value still needs to be set in Init().

@NiklasRosenstein
Copy link
Collaborator

NiklasRosenstein commented Feb 17, 2018

Also, Limit Max isn't active, yet a value is being added to the Resource file:

Hm, there seems to be no (documented) symbols that describe the "Limit Min" or "Limit Max" checkboxes in the UserData settings. I'll have to find out how to read that checkbox value first.

@NiklasRosenstein
Copy link
Collaborator

I've moved the issue of the Limit Min/Limit Max settings to a different issue.

@NiklasRosenstein
Copy link
Collaborator

Fixed in 9eb96d8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants