Exemplo n.º 1
0
void OBJECT_OT_gpencil_modifier_add(wmOperatorType *ot)
{
  PropertyRNA *prop;

  /* identifiers */
  ot->name = "Add Grease Pencil Modifier";
  ot->description = "Add a procedural operation/effect to the active grease pencil object";
  ot->idname = "OBJECT_OT_gpencil_modifier_add";

  /* api callbacks */
  ot->invoke = WM_menu_invoke;
  ot->exec = gpencil_modifier_add_exec;
  ot->poll = ED_operator_object_active_editable;

  /* flags */
  ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

  /* properties */
  prop = RNA_def_enum(ot->srna,
                      "type",
                      rna_enum_object_modifier_type_items,
                      eGpencilModifierType_Thick,
                      "Type",
                      "");
  RNA_def_enum_funcs(prop, gpencil_modifier_add_itemf);
  ot->prop = prop;
}
Exemplo n.º 2
0
void POSELIB_OT_pose_rename (wmOperatorType *ot)
{
	PropertyRNA *prop;
	static EnumPropertyItem prop_poses_dummy_types[] = {
		{0, NULL, 0, NULL, NULL}
	};
	
	/* identifiers */
	ot->name= "PoseLib Rename Pose";
	ot->idname= "POSELIB_OT_pose_rename";
	ot->description= "Rename specified pose from the active Pose Library";
	
	/* api callbacks */
	ot->invoke= poselib_rename_invoke;
	ot->exec= poselib_rename_exec;
	ot->poll= has_poselib_pose_data_poll;
	
	/* flags */
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
	
	/* properties */
		/* NOTE: name not pose is the operator's "main" property, so that it will get activated in the popup for easy renaming */
	ot->prop= RNA_def_string(ot->srna, "name", "RenamedPose", 64, "New Pose Name", "New name for pose");
	prop= RNA_def_enum(ot->srna, "pose", prop_poses_dummy_types, 0, "Pose", "The pose to rename");
		RNA_def_enum_funcs(prop, poselib_stored_pose_itemf);
}
Exemplo n.º 3
0
static void LOGIC_OT_actuator_add(wmOperatorType *ot)
{
    PropertyRNA *prop;

    /* identifiers */
    ot->name = "Add Actuator";
    ot->description = "Add an actuator to the active object";
    ot->idname = "LOGIC_OT_actuator_add";

    /* api callbacks */
    ot->invoke = WM_menu_invoke;
    ot->exec = actuator_add_exec;
    ot->poll = ED_operator_object_active_editable;

    /* flags */
    ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;

    /* properties */
    ot->prop = prop = RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, CONT_LOGIC_AND, "Type", "Type of actuator to add");
    RNA_def_enum_funcs(prop, rna_Actuator_type_itemf);
    prop = RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Actuator to add");
    RNA_def_property_flag(prop, PROP_SKIP_SAVE);
    prop = RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Actuator to");
    RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
void GPENCIL_OT_convert(wmOperatorType *ot)
{
	PropertyRNA *prop;
	
	/* identifiers */
	ot->name = "Convert Grease Pencil";
	ot->idname = "GPENCIL_OT_convert";
	ot->description = "Convert the active Grease Pencil layer to a new Curve Object";
	
	/* callbacks */
	ot->invoke = WM_menu_invoke;
	ot->exec = gp_convert_layer_exec;
	ot->poll = gp_convert_poll;
	ot->ui = gp_convert_ui;
	
	/* flags */
	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
	
	/* properties */
	ot->prop = RNA_def_enum(ot->srna, "type", prop_gpencil_convertmodes, 0, "Type", "Which type of curve to convert to");
	
	RNA_def_boolean(ot->srna, "use_normalize_weights", true, "Normalize Weight",
	                "Normalize weight (set from stroke width)");
	RNA_def_float(ot->srna, "radius_multiplier", 1.0f, 0.0f, 1000.0f, "Radius Fac",
	              "Multiplier for the points' radii (set from stroke width)", 0.0f, 10.0f);
	RNA_def_boolean(ot->srna, "use_link_strokes", true, "Link Strokes",
	                "Whether to link strokes with zero-radius sections of curves");
	
	prop = RNA_def_enum(ot->srna, "timing_mode", prop_gpencil_convert_timingmodes, GP_STROKECONVERT_TIMING_FULL,
	                    "Timing Mode", "How to use timing data stored in strokes");
	RNA_def_enum_funcs(prop, rna_GPConvert_mode_items);
	
	RNA_def_int(ot->srna, "frame_range", 100, 1, 10000, "Frame Range",
	            "The duration of evaluation of the path control curve", 1, 1000);
	RNA_def_int(ot->srna, "start_frame", 1, 1, 100000, "Start Frame",
	            "The start frame of the path control curve", 1, 100000);
	RNA_def_boolean(ot->srna, "use_realtime", false, "Realtime",
	                "Whether the path control curve reproduces the drawing in realtime, starting from Start Frame");
	prop = RNA_def_int(ot->srna, "end_frame", 250, 1, 100000, "End Frame",
	                   "The end frame of the path control curve (if Realtime is not set)", 1, 100000);
	RNA_def_property_update_runtime(prop, gp_convert_set_end_frame);
	
	RNA_def_float(ot->srna, "gap_duration", 0.0f, 0.0f, 10000.0f, "Gap Duration",
	              "Custom Gap mode: (Average) length of gaps, in frames "
	              "(Note: Realtime value, will be scaled if Realtime is not set)", 0.0f, 1000.0f);
	RNA_def_float(ot->srna, "gap_randomness", 0.0f, 0.0f, 10000.0f, "Gap Randomness",
	              "Custom Gap mode: Number of frames that gap lengths can vary", 0.0f, 1000.0f);
	RNA_def_int(ot->srna, "seed", 0, 0, 1000, "Random Seed",
	            "Custom Gap mode: Random generator seed", 0, 100);
	
	/* Note: Internal use, this one will always be hidden by UI code... */
	prop = RNA_def_boolean(ot->srna, "use_timing_data", false, "Has Valid Timing",
	                       "Whether the converted Grease Pencil layer has valid timing data (internal use)");
	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
Exemplo n.º 5
0
static void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot)
{
	PropertyRNA *prop;

	/* identifiers */
	ot->name   = "Select Orientation";
	ot->description= "Select transformation orientation";
	ot->idname = "TRANSFORM_OT_select_orientation";
	ot->flag   = OPTYPE_UNDO;

	/* api callbacks */
	ot->invoke = select_orientation_invoke;
	ot->exec   = select_orientation_exec;
	ot->poll   = ED_operator_view3d_active;

	prop= RNA_def_property(ot->srna, "orientation", PROP_ENUM, PROP_NONE);
	RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
	RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf);
}
Exemplo n.º 6
0
void OBJECT_OT_vertex_group_set_active(wmOperatorType *ot)
{
	PropertyRNA *prop;

	/* identifiers */
	ot->name= "Set Active Vertex Group";
	ot->idname= "OBJECT_OT_vertex_group_set_active";

	/* api callbacks */
	ot->poll= vertex_group_poll;
	ot->exec= set_active_group_exec;
	ot->invoke= WM_menu_invoke;

	/* flags */
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;

	/* properties */
	prop= RNA_def_enum(ot->srna, "group", vgroup_items, 0, "Group", "Vertex group to set as active.");
	RNA_def_enum_funcs(prop, vgroup_itemf);
}
Exemplo n.º 7
0
void OBJECT_OT_hook_recenter(wmOperatorType *ot)
{
	PropertyRNA *prop;
	
	/* identifiers */
	ot->name= "Recenter Hook";
	ot->description= "Set hook center to cursor position";
	ot->idname= "OBJECT_OT_hook_recenter";
	
	/* callbacks */
	ot->exec= object_hook_recenter_exec;
	ot->poll= hook_op_edit_poll;
	
	/* flags */
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
	
	/* properties */
	prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to.");
	RNA_def_enum_funcs(prop, hook_mod_itemf);
}
Exemplo n.º 8
0
void OBJECT_OT_hook_select(wmOperatorType *ot)
{
	PropertyRNA *prop;
	
	/* identifiers */
	ot->name= "Select Hook";
	ot->description= "Selects effected vertices on mesh";
	ot->idname= "OBJECT_OT_hook_select";
	
	/* callbacks */
	ot->exec= object_hook_select_exec;
	ot->poll= hook_op_edit_poll;
	
	/* flags */
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
	
	/* properties */
	prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove.");
	RNA_def_enum_funcs(prop, hook_mod_itemf);
}
Exemplo n.º 9
0
void OBJECT_OT_hook_reset(wmOperatorType *ot)
{
	PropertyRNA *prop;
	
	/* identifiers */
	ot->name= "Reset Hook";
	ot->description= "Recalculate and clear offset transformation";
	ot->idname= "OBJECT_OT_hook_reset";
	
	/* callbacks */
	ot->exec= object_hook_reset_exec;
	ot->poll= hook_op_edit_poll;
	
	/* flags */
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
	
	/* properties */
	prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to.");
	RNA_def_enum_funcs(prop, hook_mod_itemf);
}
Exemplo n.º 10
0
void POSELIB_OT_pose_remove (wmOperatorType *ot)
{
	PropertyRNA *prop;
	
	/* identifiers */
	ot->name= "PoseLib Remove Pose";
	ot->idname= "POSELIB_OT_pose_remove";
	ot->description= "Remove nth pose from the active Pose Library";
	
	/* api callbacks */
	ot->invoke= WM_menu_invoke;
	ot->exec= poselib_remove_exec;
	ot->poll= has_poselib_pose_data_poll;
	
	/* flags */
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
	
	/* properties */
	prop= RNA_def_enum(ot->srna, "pose", DummyRNA_DEFAULT_items, 0, "Pose", "The pose to remove");
		RNA_def_enum_funcs(prop, poselib_stored_pose_itemf);
	ot->prop= prop;
}
Exemplo n.º 11
0
void GROUP_OT_objects_add_active(wmOperatorType *ot)
{
	PropertyRNA *prop;

	/* identifiers */
	ot->name = "Add Selected To Active Group";
	ot->description = "Add the object to an object group that contains the active object";
	ot->idname = "GROUP_OT_objects_add_active";
	
	/* api callbacks */
	ot->exec = objects_add_active_exec;
	ot->invoke = WM_menu_invoke;
	ot->poll = ED_operator_objectmode;

	/* flags */
	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

	/* properties */
	prop = RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "The group to add other selected objects to");
	RNA_def_enum_funcs(prop, group_object_active_itemf);
	ot->prop = prop;
}
Exemplo n.º 12
0
void OBJECT_OT_modifier_add(wmOperatorType *ot)
{
	PropertyRNA *prop;

	/* identifiers */
	ot->name= "Add Modifier";
	ot->description = "Add a modifier to the active object";
	ot->idname= "OBJECT_OT_modifier_add";
	
	/* api callbacks */
	ot->invoke= WM_menu_invoke;
	ot->exec= modifier_add_exec;
	ot->poll= ED_operator_object_active_editable;
	
	/* flags */
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
	
	/* properties */
	prop= RNA_def_enum(ot->srna, "type", modifier_type_items, eModifierType_Subsurf, "Type", "");
	RNA_def_enum_funcs(prop, modifier_add_itemf);
	ot->prop= prop;
}
Exemplo n.º 13
0
void ANIM_OT_keying_set_active_set(wmOperatorType *ot)
{
	PropertyRNA *prop;
	
	/* identifiers */
	ot->name = "Set Active Keying Set";
	ot->idname = "ANIM_OT_keying_set_active_set";
	ot->description = "Select a new keying set as the active one";
	
	/* callbacks */
	ot->invoke = keyingset_active_menu_invoke;
	ot->exec = keyingset_active_menu_exec; 
	ot->poll = ED_operator_areaactive;
	
	/* flags */
	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
	
	/* keyingset to use (dynamic enum) */
	prop = RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
	RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
/*	RNA_def_property_flag(prop, PROP_HIDDEN);*/
}
Exemplo n.º 14
0
void OBJECT_OT_hook_remove(wmOperatorType *ot)
{
	PropertyRNA *prop;
	
	/* identifiers */
	ot->name= "Remove Hook";
	ot->idname= "OBJECT_OT_hook_remove";
	ot->description= "Remove a hook from the active object";
	
	/* api callbacks */
	ot->exec= object_hook_remove_exec;
	ot->invoke= WM_menu_invoke;
	ot->poll= hook_op_edit_poll;
	
	/* flags */
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
	
	/* properties */
	prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove.");
	RNA_def_enum_funcs(prop, hook_mod_itemf);
	ot->prop= prop;
}
Exemplo n.º 15
0
static void MARKER_OT_make_links_scene(wmOperatorType *ot)
{
	PropertyRNA *prop;

	/* identifiers */
	ot->name = "Make Links to Scene";
	ot->description = "Copy selected markers to another scene";
	ot->idname = "MARKER_OT_make_links_scene";

	/* api callbacks */
	ot->exec = ed_marker_make_links_scene_exec;
	ot->invoke = ed_marker_make_links_scene_invoke_wrapper;
	ot->poll = ed_markers_poll_selected_markers;

	/* flags */
	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

	/* properties */
	prop = RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
	RNA_def_enum_funcs(prop, RNA_scene_itemf);
	ot->prop = prop;

}
Exemplo n.º 16
0
static void LOGIC_OT_sensor_add(wmOperatorType *ot)
{
	PropertyRNA *prop;
	
	/* identifiers */
	ot->name= "Add Sensor";
	ot->description = "Add a sensor to the active object";
	ot->idname= "LOGIC_OT_sensor_add";
	
	/* api callbacks */
	ot->invoke= WM_menu_invoke;
	ot->exec= sensor_add_exec;
	ot->poll= ED_operator_object_active_editable;
	
	/* flags */
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
	
	/* properties */
	ot->prop= prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, SENS_ALWAYS, "Type", "Type of sensor to add");
	RNA_def_enum_funcs(prop, rna_Sensor_type_itemf);
	RNA_def_string(ot->srna, "name", "", 32, "Name", "Name of the Sensor to add");
	RNA_def_string(ot->srna, "object", "", 32, "Object", "Name of the Object to add the Sensor to");
}
Exemplo n.º 17
0
void ANIM_OT_driver_button_add(wmOperatorType *ot)
{
	/* identifiers */
	ot->name = "Add Driver";
	ot->idname = "ANIM_OT_driver_button_add";
	ot->description = "Add driver(s) for the property(s) represented by the highlighted button";
	
	/* callbacks */
	/* NOTE: No exec, as we need all these to use the current context info
	 * (especially the eyedropper, which is interactive)
	 */
	ot->invoke = add_driver_button_invoke;
	ot->exec = add_driver_button_exec; 
	ot->poll = add_driver_button_poll;
	
	/* flags */
	ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL;
	
	/* properties */
	ot->prop = RNA_def_enum(ot->srna, "mapping_type", prop_driver_create_mapping_types, 0,
	                        "Mapping Type", "Method used to match target and driven properties");
	RNA_def_enum_funcs(ot->prop, driver_mapping_type_itemsf);
}
Exemplo n.º 18
0
void OUTLINER_OT_action_set(wmOperatorType *ot)
{
	PropertyRNA *prop;

	/* identifiers */
	ot->name = "Outliner Set Action";
	ot->idname = "OUTLINER_OT_action_set";
	ot->description = "Change the active action used";
	
	/* api callbacks */
	ot->invoke = WM_enum_search_invoke;
	ot->exec = outliner_action_set_exec;
	ot->poll = ED_operator_outliner_active;
	
	/* flags */
	ot->flag = 0;
	
	/* props */
	// TODO: this would be nicer as an ID-pointer...
	prop = RNA_def_enum(ot->srna, "action", DummyRNA_NULL_items, 0, "Action", "");
	RNA_def_enum_funcs(prop, RNA_action_itemf);
	ot->prop = prop;
}
Exemplo n.º 19
0
static void UNUSED_FUNCTION(ANIM_OT_driver_button_add_menu)(wmOperatorType *ot)
{
  /* identifiers */
  ot->name = "Add Driver Menu";
  ot->idname = "ANIM_OT_driver_button_add_menu";
  ot->description = "Add driver(s) for the property(s) represented by the highlighted button";

  /* callbacks */
  ot->invoke = add_driver_button_menu_invoke;
  ot->exec = add_driver_button_menu_exec;
  ot->poll = add_driver_button_poll;

  /* flags */
  ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL;

  /* properties */
  ot->prop = RNA_def_enum(ot->srna,
                          "mapping_type",
                          prop_driver_create_mapping_types,
                          0,
                          "Mapping Type",
                          "Method used to match target and driven properties");
  RNA_def_enum_funcs(ot->prop, driver_mapping_type_itemsf);
}
Exemplo n.º 20
0
/* only used as menu */
void OBJECT_OT_group_instance_add(wmOperatorType *ot)
{
	PropertyRNA *prop;

	/* identifiers */
	ot->name= "Add Group Instance";
	ot->description = "Add a dupligroup instance";
	ot->idname= "OBJECT_OT_group_instance_add";

	/* api callbacks */
	ot->invoke= WM_enum_search_invoke;
	ot->exec= group_instance_add_exec;

	ot->poll= ED_operator_objectmode;

	/* flags */
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;

	/* properties */
	prop= RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "");
	RNA_def_enum_funcs(prop, RNA_group_itemf);
	ot->prop= prop;
	ED_object_add_generic_props(ot, FALSE);
}
Exemplo n.º 21
0
/* only used as menu */
void OBJECT_OT_group_instance_add(wmOperatorType *ot)
{
	PropertyRNA *prop;
	static EnumPropertyItem prop_group_dummy_types[] = {
		{0, NULL, 0, NULL, NULL}
	};

	/* identifiers */
	ot->name= "Add Group Instance";
	ot->description = "Add a dupligroup instance.";
	ot->idname= "OBJECT_OT_group_instance_add";

	/* api callbacks */
	ot->exec= group_instance_add_exec;

	ot->poll= ED_operator_scene_editable;

	/* flags */
	ot->flag= 0;

	/* properties */
	prop= RNA_def_enum(ot->srna, "type", prop_group_dummy_types, 0, "Type", "");
	RNA_def_enum_funcs(prop, add_dupligroup_itemf);
}
Exemplo n.º 22
0
static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
{
	StructRNA *srna;

	BPY_PROPDEF_HEAD(EnumProperty)
	
	if(srna) {
		static const char *kwlist[]= {"attr", "items", "name", "description", "default", "options", "update", NULL};
		const char *id=NULL, *name="", *description="";
		PyObject *def= NULL;
		int id_len;
		int defvalue=0;
		PyObject *items, *items_fast;
		EnumPropertyItem *eitems;
		PropertyRNA *prop;
		PyObject *pyopts= NULL;
		int opts=0;
		short is_itemf= FALSE;
		PyObject *update_cb= NULL;

		if (!PyArg_ParseTupleAndKeywords(args, kw,
		                                 "s#O|ssOO!O:EnumProperty",
		                                 (char **)kwlist, &id, &id_len,
		                                 &items, &name, &description,
		                                 &def, &PySet_Type, &pyopts,
		                                 &update_cb))
		{
			return NULL;
		}

		BPY_PROPDEF_CHECK(EnumProperty, property_flag_enum_items)

		if (bpy_prop_callback_check(update_cb, 2) == -1) {
			return NULL;
		}

		/* items can be a list or a callable */
		if(PyFunction_Check(items)) { /* dont use PyCallable_Check because we need the function code for errors */
			PyCodeObject *f_code= (PyCodeObject *)PyFunction_GET_CODE(items);
			if(f_code->co_argcount != 2) {
				PyErr_Format(PyExc_ValueError,
				             "EnumProperty(...): expected 'items' function to take 2 arguments, not %d",
				             f_code->co_argcount);
				return NULL;
			}

			if(def) {
				/* note, using type error here is odd but python does this for invalid arguments */
				PyErr_SetString(PyExc_TypeError,
				                "EnumProperty(...): 'default' can't be set when 'items' is a function");
				return NULL;
			}

			is_itemf= TRUE;
			eitems= DummyRNA_NULL_items;
		}
		else {
			if(!(items_fast= PySequence_Fast(items, "EnumProperty(...): expected a sequence of tuples for the enum items or a function"))) {
				return NULL;
			}

			eitems= enum_items_from_py(items_fast, def, &defvalue, (opts & PROP_ENUM_FLAG)!=0);

			Py_DECREF(items_fast);

			if(!eitems) {
				return NULL;
			}
		}

		if(opts & PROP_ENUM_FLAG)	prop= RNA_def_enum_flag(srna, id, eitems, defvalue, name, description);
		else						prop= RNA_def_enum(srna, id, eitems, defvalue, name, description);

		if(is_itemf) {
			RNA_def_enum_funcs(prop, bpy_props_enum_itemf);
			RNA_def_enum_py_data(prop, (void *)items);
			/* Py_INCREF(items); */ /* watch out!, if user is tricky they can probably crash blender if they manage to free the callback, take care! */
		}

		if(pyopts) {
			if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
			if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
		}
		bpy_prop_callback_assign(prop, update_cb);
		RNA_def_property_duplicate_pointers(srna, prop);

		if(is_itemf == FALSE) {
			MEM_freeN(eitems);
		}
	}
	Py_RETURN_NONE;
}
Exemplo n.º 23
0
void Transform_Properties(struct wmOperatorType *ot, int flags)
{
	PropertyRNA *prop;

	if (flags & P_AXIS) {
		prop = RNA_def_property(ot->srna, "axis", PROP_FLOAT, PROP_DIRECTION);
		RNA_def_property_array(prop, 3);
		/* Make this not hidden when there's a nice axis selection widget */
		RNA_def_property_flag(prop, PROP_HIDDEN);
		RNA_def_property_ui_text(prop, "Axis", "The axis around which the transformation occurs");
	}

	if (flags & P_CONSTRAINT) {
		RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
		prop = RNA_def_property(ot->srna, "constraint_orientation", PROP_ENUM, PROP_NONE);
		RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
		RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf);
	}

	if (flags & P_MIRROR) {
		prop = RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
		if (flags & P_MIRROR_DUMMY) {
			/* only used so macros can disable this option */
			RNA_def_property_flag(prop, PROP_HIDDEN);
		}
	}


	if (flags & P_PROPORTIONAL) {
		RNA_def_enum(ot->srna, "proportional", rna_enum_proportional_editing_items, 0, "Proportional Editing", "");
		prop = RNA_def_enum(ot->srna, "proportional_edit_falloff", rna_enum_proportional_falloff_items, 0,
		                    "Proportional Editing Falloff", "Falloff type for proportional editing mode");
		RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
		RNA_def_float(ot->srna, "proportional_size", 1, T_PROP_SIZE_MIN, T_PROP_SIZE_MAX,
		              "Proportional Size", "", 0.001f, 100.0f);
	}

	if (flags & P_SNAP) {
		prop = RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
		RNA_def_property_flag(prop, PROP_HIDDEN);

		if (flags & P_GEO_SNAP) {
			prop = RNA_def_enum(ot->srna, "snap_target", rna_enum_snap_target_items, 0, "Target", "");
			RNA_def_property_flag(prop, PROP_HIDDEN);
			prop = RNA_def_float_vector(ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX);
			RNA_def_property_flag(prop, PROP_HIDDEN);
			
			if (flags & P_ALIGN_SNAP) {
				prop = RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point Normal", "");
				RNA_def_property_flag(prop, PROP_HIDDEN);
				prop = RNA_def_float_vector(ot->srna, "snap_normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "", -FLT_MAX, FLT_MAX);
				RNA_def_property_flag(prop, PROP_HIDDEN);
			}
		}
	}
	
	if (flags & P_GPENCIL_EDIT) {
		RNA_def_boolean(ot->srna, "gpencil_strokes", 0, "Edit Grease Pencil", "Edit selected Grease Pencil strokes");
	}
	
	if ((flags & P_OPTIONS) && !(flags & P_NO_TEXSPACE)) {
		RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Texture Space", "Edit Object data texture space");
		prop = RNA_def_boolean(ot->srna, "remove_on_cancel", 0, "Remove on Cancel", "Remove elements on cancel");
		RNA_def_property_flag(prop, PROP_HIDDEN);
	}

	if (flags & P_CORRECT_UV) {
		RNA_def_boolean(ot->srna, "correct_uv", 0, "Correct UVs", "Correct UV coordinates when transforming");
	}

	if ((flags & P_NO_DEFAULTS) == 0) {
		// Add confirm method all the time. At the end because it's not really that important and should be hidden only in log, not in keymap edit
		/*prop =*/ RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button");
		//RNA_def_property_flag(prop, PROP_HIDDEN);
	}
}
Exemplo n.º 24
0
void Transform_Properties(struct wmOperatorType *ot, int flags)
{
	PropertyRNA *prop;

	if (flags & P_AXIS)
	{
		prop= RNA_def_property(ot->srna, "axis", PROP_FLOAT, PROP_DIRECTION);
		RNA_def_property_array(prop, 3);
		/* Make this not hidden when there's a nice axis selection widget */
		RNA_def_property_flag(prop, PROP_HIDDEN);
		RNA_def_property_ui_text(prop, "Axis", "The axis around which the transformation occurs");

	}

	if (flags & P_CONSTRAINT)
	{
		RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
		prop= RNA_def_property(ot->srna, "constraint_orientation", PROP_ENUM, PROP_NONE);
		RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
		RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf);

		
	}

	if (flags & P_MIRROR)
	{
		RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
	}


	if (flags & P_PROPORTIONAL)
	{
		RNA_def_enum(ot->srna, "proportional", proportional_editing_items, 0, "Proportional Editing", "");
		RNA_def_enum(ot->srna, "proportional_edit_falloff", proportional_falloff_items, 0, "Proportional Editing Falloff", "Falloff type for proportional editing mode.");
		RNA_def_float(ot->srna, "proportional_size", 1, 0.00001f, FLT_MAX, "Proportional Size", "", 0.001, 100);
	}

	if (flags & P_SNAP)
	{
		prop= RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
		RNA_def_property_flag(prop, PROP_HIDDEN);

		if (flags & P_GEO_SNAP) {
			prop= RNA_def_enum(ot->srna, "snap_target", snap_target_items, 0, "Target", "");
			RNA_def_property_flag(prop, PROP_HIDDEN);
			prop= RNA_def_float_vector(ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX);
			RNA_def_property_flag(prop, PROP_HIDDEN);
			
			if (flags & P_ALIGN_SNAP) {
				prop= RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point Normal", "");
				RNA_def_property_flag(prop, PROP_HIDDEN);
				prop= RNA_def_float_vector(ot->srna, "snap_normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "", -FLT_MAX, FLT_MAX);
				RNA_def_property_flag(prop, PROP_HIDDEN);
			}
		}
	}
	
	if (flags & P_OPTIONS)
	{
		RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Object data texture space", "");
	}

	// Add confirm method all the time. At the end because it's not really that important and should be hidden only in log, not in keymap edit
	/*prop =*/ RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button");
	//RNA_def_property_flag(prop, PROP_HIDDEN);
}