I'm a Render Engine developer, how can I support Skatter?

Transformation objects are stored in an hash/array structure which can be read by the render engines (or anyone for that matter). This is very similar to parsing the model and reading the transformation of regular Component Instances.
This allows users to render hundreds of thousands of instances without overloading Sketchup.

The hash is in a shared namespace called "Common", and its name is "render_instances".

Its structure is :

	Sketchup.active_model.definitions.entityID => { 
		"plugin_name" => {
			comp_def => [
				{:transformation => trans1, :material => mat1},
				{:transformation => trans2, :material => mat2},
  • Sketchup.active_model.definitions.entityID  is used to differentiate models on OSX, as we can have multiple models opened in one Sketchup instance
  • "plugin_name"  is the plugin name, in this case "skatter". This level is necessary so we don't overwrite each other's infos
  • comp_def  is the component definition object
  • trans1  is a transformation object
  • mat1 is a material object present in the SketchUp model. If this is not defined or equals nil, simply consider this instance as having the default material applied to it, just like a regular Component Instance.

To read it is pretty simple in ruby :

modelID = Sketchup.active_model.definitions.entityID
if defined?(Common.render_instances) && Common.render_instances[modelID]
	for plugin_name, comp_defs in Common.render_instances[modelID]
		for comp_def, insts in comp_defs
			for inst in insts
				transform = inst[:transformation]
				material = inst[:material]
				#Then do your stuff using comp_def, transform and material...

Additionally, you can add an observer to the Common module, and Skatter will call it every time it updates. It is useful if you are doing Real Time rendering.

class MyObserver
	def on_render_instances_updated(modelID, plugin_name, comp_def)
		# modelID is Sketchup.active_model.definitions.entityID, used to differenciate between models on OSX
		puts modelID.to_s + " -> " + plugin_name + " -> " + comp_def.name
		transformations_array = Common.render_instances[modelID][plugin_name][comp_def]

If you have any question or need a NFR license to test your implementation with Skatter, contact us at [email protected]

This is an open protocol, so if other plugins use it, you will automatically support them as well.

Still need help? Contact Us Contact Us