I want to globally scale a set of components
-
So I'm working on a project that will have a bunch of Dynamic Components.
Many of these don't have an actual size they need to be, they are kind of like 3d icons representing objects. I want to user to be able to change one value and globally change the size of these. Alternatively I could try something like using the camera FOV or distance to target. But that would require redraw a lot, which I don't think I want.
At first I gave each DC its own variable "view scale". I suppose I could still do that and then have an observer recognize when one is changed, and push the value to all other components with this attribute field. Or I don't use DC for this at all, but have it as a pure ruby. Maybe this would be a good way to set attributes to global for other uses.
This could be the type of attributes.
- instance attribute
- definition attribute (this get applied to all instance of a single definition)
- regional attribute (this get applied to any dynamic component that passes a name query "e.g. Desk*" that also has this attribute key)
- global attribute (this gets applied to any dynamic component with this attribute key)
For all but the instance case, when you change the attribute value in one DC, it then gets pushed via an observer to all other dynamic components. This also kind of creates a method for non related DC's to talk with each other. This DC observer could be a catch all for intra-DC communication.
So my first thought is how do we keep track of what type of attribute is of which kind. Does the DCManager.rb keep track of this, do I pre-fix them a certain way, or add an extra field to denote if it is anything other than "instance"
For example here would be a global attribute
viewscale = 1
atcls_viewscale = globalHaving some sort of tag in the DC would make the ruby more generic, and it wouldn't have to be changed as you add new non-instance attributes. When the observer recognizes activity it would look for attributes named "atcls_* and from that it would have the name and class of the attribute to be pushed through the model. One issue would be when you bring something new into the model. Most likely it will have a different value. Rather than have this new value overwrite the global variable, maybe an alert is brought up saying this doesn't match. "Would you like to change this value to match the global value, or would you like to make this the new global value?"
Advertisement